indy

package
v0.31.41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const MethodPrefix = "did:sov:"
View Source
const SovVerKeyLen = 32

Variables

View Source
var (
	ErrWrongSignature = fmt.Errorf("signature validation failed")
)

Functions

func DID2KID

func DID2KID(did string) string

Types

type Crypto

type Crypto struct {
}

func (*Crypto) Blind added in v0.31.41

func (c *Crypto) Blind(_ interface{}, _ ...map[string]interface{}) ([][]byte, error)

Blind will blind provided values and add blinded data realted to the key in kh returns:

blinded values in []byte
error in case of errors

func (*Crypto) ComputeMAC

func (c *Crypto) ComputeMAC(_ []byte, _ interface{}) ([]byte, error)

ComputeMAC computes message authentication code (MAC) for code data using a matching MAC primitive in kh key handle

func (*Crypto) Decrypt

func (c *Crypto) Decrypt(_ []byte, _ []byte, _ []byte, _ interface{}) ([]byte, error)

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

func (c *Crypto) Encrypt(_ []byte, _ []byte, _ interface{}) ([]byte, []byte, error)

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) GetCorrectnessProof added in v0.31.41

func (c *Crypto) GetCorrectnessProof(_ interface{}) ([]byte, error)

GetCorrectnessProof will return correctness proof for a public key handle returns:

correctness proof in []byte
error in case of errors

func (*Crypto) Sign

func (c *Crypto) Sign(msg []byte, kh interface{}) (s []byte, err error)

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

func (c *Crypto) SignMulti(_ [][]byte, _ interface{}) ([]byte, error)

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) SignWithSecrets added in v0.31.41

func (c *Crypto) SignWithSecrets(_ interface{}, _ map[string]interface{},
	_ []byte, _ []byte, _ [][]byte, _ string) ([]byte, []byte, error)

SignWithSecrets will generate a signature and related correctness proof for the provided values using secrets and related DID returns:

signature in []byte
correctness proof 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

func (c *Crypto) Verify(signature []byte, msg []byte, kh interface{}) (err error)

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

func (c *Crypto) VerifyMAC(_ []byte, _ []byte, _ interface{}) error

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

func (c *Crypto) VerifyMulti(_ [][]byte, _ []byte, _ interface{}) error

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

func (c *Crypto) VerifyProof(_ [][]byte, _ []byte, _ []byte, _ interface{}) error

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 Handle

type Handle struct {
	Wallet int
	VerKey string
}

type Indy

type Indy struct {
	Handle int
	// contains filtered or unexported fields
}

func New

func New(handle int) *Indy

func (*Indy) Close

func (i *Indy) Close() error

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 (i *Indy) GetOpenStores() []storage.Store

func (*Indy) GetStoreConfig

func (i *Indy) GetStoreConfig(_ string) (storage.StoreConfiguration, error)

func (*Indy) KMS

func (i *Indy) KMS() kms.KeyManager

func (*Indy) Open

func (i *Indy) Open() error

func (*Indy) OpenStore

func (i *Indy) OpenStore(_ string) (storage.Store, error)

func (*Indy) OurPackager

func (i *Indy) OurPackager() api.Packager

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) Add

func (k *KMS) Add(KID, verKey string)

func (*KMS) Create

func (k *KMS) Create(_ kms.KeyType, _ ...kms.KeyOpts) (string, interface{}, error)

func (*KMS) CreateAndExportPubKeyBytes

func (k *KMS) CreateAndExportPubKeyBytes(_ kms.KeyType, _ ...kms.KeyOpts) (string, []byte, error)

func (*KMS) ExportPubKeyBytes

func (k *KMS) ExportPubKeyBytes(_ string) ([]byte, kms.KeyType, error)

func (*KMS) Get

func (k *KMS) Get(KID string) (interface{}, error)

func (*KMS) ImportPrivateKey

func (k *KMS) ImportPrivateKey(_ interface{}, _ kms.KeyType, _ ...kms.PrivateKeyOpts) (string, interface{}, error)

func (*KMS) PubKeyBytesToHandle

func (k *KMS) PubKeyBytesToHandle(pubKey []byte, _ kms.KeyType, _ ...kms.KeyOpts) (interface{}, error)

func (*KMS) Rotate

func (k *KMS) Rotate(_ kms.KeyType, _ string, _ ...kms.KeyOpts) (string, interface{}, error)

type Packager

type Packager struct {
	// contains filtered or unexported fields
}

func (*Packager) Crypto

func (p *Packager) Crypto() crypto.Crypto

func (*Packager) KMS

func (p *Packager) KMS() kms.KeyManager

func (*Packager) PackMessage

func (p *Packager) PackMessage(envelope *transport.Envelope) (b []byte, err error)

func (*Packager) StorageProvider

func (p *Packager) StorageProvider() storage.Provider

func (*Packager) UnpackMessage

func (p *Packager) UnpackMessage(
	encMessage []byte,
) (
	e *transport.Envelope,
	err error,
)

func (*Packager) VDRegistry

func (p *Packager) VDRegistry() vdr.Registry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL