Documentation
¶
Index ¶
- Variables
- func CreateProfile(userID string, ctx provider, options ...wallet.ProfileOptions) error
- func ProfileExists(userID string, ctx provider) error
- func UpdateProfile(userID string, ctx provider, options ...wallet.ProfileOptions) error
- type Client
- func (c *Client) Add(contentType wallet.ContentType, content json.RawMessage, ...) error
- func (c *Client) Close() bool
- func (c *Client) Connect(invitation *outofband.Invitation, options ...wallet.ConnectOptions) (string, error)
- func (c *Client) CreateKeyPair(keyType kms.KeyType) (*wallet.KeyPair, error)
- func (c *Client) Derive(credential wallet.CredentialToDerive, options *wallet.DeriveOptions) (*verifiable.Credential, error)
- func (c *Client) Export(auth string) (json.RawMessage, error)
- func (c *Client) Get(contentType wallet.ContentType, contentID string) (json.RawMessage, error)
- func (c *Client) GetAll(contentType wallet.ContentType, options ...wallet.GetAllContentsOptions) (map[string]json.RawMessage, error)
- func (c *Client) Import(auth string, contents json.RawMessage) error
- func (c *Client) Issue(credential json.RawMessage, options *wallet.ProofOptions) (*verifiable.Credential, error)
- func (c *Client) Open(options ...wallet.UnlockOptions) error
- func (c *Client) PresentProof(thID string, presentProofFrom wallet.PresentProofFrom) error
- func (c *Client) ProposePresentation(invitation *outofband.Invitation, options ...wallet.ProposePresentationOption) (*service.DIDCommMsgMap, error)
- func (c *Client) Prove(opts *wallet.ProofOptions, creds ...wallet.ProveOptions) (*verifiable.Presentation, error)
- func (c *Client) Query(params ...*wallet.QueryParams) ([]*verifiable.Presentation, error)
- func (c *Client) Remove(contentType wallet.ContentType, contentID string) error
- func (c *Client) Verify(option wallet.VerificationOption) (bool, error)
Constants ¶
This section is empty.
Variables ¶
var ErrWalletLocked = errors.New("wallet locked")
ErrWalletLocked when key manager related operation attempted on locked wallet.
Functions ¶
func CreateProfile ¶
func CreateProfile(userID string, ctx provider, options ...wallet.ProfileOptions) 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 ProfileExists ¶ added in v0.1.7
ProfileExists checks if profile exists for given wallet user, returns error if not found.
func UpdateProfile ¶
func UpdateProfile(userID string, ctx provider, options ...wallet.ProfileOptions) 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 ¶
func New(userID string, ctx provider, options ...wallet.UnlockOptions) (*Client, error)
New returns new verifiable credential wallet client for given user.
Args: - userID : unique user identifier used for login. - provider: dependencies for the verifiable credential wallet client. - options : options for unlocking wallet. Any other existing wallet instance of same wallet user will be locked once this instance is unlocked.
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(contentType wallet.ContentType, content json.RawMessage, options ...wallet.AddContentOptions) error
Add adds given data model to wallet contents store.
Supported data models:
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Collection
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Credential
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#DIDResolutionResponse
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#meta-data
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#connection
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Key
TODO: (#2433) support for correlation between wallet contents (ex: credentials to a profile/collection).
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) Connect ¶ added in v0.1.7
func (c *Client) Connect(invitation *outofband.Invitation, options ...wallet.ConnectOptions) (string, error)
Connect accepts out-of-band invitations and performs DID exchange.
Args:
- invitation: out-of-band invitation.
- options: connection options.
Returns:
- connection ID if DID exchange is successful.
- error if operation false.
func (*Client) CreateKeyPair ¶ added in v0.1.7
CreateKeyPair creates key pair inside a wallet.
Args: - authToken: authorization for performing create key pair operation. - keyType: type of the key to be created.
func (*Client) Derive ¶ added in v0.1.7
func (c *Client) Derive(credential wallet.CredentialToDerive, options *wallet.DeriveOptions) (*verifiable.Credential, error)
Derive derives a credential and returns response credential.
Args: - credential to derive (ID of the stored credential, raw credential or credential instance). - derive options.
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:
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Collection
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Credential
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#DIDResolutionResponse
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#meta-data
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#connection
func (*Client) Get ¶
func (c *Client) Get(contentType wallet.ContentType, contentID string) (json.RawMessage, error)
Get fetches a wallet content by content ID.
Supported data models:
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Collection
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Credential
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#DIDResolutionResponse
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#meta-data
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#connection
func (*Client) GetAll ¶ added in v0.1.7
func (c *Client) GetAll(contentType wallet.ContentType, options ...wallet.GetAllContentsOptions) (map[string]json.RawMessage, error)
GetAll fetches all wallet contents of given type.
Supported data models:
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Collection
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Credential
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#DIDResolutionResponse
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#meta-data
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#connection
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:
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Collection
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Credential
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#DIDResolutionResponse
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#meta-data
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#connection
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Key
func (*Client) Issue ¶
func (c *Client) Issue(credential json.RawMessage, options *wallet.ProofOptions) (*verifiable.Credential, 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(options ...wallet.UnlockOptions) error
Open unlocks wallet client's key manager instance and returns a token for subsequent use of wallet features.
Args: - unlock options for opening wallet. Returns token with expiry that can be used for subsequent use of wallet features.
func (*Client) PresentProof ¶ added in v0.1.7
func (c *Client) PresentProof(thID string, presentProofFrom wallet.PresentProofFrom) error
PresentProof sends message present proof message from wallet to relying party. https://w3c-ccg.github.io/universal-wallet-interop-spec/#presentproof
Currently Supporting [0454-present-proof-v2](https://github.com/hyperledger/aries-rfcs/tree/master/features/0454-present-proof-v2)
Args:
- thID: thread ID (action ID) of request presentation.
- presentation: presentation to be sent.
Returns:
- error if operation fails.
TODO: wait for acknowledgement option to be added.
func (*Client) ProposePresentation ¶ added in v0.1.7
func (c *Client) ProposePresentation(invitation *outofband.Invitation, options ...wallet.ProposePresentationOption) (*service.DIDCommMsgMap, error)
ProposePresentation accepts out-of-band invitation and sends message proposing presentation from wallet to relying party.
https://w3c-ccg.github.io/universal-wallet-interop-spec/#proposepresentation
Currently Supporting [0454-present-proof-v2](https://github.com/hyperledger/aries-rfcs/tree/master/features/0454-present-proof-v2)
Args:
- invitation: out-of-band invitation from relying party.
- options: options for accepting invitation and send propose presentation message.
Returns:
- DIDCommMsgMap containing request presentation message if operation is successful.
- error if operation fails.
func (*Client) Prove ¶
func (c *Client) Prove(opts *wallet.ProofOptions, creds ...wallet.ProveOptions) (*verifiable.Presentation, error)
Prove produces a Verifiable Presentation.
Args: - list of interfaces (string of credential IDs which can be resolvable to stored credentials in wallet or raw credential). - proof options
func (*Client) Query ¶
func (c *Client) Query(params ...*wallet.QueryParams) ([]*verifiable.Presentation, error)
Query runs query against wallet credential contents and returns presentation containing credential results.
https://w3c-ccg.github.io/universal-wallet-interop-spec/#query
Supported Query Types:
func (*Client) Remove ¶
func (c *Client) Remove(contentType wallet.ContentType, contentID string) error
Remove removes wallet content by content ID.
Supported data models:
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Collection
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#Credential
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#DIDResolutionResponse
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#meta-data
- https://w3c-ccg.github.io/universal-wallet-interop-spec/#connection
func (*Client) Verify ¶
func (c *Client) Verify(option wallet.VerificationOption) (bool, error)
Verify takes Takes a Verifiable Credential or Verifiable Presentation as input,.
Args: - verification option for sending different models (stored credential ID, raw credential, raw presentation).
Returns: a boolean verified, and an error if verified is false.