From c0c9eec612eb443b865798275c62c2520d155204 Mon Sep 17 00:00:00 2001 From: Maycon Date: Fri, 3 Oct 2025 11:36:49 -0300 Subject: [PATCH 01/12] fixing knowladge base docs integration --- .github/workflows/docs-push.yml | 19 +-- ...allet.md => cloud-wallet-documentation.md} | 0 docs/getting-started/README.md | 121 ++++++++++++++++++ docs/index.md | 3 +- docs/wallet-SDK-intro.md | 86 +++++++++++++ integration-tests/helpers/wallet-helpers.ts | 2 +- integration-tests/message-provider.test.ts | 67 +++++++++- 7 files changed, 283 insertions(+), 15 deletions(-) rename docs/{cloud-wallet.md => cloud-wallet-documentation.md} (100%) create mode 100644 docs/getting-started/README.md create mode 100644 docs/wallet-SDK-intro.md diff --git a/.github/workflows/docs-push.yml b/.github/workflows/docs-push.yml index b56a3639..2b00031a 100644 --- a/.github/workflows/docs-push.yml +++ b/.github/workflows/docs-push.yml @@ -1,11 +1,11 @@ name: Push docs to knowledgebase -on: - push: - branches: master - paths: - - "docs/**" - - ".github/workflows/docs-push.yml" - - "README.md" +on: [push] + # push: + # branches: master + # paths: + # - "docs/**" + # - ".github/workflows/docs-push.yml" + # - "README.md" jobs: Copy-docs: @@ -34,8 +34,9 @@ jobs: - name: Copy files run: | # Specify the files or directories you want to copy - cp -r docs/* knowledge-base/developer-documentation/wallet-sdk/ - cp README.md knowledge-base/developer-documentation/wallet-sdk/README.md + rm -rf credential-wallet/wallet-sdk + cp -r docs/* credential-wallet/wallet-sdk + cp README.md credential-wallet/wallet-sdk/README.md - name: Get branch name id: get_branch diff --git a/docs/cloud-wallet.md b/docs/cloud-wallet-documentation.md similarity index 100% rename from docs/cloud-wallet.md rename to docs/cloud-wallet-documentation.md diff --git a/docs/getting-started/README.md b/docs/getting-started/README.md new file mode 100644 index 00000000..7382f14d --- /dev/null +++ b/docs/getting-started/README.md @@ -0,0 +1,121 @@ +# Getting Started + +This guide walks you through the process of setting up the Dock Wallet SDK, creating a wallet, managing decentralized identifiers (DIDs), adding credentials, and verifying them. + +## Installation + +To start, you need to install the necessary packages for the wallet SDK and the data store. Open your terminal and run the following command: + +```bash +yarn add @docknetwork/wallet-sdk-core @docknetwork/wallet-sdk-data-store-typeorm +``` + +The `@docknetwork/wallet-sdk-core` provides the core wallet functionality, while `@docknetwork/wallet-sdk-data-store-typeorm` handles data persistence using a local SQLite database. + +## Usage Example + +### 1. Initialize the Data Store + +Before creating a wallet, you need to set up a data store to manage the persistence of wallet data such as DIDs and credentials. Here’s how to create a data store: + +```ts +import {createDataStore} from '@docknetwork/wallet-sdk-data-store-typeorm/lib'; + +const dataStore = await createDataStore({ + databasePath: 'dock-wallet', + dbType: 'sqlite', + defaultNetwork: 'testnet', +}); +``` + +This code initializes a SQLite database to store wallet data. You can adjust the `databasePath` and `defaultNetwork` based on your needs. + +If you want to use the cloud wallet solution, please refer to the [Cloud Wallet Documentation](../cloud-wallet.md) for detailed instructions and configuration options. + +### 2. Create a New Wallet + +Once the data store is set up, you can create a wallet. The wallet will act as a container for managing your documents, DIDs, and credentials. + +```ts +import {createWallet} from '@docknetwork/wallet-sdk-core/lib/wallet'; + +const wallet = await createWallet({ + dataStore, +}); +``` + +This creates a new wallet instance that links to the previously created data store. + +### 3. Fetch your DIDs + +DIDs (Decentralized Identifiers) are a key part of self-sovereign identity. When a wallet is created, a default DID is automatically generated. You can retrieve and view the default DID associated with your wallet using the following code: + +```ts +// The didProvider is used to manage DIDs +import {createDIDProvider} from '@docknetwork/wallet-sdk-core/src/did-provider'; + +const didProvider = createDIDProvider({wallet}); +const defaultDID = await didProvider.getDefaultDID(); + +console.log(defaultDID); + +// Example output: did:key:z6MkrcDhePAr5J44Htf6CLSQpZFUGGec4kPVVmERaY9Seijw +``` + +### 4. Add a Credential to the Wallet + +Once you have a wallet and a DID, you can start managing credentials. In this example, you will import a credential from a URL into the wallet. + +```ts +import {createCredentialProvider} from '@docknetwork/wallet-sdk-core/src/credential-provider'; + +const credentialProvider = createCredentialProvider({ + wallet, // Pass the wallet instance +}); + +await credentialProvider.importCredentialFromURI({ + uri: 'https://creds-testnet.dock.io/8489dc69b69a70c97646ad9b4f256acaddb57762b5a6f661f0c9dae3b7f72ea6', // Credential URL + getAuthCode: async () => { + // You can implement your own UI to get the password + // For this example it will be hardcoded + return 'test'; + }, +}); + +const credentials = await credentialProvider.getCredentials(); // Retrieve all imported credentials + +console.log(credentials); +``` + +In this example, the credential is fetched from a specified URI and imported into the wallet. The `getAuthCode` function is used to handle any authentication, such as providing a password if required. + +### 5. Verify a Credential + +The Dock Wallet SDK provides built-in functionality for verifying credentials. This is especially useful when interacting with third parties who need to verify your credentials. The verification controller manages this process. Below is an example of how to start a verification, select which credentials to reveal, create a presentation, and submit it for verification. + +```ts +const { + createVerificationController, +} = require('@docknetwork/wallet-sdk-core/src/verification-controller'); + +const controller = createVerificationController({ + wallet, // Your wallet instance +}); + +await controller.start({ + template: 'https://creds-testnet.dock.io/proof/1fd8c457-f805-4117-9469-67b3e8c70fff', // Proof request template from the verifier +}); + +controller.selectedCredentials.set(credential.id, { + credential: credential, // Specify the credential you want to present + attributesToReveal: ['credentialSubject.name'] // Choose which attributes to reveal +}); + +const presentation = await controller.createPresentation(); // Create a presentation based on the selected credentials + +const verificationResponse = await controller.submitPresentation(presentation); // Submit the presentation for verification + +console.log(verificationResponse); +``` + +In this example, the verification process starts by fetching a proof request template. After selecting the credentials and specifying which attributes to reveal, the wallet creates a verifiable presentation. The presentation is then submitted, and the verifier responds with a verification result. \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 0cbd74be..2b46b66a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,3 +1,4 @@ # Truvera Wallet SDK Documentation -- [@docknetwork/wallet-sdk-core](./api/core.md) \ No newline at end of file +- [@docknetwork/wallet-sdk-core](./api/core.md) +- [@docknetwork/wallet-sdk-wasm](./api/wasm.md) diff --git a/docs/wallet-SDK-intro.md b/docs/wallet-SDK-intro.md new file mode 100644 index 00000000..40903d3f --- /dev/null +++ b/docs/wallet-SDK-intro.md @@ -0,0 +1,86 @@ +# Truvera Wallet SDK + +The [Wallet SDK](https://github.com/docknetwork/wallet-sdk) enables you to build a Verifiable Credentials wallet inside your app and allows your users to receive, store, and manage their DOCK tokens too. This was built for mobile applications with added support for Polkadot-JS. + +To use the wallet-sdk, all you need to do is wrap your app in a `WalletSDKProvider` and start building your wallet. + +Using [polkadot-js](https://polkadot.js.org/) libraries in React Native is a challenge, due to the lack of WebAssembly support. +The Truvera Wallet SDK handles all the Polkadot Web Assembly in a WebView, sending messages to the React Native thread through a JSON RPC layer. + +Truvera Mobile SDK supports: +- Devices that have Android 8.1 or higher and iOS 11 or higher. +- Minimum supported version of Node.js is 20.2.0 + +## Installation +```js +yarn add @docknetwork/wallet-sdk-core +yarn add @docknetwork/wallet-sdk-react-native + +``` +**There are some scripts and additional dependencies required.** +Please check our [examples](/examples) folder for detailed steps. + +## React Native Example +The following example will create a wallet and allow the user to add credentials to it. Displaying the count of documents added to the wallet. +Notice that the all documents are accessible through the `documents` object. + +```js +import {Box, Button, NativeBaseProvider, Text} from 'native-base'; +import React, {useEffect} from 'react'; +import { + WalletSDKProvider, + useWallet, +} from '@docknetwork/wallet-sdk-react-native/lib'; + +const WalletDetails = function () { + const {wallet, status, documents} = useWallet(); + + return ( + + Wallet status: {status} + Wallet docs: {documents.length} + + + ); +}; + +const App = () => { + return ( + + + + Dock Wallet SDK Demo + Press on `add credential` button to create a new credential + + + + + ); +}; + +export default App; + +``` + +## Running on other platforms + +Check the following repository for detailed examples for running the Truvera Wallet SDK on NodeJS, Web, and Flutter. + +[See the examples](https://github.com/docknetwork/wallet-sdk/tree/master/examples) + + +## Docs + +For more details you can check the [getting started guide](https://github.com/docknetwork/wallet-sdk/blob/master/docs/getting-started.md) + +[See the Github repository](https://docknetwork.github.io/wallet-sdk/) + +## Features +- [Biometric Plugin](https://github.com/docknetwork/wallet-sdk/blob/master/docs/biometric-plugin.md) +- [Ecosystem Tools](https://github.com/docknetwork/wallet-sdk/blob/master/docs/ecosystem-tools.md) +- [Cloud Wallet](https://github.com/docknetwork/wallet-sdk/blob/master/docs/cloud-wallet.md) \ No newline at end of file diff --git a/integration-tests/helpers/wallet-helpers.ts b/integration-tests/helpers/wallet-helpers.ts index ef0339fa..e733815d 100644 --- a/integration-tests/helpers/wallet-helpers.ts +++ b/integration-tests/helpers/wallet-helpers.ts @@ -44,7 +44,7 @@ export async function createNewWallet({ dataStore = await createDataStore({ databasePath: ':memory:', dbType: 'sqlite', - defaultNetwork: 'testnet', + defaultNetwork: 'mainnet', }); } diff --git a/integration-tests/message-provider.test.ts b/integration-tests/message-provider.test.ts index 93056819..7b9a25ed 100644 --- a/integration-tests/message-provider.test.ts +++ b/integration-tests/message-provider.test.ts @@ -20,12 +20,71 @@ describe('Credential Distribution', () => { const result = await getMessageProvider().sendMessage({ from: currentDID, - to: 'did:cheqd:testnet:c0890f1c-c7bb-4ea6-be7a-8c31404743b7', + // to: 'did:key:z6MkspAWGxhkyiMegReJuAMhCm2KxqRFg6Kfy5rFeKapT2M5', + to: 'did:key:z6Mks5pBCgytRnjrnzJt8Dfw9KtmhiBKRpZAbfgKsx4XGJvi', body: { - messageID: '123', - response: 'yes', + credentials: [ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://ld.truvera.io/credentials/extensions-v1", + "https://ld.truvera.io/security/bbs23/v1", + { + "BasicCredential": "dk:BasicCredential", + "dk": "https://ld.truvera.io/credentials#" + } + ], + "credentialStatus": { + "id": "accumulator:cheqd:mainnet:a29e4452-02b3-4f9b-b778-d0145e3d16c7:faff0ab1-9a8f-4cc0-a77b-08e09e767d99", + "type": "DockVBAccumulator2022", + "revocationCheck": "membership", + "revocationId": "1" + }, + "id": "https://creds.truvera.io/454936ca6be64f86abc6ec5aefa0fa98255eb1da71cb73355fa34dd55076ffaa", + "type": [ + "VerifiableCredential", + "BasicCredential" + ], + "credentialSubject": { + "id": "test", + "name": "testmainnet" + }, + "issuanceDate": "2025-09-19T11:37:04.222Z", + "issuer": { + "name": "test-cheqd", + "id": "did:cheqd:mainnet:a29e4452-02b3-4f9b-b778-d0145e3d16c7" + }, + "credentialSchema": { + "id": "https://schema.truvera.io/BasicCredential-V2-1703777584571.json", + "type": "JsonSchemaValidator2018", + "details": "{\"jsonSchema\":{\"$id\":\"https://schema.truvera.io/BasicCredential-V2-1703777584571.json\",\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"additionalProperties\":true,\"description\":\"A representation of a very basic example credential\",\"name\":\"Basic Credential\",\"properties\":{\"@context\":{\"type\":\"string\"},\"credentialSchema\":{\"properties\":{\"details\":{\"type\":\"string\"},\"id\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"},\"version\":{\"type\":\"string\"}},\"type\":\"object\"},\"credentialStatus\":{\"properties\":{\"id\":{\"type\":\"string\"},\"revocationCheck\":{\"type\":\"string\"},\"revocationId\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"}},\"type\":\"object\"},\"credentialSubject\":{\"properties\":{\"id\":{\"description\":\"A unique identifier of the recipient. Example: DID, email address, national ID number, employee ID, student ID etc.\",\"title\":\"Subject ID\",\"type\":\"string\"},\"name\":{\"description\":\"The name of the credential holder.\",\"title\":\"Subject Name\",\"type\":\"string\"}},\"required\":[\"name\"],\"type\":\"object\"},\"cryptoVersion\":{\"type\":\"string\"},\"id\":{\"type\":\"string\"},\"issuanceDate\":{\"format\":\"date-time\",\"type\":\"string\"},\"issuer\":{\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"}},\"type\":\"object\"},\"name\":{\"type\":\"string\"},\"proof\":{\"properties\":{\"@context\":{\"items\":[{\"properties\":{\"proof\":{\"properties\":{\"@container\":{\"type\":\"string\"},\"@id\":{\"type\":\"string\"},\"@type\":{\"type\":\"string\"}},\"type\":\"object\"},\"sec\":{\"type\":\"string\"}},\"type\":\"object\"},{\"type\":\"string\"}],\"type\":\"array\"},\"created\":{\"format\":\"date-time\",\"type\":\"string\"},\"proofPurpose\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"},\"verificationMethod\":{\"type\":\"string\"}},\"type\":\"object\"},\"type\":{\"type\":\"string\"}},\"type\":\"object\"},\"parsingOptions\":{\"defaultDecimalPlaces\":4,\"defaultMinimumDate\":-17592186044415,\"defaultMinimumInteger\":-4294967295,\"useDefaults\":true}}", + "version": "0.4.0" + }, + "name": "mainnet", + "cryptoVersion": "0.6.0", + "proof": { + "@context": [ + { + "sec": "https://w3id.org/security#", + "proof": { + "@id": "sec:proof", + "@type": "@id", + "@container": "@graph" + } + }, + "https://ld.truvera.io/security/bbs23/v1" + ], + "type": "Bls12381BBSSignatureDock2023", + "created": "2025-09-19T11:37:37Z", + "verificationMethod": "did:cheqd:mainnet:a29e4452-02b3-4f9b-b778-d0145e3d16c7#keys-2", + "proofPurpose": "assertionMethod", + "proofValue": "z2TUekhmP8o7WwGLDckzTBvutUrdhXVCvx6UpVD3gdRzgBHsDadgU65EgJ3jN6zrWpzmb7YYmsDi514TBneTNAvoTKNUo8UezH25odBomyVrQLt" + }, + "$$accum__witness$$": "{\"blockNo\":\"af8515d8-0dc2-4fa6-ba35-38ea0f918e32\",\"witness\":\"0x8ea1988551f88656083cbcc58f96819e1cef4b49cdbce7e21094689c47256009435a466ab46e09c0863d88ef5f4a77b6\"}" + }, + ] }, - type: 'https://schema.truvera.io/yes-no-response-V1.json', + type: 'https://mattr.global/schemas/verifiable-credential/offer/Direct', }); expect(result.success).toBe(true); From 606d4a8ff5aec7eaa811100c0732b57a0df4b767 Mon Sep 17 00:00:00 2001 From: Maycon Date: Fri, 3 Oct 2025 11:40:57 -0300 Subject: [PATCH 02/12] fixing knowladge base docs integration --- .github/workflows/docs-push.yml | 6 +- integration-tests/helpers/wallet-helpers.ts | 2 +- integration-tests/message-provider.test.ts | 67 ++------------------- 3 files changed, 8 insertions(+), 67 deletions(-) diff --git a/.github/workflows/docs-push.yml b/.github/workflows/docs-push.yml index 2b00031a..56c6bc26 100644 --- a/.github/workflows/docs-push.yml +++ b/.github/workflows/docs-push.yml @@ -34,9 +34,9 @@ jobs: - name: Copy files run: | # Specify the files or directories you want to copy - rm -rf credential-wallet/wallet-sdk - cp -r docs/* credential-wallet/wallet-sdk - cp README.md credential-wallet/wallet-sdk/README.md + rm -rf knowledge-base/credential-wallet/wallet-sdk + cp -r docs/* knowledge-base/credential-wallet/wallet-sdk + cp README.md knowledge-base/credential-wallet/wallet-sdk/README.md - name: Get branch name id: get_branch diff --git a/integration-tests/helpers/wallet-helpers.ts b/integration-tests/helpers/wallet-helpers.ts index e733815d..ef0339fa 100644 --- a/integration-tests/helpers/wallet-helpers.ts +++ b/integration-tests/helpers/wallet-helpers.ts @@ -44,7 +44,7 @@ export async function createNewWallet({ dataStore = await createDataStore({ databasePath: ':memory:', dbType: 'sqlite', - defaultNetwork: 'mainnet', + defaultNetwork: 'testnet', }); } diff --git a/integration-tests/message-provider.test.ts b/integration-tests/message-provider.test.ts index 7b9a25ed..93056819 100644 --- a/integration-tests/message-provider.test.ts +++ b/integration-tests/message-provider.test.ts @@ -20,71 +20,12 @@ describe('Credential Distribution', () => { const result = await getMessageProvider().sendMessage({ from: currentDID, - // to: 'did:key:z6MkspAWGxhkyiMegReJuAMhCm2KxqRFg6Kfy5rFeKapT2M5', - to: 'did:key:z6Mks5pBCgytRnjrnzJt8Dfw9KtmhiBKRpZAbfgKsx4XGJvi', + to: 'did:cheqd:testnet:c0890f1c-c7bb-4ea6-be7a-8c31404743b7', body: { - credentials: [ - { - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://ld.truvera.io/credentials/extensions-v1", - "https://ld.truvera.io/security/bbs23/v1", - { - "BasicCredential": "dk:BasicCredential", - "dk": "https://ld.truvera.io/credentials#" - } - ], - "credentialStatus": { - "id": "accumulator:cheqd:mainnet:a29e4452-02b3-4f9b-b778-d0145e3d16c7:faff0ab1-9a8f-4cc0-a77b-08e09e767d99", - "type": "DockVBAccumulator2022", - "revocationCheck": "membership", - "revocationId": "1" - }, - "id": "https://creds.truvera.io/454936ca6be64f86abc6ec5aefa0fa98255eb1da71cb73355fa34dd55076ffaa", - "type": [ - "VerifiableCredential", - "BasicCredential" - ], - "credentialSubject": { - "id": "test", - "name": "testmainnet" - }, - "issuanceDate": "2025-09-19T11:37:04.222Z", - "issuer": { - "name": "test-cheqd", - "id": "did:cheqd:mainnet:a29e4452-02b3-4f9b-b778-d0145e3d16c7" - }, - "credentialSchema": { - "id": "https://schema.truvera.io/BasicCredential-V2-1703777584571.json", - "type": "JsonSchemaValidator2018", - "details": "{\"jsonSchema\":{\"$id\":\"https://schema.truvera.io/BasicCredential-V2-1703777584571.json\",\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"additionalProperties\":true,\"description\":\"A representation of a very basic example credential\",\"name\":\"Basic Credential\",\"properties\":{\"@context\":{\"type\":\"string\"},\"credentialSchema\":{\"properties\":{\"details\":{\"type\":\"string\"},\"id\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"},\"version\":{\"type\":\"string\"}},\"type\":\"object\"},\"credentialStatus\":{\"properties\":{\"id\":{\"type\":\"string\"},\"revocationCheck\":{\"type\":\"string\"},\"revocationId\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"}},\"type\":\"object\"},\"credentialSubject\":{\"properties\":{\"id\":{\"description\":\"A unique identifier of the recipient. Example: DID, email address, national ID number, employee ID, student ID etc.\",\"title\":\"Subject ID\",\"type\":\"string\"},\"name\":{\"description\":\"The name of the credential holder.\",\"title\":\"Subject Name\",\"type\":\"string\"}},\"required\":[\"name\"],\"type\":\"object\"},\"cryptoVersion\":{\"type\":\"string\"},\"id\":{\"type\":\"string\"},\"issuanceDate\":{\"format\":\"date-time\",\"type\":\"string\"},\"issuer\":{\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"}},\"type\":\"object\"},\"name\":{\"type\":\"string\"},\"proof\":{\"properties\":{\"@context\":{\"items\":[{\"properties\":{\"proof\":{\"properties\":{\"@container\":{\"type\":\"string\"},\"@id\":{\"type\":\"string\"},\"@type\":{\"type\":\"string\"}},\"type\":\"object\"},\"sec\":{\"type\":\"string\"}},\"type\":\"object\"},{\"type\":\"string\"}],\"type\":\"array\"},\"created\":{\"format\":\"date-time\",\"type\":\"string\"},\"proofPurpose\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"},\"verificationMethod\":{\"type\":\"string\"}},\"type\":\"object\"},\"type\":{\"type\":\"string\"}},\"type\":\"object\"},\"parsingOptions\":{\"defaultDecimalPlaces\":4,\"defaultMinimumDate\":-17592186044415,\"defaultMinimumInteger\":-4294967295,\"useDefaults\":true}}", - "version": "0.4.0" - }, - "name": "mainnet", - "cryptoVersion": "0.6.0", - "proof": { - "@context": [ - { - "sec": "https://w3id.org/security#", - "proof": { - "@id": "sec:proof", - "@type": "@id", - "@container": "@graph" - } - }, - "https://ld.truvera.io/security/bbs23/v1" - ], - "type": "Bls12381BBSSignatureDock2023", - "created": "2025-09-19T11:37:37Z", - "verificationMethod": "did:cheqd:mainnet:a29e4452-02b3-4f9b-b778-d0145e3d16c7#keys-2", - "proofPurpose": "assertionMethod", - "proofValue": "z2TUekhmP8o7WwGLDckzTBvutUrdhXVCvx6UpVD3gdRzgBHsDadgU65EgJ3jN6zrWpzmb7YYmsDi514TBneTNAvoTKNUo8UezH25odBomyVrQLt" - }, - "$$accum__witness$$": "{\"blockNo\":\"af8515d8-0dc2-4fa6-ba35-38ea0f918e32\",\"witness\":\"0x8ea1988551f88656083cbcc58f96819e1cef4b49cdbce7e21094689c47256009435a466ab46e09c0863d88ef5f4a77b6\"}" - }, - ] + messageID: '123', + response: 'yes', }, - type: 'https://mattr.global/schemas/verifiable-credential/offer/Direct', + type: 'https://schema.truvera.io/yes-no-response-V1.json', }); expect(result.success).toBe(true); From 80b87c236b069afe7650647672aa80b05db8655b Mon Sep 17 00:00:00 2001 From: Maycon Date: Fri, 3 Oct 2025 11:44:49 -0300 Subject: [PATCH 03/12] fixing knowladge base docs integration --- .github/workflows/docs-push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docs-push.yml b/.github/workflows/docs-push.yml index 56c6bc26..632f3b41 100644 --- a/.github/workflows/docs-push.yml +++ b/.github/workflows/docs-push.yml @@ -34,6 +34,7 @@ jobs: - name: Copy files run: | # Specify the files or directories you want to copy + ls ./ rm -rf knowledge-base/credential-wallet/wallet-sdk cp -r docs/* knowledge-base/credential-wallet/wallet-sdk cp README.md knowledge-base/credential-wallet/wallet-sdk/README.md From 04f8be4250aad8f989ded1d5f61fae53b28ebb6b Mon Sep 17 00:00:00 2001 From: Maycon Date: Fri, 3 Oct 2025 11:48:21 -0300 Subject: [PATCH 04/12] fixing knowladge base docs integration --- .github/workflows/docs-push.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docs-push.yml b/.github/workflows/docs-push.yml index 632f3b41..48f69aa1 100644 --- a/.github/workflows/docs-push.yml +++ b/.github/workflows/docs-push.yml @@ -34,10 +34,10 @@ jobs: - name: Copy files run: | # Specify the files or directories you want to copy - ls ./ - rm -rf knowledge-base/credential-wallet/wallet-sdk - cp -r docs/* knowledge-base/credential-wallet/wallet-sdk - cp README.md knowledge-base/credential-wallet/wallet-sdk/README.md + ls ./knowledge-base + rm -rf ./knowledge-base/credential-wallet/wallet-sdk + cp -r docs/* ./knowledge-base/credential-wallet/wallet-sdk + cp README.md ./knowledge-base/credential-wallet/wallet-sdk/README.md - name: Get branch name id: get_branch From 5a0d51ec619ad2426131822f3e193feffe7b095a Mon Sep 17 00:00:00 2001 From: Maycon Date: Fri, 3 Oct 2025 15:32:28 -0300 Subject: [PATCH 05/12] fixing knowledge base docs integration --- .github/workflows/docs-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-push.yml b/.github/workflows/docs-push.yml index 48f69aa1..5956c843 100644 --- a/.github/workflows/docs-push.yml +++ b/.github/workflows/docs-push.yml @@ -34,7 +34,7 @@ jobs: - name: Copy files run: | # Specify the files or directories you want to copy - ls ./knowledge-base + ls ./knowledge-base/credential-wallet rm -rf ./knowledge-base/credential-wallet/wallet-sdk cp -r docs/* ./knowledge-base/credential-wallet/wallet-sdk cp README.md ./knowledge-base/credential-wallet/wallet-sdk/README.md From eeb93e5f4070d77131e41828449826b4cf8af434 Mon Sep 17 00:00:00 2001 From: Maycon Date: Fri, 3 Oct 2025 15:40:43 -0300 Subject: [PATCH 06/12] fixing knowledge base docs integration --- .github/workflows/docs-push.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs-push.yml b/.github/workflows/docs-push.yml index 5956c843..97d3ea61 100644 --- a/.github/workflows/docs-push.yml +++ b/.github/workflows/docs-push.yml @@ -34,10 +34,9 @@ jobs: - name: Copy files run: | # Specify the files or directories you want to copy - ls ./knowledge-base/credential-wallet rm -rf ./knowledge-base/credential-wallet/wallet-sdk - cp -r docs/* ./knowledge-base/credential-wallet/wallet-sdk - cp README.md ./knowledge-base/credential-wallet/wallet-sdk/README.md + rsync -av docs/ ./knowledge-base/credential-wallet/wallet-sdk/ + rsync -av README.md ./knowledge-base/credential-wallet/wallet-sdk/README.md - name: Get branch name id: get_branch From 29d00f55c54170b02e470538a191fb258165027c Mon Sep 17 00:00:00 2001 From: Maycon Date: Tue, 7 Oct 2025 10:11:25 -0300 Subject: [PATCH 07/12] handle PR feedback --- .github/workflows/docs-push.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docs-push.yml b/.github/workflows/docs-push.yml index 97d3ea61..df496408 100644 --- a/.github/workflows/docs-push.yml +++ b/.github/workflows/docs-push.yml @@ -27,15 +27,14 @@ jobs: - name: Install dependencies run: npm ci - - name: Generate docs + - name: Generate API docs run: | npm run docs - name: Copy files run: | - # Specify the files or directories you want to copy - rm -rf ./knowledge-base/credential-wallet/wallet-sdk - rsync -av docs/ ./knowledge-base/credential-wallet/wallet-sdk/ + # Sync docs and README to knowledgebase + rsync -av --delete docs/ ./knowledge-base/credential-wallet/wallet-sdk/ rsync -av README.md ./knowledge-base/credential-wallet/wallet-sdk/README.md - name: Get branch name From 5341c849462f6bb296747072f258091b44d5f06a Mon Sep 17 00:00:00 2001 From: Maycon Date: Tue, 7 Oct 2025 10:13:07 -0300 Subject: [PATCH 08/12] handle PR feedback --- docs/{cloud-wallet-documentation.md => cloud-wallet.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/{cloud-wallet-documentation.md => cloud-wallet.md} (100%) diff --git a/docs/cloud-wallet-documentation.md b/docs/cloud-wallet.md similarity index 100% rename from docs/cloud-wallet-documentation.md rename to docs/cloud-wallet.md From cf88f4cebca49d667f26229f9ed3e9f5a6616d90 Mon Sep 17 00:00:00 2001 From: Maycon Date: Tue, 7 Oct 2025 10:15:03 -0300 Subject: [PATCH 09/12] handle PR feedback --- docs/getting-started/README.md | 121 --------------------------------- 1 file changed, 121 deletions(-) delete mode 100644 docs/getting-started/README.md diff --git a/docs/getting-started/README.md b/docs/getting-started/README.md deleted file mode 100644 index 7382f14d..00000000 --- a/docs/getting-started/README.md +++ /dev/null @@ -1,121 +0,0 @@ -# Getting Started - -This guide walks you through the process of setting up the Dock Wallet SDK, creating a wallet, managing decentralized identifiers (DIDs), adding credentials, and verifying them. - -## Installation - -To start, you need to install the necessary packages for the wallet SDK and the data store. Open your terminal and run the following command: - -```bash -yarn add @docknetwork/wallet-sdk-core @docknetwork/wallet-sdk-data-store-typeorm -``` - -The `@docknetwork/wallet-sdk-core` provides the core wallet functionality, while `@docknetwork/wallet-sdk-data-store-typeorm` handles data persistence using a local SQLite database. - -## Usage Example - -### 1. Initialize the Data Store - -Before creating a wallet, you need to set up a data store to manage the persistence of wallet data such as DIDs and credentials. Here’s how to create a data store: - -```ts -import {createDataStore} from '@docknetwork/wallet-sdk-data-store-typeorm/lib'; - -const dataStore = await createDataStore({ - databasePath: 'dock-wallet', - dbType: 'sqlite', - defaultNetwork: 'testnet', -}); -``` - -This code initializes a SQLite database to store wallet data. You can adjust the `databasePath` and `defaultNetwork` based on your needs. - -If you want to use the cloud wallet solution, please refer to the [Cloud Wallet Documentation](../cloud-wallet.md) for detailed instructions and configuration options. - -### 2. Create a New Wallet - -Once the data store is set up, you can create a wallet. The wallet will act as a container for managing your documents, DIDs, and credentials. - -```ts -import {createWallet} from '@docknetwork/wallet-sdk-core/lib/wallet'; - -const wallet = await createWallet({ - dataStore, -}); -``` - -This creates a new wallet instance that links to the previously created data store. - -### 3. Fetch your DIDs - -DIDs (Decentralized Identifiers) are a key part of self-sovereign identity. When a wallet is created, a default DID is automatically generated. You can retrieve and view the default DID associated with your wallet using the following code: - -```ts -// The didProvider is used to manage DIDs -import {createDIDProvider} from '@docknetwork/wallet-sdk-core/src/did-provider'; - -const didProvider = createDIDProvider({wallet}); -const defaultDID = await didProvider.getDefaultDID(); - -console.log(defaultDID); - -// Example output: did:key:z6MkrcDhePAr5J44Htf6CLSQpZFUGGec4kPVVmERaY9Seijw -``` - -### 4. Add a Credential to the Wallet - -Once you have a wallet and a DID, you can start managing credentials. In this example, you will import a credential from a URL into the wallet. - -```ts -import {createCredentialProvider} from '@docknetwork/wallet-sdk-core/src/credential-provider'; - -const credentialProvider = createCredentialProvider({ - wallet, // Pass the wallet instance -}); - -await credentialProvider.importCredentialFromURI({ - uri: 'https://creds-testnet.dock.io/8489dc69b69a70c97646ad9b4f256acaddb57762b5a6f661f0c9dae3b7f72ea6', // Credential URL - getAuthCode: async () => { - // You can implement your own UI to get the password - // For this example it will be hardcoded - return 'test'; - }, -}); - -const credentials = await credentialProvider.getCredentials(); // Retrieve all imported credentials - -console.log(credentials); -``` - -In this example, the credential is fetched from a specified URI and imported into the wallet. The `getAuthCode` function is used to handle any authentication, such as providing a password if required. - -### 5. Verify a Credential - -The Dock Wallet SDK provides built-in functionality for verifying credentials. This is especially useful when interacting with third parties who need to verify your credentials. The verification controller manages this process. Below is an example of how to start a verification, select which credentials to reveal, create a presentation, and submit it for verification. - -```ts -const { - createVerificationController, -} = require('@docknetwork/wallet-sdk-core/src/verification-controller'); - -const controller = createVerificationController({ - wallet, // Your wallet instance -}); - -await controller.start({ - template: 'https://creds-testnet.dock.io/proof/1fd8c457-f805-4117-9469-67b3e8c70fff', // Proof request template from the verifier -}); - -controller.selectedCredentials.set(credential.id, { - credential: credential, // Specify the credential you want to present - attributesToReveal: ['credentialSubject.name'] // Choose which attributes to reveal -}); - -const presentation = await controller.createPresentation(); // Create a presentation based on the selected credentials - -const verificationResponse = await controller.submitPresentation(presentation); // Submit the presentation for verification - -console.log(verificationResponse); -``` - -In this example, the verification process starts by fetching a proof request template. After selecting the credentials and specifying which attributes to reveal, the wallet creates a verifiable presentation. The presentation is then submitted, and the verifier responds with a verification result. \ No newline at end of file From ca14166460c068778e4da7cf24e780b168d96349 Mon Sep 17 00:00:00 2001 From: Maycon Date: Tue, 7 Oct 2025 10:22:51 -0300 Subject: [PATCH 10/12] fixing knowladge base docs integration --- .github/workflows/docs-push.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docs-push.yml b/.github/workflows/docs-push.yml index df496408..4760ac25 100644 --- a/.github/workflows/docs-push.yml +++ b/.github/workflows/docs-push.yml @@ -1,11 +1,11 @@ name: Push docs to knowledgebase -on: [push] - # push: - # branches: master - # paths: - # - "docs/**" - # - ".github/workflows/docs-push.yml" - # - "README.md" +on: + push: + branches: master + paths: + - "docs/**" + - ".github/workflows/docs-push.yml" + - "README.md" jobs: Copy-docs: From df99a197df7b7e541379c2d8d9e47b55ba4664db Mon Sep 17 00:00:00 2001 From: Richard Esplin Date: Tue, 7 Oct 2025 22:14:46 -0600 Subject: [PATCH 11/12] Delete docs/wallet-SDK-intro.md This is a duplicate of the main wallet SDK README --- docs/wallet-SDK-intro.md | 86 ---------------------------------------- 1 file changed, 86 deletions(-) delete mode 100644 docs/wallet-SDK-intro.md diff --git a/docs/wallet-SDK-intro.md b/docs/wallet-SDK-intro.md deleted file mode 100644 index 40903d3f..00000000 --- a/docs/wallet-SDK-intro.md +++ /dev/null @@ -1,86 +0,0 @@ -# Truvera Wallet SDK - -The [Wallet SDK](https://github.com/docknetwork/wallet-sdk) enables you to build a Verifiable Credentials wallet inside your app and allows your users to receive, store, and manage their DOCK tokens too. This was built for mobile applications with added support for Polkadot-JS. - -To use the wallet-sdk, all you need to do is wrap your app in a `WalletSDKProvider` and start building your wallet. - -Using [polkadot-js](https://polkadot.js.org/) libraries in React Native is a challenge, due to the lack of WebAssembly support. -The Truvera Wallet SDK handles all the Polkadot Web Assembly in a WebView, sending messages to the React Native thread through a JSON RPC layer. - -Truvera Mobile SDK supports: -- Devices that have Android 8.1 or higher and iOS 11 or higher. -- Minimum supported version of Node.js is 20.2.0 - -## Installation -```js -yarn add @docknetwork/wallet-sdk-core -yarn add @docknetwork/wallet-sdk-react-native - -``` -**There are some scripts and additional dependencies required.** -Please check our [examples](/examples) folder for detailed steps. - -## React Native Example -The following example will create a wallet and allow the user to add credentials to it. Displaying the count of documents added to the wallet. -Notice that the all documents are accessible through the `documents` object. - -```js -import {Box, Button, NativeBaseProvider, Text} from 'native-base'; -import React, {useEffect} from 'react'; -import { - WalletSDKProvider, - useWallet, -} from '@docknetwork/wallet-sdk-react-native/lib'; - -const WalletDetails = function () { - const {wallet, status, documents} = useWallet(); - - return ( - - Wallet status: {status} - Wallet docs: {documents.length} - - - ); -}; - -const App = () => { - return ( - - - - Dock Wallet SDK Demo - Press on `add credential` button to create a new credential - - - - - ); -}; - -export default App; - -``` - -## Running on other platforms - -Check the following repository for detailed examples for running the Truvera Wallet SDK on NodeJS, Web, and Flutter. - -[See the examples](https://github.com/docknetwork/wallet-sdk/tree/master/examples) - - -## Docs - -For more details you can check the [getting started guide](https://github.com/docknetwork/wallet-sdk/blob/master/docs/getting-started.md) - -[See the Github repository](https://docknetwork.github.io/wallet-sdk/) - -## Features -- [Biometric Plugin](https://github.com/docknetwork/wallet-sdk/blob/master/docs/biometric-plugin.md) -- [Ecosystem Tools](https://github.com/docknetwork/wallet-sdk/blob/master/docs/ecosystem-tools.md) -- [Cloud Wallet](https://github.com/docknetwork/wallet-sdk/blob/master/docs/cloud-wallet.md) \ No newline at end of file From cc971d44ebd4b74134d115e59ba75182119cf6bb Mon Sep 17 00:00:00 2001 From: Richard Esplin Date: Tue, 7 Oct 2025 22:18:44 -0600 Subject: [PATCH 12/12] Update docs-push.yml Have rsync recursively copy --- .github/workflows/docs-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-push.yml b/.github/workflows/docs-push.yml index 4760ac25..f058d7b2 100644 --- a/.github/workflows/docs-push.yml +++ b/.github/workflows/docs-push.yml @@ -34,7 +34,7 @@ jobs: - name: Copy files run: | # Sync docs and README to knowledgebase - rsync -av --delete docs/ ./knowledge-base/credential-wallet/wallet-sdk/ + rsync -avr --delete docs/ ./knowledge-base/credential-wallet/wallet-sdk/ rsync -av README.md ./knowledge-base/credential-wallet/wallet-sdk/README.md - name: Get branch name