Documentation ¶
Overview ¶
Package packers defines core 3 protocol packers: anoncrypt, plain and zkp
Index ¶
- Constants
- Variables
- type AnoncryptPacker
- type AnoncryptPackerParams
- type DIDResolverHandlerFunc
- type DataPreparerHandlerFunc
- type JWSPacker
- type KeyResolverHandlerFunc
- type PlainMessagePacker
- type PlainPackerParams
- type ProvingParams
- type SignerResolverHandlerFunc
- type SigningParams
- type StateVerificationFunc
- type VerificationHandlerFunc
- type VerificationParams
- type ZKPPacker
- type ZKPPackerParams
Constants ¶
const ( JSONWebKey2020 verificationType = "JsonWebKey2020" EcdsaSecp256k1VerificationKey2019 verificationType = "EcdsaSecp256k1VerificationKey2019" EcdsaSecp256k1RecoveryMethod2020 verificationType = "EcdsaSecp256k1RecoveryMethod2020" EddsaBJJVerificationKey verificationType = "EddsaBJJVerificationKey" )
List of supported verification types
const MediaTypeEncryptedMessage iden3comm.MediaType = "application/iden3comm-encrypted-json"
MediaTypeEncryptedMessage is media type for ecnrypted message
const MediaTypePlainMessage iden3comm.MediaType = "application/iden3comm-plain-json"
MediaTypePlainMessage is media type for plain message
const MediaTypeSignedMessage iden3comm.MediaType = "application/iden3comm-signed-json"
MediaTypeSignedMessage is media type for jws
const MediaTypeZKPMessage iden3comm.MediaType = "application/iden3-zkp-json"
MediaTypeZKPMessage is media type for jwz
Variables ¶
var ErrorVerificationMethodNotFound = errors.New("specified verification method not found")
ErrorVerificationMethodNotFound is return where no verification method found for specified kid
Functions ¶
This section is empty.
Types ¶
type AnoncryptPacker ¶
type AnoncryptPacker struct {
// contains filtered or unexported fields
}
AnoncryptPacker is packer for anon encryption / decryption
func NewAnoncryptPacker ¶
func NewAnoncryptPacker(kr KeyResolverHandlerFunc) *AnoncryptPacker
NewAnoncryptPacker returns new anon packers
func (*AnoncryptPacker) MediaType ¶
func (p *AnoncryptPacker) MediaType() iden3comm.MediaType
MediaType for iden3comm
func (*AnoncryptPacker) Pack ¶
func (p *AnoncryptPacker) Pack(payload []byte, params iden3comm.PackerParams) ([]byte, error)
Pack returns packed message to transport envelope
func (*AnoncryptPacker) Unpack ¶
func (p *AnoncryptPacker) Unpack(envelope []byte) (*iden3comm.BasicMessage, error)
Unpack returns unpacked message from transport envelope
type AnoncryptPackerParams ¶
type AnoncryptPackerParams struct { RecipientKey *jose.JSONWebKey iden3comm.PackerParams }
AnoncryptPackerParams is params for anoncrypt packer
type DIDResolverHandlerFunc ¶
type DIDResolverHandlerFunc func(did string) (*verifiable.DIDDocument, error)
DIDResolverHandlerFunc resolves did
func (DIDResolverHandlerFunc) Resolve ¶
func (f DIDResolverHandlerFunc) Resolve(did string) (*verifiable.DIDDocument, error)
Resolve function is responsible to call provided handler for resolve did document
type DataPreparerHandlerFunc ¶
type DataPreparerHandlerFunc func(hash []byte, id *w3c.DID, circuitID circuits.CircuitID) ([]byte, error)
DataPreparerHandlerFunc registers the handler function for inputs preparation.
type JWSPacker ¶
type JWSPacker struct {
// contains filtered or unexported fields
}
JWSPacker is packer that use jws
func NewJWSPacker ¶
func NewJWSPacker( didResolverHandler DIDResolverHandlerFunc, signerResolverHandlerFunc SignerResolverHandlerFunc, ) *JWSPacker
NewJWSPacker creates new jws packer instance
func (*JWSPacker) MediaType ¶
func (p *JWSPacker) MediaType() iden3comm.MediaType
MediaType for iden3comm that returns MediaTypeSignedMessage
type KeyResolverHandlerFunc ¶
KeyResolverHandlerFunc resolve private key by key id
func (KeyResolverHandlerFunc) Resolve ¶
func (kr KeyResolverHandlerFunc) Resolve(keyID string) (key interface{}, err error)
Resolve function is responsible to call provided handler for recipient private key resolve
type PlainMessagePacker ¶
type PlainMessagePacker struct { }
PlainMessagePacker is simple packer that doesn't use encryption / encoding
func (*PlainMessagePacker) MediaType ¶
func (p *PlainMessagePacker) MediaType() iden3comm.MediaType
MediaType for iden3comm
func (*PlainMessagePacker) Pack ¶
func (p *PlainMessagePacker) Pack(payload []byte, _ iden3comm.PackerParams) ([]byte, error)
Pack returns packed message to transport envelope
func (*PlainMessagePacker) Unpack ¶
func (p *PlainMessagePacker) Unpack(envelope []byte) (*iden3comm.BasicMessage, error)
Unpack returns unpacked message from transport envelope
type PlainPackerParams ¶
type PlainPackerParams struct {
iden3comm.PackerParams
}
PlainPackerParams is params for plain packer
type ProvingParams ¶
type ProvingParams struct { DataPreparer DataPreparerHandlerFunc ProvingKey []byte Wasm []byte }
ProvingParams packer parameters for ZKP generation
func NewProvingParams ¶
func NewProvingParams(dataPreparer DataPreparerHandlerFunc, provingKey, wasm []byte) ProvingParams
NewProvingParams defines the ZK proving parameters for ZKP generation
type SignerResolverHandlerFunc ¶
SignerResolverHandlerFunc resolves signer
type SigningParams ¶
type SigningParams struct { Alg jwa.SignatureAlgorithm KID string DIDDoc *verifiable.DIDDocument iden3comm.PackerParams }
SigningParams packer parameters for jws generation
func NewSigningParams ¶
func NewSigningParams() SigningParams
NewSigningParams defines the signing parameters for jws generation
func (*SigningParams) Verify ¶
func (s *SigningParams) Verify() error
Verify checks if signing params are valid
type StateVerificationFunc ¶
StateVerificationFunc must verify pubsignals for circuit id
type VerificationHandlerFunc ¶
VerificationHandlerFunc registers the handler function for state verification.
func (VerificationHandlerFunc) Verify ¶
func (f VerificationHandlerFunc) Verify(id circuits.CircuitID, pubsignals []string) error
Verify function is responsible to call provided handler for outputs verification
type VerificationParams ¶
type VerificationParams struct { Key []byte VerificationFn VerificationHandlerFunc }
VerificationParams defined the verification function and the verification key for ZKP full verification
func NewVerificationParams ¶
func NewVerificationParams(key []byte, verifier VerificationHandlerFunc) VerificationParams
NewVerificationParams creates new verification params
type ZKPPacker ¶
type ZKPPacker struct { Prover map[jwz.ProvingMethodAlg]ProvingParams Verification map[jwz.ProvingMethodAlg]VerificationParams }
ZKPPacker is packer that use JWZ
func NewZKPPacker ¶
func NewZKPPacker(provingParams map[jwz.ProvingMethodAlg]ProvingParams, verification map[jwz.ProvingMethodAlg]VerificationParams) *ZKPPacker
NewZKPPacker creates new zkp packer instance
func (*ZKPPacker) MediaType ¶
func (p *ZKPPacker) MediaType() iden3comm.MediaType
MediaType for iden3comm that returns MediaTypeZKPMessage
type ZKPPackerParams ¶
type ZKPPackerParams struct { SenderID *w3c.DID ProvingMethodAlg jwz.ProvingMethodAlg iden3comm.PackerParams }
ZKPPackerParams is params for zkp packer