Skip to content

Commit

Permalink
Merge branch 'master' into DCKW-775-SDK-developer-only-has-to-provide…
Browse files Browse the repository at this point in the history
…-a-single-cloud-wallet-key
  • Loading branch information
gasher authored Mar 4, 2025
2 parents 4adf558 + 477d4a7 commit 0d3af8a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/cloud-wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,33 @@ const document = {
await wallet.addDocument(document);
```

### Issuing Credentials to Cloud Wallet

You can issue credentials directly to a cloud wallet using the Truvera Workspace/API. The credential will be automatically distributed to the holder's cloud wallet through the DIDComm protocol, eliminating the need for direct API calls or manual credential handling.

#### Important Requirement

For the DIDComm automatic distribution to work properly, the **subject ID of the credential must be set to the holder's DID** when issuing the credential. This enables the system to route the credential to the correct wallet.

#### Receiving Credentials in Cloud Wallet

After a credential has been issued to a holder's DID, the cloud wallet only needs to fetch and process DIDComm messages to receive it:

```ts
import {createDIDProvider} from '@docknetwork/wallet-sdk-core/lib/did-provider';
import {createMessageProvider} from '@docknetwork/wallet-sdk-core/lib/message-provider';

const didProvider = createDIDProvider({ wallet });

const messageProvider = createMessageProvider({
wallet,
didProvider,
});

// This will process the messages for all the DIDs in the wallet
await messageProvider.fetchMessages();
await messageProvider.processDIDCommMessages();
```

### Full Example

Expand Down

0 comments on commit 0d3af8a

Please sign in to comment.