Documentation
¶
Index ¶
- Variables
- func CreateProfile(userID string, ctx provider, options ...KeyManagerOptions) error
- func UpdateProfile(userID string, ctx provider, options ...KeyManagerOptions) error
- type Client
- func (c *Client) Add(model json.RawMessage) error
- func (c *Client) Close() bool
- func (c *Client) Export(auth string) (json.RawMessage, error)
- func (c *Client) Get(contentID string) (json.RawMessage, error)
- func (c *Client) Import(auth string, contents json.RawMessage) error
- func (c *Client) Issue(credential json.RawMessage, options *ProofOptions) (json.RawMessage, error)
- func (c *Client) Open(auth string, secretLockSvc secretlock.Service, tokenExpiry time.Duration) (string, error)
- func (c *Client) Prove(credentialIDs []string, options *ProofOptions) (json.RawMessage, error)
- func (c *Client) Query(query *QueryParams) ([]json.RawMessage, error)
- func (c *Client) Remove(contentID string) error
- func (c *Client) Verify(raw json.RawMessage) (bool, error)
- type KeyManagerOptions
- type ProofOptions
- type QueryParams
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyUnlocked = errors.New("profile already unlocked")
ErrAlreadyUnlocked error when key manager is already created for a given user.
var ErrProfileNotFound = errors.New("profile does not exist")
ErrProfileNotFound error for wallet profile not found scenario.
Functions ¶
func CreateProfile ¶
func CreateProfile(userID string, ctx provider, options ...KeyManagerOptions) error
CreateProfile creates a new verifiable credential wallet profile for given user. returns error if wallet profile is already created. Use `UpdateProfile()` for replacing an already created verifiable credential wallet profile.
func UpdateProfile ¶
func UpdateProfile(userID string, ctx provider, options ...KeyManagerOptions) error
UpdateProfile updates existing verifiable credential wallet profile. Will create new profile if no profile exists for given user. Caution: you might lose your existing keys if you change kms options.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client enable access to verifiable credential wallet features.
func New ¶
New returns new verifiable credential wallet client for given user. returns error if wallet profile is not found. To create a new wallet profile, use `CreateProfile()`. To update an existing profile, use `UpdateProfile()`.
func (*Client) Add ¶
func (c *Client) Add(model json.RawMessage) error
Add adds given data model to wallet contents store.
Supported data models:
func (*Client) Close ¶
Close expires token issued to this VC wallet client. returns false if token is not found or already expired for this wallet user.
func (*Client) Export ¶
func (c *Client) Export(auth string) (json.RawMessage, error)
Export produces a serialized exported wallet representation. Only ciphertext wallet contents can be exported.
Args: - auth: token to be used to lock the wallet before exporting. Returns exported locked wallet.
Supported data models:
func (*Client) Get ¶
func (c *Client) Get(contentID string) (json.RawMessage, error)
Get fetches a wallet content by content ID.
Supported data models:
func (*Client) Import ¶
func (c *Client) Import(auth string, contents json.RawMessage) error
Import Takes a serialized exported wallet representation as input and imports all contents into wallet.
Args: - contents: wallet content to be imported. - auth: token used while exporting the wallet.
Supported data models:
func (*Client) Issue ¶
func (c *Client) Issue(credential json.RawMessage, options *ProofOptions) (json.RawMessage, error)
Issue adds proof to a Verifiable Credential.
Args: - A verifiable credential with or without proof - Proof options
func (*Client) Open ¶
func (c *Client) Open(auth string, secretLockSvc secretlock.Service, tokenExpiry time.Duration) (string, error)
Open unlocks wallet client's key manager instance and returns a token for subsequent use of wallet features.
Args: - auth : auth token in case of remotekms or passphrase in case of localkms. - secretLockSvc: secret lock service for localkms if you choose not to provide passphrase. - tokenExpiry : (optional, default: 10 * time.minute) time duration after which issued token will expiry. Returns token with expiry that can be used for subsequent use of wallet features.
func (*Client) Prove ¶
func (c *Client) Prove(credentialIDs []string, options *ProofOptions) (json.RawMessage, error)
Prove produces a Verifiable Presentation.
Args: - List of verifiable credentials IDs. - Proof options
func (*Client) Query ¶
func (c *Client) Query(query *QueryParams) ([]json.RawMessage, error)
Query returns a collection of results based on current wallet contents.
Supported Query Types:
type KeyManagerOptions ¶
type KeyManagerOptions func(opts *kmsOpts)
KeyManagerOptions is option for verifiable credential wallet client key manager.
func WithKeyServerURL ¶
func WithKeyServerURL(url string) KeyManagerOptions
WithKeyServerURL option, when provided then wallet client will use remote kms for key operations. This option will be ignore if provided with 'WithSecretLockService' option.
func WithPassphrase ¶
func WithPassphrase(passphrase string) KeyManagerOptions
WithPassphrase option to provide passphrase for local kms for key operations.
func WithSecretLockService ¶
func WithSecretLockService(svc secretlock.Service) KeyManagerOptions
WithSecretLockService option, when provided then wallet client will use local kms for key operations.
type ProofOptions ¶
type ProofOptions struct { // VerificationMethod is the URI of the verificationMethod used for the proof. VerificationMethod string `json:"verificationMethod,omitempty"` // ProofPurpose is purpose of the proof. ProofPurpose string `json:"proofPurpose,omitempty"` // Controller is a DID to be for signing. Controller string `json:"controller,omitempty"` // Created date of the proof. If omitted current system time will be used. Created *time.Time `json:"created,omitempty"` // Domain is operational domain of a digital proof. Domain string `json:"domain,omitempty"` // Challenge is a random or pseudo-random value option authentication Challenge string `json:"challenge,omitempty"` // ProofType is signature type used for signing ProofType string `json:"proofType,omitempty"` }
ProofOptions model
Options for adding linked data proofs to a verifiable credential or a verifiable presentation.
type QueryParams ¶
type QueryParams struct { // Type of the query. // Allowed values 'QueryByFrame', 'PresentationExchange' Type string // Wallet content query. Query json.RawMessage }
QueryParams model
Parameters for querying vc wallet contents.