From 1b300ccc852fe171ab61405d4038d5276887f1f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Rib=C3=B3?= Date: Mon, 13 Nov 2023 19:01:06 +0100 Subject: [PATCH] fix!: Update to new SDK npm package. (#31) BREAKING: updated SDK to the latest published version 3.1.0 in NPM https://www.npmjs.com/package/@atala/prism-wallet-sdk which does not require authentication token anymore. --- package-lock.json | 126 ++++++++++++----------- package.json | 2 +- rollup/rollup.mjs | 6 +- src/index.ts | 2 +- src/schemas/Credential.ts | 2 +- src/schemas/CredentialRequestMetadata.ts | 2 +- src/schemas/LinkSecret.ts | 2 +- src/schemas/Mediator.ts | 2 +- src/schemas/Message.ts | 2 +- src/schemas/PrivateKey.ts | 2 +- tests/fixtures.ts | 2 +- tests/pluto.test.ts | 2 +- versioning.cjs | 62 +++++------ 13 files changed, 109 insertions(+), 105 deletions(-) diff --git a/package-lock.json b/package-lock.json index a3a55350..8edcab3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -82,7 +82,7 @@ "typescript": "^5.1.6" }, "peerDependencies": { - "@input-output-hk/atala-prism-wallet-sdk": "^2.5.0" + "@atala/prism-wallet-sdk": "^3.1.0" } }, "../../iohk/atala-prism-wallet-sdk-ts": { @@ -218,6 +218,67 @@ "node": ">=6.0.0" } }, + "node_modules/@atala/prism-wallet-sdk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@atala/prism-wallet-sdk/-/prism-wallet-sdk-3.1.0.tgz", + "integrity": "sha512-BMkY1q53vFyld/QmAcO9ZRqiNU2JRJR63pmUz6mcmQTVvZvNxKyY1fwsMEgJO4MJhbu5wShQlpqdfzIQmT62LQ==", + "peer": true, + "dependencies": { + "@scure/bip32": "^1.3.0", + "@scure/bip39": "^1.1.1", + "@stablelib/base64": "^1.0.1", + "@stablelib/sha256": "^1.0.1", + "@stablelib/uuid": "^1.0.2", + "@stablelib/wipe": "^1.0.1", + "@stablelib/x25519": "^1.0.3", + "antlr4ts": "^0.5.0-alpha.4", + "assert": "^2.0.0", + "axios": "^1.6.1", + "bn.js": "^5.2.1", + "buffer": "^6.0.3", + "core-js": "^3.29.1", + "did-jwt": "^6.11.5", + "did-resolver": "^4.1.0", + "didcomm-node": "^0.4.1", + "elliptic": "^6.5.4", + "google-protobuf": "^3.21.2", + "hash.js": "1.1.7", + "jose": "^4.12.2", + "jsonwebtoken": "^9.0.0", + "multiformats": "^9.9.0", + "util": "^0.12.5", + "uuid": "^9.0.0" + }, + "peerDependenciesMeta": { + "react-native-sqlite-storage": { + "optional": true + } + } + }, + "node_modules/@atala/prism-wallet-sdk/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "peer": true, + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "node_modules/@babel/code-frame": { "version": "7.22.13", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", @@ -2855,63 +2916,6 @@ "node": ">=6.9.0" } }, - "node_modules/@input-output-hk/atala-prism-wallet-sdk": { - "version": "2.5.0", - "resolved": "https://npm.pkg.github.com/download/@input-output-hk/atala-prism-wallet-sdk/2.5.0/2ad8fea45603571aaa9a0423493cfc8bc167913f", - "integrity": "sha512-3xAtnT/gqsKXzSeqmGc+IlfnpY3SBluD96rRqJ0sz2S3rA30Ehx2mjidiySaL/fYywfbj/dropvK0D5GM28bjA==", - "license": "Apache-2.0", - "peer": true, - "dependencies": { - "@scure/bip32": "^1.3.0", - "@scure/bip39": "^1.1.1", - "@stablelib/base64": "^1.0.1", - "@stablelib/sha256": "^1.0.1", - "@stablelib/uuid": "^1.0.2", - "@stablelib/wipe": "^1.0.1", - "@stablelib/x25519": "^1.0.3", - "antlr4ts": "^0.5.0-alpha.4", - "assert": "^2.0.0", - "axios": "^1.3.4", - "bn.js": "^5.2.1", - "buffer": "^6.0.3", - "core-js": "^3.29.1", - "did-jwt": "^6.11.5", - "did-resolver": "^4.1.0", - "didcomm-node": "^0.4.1", - "elliptic": "^6.5.4", - "google-protobuf": "^3.21.2", - "hash.js": "1.1.7", - "jose": "^4.12.2", - "jsonwebtoken": "^9.0.0", - "multiformats": "^9.9.0", - "util": "^0.12.5", - "uuid": "^9.0.0" - } - }, - "node_modules/@input-output-hk/atala-prism-wallet-sdk/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "peer": true, - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -7535,9 +7539,9 @@ } }, "node_modules/axios": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", - "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz", + "integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", diff --git a/package.json b/package.json index 0e74a3fd..5c114e03 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "author": "elribonazo@gmail.com", "license": "Apache-2.0", "peerDependencies": { - "@input-output-hk/atala-prism-wallet-sdk": "^2.5.0" + "@atala/prism-wallet-sdk": "^3.1.0" }, "dependencies": { "dexie": "^3.2.4", diff --git a/rollup/rollup.mjs b/rollup/rollup.mjs index 1a4f5407..156dbef2 100644 --- a/rollup/rollup.mjs +++ b/rollup/rollup.mjs @@ -6,11 +6,7 @@ import ignore from "rollup-plugin-ignore"; import json from "@rollup/plugin-json"; import commonjs from "@rollup/plugin-commonjs"; -const externals = [ - "@input-output-hk/atala-prism-wallet-sdk", - "dexie", - "dexie-encrypted", -]; +const externals = ["@atala/prism-wallet-sdk", "dexie", "dexie-encrypted"]; function CreateConfig(buildPath, plugins = [], extraInputs = []) { return { diff --git a/src/index.ts b/src/index.ts index c05c0ce5..1210d71c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { Domain } from "@input-output-hk/atala-prism-wallet-sdk"; +import { Domain } from "@atala/prism-wallet-sdk"; import { getRxStorageDexie } from "rxdb/plugins/storage-dexie"; import { wrappedKeyEncryptionCryptoJsStorage } from "rxdb/plugins/encryption-crypto-js"; import { diff --git a/src/schemas/Credential.ts b/src/schemas/Credential.ts index b7658f60..8daf2da5 100644 --- a/src/schemas/Credential.ts +++ b/src/schemas/Credential.ts @@ -5,7 +5,7 @@ import { Domain, JWTCredential, JWTVerifiableCredentialRecoveryId, -} from "@input-output-hk/atala-prism-wallet-sdk"; +} from "@atala/prism-wallet-sdk"; import type { Schema } from "../types"; import { RxCollection, RxDocument } from "rxdb"; diff --git a/src/schemas/CredentialRequestMetadata.ts b/src/schemas/CredentialRequestMetadata.ts index 0f5cab39..9abdbca5 100644 --- a/src/schemas/CredentialRequestMetadata.ts +++ b/src/schemas/CredentialRequestMetadata.ts @@ -5,7 +5,7 @@ import { Domain, JWTCredential, JWTVerifiableCredentialRecoveryId, -} from "@input-output-hk/atala-prism-wallet-sdk"; +} from "@atala/prism-wallet-sdk"; import type { Schema } from "../types"; import { RxCollection, RxDocument } from "rxdb"; diff --git a/src/schemas/LinkSecret.ts b/src/schemas/LinkSecret.ts index 5ad8578f..be0404c7 100644 --- a/src/schemas/LinkSecret.ts +++ b/src/schemas/LinkSecret.ts @@ -1,4 +1,4 @@ -import { Domain } from "@input-output-hk/atala-prism-wallet-sdk"; +import { Domain } from "@atala/prism-wallet-sdk"; import type { Schema } from "../types"; import { RxCollection, RxDocument } from "rxdb"; diff --git a/src/schemas/Mediator.ts b/src/schemas/Mediator.ts index a67df629..ce161924 100644 --- a/src/schemas/Mediator.ts +++ b/src/schemas/Mediator.ts @@ -1,6 +1,6 @@ import { RxCollection, RxDocument } from "rxdb"; import type { Schema } from "../types"; -import { Domain } from "@input-output-hk/atala-prism-wallet-sdk"; +import { Domain } from "@atala/prism-wallet-sdk"; export type MediatorSchemaType = { id: string; diff --git a/src/schemas/Message.ts b/src/schemas/Message.ts index 620de00a..27e515df 100644 --- a/src/schemas/Message.ts +++ b/src/schemas/Message.ts @@ -1,4 +1,4 @@ -import { Domain } from "@input-output-hk/atala-prism-wallet-sdk"; +import { Domain } from "@atala/prism-wallet-sdk"; import type { Schema } from "../types"; import { RxCollection, RxDocument } from "rxdb"; diff --git a/src/schemas/PrivateKey.ts b/src/schemas/PrivateKey.ts index af4e9275..2d04673e 100644 --- a/src/schemas/PrivateKey.ts +++ b/src/schemas/PrivateKey.ts @@ -4,7 +4,7 @@ import { Secp256k1PrivateKey, X25519PrivateKey, Domain, -} from "@input-output-hk/atala-prism-wallet-sdk"; +} from "@atala/prism-wallet-sdk"; import type { Schema } from "../types"; import { RxCollection, RxDocument } from "rxdb"; diff --git a/tests/fixtures.ts b/tests/fixtures.ts index 6bb87996..b8079bfc 100644 --- a/tests/fixtures.ts +++ b/tests/fixtures.ts @@ -6,7 +6,7 @@ import { X25519KeyPair, X25519PrivateKey, Domain, -} from "@input-output-hk/atala-prism-wallet-sdk"; +} from "@atala/prism-wallet-sdk"; const secpPrivateKey = new Secp256k1PrivateKey( new Uint8Array([ 45, 182, 188, 189, 107, 229, 136, 180, 199, 177, 110, 84, 98, 140, 121, 84, diff --git a/tests/pluto.test.ts b/tests/pluto.test.ts index 2b8a2dcc..7b2deb61 100644 --- a/tests/pluto.test.ts +++ b/tests/pluto.test.ts @@ -10,7 +10,7 @@ import { Domain, JWTCredential, Pollux, -} from "@input-output-hk/atala-prism-wallet-sdk"; +} from "@atala/prism-wallet-sdk"; import * as Fixtures from "./fixtures"; import * as sinon from "sinon"; diff --git a/versioning.cjs b/versioning.cjs index 06f46feb..4896e0e5 100644 --- a/versioning.cjs +++ b/versioning.cjs @@ -1,49 +1,53 @@ -const fs = require('fs'); +const fs = require("fs"); function findPackageVersion(packageName) { try { // Read the package.json file - const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf-8')); + const packageJson = JSON.parse(fs.readFileSync("./package.json", "utf-8")); // Check if the package is in the dependencies - if (packageJson.peerDependencies && packageJson.peerDependencies[packageName]) { + if ( + packageJson.peerDependencies && + packageJson.peerDependencies[packageName] + ) { return packageJson.peerDependencies[packageName]; } else { return undefined; // Package not found } } catch (error) { - console.error('Error reading or parsing package.json:', error); + console.error("Error reading or parsing package.json:", error); return undefined; } } function updateReadme(version) { - const readmeFilePath = 'README.md'; - - try { - // Read the content of the README.md file - let readmeContent = fs.readFileSync(readmeFilePath, 'utf-8').split('\n'); - - // Check if there are at least 4 lines in the file - if (readmeContent.length >= 4) { - // Replace the 4th line with "123" - readmeContent[3] = `This package is compatible with Atala Prism Wallet SDK v${version.slice(1)}`; - - // Join the lines back together - readmeContent = readmeContent.join('\n'); - - // Write the modified content back to the README.md file - fs.writeFileSync(readmeFilePath, readmeContent, 'utf-8'); - console.log('README.md updated successfully.'); - } else { - console.log('README.md does not have at least 4 lines.'); - } - } catch (error) { - console.error('Error reading or updating README.md:', error); + const readmeFilePath = "README.md"; + + try { + // Read the content of the README.md file + let readmeContent = fs.readFileSync(readmeFilePath, "utf-8").split("\n"); + + // Check if there are at least 4 lines in the file + if (readmeContent.length >= 4) { + // Replace the 4th line with "123" + readmeContent[3] = `This package is compatible with Atala Prism Wallet SDK v${version.slice( + 1 + )}`; + + // Join the lines back together + readmeContent = readmeContent.join("\n"); + + // Write the modified content back to the README.md file + fs.writeFileSync(readmeFilePath, readmeContent, "utf-8"); + console.log("README.md updated successfully."); + } else { + console.log("README.md does not have at least 4 lines."); } + } catch (error) { + console.error("Error reading or updating README.md:", error); } +} - -const packageNameToFind = '@input-output-hk/atala-prism-wallet-sdk'; // Replace with the package name you want to find +const packageNameToFind = "@atala/prism-wallet-sdk"; // Replace with the package name you want to find const packageVersion = findPackageVersion(packageNameToFind); -updateReadme(packageVersion) \ No newline at end of file +updateReadme(packageVersion);