Wallets

Manage Digital Wallet with Wallets Service.

Install Dependency

Package: AffinidiTdk.WalletsClient

dotnet add package AffinidiTdk.WalletsClient

You can check the latest version of this module on the nuget.org repository or view the source code at the GitHub repository.

Classes and Methods

Wallet API

Used to manage digital wallets for issuing credentials.

CreateWallet

Create a wallet by type.

Parameters

CreateWalletInput [Object]

JSON object to provide details for the wallet to create. See more here.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); CreateWalletInput input = new CreateWalletInput(name: "DotNet Wallet", didMethod: CreateWalletInput.DidMethodEnum.Key); CreateWalletResponse result = api.CreateWallet(input);

DeleteWallet

Delete a Wallet by ID.

Parameters

walletId [String]

ID of the Wallet to delete.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); var walletId = "<WALLET_ID>"; api.DeleteWallet(walletId);

GetWallet

Retrieves the details of the Wallet.

Parameters

walletId [String]

ID of the Wallet to retrieve.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); var walletId = "<WALLET_ID>"; WalletDto result = api.GetWallet(walletId);

ListWallets

Get the list of the Wallets.

Parameters

No Parameters Required

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); WalletsListDto result = api.ListWallets();

SignCredential

Sign a credentials with the Wallet details (DID document).

Parameters

walletId [String]

ID of the Wallet used for signing the credential.

SignCredentialInputDto [Object]

JSON object to provide the credential data to sign. See more here.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); var walletId = "<WALLET_ID>"; SignCredentialInputDto input = new SignCredentialInputDto(); SignCredentialResultDto result = api.SignCredential(walletId, input);

SignJwtToken

Sign the JSON Web Token with the Wallet details (DID document).

Parameters

walletId [String]

ID of the Wallet used for signing the JWT.

SignCredentialInputDto [Object]

JSON object to provide the JWT data to sign. See more here.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); var walletId = "<WALLET_ID>"; SignJwtToken input = new SignJwtToken(); SignJwtTokenOK result = api.SignJwtToken(walletId, input);

UpdateWallet

Update an existing Wallet by ID.

Parameters

walletId [String]

ID of the Wallet to update.

UpdateWalletInput [Object]

JSON object to provide details for the wallet to update. See more here.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); var walletId = "<WALLET_ID>"; UpdateWalletInput input = new UpdateWalletInput(); WalletDto result = api.UpdateWallet(walletId, input);

CreateWalletKey

Add a cryptographic key to an existing wallet.

Note: Multiple keys are only supported for did:web wallets.

Parameters

walletId [String]

ID of the Wallet to add a key to.

CreateWalletKeyInput [Object]

JSON object to provide the key type and verification relationships. See more here.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); var walletId = "<WALLET_ID>"; CreateWalletKeyInput input = new CreateWalletKeyInput { KeyType = "ed25519", Relationships = new List<VerificationRelationship> { VerificationRelationship.Authentication, VerificationRelationship.AssertionMethod } }; WalletKeyDto result = api.CreateWalletKey(walletId, input);

ListWalletKeys

Retrieve all keys associated with a wallet.

Note: Multiple keys are only supported for did:web wallets.

Parameters

walletId [String]

ID of the Wallet.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); var walletId = "<WALLET_ID>"; ListWalletKeysOK result = api.ListWalletKeys(walletId);

RemoveWalletKey

Remove a key from a wallet.

Note: Multiple keys are only supported for did:web wallets.

Parameters

walletId [String]

ID of the Wallet.

keyId [String]

Wallet-scoped key identifier.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); var walletId = "<WALLET_ID>"; var keyId = "<KEY_ID>"; api.RemoveWalletKey(walletId, keyId);

UpdateWalletKey

Update the verification relationships of an existing wallet key.

Note: Multiple keys are only supported for did:web wallets.

Parameters

walletId [String]

ID of the Wallet.

keyId [String]

Wallet-scoped key identifier to update.

UpdateWalletKeyInput [Object]

JSON object to provide the updated verification relationships. See more here.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); var walletId = "<WALLET_ID>"; var keyId = "<KEY_ID>"; UpdateWalletKeyInput input = new UpdateWalletKeyInput { Relationships = new List<VerificationRelationship> { VerificationRelationship.Authentication, VerificationRelationship.KeyAgreement } }; WalletKeyDto result = api.UpdateWalletKey(walletId, keyId, input);

CreateServiceEndpoint

Add a DID service endpoint to a wallet’s DID document.

Parameters

walletId [String]

ID of the Wallet.

ServiceEndpointInput [Object]

JSON object to provide the service endpoint details. See more here.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); var walletId = "<WALLET_ID>"; ServiceEndpointInput input = new ServiceEndpointInput { Name = "My Service", Url = "https://example.com/service", ServiceType = "LinkedDomains" }; ServiceEndpointDto result = api.CreateServiceEndpoint(walletId, input);

ListServiceEndpoints

Retrieve all service endpoints associated with a wallet.

Parameters

walletId [String]

ID of the Wallet.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); var walletId = "<WALLET_ID>"; ListServiceEndpointsOK result = api.ListServiceEndpoints(walletId);

RemoveServiceEndpoint

Remove a service endpoint from a wallet’s DID document.

Parameters

walletId [String]

ID of the Wallet.

serviceId [String]

ID of the service endpoint to remove.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); var walletId = "<WALLET_ID>"; var serviceId = "<SERVICE_ID>"; api.RemoveServiceEndpoint(walletId, serviceId);

UpdateServiceEndpoint

Update an existing service endpoint on a wallet.

Parameters

walletId [String]

ID of the Wallet.

serviceId [String]

ID of the service endpoint to update.

UpdateServiceEndpointInput [Object]

JSON object to provide the updated service endpoint details. See more here.

Example
using AffinidiTdk.WalletsClient.Client; using AffinidiTdk.WalletsClient.Api; using AffinidiTdk.WalletsClient.Model;
Configuration config = new Configuration(); config.AddApiKey("authorization", projectScopedToken); WalletApi api = new WalletApi(config); var walletId = "<WALLET_ID>"; var serviceId = "<SERVICE_ID>"; UpdateServiceEndpointInput input = new UpdateServiceEndpointInput { Url = "https://new-endpoint.example.com" }; ServiceEndpointDto result = api.UpdateServiceEndpoint(walletId, serviceId, input);