Documentation
¶
Index ¶
- func AddPublicKeys(key1, key2 jwk.Key) (jwk.Key, error)
- func AddSecretKeys(key1, key2 jwk.Key) (jwk.Key, error)
- func DeriveSecretKey(master jwk.Key, context, dst []byte) (jwk.Key, error)
- func GenerateSecretKey() (jwk.Key, error)
- func IsKeyValid(key jwk.Key) error
- type CnfData
- type IssuerConfig
- func (c *IssuerConfig) AddCnfToPayload(uuid string, vcPayload map[string]interface{}, userMap map[string]*UserData) (map[string]interface{}, *UserData, error)
- func (c *IssuerConfig) GeneratePublicKeys(hashBytes []byte) (map[string]KeyData, error)
- func (c *IssuerConfig) GetPublicKeysFromWalletProvider(emailMap map[string]string) (map[string]*UserData, error)
- func (c *IssuerConfig) GetUserDataMap(userDataBytes []byte) (map[string]*UserData, error)
- func (c *IssuerConfig) PrepareMessagePack(signedCredential []byte, uuid string, userMap map[string]*UserData, ...) ([]byte, error)
- func (c *IssuerConfig) ValidateConfig() error
- type KeyData
- type MasterKeyStore
- type MessagePack
- type ProviderConfig
- func (c *ProviderConfig) GeneratePublicKeys(requestJson []byte) ([]byte, error)
- func (c *ProviderConfig) GenerateSecretKey(requestJson []byte, dst string) ([]byte, error)
- func (c *ProviderConfig) GenerateSinglePublicKey(requestJson []byte) ([]byte, error)
- func (c *ProviderConfig) ValidateConfig() error
- type SecretKeyData
- type UserData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPublicKeys ¶
AddPublicKeys adds two ECDSA public keys using elliptic curve point addition
func AddSecretKeys ¶
AddSecretKeys adds two ECDSA private keys using scalar addition modulo curve order
func DeriveSecretKey ¶
DeriveSecretKey derives a secret key from master key material using hash-to-field
func GenerateSecretKey ¶
GenerateSecretKey generates a cryptographically secure NIST P-256 private key
func IsKeyValid ¶
IsKeyValid checks if a JWK represents a valid NIST P-256 key
Types ¶
type IssuerConfig ¶
type IssuerConfig struct {
ProviderURL string
}
func (*IssuerConfig) AddCnfToPayload ¶
func (c *IssuerConfig) AddCnfToPayload(uuid string, vcPayload map[string]interface{}, userMap map[string]*UserData) (map[string]interface{}, *UserData, error)
AddCnfToPayload (F1) generates VC keys and adds confirmation key to the VC payload
func (*IssuerConfig) GeneratePublicKeys ¶
func (c *IssuerConfig) GeneratePublicKeys(hashBytes []byte) (map[string]KeyData, error)
func (*IssuerConfig) GetPublicKeysFromWalletProvider ¶
func (c *IssuerConfig) GetPublicKeysFromWalletProvider(emailMap map[string]string) (map[string]*UserData, error)
GetPublicKeysFromWalletProvider (F0) generates wallet provider public keys for a map of users
func (*IssuerConfig) GetUserDataMap ¶ added in v0.1.15
func (c *IssuerConfig) GetUserDataMap(userDataBytes []byte) (map[string]*UserData, error)
GetUserDataMap takes raw userDataBytes that are usually stored in the database and converts them to correct format that the rest of IssuerConfig methods use.
func (*IssuerConfig) PrepareMessagePack ¶
func (c *IssuerConfig) PrepareMessagePack(signedCredential []byte, uuid string, userMap map[string]*UserData, displayConf, previewDisplayConf []byte, credentialType string) ([]byte, error)
PrepareMessagePack (F2) encrypts the credential with credential public key and encrypts the credential secret key with wallet provider public key. It returns the message pack to be send to the credential recipient email
func (*IssuerConfig) ValidateConfig ¶
func (c *IssuerConfig) ValidateConfig() error
ValidateConfig validates the configuration before use
type MasterKeyStore ¶
MasterKeyStore interface allows users to implement their own key storage
type MessagePack ¶
type MessagePack struct {
EncVC []byte `json:"encrypted_vc" msgpack:"encrypted_vc"` // encrypted with VcPubKey
EncVCSecKey []byte `json:"encrypted_vc_sec_key" msgpack:"encrypted_vc_sec_key"` // encrypted with WpPubKey
ProviderURL string `json:"provider_url" msgpack:"provider_url"` // so you know which wp to call
KeyId string `json:"key_id" msgpack:"key_id"` // needed to generate wp secret key
Salt []byte `json:"salt" msgpack:"salt"` // needed to generate wp secret key
Email string `json:"email" msgpack:"email"` // who gets the VC
DisplayMap []byte `json:"display_map" msgpack:"display_map"` // how VC looks in wallet
PreviewDisplayMap []byte `json:"preview_display_map" msgpack:"preview_display_map"` // preview of VC before he adds it to the wallet
CredentialType string `json:"credential_type" msgpack:"credential_type"` // type of the credential, needed for wallet to know how to display it
}
MessagePack defines values that are stored in the message pack binary format
type ProviderConfig ¶
func (*ProviderConfig) GeneratePublicKeys ¶
func (c *ProviderConfig) GeneratePublicKeys(requestJson []byte) ([]byte, error)
func (*ProviderConfig) GenerateSecretKey ¶ added in v0.1.5
func (c *ProviderConfig) GenerateSecretKey(requestJson []byte, dst string) ([]byte, error)
func (*ProviderConfig) GenerateSinglePublicKey ¶ added in v0.1.14
func (c *ProviderConfig) GenerateSinglePublicKey(requestJson []byte) ([]byte, error)
func (*ProviderConfig) ValidateConfig ¶
func (c *ProviderConfig) ValidateConfig() error