Documentation ¶
Index ¶
- Constants
- Variables
- func DID2KID(did string) string
- type Crypto
- func (c *Crypto) ComputeMAC(_ []byte, _ interface{}) ([]byte, error)
- func (c *Crypto) Decrypt(_ []byte, _ []byte, _ []byte, _ interface{}) ([]byte, error)
- func (c *Crypto) DeriveProof(_ [][]byte, _ []byte, _ []byte, _ []int, _ interface{}) ([]byte, error)
- func (c *Crypto) Encrypt(_ []byte, _ []byte, _ interface{}) ([]byte, []byte, error)
- func (c *Crypto) Sign(msg []byte, kh interface{}) (s []byte, err error)
- func (c *Crypto) SignMulti(_ [][]byte, _ interface{}) ([]byte, error)
- func (c *Crypto) UnwrapKey(_ *crypto.RecipientWrappedKey, _ interface{}, _ ...crypto.WrapKeyOpts) ([]byte, error)
- func (c *Crypto) Verify(signature []byte, msg []byte, kh interface{}) (err error)
- func (c *Crypto) VerifyMAC(_ []byte, _ []byte, _ interface{}) error
- func (c *Crypto) VerifyMulti(_ [][]byte, _ []byte, _ interface{}) error
- func (c *Crypto) VerifyProof(_ [][]byte, _ []byte, _ []byte, _ interface{}) error
- func (c *Crypto) WrapKey(_ []byte, _ []byte, _ []byte, _ *crypto.PublicKey, _ ...crypto.WrapKeyOpts) (*crypto.RecipientWrappedKey, error)
- type Handle
- type Indy
- func (i *Indy) Close() error
- func (i *Indy) ConnectionStorage() api.ConnectionStorage
- func (i *Indy) CredentialStorage() api.CredentialStorage
- func (i *Indy) DIDStorage() api.DIDStorage
- func (i *Indy) GetOpenStores() []storage.Store
- func (i *Indy) GetStoreConfig(_ string) (storage.StoreConfiguration, error)
- func (i *Indy) KMS() kms.KeyManager
- func (i *Indy) Open() error
- func (i *Indy) OpenStore(_ string) (storage.Store, error)
- func (i *Indy) OurPackager() api.Packager
- func (i *Indy) SetStoreConfig(_ string, _ storage.StoreConfiguration) error
- type KMS
- func (k *KMS) Add(KID, verKey string)
- func (k *KMS) Create(_ kms.KeyType) (string, interface{}, error)
- func (k *KMS) CreateAndExportPubKeyBytes(_ kms.KeyType) (string, []byte, error)
- func (k *KMS) ExportPubKeyBytes(_ string) ([]byte, kms.KeyType, error)
- func (k *KMS) Get(KID string) (interface{}, error)
- func (k *KMS) ImportPrivateKey(_ interface{}, _ kms.KeyType, _ ...kms.PrivateKeyOpts) (string, interface{}, error)
- func (k *KMS) PubKeyBytesToHandle(pubKey []byte, _ kms.KeyType) (interface{}, error)
- func (k *KMS) Rotate(_ kms.KeyType, _ string) (string, interface{}, error)
- type Packager
- func (p *Packager) Crypto() crypto.Crypto
- func (p *Packager) KMS() kms.KeyManager
- func (p *Packager) PackMessage(envelope *transport.Envelope) (b []byte, err error)
- func (p *Packager) StorageProvider() storage.Provider
- func (p *Packager) UnpackMessage(encMessage []byte) (e *transport.Envelope, err error)
- func (p *Packager) VDRegistry() vdr.Registry
Constants ¶
const MethodPrefix = "did:sov:"
const SovVerKeyLen = 32
Variables ¶
var (
ErrWrongSignature = fmt.Errorf("signature validation failed")
)
Functions ¶
Types ¶
type Crypto ¶
type Crypto struct { }
func (*Crypto) ComputeMAC ¶
ComputeMAC computes message authentication code (MAC) for code data using a matching MAC primitive in kh key handle
func (*Crypto) Decrypt ¶
Decrypt will decrypt cipher with aad and given nonce using a matching AEAD primitive in kh key handle of a private key returns:
plainText in []byte error in case of errors
func (*Crypto) DeriveProof ¶
func (c *Crypto) DeriveProof(_ [][]byte, _ []byte, _ []byte, _ []int, _ interface{}) ([]byte, error)
DeriveProof will create a signature proof for a list of revealed messages using BBS signature (can be built using a Signer's SignMulti() call) and a matching signing primitive found in kh key handle of a public key. returns:
signature proof in []byte error in case of errors
func (*Crypto) Encrypt ¶
Encrypt will encrypt msg and aad using a matching AEAD primitive in kh key handle of a public key returns:
cipherText in []byte nonce in []byte error in case of errors during encryption
func (*Crypto) Sign ¶
Sign will sign msg using a matching signature primitive in kh key handle of a private key returns:
signature in []byte error in case of errors
func (*Crypto) SignMulti ¶
SignMulti will create a signature of messages using a matching signing primitive found in kh key handle of a private key. returns:
signature in []byte error in case of errors
func (*Crypto) UnwrapKey ¶
func (c *Crypto) UnwrapKey(_ *crypto.RecipientWrappedKey, _ interface{}, _ ...crypto.WrapKeyOpts) ([]byte, error)
UnwrapKey unwraps a key in recWK using recipient private key kh. 'opts' allows setting the optional sender key handle using WithSender() option and the an authentication tag using WithTag() option. These allow ECDH-1PU key unwrapping (aka Authcrypt). The absence of these options uses ECDH-ES key unwrapping (aka Anoncrypt). There is no need to use WithXC20PKW() for UnwrapKey since the function will use the wrapping algorithm based on recWK.Alg. returns:
unwrapped key in raw bytes error in case of errors
func (*Crypto) Verify ¶
Verify will verify a signature for the given msg using a matching signature primitive in kh key handle of a public key returns:
error in case of errors or nil if signature verification was successful
func (*Crypto) VerifyMAC ¶
VerifyMAC determines if mac is a correct authentication code (MAC) for data using a matching MAC primitive in kh key handle and returns nil if so, otherwise it returns an error.
func (*Crypto) VerifyMulti ¶
VerifyMulti will verify a signature of messages using a matching signing primitive found in kh key handle of a public key. returns:
error in case of errors or nil if signature verification was successful
func (*Crypto) VerifyProof ¶
VerifyProof will verify a signature proof (generated e.g. by Verifier's DeriveProof() call) for revealedMessages using a matching signing primitive found in kh key handle of a public key. returns:
error in case of errors or nil if signature proof verification was successful
func (*Crypto) WrapKey ¶
func (c *Crypto) WrapKey(_ []byte, _ []byte, _ []byte, _ *crypto.PublicKey, _ ...crypto.WrapKeyOpts) (*crypto.RecipientWrappedKey, error)
WrapKey will execute key wrapping of cek using apu, apv and recipient public key 'recPubKey'. 'opts' allows setting the optional sender key handle using WithSender() option and the an authentication tag using WithTag() option. These allow ECDH-1PU key unwrapping (aka Authcrypt). The absence of these options uses ECDH-ES key wrapping (aka Anoncrypt). Another option that can be used is WithXC20PKW() to instruct the WrapKey to use XC20P key wrapping instead of the default A256GCM. returns:
RecipientWrappedKey containing the wrapped cek value error in case of errors
type Indy ¶
type Indy struct { Handle int // contains filtered or unexported fields }
func (*Indy) ConnectionStorage ¶
func (i *Indy) ConnectionStorage() api.ConnectionStorage
func (*Indy) CredentialStorage ¶
func (i *Indy) CredentialStorage() api.CredentialStorage
func (*Indy) DIDStorage ¶
func (i *Indy) DIDStorage() api.DIDStorage
func (*Indy) GetOpenStores ¶
func (*Indy) GetStoreConfig ¶
func (i *Indy) GetStoreConfig(_ string) (storage.StoreConfiguration, error)
func (*Indy) KMS ¶
func (i *Indy) KMS() kms.KeyManager
func (*Indy) OurPackager ¶
func (*Indy) SetStoreConfig ¶
func (i *Indy) SetStoreConfig(_ string, _ storage.StoreConfiguration) error
type KMS ¶
type KMS struct {
// contains filtered or unexported fields
}
func NewKMS ¶
func NewKMS(storage api.AgentStorage) *KMS
func (*KMS) CreateAndExportPubKeyBytes ¶
func (*KMS) ExportPubKeyBytes ¶
func (*KMS) ImportPrivateKey ¶
func (*KMS) PubKeyBytesToHandle ¶
type Packager ¶
type Packager struct {
// contains filtered or unexported fields
}
func (*Packager) KMS ¶
func (p *Packager) KMS() kms.KeyManager