Wallets

Manage Digital Wallet with Wallets Service.

Install Dependency

Package: AffinidiTdk.WalletsClient

dotnet add package AffinidiTdk.WalletsClient

Check the latest version on nuget.org or view the source on GitHub.

Classes and Methods

Wallet API

Used to manage digital wallets for issuing credentials.

CreateWallet

Create a wallet by type.

Parameters

CreateWalletInput Object Required
JSON object to provide details for the wallet to create.

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 Required
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 Required
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.

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 Required
ID of the Wallet used for signing the credential.
SignCredentialInputDto Object Required
JSON object to provide the credential data to sign.

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 Required
ID of the Wallet used for signing the JWT.
SignCredentialInputDto Object Required
JSON object to provide the JWT data to sign.

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 Required
ID of the Wallet to update.
UpdateWalletInput Object Required
JSON object to provide details for the wallet to update.

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 Required
ID of the Wallet to add a key to.
CreateWalletKeyInput Object Required
JSON object to provide the key type and verification relationships.

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

{ KeyType = “ed25519”, Relationships = new List { 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 Required
ID of the Wallet.
**Example** ```cs 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 Required
ID of the Wallet.
keyId String Required
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 Required
ID of the Wallet.
keyId String Required
Wallet-scoped key identifier to update.
UpdateWalletKeyInput Object Required
JSON object to provide the updated verification relationships.

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 Required
ID of the Wallet.
ServiceEndpointInput Object Required
JSON object to provide the service endpoint details.

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 Required
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 Required
ID of the Wallet.
serviceId String Required
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 Required
ID of the Wallet.
serviceId String Required
ID of the service endpoint to update.
UpdateServiceEndpointInput Object Required
JSON object to provide the updated service endpoint details.

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