diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a2de986..e1704eb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.2] - 2024-02-01 +### Added +- `@rarimo/rarime`: + - Migration to a Compose DB model with increased Verifiable Credential size; + - Compose DB model preparation script; + ## [2.0.1] - 2024-01-24 ### Changed - `@rarimo/rarime-connector` - set strict snap version requirement @@ -150,8 +156,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Implemented `@rarimo/rarime-connector` and `@rarimo/rarime` packages -[Unreleased]: https://github.com/rarimo/rarime/compare/2.0.1...HEAD -[2.0.0]: https://github.com/rarimo/rarime/compare/2.0.0...2.0.1 +[Unreleased]: https://github.com/rarimo/rarime/compare/2.0.2...HEAD +[2.0.2]: https://github.com/rarimo/rarime/compare/2.0.1...2.0.2 +[2.0.1]: https://github.com/rarimo/rarime/compare/2.0.0...2.0.1 [2.0.0]: https://github.com/rarimo/rarime/compare/1.0.2...2.0.0 [1.0.2]: https://github.com/rarimo/rarime/compare/1.0.1...1.0.2 [1.0.1]: https://github.com/rarimo/rarime/compare/1.0.0...1.0.1 diff --git a/package.json b/package.json index 17564b03..bfdb59e4 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "@typescript-eslint/eslint-plugin": "5.33.0", "@typescript-eslint/parser": "5.33.0", "chalk": "4.1.2", + "dotenv": "^16.4.1", "eslint": "8.21.0", "eslint-config-prettier": "8.1.0", "eslint-plugin-import": "2.26.0", diff --git a/packages/connector/package.json b/packages/connector/package.json index 960a5dcc..2ab6080c 100644 --- a/packages/connector/package.json +++ b/packages/connector/package.json @@ -1,6 +1,6 @@ { "name": "@rarimo/rarime-connector", - "version": "2.0.1", + "version": "2.0.2", "description": "Facilitates interaction between a DApp and RariMe MetaMask snap", "repository": { "type": "git", diff --git a/packages/connector/src/version.json b/packages/connector/src/version.json index acbd75dd..911484db 100644 --- a/packages/connector/src/version.json +++ b/packages/connector/src/version.json @@ -1,3 +1,3 @@ { - "version": "2.0.1" + "version": "2.0.2" } diff --git a/packages/site/package.json b/packages/site/package.json index b3f2a4f5..77304e1f 100644 --- a/packages/site/package.json +++ b/packages/site/package.json @@ -1,6 +1,6 @@ { "name": "site", - "version": "2.0.1", + "version": "2.0.2", "private": true, "license": "(MIT-0 OR Apache-2.0)", "scripts": { diff --git a/packages/snap/.npmignore b/packages/snap/.npmignore new file mode 100644 index 00000000..38aacf11 --- /dev/null +++ b/packages/snap/.npmignore @@ -0,0 +1 @@ +ceramic-prepare-vc.mjs diff --git a/packages/snap/ceramic-prepare-vc.mjs b/packages/snap/ceramic-prepare-vc.mjs new file mode 100644 index 00000000..00b2108f --- /dev/null +++ b/packages/snap/ceramic-prepare-vc.mjs @@ -0,0 +1,70 @@ +/** + * @name ceramic-prepare-vc + * @description Create composite from graphql model, + * deploy and compile json files + * + * https://developers.ceramic.network/docs/composedb/create-your-composite + */ + +import path from 'path'; +import fs from 'fs'; + +import { fileURLToPath } from 'url'; +import npm from 'npm-commands'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +// http://0.0.0.0:7007 || https://ceramic.rarimo.com +const ceramicUrl = process.env.CERAMIC_URL; +const didPK = process.env.DID_PRIVATE_KEY + +// Directory path +const modelsDirPath = './ceramic/models'; + +// Reading directory contents +fs.readdir(modelsDirPath, async (err, files) => { + if (err) { + console.error('Error reading directory:', err); + return; + } + + for (const file of files) { + if (fs.statSync(path.join(modelsDirPath, file)).isFile()) { + console.log('\n\n==========================================================\n\n'); + console.log('PREPARE VC FOR:', file); + + const modelFile = path.join( + __dirname, + `./ceramic/models/${file}`, + ); + + const modelFileName = path.basename(`./ceramic/models/${modelFile}`, '.graphql'); + + const compositeOutput = path.join( + __dirname, + `./ceramic/composites/${modelFileName}.json`, + ); + + const runtimeOutput = path.join( + __dirname, + `./ceramic/composites/${modelFileName}-runtime.json`, + ); + + await npm().arguments({ + ['ceramic-url']: ceramicUrl, + ['output']: compositeOutput, + ['did-private-key']: didPK, + }).runAsync(`composedb composite:create ${modelFile}`); + + await npm().arguments({ + ['ceramic-url']: ceramicUrl, + ['did-private-key']: didPK, + }).runAsync(`composedb composite:deploy ${compositeOutput}`); + + await npm().arguments({ + ['ceramic-url']: ceramicUrl, + }).runAsync(`composedb composite:compile ${compositeOutput} ${runtimeOutput}`); + } + } +}); diff --git a/packages/snap/ceramic/composites/VerifiableCredentialsV2-runtime.json b/packages/snap/ceramic/composites/VerifiableCredentialsV2-runtime.json new file mode 100644 index 00000000..7ad0e6fc --- /dev/null +++ b/packages/snap/ceramic/composites/VerifiableCredentialsV2-runtime.json @@ -0,0 +1 @@ +{"models":{"VerifiableCredential":{"interface":false,"implements":[],"id":"kjzl6hvfrbw6c5j1vrqei8a3h06om20x4qj8fj84ku46oew5b0yv9h6gyzwd2t4","accountRelation":{"type":"list"}}},"objects":{"VerifiableCredential":{"data":{"type":"string","required":true},"claimId":{"type":"string","required":true,"indexed":true},"ownerDid":{"type":"string","required":true,"indexed":true},"queryHash":{"type":"string","required":true,"indexed":true}}},"enums":{},"accountData":{"verifiableCredentialList":{"type":"connection","name":"VerifiableCredential"}}} diff --git a/packages/snap/ceramic/composites/VerifiableCredentialsV2.json b/packages/snap/ceramic/composites/VerifiableCredentialsV2.json new file mode 100644 index 00000000..ce853e84 --- /dev/null +++ b/packages/snap/ceramic/composites/VerifiableCredentialsV2.json @@ -0,0 +1 @@ +{"version":"1.1","models":{"kjzl6hvfrbw6c5j1vrqei8a3h06om20x4qj8fj84ku46oew5b0yv9h6gyzwd2t4":[{"jws":{"payload":"AXESIJ3BF8Q_1bYO8VuaK8GI5BbkQmxJ73zD-xykLspGo9pz","signatures":[{"signature":"vIKvgfCZ3ZdZAiiZtbViRwtGhK4yniFhsf9lbxTyg1LTY6K7699bdieQoggcYTWs_KoP19xU95gy5JNu7yQOCg","protected":"eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDprZXk6ejZNa2o2Tmt2Q1I0R0ZGU0pwWkxkNnZZb2FZVlJGTWtIcW1oVGd5MUhuTDVQSjJiI3o2TWtqNk5rdkNSNEdGRlNKcFpMZDZ2WW9hWVZSRk1rSHFtaFRneTFIbkw1UEoyYiJ9"}],"link":"bafyreie5yel4ip6vwyhpcw42fpayrzaw4rbgysppptb7whfef3feni62om"},"linkedBlock":"omRkYXRhqWRuYW1ldFZlcmlmaWFibGVDcmVkZW50aWFsZXZpZXdzoGZzY2hlbWGlZHR5cGVmb2JqZWN0ZyRzY2hlbWF4LGh0dHBzOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LzIwMjAtMTIvc2NoZW1haHJlcXVpcmVkhGhvd25lckRpZGRkYXRhaXF1ZXJ5SGFzaGdjbGFpbUlkanByb3BlcnRpZXOkZGRhdGGiZHR5cGVmc3RyaW5naW1heExlbmd0aBoAD0JAZ2NsYWltSWSiZHR5cGVmc3RyaW5naW1heExlbmd0aBkH0Ghvd25lckRpZKJkdHlwZWZzdHJpbmdpbWF4TGVuZ3RoGQfQaXF1ZXJ5SGFzaKJkdHlwZWZzdHJpbmdpbWF4TGVuZ3RoGQfQdGFkZGl0aW9uYWxQcm9wZXJ0aWVz9Gd2ZXJzaW9uYzIuMGlpbnRlcmZhY2X0aXJlbGF0aW9uc6BqaW1wbGVtZW50c4BrZGVzY3JpcHRpb254NEEgbW9kZWwgZm9yIHN0b3JpbmcgZW5jcnlwdGVkIHZlcmlmaWFibGUgY3JlZGVudGlhbHNvYWNjb3VudFJlbGF0aW9uoWR0eXBlZGxpc3RmaGVhZGVyo2NzZXBlbW9kZWxlbW9kZWxSzgEEAXFxCwAJaG1vZGVsLXYxa2NvbnRyb2xsZXJzgXg4ZGlkOmtleTp6Nk1rajZOa3ZDUjRHRkZTSnBaTGQ2dllvYVlWUkZNa0hxbWhUZ3kxSG5MNVBKMmI="}]},"indices":{"kjzl6hvfrbw6c5j1vrqei8a3h06om20x4qj8fj84ku46oew5b0yv9h6gyzwd2t4":[{"fields":[{"path":["queryHash"]}]},{"fields":[{"path":["claimId"]}]},{"fields":[{"path":["ownerDid"]}]}]},"aliases":{"kjzl6hvfrbw6c5j1vrqei8a3h06om20x4qj8fj84ku46oew5b0yv9h6gyzwd2t4":"VerifiableCredential"},"views":{"account":{},"root":{},"models":{"kjzl6hvfrbw6c5j1vrqei8a3h06om20x4qj8fj84ku46oew5b0yv9h6gyzwd2t4":{}}},"commonEmbeds":[]} diff --git a/packages/snap/ceramic/models/VerifiableCredentialsV2.graphql b/packages/snap/ceramic/models/VerifiableCredentialsV2.graphql new file mode 100644 index 00000000..6db3ecf0 --- /dev/null +++ b/packages/snap/ceramic/models/VerifiableCredentialsV2.graphql @@ -0,0 +1,13 @@ +type VerifiableCredential @createModel( + description: "A model for storing encrypted verifiable credentials", + accountRelation: LIST +) +@createIndex(fields: [{ path: "queryHash" }]) +@createIndex(fields: [{ path: "claimId" }]) +@createIndex(fields: [{ path: "ownerDid" }]) +{ + ownerDid: String! @string(maxLength: 2000) + data: String! @string(maxLength: 1000000) + queryHash: String! @string(maxLength: 2000) + claimId: String! @string(maxLength: 2000) +} diff --git a/packages/snap/package.json b/packages/snap/package.json index 92651561..e2eab8d1 100644 --- a/packages/snap/package.json +++ b/packages/snap/package.json @@ -1,6 +1,6 @@ { "name": "@rarimo/rarime", - "version": "2.0.1", + "version": "2.0.2", "description": "RariMe is a MetaMask Snap that safely holds any of your credentials and allows you to prove your identity without revealing any personal data. Powered by Rarimo Protocol and Zero-Knowledge Proof technology.", "repository": { "type": "git", @@ -34,11 +34,9 @@ "generate-ether-types": "typechain --target=ethers-v5 'abis/**/*.json' --out-dir src/types/contracts", "prepublishOnly": "yarn && yarn build", "preversion": "yarn && yarn build && git add snap.manifest.json", - "ceramic:create-vc": "composedb composite:create ./ceramic/models/VerifiableCredentials.graphql --ceramic-url=$CERAMIC_URL --output=./ceramic/composites/VerifiableCredentials.json --did-private-key=$DID_PRIVATE_KEY", - "ceramic:deploy-vc": "composedb composite:deploy ./ceramic/composites/VerifiableCredentials.json --ceramic-url=$CERAMIC_URL --did-private-key=$DID_PRIVATE_KEY", - "ceramic:compile-vc": "composedb composite:compile ./ceramic/composites/VerifiableCredentials.json --ceramic-url=$CERAMIC_URL ./ceramic/composites/VerifiableCredentials-runtime.json", - "ceramic:prepare-vc": "yarn ceramic:create-vc && yarn ceramic:deploy-vc && yarn ceramic:compile-vc", - "ceramic:graphql-server": "composedb graphql:server --ceramic-url=$CERAMIC_URL --graphiql ./ceramic/composites/VerifiableCredentials-runtime.json --did-private-key=$DID_PRIVATE_KEY --port=5005", + "composedb": "composedb", + "ceramic:prepare-vc": "node ceramic-prepare-vc.mjs", + "ceramic:graphql-server": "composedb graphql:server --ceramic-url=$CERAMIC_URL --graphiql ./ceramic/composites/VerifiableCredentialsV2-runtime.json --did-private-key=$DID_PRIVATE_KEY --port=5005", "generate-graphql-types": "graphql-codegen --config ./codegen.ts" }, "dependencies": { @@ -58,7 +56,7 @@ "@metamask/snaps-jest": "^4.0.0", "@metamask/snaps-sdk": "^1.1.0", "@metamask/snaps-utils": "^4.0.0", - "@rarimo/rarime-connector": "2.0.1", + "@rarimo/rarime-connector": "2.0.2", "buffer": "6.0.3", "dids": "4.0.4", "ethers": "5.7.2", @@ -101,6 +99,7 @@ "eslint-plugin-prettier": "4.2.1", "node-stdlib-browser": "1.2.0", "nodemon": "2.0.20", + "npm-commands": "^1.2.1", "prettier": "2.2.1", "rimraf": "3.0.2", "typechain": "8.3.1", diff --git a/packages/snap/snap.manifest.json b/packages/snap/snap.manifest.json index 7f5c08ea..8e39a490 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -1,5 +1,5 @@ { - "version": "2.0.1", + "version": "2.0.2", "description": "Securely store and manage all of your identity credentials. Use them across chains with ZK-protected privacy guarantees.", "proposedName": "RariMe", "repository": { @@ -7,7 +7,7 @@ "url": "https://github.com/rarimo/rarime.git" }, "source": { - "shasum": "vhP1WB7B+rqWRe/XbXFHZSQZ49QZzxDs9tHx0joslpU=", + "shasum": "i0ljRZ0cephpKn1+G77icrHnm0Gh4soRcJ9b6xpQaXA=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snap/src/helpers/ceramic-helpers.ts b/packages/snap/src/helpers/ceramic-helpers.ts index e69b60c5..6c0d7b13 100644 --- a/packages/snap/src/helpers/ceramic-helpers.ts +++ b/packages/snap/src/helpers/ceramic-helpers.ts @@ -5,22 +5,28 @@ import { Hex } from '@iden3/js-crypto'; import { ComposeClient } from '@composedb/client'; import type { RuntimeCompositeDefinition } from '@composedb/types'; import { CERAMIC_URL } from '../config'; -import VerifiableRuntimeComposite from '../../ceramic/composites/VerifiableCredentials-runtime.json'; export class CeramicProvider { private readonly pkHex: string; - private readonly serverURL?: string; + private _compose: ComposeClient; - private _compose = new ComposeClient({ - ceramic: CERAMIC_URL, - definition: VerifiableRuntimeComposite as RuntimeCompositeDefinition, - ...(this.serverURL && { serverURL: this.serverURL }), - }); - - constructor(pkHex: string, serverURL?: string) { + constructor(pkHex: string, composeClient: ComposeClient) { this.pkHex = pkHex; - this.serverURL = serverURL; + this._compose = composeClient; + } + + public static create( + pkHex: string, + opts: { definition: object; serverURL?: string }, + ) { + const composeClient = new ComposeClient({ + ceramic: CERAMIC_URL, + definition: opts.definition as RuntimeCompositeDefinition, + ...(opts.serverURL && { serverURL: opts.serverURL }), + }); + + return new CeramicProvider(pkHex, composeClient); } async auth() { diff --git a/packages/snap/src/helpers/credential-helpers.ts b/packages/snap/src/helpers/credential-helpers.ts index 23474374..640b72fe 100644 --- a/packages/snap/src/helpers/credential-helpers.ts +++ b/packages/snap/src/helpers/credential-helpers.ts @@ -30,6 +30,8 @@ import { GetVerifiableCredentialsByClaimIdAndQueryHash, } from '../types'; import { getItemFromStore, setItemInStore } from '../rpc'; +import VerifiableRuntimeCompositeV2 from '../../ceramic/composites/VerifiableCredentialsV2-runtime.json'; +import VerifiableRuntimeComposite from '../../ceramic/composites/VerifiableCredentials-runtime.json'; import { getCoreClaimFromProof } from './proof-helpers'; import { CeramicProvider } from './ceramic-helpers'; @@ -105,8 +107,8 @@ const loadAllCredentialsListPages = async < }; export const getAuthenticatedCeramicProvider = async ( + opts: { definition: object; serverURL?: string }, pkHex?: string, - serverURL?: string, ) => { let privateKeyHex = pkHex ?? ''; @@ -120,7 +122,10 @@ export const getAuthenticatedCeramicProvider = async ( privateKeyHex = identityStorage.privateKeyHex; } - const ceramicProvider = new CeramicProvider(privateKeyHex, serverURL); + const ceramicProvider = CeramicProvider.create(privateKeyHex, { + ...(opts.serverURL && { serverURL: opts.serverURL }), + definition: opts.definition, + }); await ceramicProvider.auth(); @@ -137,7 +142,11 @@ export class VCManager { this.saltedEntropy = saltedEntropy; } - static async create(pkHex?: string, serverURL?: string) { + static async create(opts?: { + pkHex?: string; + definition?: object; + serverURL?: string; + }) { /** * Add some account-specific entropy to the input, * additional entropy will prevent someone from counting @@ -154,8 +163,16 @@ export class VCManager { ? entropy.substring(2) : entropy; + const definition = opts?.definition ?? VerifiableRuntimeCompositeV2; + return new VCManager( - await getAuthenticatedCeramicProvider(pkHex, serverURL), + await getAuthenticatedCeramicProvider( + { + ...(opts?.serverURL && { serverURL: opts.serverURL }), + definition, + }, + opts?.pkHex, + ), saltedEntropy, ); } @@ -472,19 +489,41 @@ export class VCManager { } } -export const moveStoreVCtoCeramic = async () => { - const credentials = (await getItemFromStore(StorageKeys.credentials)) || []; +export const migrateVCsToLastCeramicModel = async () => { + const targetVcManager = await VCManager.create(); - const vcManager = await VCManager.create(); + const targetVcs = await targetVcManager.getAllDecryptedVCs(); - if (credentials.length) { - await Promise.all( - credentials.map(async (credential: W3CCredential) => { - await vcManager.encryptAndSaveVC(credential); - }), - ); - await setItemInStore(StorageKeys.credentials, []); + if (targetVcs.length) { + return; } + + const storeCredentials: W3CCredential[] = + (await getItemFromStore(StorageKeys.credentials)) || []; + + await Promise.all( + [VerifiableRuntimeComposite].map(async (definition) => { + const vcManager = await VCManager.create({ + definition, + }); + + const ceramicVCs = await vcManager.getAllDecryptedVCs(); + + const vcs = [...storeCredentials, ...ceramicVCs].reduce((acc, vc) => { + const isVcExist = Boolean(acc.find((el) => el.id === vc.id)); + + return [...acc, ...(isVcExist ? [] : [vc])]; + }, [] as W3CCredential[]); + + await Promise.all( + vcs.map(async (vc) => { + await targetVcManager.encryptAndSaveVC(vc); + }), + ); + + await setItemInStore(StorageKeys.credentials, []); + }), + ); }; export const getRevocationStatus = async ( diff --git a/packages/snap/src/index.ts b/packages/snap/src/index.ts index 0c216e91..2e4bc8c8 100644 --- a/packages/snap/src/index.ts +++ b/packages/snap/src/index.ts @@ -26,7 +26,7 @@ import { getProviderChainInfo, getRarimoCoreUrl, loadDataFromRarimoCore, - moveStoreVCtoCeramic, + migrateVCsToLastCeramicModel, parseDidV2, VCManager, } from './helpers'; @@ -45,7 +45,7 @@ export const onRpcRequest = async ({ origin: string; }) => { if (request.method !== RPCMethods.CreateIdentity) { - await moveStoreVCtoCeramic(); + await migrateVCsToLastCeramicModel(); } switch (request.method) { @@ -60,7 +60,7 @@ export const onRpcRequest = async ({ proofRequest, } = request.params as CheckCredentialExistenceRequestParams; - const vcManager = await VCManager.create(identityStorage.privateKeyHex); + const vcManager = await VCManager.create(); let result: SaveCredentialsResponse[] = []; @@ -129,7 +129,7 @@ export const onRpcRequest = async ({ }); if (res) { - const vcManager = await VCManager.create(identityStorage.privateKeyHex); + const vcManager = await VCManager.create(); const identity = await Identity.create(identityStorage.privateKeyHex); @@ -242,7 +242,7 @@ export const onRpcRequest = async ({ throw new Error('Account address is required'); } - const vcManager = await VCManager.create(identityStorage.privateKeyHex); + const vcManager = await VCManager.create(); const credentials = ( await vcManager.getDecryptedVCsByQuery(query, issuerDid) diff --git a/packages/snap/src/tests/verifiable-credentials.test.ts b/packages/snap/src/tests/verifiable-credentials.test.ts index 9bb9b5b7..9da2f960 100644 --- a/packages/snap/src/tests/verifiable-credentials.test.ts +++ b/packages/snap/src/tests/verifiable-credentials.test.ts @@ -1,10 +1,10 @@ import * as crypto from 'crypto'; import { Hex, PrivateKey } from '@iden3/js-crypto'; +import { ProofQuery } from '@rarimo/rarime-connector'; import { hashVC, VCManager } from '../helpers'; import { SaveCredentialsRequestParams, CreateProofRequestParams, - ProofQuery, W3CCredential, } from '../types'; import { CircuitId } from '../enums'; @@ -144,7 +144,7 @@ const dummyQueryProofRequest: CreateProofRequestParams = { $eq: 1, }, }, - type: dummyVC.credentialSubject.type as string, + type: dummyVC.type, }, }; @@ -155,7 +155,7 @@ const dummyQueryProof: ProofQuery = { $eq: 1, }, }, - type: dummyVC.credentialSubject.type as string, + type: dummyVC.type, }; /** @@ -182,8 +182,8 @@ describe('Verifiable Credentials', () => { it('should encrypt and save Verifiable Credentials for "user 1" and "user 2"', async () => { const [vcManager1, vcManager2] = await Promise.all([ - VCManager.create(pkHex1, serverURL), - VCManager.create(pkHex2, serverURL), + VCManager.create({ pkHex: pkHex1, serverURL }), + VCManager.create({ pkHex: pkHex2, serverURL }), ]); await expect(vcManager1.encryptAndSaveVC(dummyVC)).resolves.not.toThrow(); @@ -193,8 +193,8 @@ describe('Verifiable Credentials', () => { it('should fetch and decrypt Verifiable Credentials of "user 1" and "user 2"', async () => { const [vcManager1, vcManager2] = await Promise.all([ - VCManager.create(pkHex1, serverURL), - VCManager.create(pkHex2, serverURL), + VCManager.create({ pkHex: pkHex1, serverURL }), + VCManager.create({ pkHex: pkHex2, serverURL }), ]); const vc1 = await vcManager1.getAllDecryptedVCs(); @@ -206,8 +206,8 @@ describe('Verifiable Credentials', () => { it('should not save Verifiable Credentials for "user 1" and "user 2"', async () => { const [vcManager1, vcManager2] = await Promise.all([ - VCManager.create(pkHex1, serverURL), - VCManager.create(pkHex2, serverURL), + VCManager.create({ pkHex: pkHex1, serverURL }), + VCManager.create({ pkHex: pkHex2, serverURL }), ]); await expect(vcManager1.encryptAndSaveVC(dummyVC)).resolves.not.toThrow(); @@ -223,8 +223,8 @@ describe('Verifiable Credentials', () => { it('should fetch and decrypt Verifiable Credentials of "user 1" and "user 2" by offer', async () => { const [vcManager1, vcManager2] = await Promise.all([ - VCManager.create(pkHex1, serverURL), - VCManager.create(pkHex2, serverURL), + VCManager.create({ pkHex: pkHex1, serverURL }), + VCManager.create({ pkHex: pkHex2, serverURL }), ]); const vc1 = await vcManager1.getDecryptedVCsByOffer(dummyOffer); @@ -236,8 +236,8 @@ describe('Verifiable Credentials', () => { it('should fetch and decrypt Verifiable Credentials of "user 1" and "user 2" by query hash', async () => { const [vcManager1, vcManager2] = await Promise.all([ - VCManager.create(pkHex1, serverURL), - VCManager.create(pkHex2, serverURL), + VCManager.create({ pkHex: pkHex1, serverURL }), + VCManager.create({ pkHex: pkHex2, serverURL }), ]); const client1 = vcManager1.ceramicProvider.client(); @@ -276,8 +276,8 @@ describe('Verifiable Credentials', () => { it('should fetch and decrypt Verifiable Credentials of "user 1" and "user 2" by query proof', async () => { const [vcManager1, vcManager2] = await Promise.all([ - VCManager.create(pkHex1, serverURL), - VCManager.create(pkHex2, serverURL), + VCManager.create({ pkHex: pkHex1, serverURL }), + VCManager.create({ pkHex: pkHex2, serverURL }), ]); const vc1 = await vcManager1.getDecryptedVCsByQuery( diff --git a/yarn.lock b/yarn.lock index a3b23e11..6f601c86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7460,7 +7460,7 @@ __metadata: languageName: node linkType: hard -"@rarimo/rarime-connector@2.0.1, @rarimo/rarime-connector@workspace:^, @rarimo/rarime-connector@workspace:packages/connector": +"@rarimo/rarime-connector@2.0.2, @rarimo/rarime-connector@workspace:^, @rarimo/rarime-connector@workspace:packages/connector": version: 0.0.0-use.local resolution: "@rarimo/rarime-connector@workspace:packages/connector" dependencies: @@ -7505,7 +7505,7 @@ __metadata: "@metamask/snaps-jest": ^4.0.0 "@metamask/snaps-sdk": ^1.1.0 "@metamask/snaps-utils": ^4.0.0 - "@rarimo/rarime-connector": 2.0.1 + "@rarimo/rarime-connector": 2.0.2 "@typechain/ethers-v5": 11.1.1 "@types/intl": 1.2.0 "@types/lodash": ^4.14.202 @@ -7530,6 +7530,7 @@ __metadata: lodash: ^4.17.21 node-stdlib-browser: 1.2.0 nodemon: 2.0.20 + npm-commands: ^1.2.1 prettier: 2.2.1 rimraf: 3.0.2 snarkjs: ^0.7.2 @@ -13851,6 +13852,13 @@ __metadata: languageName: node linkType: hard +"dotenv@npm:^16.4.1": + version: 16.4.1 + resolution: "dotenv@npm:16.4.1" + checksum: a343f0a1d156deef8c60034f797969867af4dbccfacedd4ac15fad04547e7ffe0553b58fc3b27a5837950f0d977e38e9234943fbcec4aeced4e3d044309a76ab + languageName: node + linkType: hard + "dotenv@npm:^7.0.0": version: 7.0.0 resolution: "dotenv@npm:7.0.0" @@ -21348,6 +21356,13 @@ __metadata: languageName: node linkType: hard +"npm-commands@npm:^1.2.1": + version: 1.2.1 + resolution: "npm-commands@npm:1.2.1" + checksum: 4886c88a687dfe6c810f036713709c3c3baff563b54d4cc0139bcad8a2e7aa41e3f0312be30a2a4e925746d644ea8881e9c69c3f74cd78795f3fc410f825efe5 + languageName: node + linkType: hard + "npm-normalize-package-bin@npm:^1.0.1": version: 1.0.1 resolution: "npm-normalize-package-bin@npm:1.0.1" @@ -23210,6 +23225,7 @@ __metadata: "@typescript-eslint/eslint-plugin": 5.33.0 "@typescript-eslint/parser": 5.33.0 chalk: 4.1.2 + dotenv: ^16.4.1 eslint: 8.21.0 eslint-config-prettier: 8.1.0 eslint-plugin-import: 2.26.0