Skip to content

Commit

Permalink
Merge pull request #348 from docknetwork/chore/issue-directly-to-clou…
Browse files Browse the repository at this point in the history
…d-wallet-docs

Add issue directly to cloud wallet docs.
  • Loading branch information
gasher authored Mar 3, 2025
2 parents bea0bf9 + e35ca54 commit 477d4a7
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 @@ -99,6 +99,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 477d4a7

Please sign in to comment.