vcwallet

package
v0.0.0-...-57c6170 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func ProfileExists(userID string, ctx provider) error

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

func (c *Client) Close() bool

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

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

func (c *Client) CreateKeyPair(keyType kms.KeyType) (*wallet.KeyPair, error)

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

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:

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

func (c *Client) PresentProof(thID string, presentProofFrom ...wallet.ConcludeInteractionOptions) (*wallet.CredentialInteractionStatus, 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:

  • Credential interaction status containing status, redirectURL.
  • error if operation fails.

func (*Client) ProposeCredential

func (c *Client) ProposeCredential(invitation *wallet.GenericInvitation, options ...wallet.InitiateInteractionOption) (*service.DIDCommMsgMap, error)

ProposeCredential sends propose credential message from wallet to issuer. https://w3c-ccg.github.io/universal-wallet-interop-spec/#requestcredential

Currently Supporting : 0453-issueCredentialV2 https://github.com/hyperledger/aries-rfcs/blob/main/features/0453-issue-credential-v2/README.md

Args:

  • invitation: out-of-band invitation from issuer.
  • options: options for accepting invitation and send propose credential message.

Returns:

  • DIDCommMsgMap containing offer credential message if operation is successful.
  • error if operation fails.

func (*Client) ProposePresentation

func (c *Client) ProposePresentation(invitation *wallet.GenericInvitation, options ...wallet.InitiateInteractionOption) (*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) RequestCredential

func (c *Client) RequestCredential(thID string, options ...wallet.ConcludeInteractionOptions) (*wallet.CredentialInteractionStatus, error)

RequestCredential sends request credential message from wallet to issuer and optionally waits for credential response. https://w3c-ccg.github.io/universal-wallet-interop-spec/#proposecredential

Currently Supporting : 0453-issueCredentialV2 https://github.com/hyperledger/aries-rfcs/blob/main/features/0453-issue-credential-v2/README.md

Args:

  • thID: thread ID (action ID) of offer credential message previously received.
  • concludeInteractionOptions: options to conclude interaction like presentation to be shared etc.

Returns:

  • Credential interaction status containing status, redirectURL.
  • error if operation fails.

func (*Client) ResolveCredentialManifest

func (c *Client) ResolveCredentialManifest(manifest json.RawMessage, resolve wallet.ResolveManifestOption) ([]*cm.ResolvedDescriptor, error)

ResolveCredentialManifest resolves given credential manifest by credential response or credential. Supports: https://identity.foundation/credential-manifest/

Args:

  • authToken: authorization for performing operation.
  • manifest: Credential manifest data model in raw format.
  • resolve: options to provide credential response or credential to resolve.

Returns:

  • list of resolved descriptors.
  • error if operation fails.

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.

Jump to

Keyboard shortcuts

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