From 320e2a31a0e54518ac3fcdecfbc62ab8aba4c4cb Mon Sep 17 00:00:00 2001 From: AgneCaunt <139773510+AgneCaunt@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:20:57 +0200 Subject: [PATCH 1/2] Update cloud-wallet.md Adding the cloud wallet instruction changes that Richard did during the backlog sync --- docs/cloud-wallet.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/cloud-wallet.md b/docs/cloud-wallet.md index 3552890f..f9a6565a 100644 --- a/docs/cloud-wallet.md +++ b/docs/cloud-wallet.md @@ -12,9 +12,10 @@ The Cloud Wallet integrates with an [Encrypted Data Vault (EDV)](https://digital The example below demonstrates how to initialize and use the Cloud Wallet for managing documents. - ### Step 1: Initialize the Data Store +First, you need to create local data storage to connect to the credential wallet. + #### For Mobile and Node.js ```ts @@ -40,7 +41,7 @@ const dataStore = await createDataStore({ ### Step 2: Generate Wallet Keys -Use the same Cloud Wallet keys across multiple devices to access the same documents. These keys are used to encrypt, decrypt, and locate documents in the EDV. +Next, we generate keys for interacting with the cloud wallet. Use the same Cloud Wallet keys across multiple devices to access the same documents. These keys are used to encrypt, decrypt, and locate documents in the EDV. ```ts const {verificationKey, agreementKey, hmacKey} = await edvService.generateKeys(); @@ -52,7 +53,7 @@ The key generation returns an object with `agreementKey`, `verificationKey`, and ### Step 3: Initialize the Cloud Wallet -After setting up the data store and generating keys, initialize the Cloud Wallet. This ensures continuous synchronization between the EDV and the wallet. +After setting up the data store and generating keys, initialize the Cloud Wallet and connect it to the local data storage. This ensures continuous synchronization between the EDV and the wallet. ```ts import {initializeCloudWallet} from '@docknetwork/wallet-sdk-core/lib/cloud-wallet'; @@ -70,11 +71,11 @@ const {pullDocuments} = await initializeCloudWallet({ await pullDocuments(); ``` -The `pullDocuments` function synchronizes the EDV and the wallet by comparing documents and updating the data store accordingly. +The `pullDocuments` function synchronizes the EDV and the wallet by comparing documents and updating the data store accordingly.Documents can be credentials or messages. ### Step 4: Create a New Wallet -Now, create a wallet to manage your documents. This will allow you to add, update, and remove documents. +Now, create a credential wallet inside of the data storage. This will allow you to add, update, and remove documents. ```ts import {createWallet} from '@docknetwork/wallet-sdk-core/lib/wallet'; @@ -142,4 +143,4 @@ async function example() { example(); -``` \ No newline at end of file +``` From 139c45b2169f3376007473369417741770b427d6 Mon Sep 17 00:00:00 2001 From: Maycon Date: Mon, 2 Dec 2024 10:32:37 -0300 Subject: [PATCH 2/2] removing did format on pex filtering --- packages/wasm/src/services/pex/service.ts | 12 +++++++++--- .../wasm/src/services/pex/tests/pex-service.test.js | 6 ++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/wasm/src/services/pex/service.ts b/packages/wasm/src/services/pex/service.ts index cc3046b0..06ece731 100644 --- a/packages/wasm/src/services/pex/service.ts +++ b/packages/wasm/src/services/pex/service.ts @@ -30,13 +30,19 @@ export function removeOptionalAttribute(presentationDefinition) { field => field.optional !== true, ); - // Removes the optinal attributes from the fields - // It applies in case optional: false - // The field is required, but pex doesn't support the attribute + inputDescriptor.constraints.fields.forEach(field => { + // Removes the optinal attributes from the fields + // It applies in case optional: false + // The field is required, but pex doesn't support the attribute if (field.optional !== undefined) { delete field.optional; } + + // Remove the did format attribute, that is not support by pex + if(field?.filter?.format === 'did') { + delete field.filter.format; + } }); // There is a case where ALL fields are optional diff --git a/packages/wasm/src/services/pex/tests/pex-service.test.js b/packages/wasm/src/services/pex/tests/pex-service.test.js index 3c7f061e..dce63ca3 100644 --- a/packages/wasm/src/services/pex/tests/pex-service.test.js +++ b/packages/wasm/src/services/pex/tests/pex-service.test.js @@ -422,6 +422,9 @@ describe('Pex Examples', () => { fields: [ { path: ['$.credentialSubject.id'], + filter: { + format: 'did', + }, }, { path: ['$.type[*]'], @@ -441,6 +444,9 @@ describe('Pex Examples', () => { result = removeOptionalAttribute(template); expect(getFieldsWithOptionalAttributes(result)).toBe(0); expect(result.input_descriptors[0].constraints.fields.length).toBe(1); + expect( + result.input_descriptors[0].constraints.fields[0].filter.format, + ).toBeUndefined(); template = { id: 'income_test',