Documentation ¶
Index ¶
- Constants
- Variables
- func CreateNonce() string
- func DecodeEnvelope(encEnvelope []byte) ([]byte, error)
- func EnvelopeMatcher(key string) (string, bool)
- func PrepareToHash(payload []byte, nonce, channel, chaincode, method, deadline string, ...) []byte
- func Sign(crypto crypto.Crypto, payload []byte, ...) ([]byte, error)
- func Verify(verifier Verifier) router.MiddlewareFunc
- func WithEnvelope() gateway.Opt
- type DefaultVerifier
- type Envelope
- func (*Envelope) Descriptor() ([]byte, []int)deprecated
- func (x *Envelope) GetChaincode() string
- func (x *Envelope) GetChannel() string
- func (x *Envelope) GetDeadline() *timestamppb.Timestamp
- func (x *Envelope) GetHashFunc() string
- func (x *Envelope) GetHashToSign() string
- func (x *Envelope) GetMethod() string
- func (x *Envelope) GetNonce() string
- func (x *Envelope) GetPublicKey() string
- func (x *Envelope) GetSignature() string
- func (x *Envelope) GetSignatureAlg() string
- func (*Envelope) ProtoMessage()
- func (x *Envelope) ProtoReflect() protoreflect.Message
- func (x *Envelope) Reset()
- func (x *Envelope) String() string
- func (this *Envelope) Validate() error
- type Verifier
Constants ¶
View Source
const ( TimeLayout = "2006-01-02T15:04:05.000Z" PubKey string = "envelopePubkey" // router context key )
View Source
const HeaderKey = "X-Envelope"
Variables ¶
View Source
var ( ErrSignatureNotFound = errors.New(`signature not found`) ErrSignatureCheckFailed = errors.New(`check signature failed`) ErrDeadlineExpired = errors.New(`deadline expired`) ErrCheckSignatureFailed = errors.New(`check signature failed`) ErrTxAlreadyExecuted = errors.New(`tx already executed`) ErrInvalidMethod = errors.New(`invalid method in envelope`) ErrInvalidChannel = errors.New(`invalid channel in envelope`) )
View Source
var File_envelope_envelope_proto protoreflect.FileDescriptor
Functions ¶
func CreateNonce ¶
func CreateNonce() string
func EnvelopeMatcher ¶
handle custom header to pass envelope
func PrepareToHash ¶ added in v1.0.5
func Verify ¶
func Verify(verifier Verifier) router.MiddlewareFunc
Verify is a middleware for checking signature in envelop
func WithEnvelope ¶
input opt for gateway to handle envelope with signature
Types ¶
type DefaultVerifier ¶ added in v1.0.5
type DefaultVerifier struct {
// contains filtered or unexported fields
}
func NewVerifier ¶ added in v1.0.5
func NewVerifier(verifier crypto.Verifier) *DefaultVerifier
type Envelope ¶
type Envelope struct { PublicKey string `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // signer public key in base58 Signature string `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // payload signature in base58 Nonce string `protobuf:"bytes,3,opt,name=nonce,proto3" json:"nonce,omitempty"` // number is given for replay protection HashToSign string `protobuf:"bytes,4,opt,name=hash_to_sign,json=hashToSign,proto3" json:"hash_to_sign,omitempty"` // payload hash in base58 HashFunc string `protobuf:"bytes,5,opt,name=hash_func,json=hashFunc,proto3" json:"hash_func,omitempty"` // function used for hashing Deadline *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=deadline,proto3" json:"deadline,omitempty"` // signature is not valid after deadline (EIP-2612) // channel + chaincode + method are used as domain separator to prevent replay attack from other domains (EIP-2612) Channel string `protobuf:"bytes,7,opt,name=channel,proto3" json:"channel,omitempty"` Chaincode string `protobuf:"bytes,8,opt,name=chaincode,proto3" json:"chaincode,omitempty"` Method string `protobuf:"bytes,9,opt,name=method,proto3" json:"method,omitempty"` SignatureAlg string `protobuf:"bytes,10,opt,name=signature_alg,json=signatureAlg,proto3" json:"signature_alg,omitempty"` // contains filtered or unexported fields }
func (*Envelope) Descriptor
deprecated
func (*Envelope) GetChaincode ¶
func (*Envelope) GetChannel ¶
func (*Envelope) GetDeadline ¶
func (x *Envelope) GetDeadline() *timestamppb.Timestamp
func (*Envelope) GetHashFunc ¶
func (*Envelope) GetHashToSign ¶
func (*Envelope) GetPublicKey ¶
func (*Envelope) GetSignature ¶
func (*Envelope) GetSignatureAlg ¶ added in v1.0.5
func (*Envelope) ProtoMessage ¶
func (*Envelope) ProtoMessage()
func (*Envelope) ProtoReflect ¶
func (x *Envelope) ProtoReflect() protoreflect.Message
Source Files ¶
Click to show internal directories.
Click to hide internal directories.