diff --git a/demos/next/package-lock.json b/demos/next/package-lock.json index f40a3405c..dcd2cb9c0 100644 --- a/demos/next/package-lock.json +++ b/demos/next/package-lock.json @@ -37,13 +37,16 @@ } }, "../..": { - "name": "@atala/prism-wallet-sdk", + "name": "@hyperledger/identus-edge-agent-sdk", "version": "3.1.0", + "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@atala/apollo": "^1.2.10", + "@hyperledger/identus-apollo": "^1.3.6", "@scure/bip32": "^1.3.0", "@scure/bip39": "^1.1.1", + "@sd-jwt/sd-jwt-vc": "^0.7.1", + "@sinclair/typebox": "^0.32.31", "@stablelib/base64": "^1.0.1", "@stablelib/sha256": "^1.0.1", "@stablelib/uuid": "^1.0.2", @@ -61,9 +64,14 @@ "hash.js": "1.1.7", "isows": "^1.0.3", "jose": "^4.15.5", + "jsonld": "^8.3.2", "jsonwebtoken": "^9.0.0", "multiformats": "^9.9.0", + "pako": "^2.1.0", + "patch-package": "^8.0.0", + "postinstall-postinstall": "^2.1.0", "rxdb": "^14.17.1", + "rxjs": "^7.8.1", "text-encoding": "^0.7.0", "util": "^0.12.5", "uuid": "^9.0.0" @@ -96,7 +104,9 @@ "@types/elliptic": "^6.4.16", "@types/google-protobuf": "^3.15.6", "@types/jest": "^29.5.5", + "@types/jsonld": "^1.5.14", "@types/node": "^18.14.2", + "@types/pako": "^2.0.3", "@types/sinon": "^10.0.13", "@types/sinon-chai": "^3.2.9", "@types/uuid": "^9.0.1", @@ -120,9 +130,13 @@ "eslint-plugin-n": "^15.6.1", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-react": "^7.32.2", + "eslint-plugin-unused-imports": "^2.0.0", "get-func-name": "^3.0.0", + "husky": "^9.0.11", "jest": "^29.5.0", "jest-junit": "^16.0.0", + "jwe-browser": "file:./externals/generated/jwe-wasm-browser", + "jwe-node": "file:./externals/generated/jwe-wasm-node", "prettier": "^3.0.2", "rollup-plugin-cleanup": "^3.2.1", "rollup-plugin-copy": "^3.5.0", @@ -132,7 +146,7 @@ "rollup-plugin-polyfill-node": "^0.12.0", "rollup-plugin-strip-code": "^0.2.7", "rollup-plugin-typescript2": "^0.34.1", - "semantic-release": "^21.1.1", + "semantic-release": "^24.0.0", "semantic-release-slack-bot": "^4.0.2", "sinon": "^15.0.1", "sinon-chai": "^3.7.0", @@ -192,27 +206,6 @@ "node": ">=6.0.0" } }, - "../../node_modules/@atala/apollo": { - "version": "1.2.10", - "dependencies": { - "@noble/curves": "1.2.0", - "@noble/hashes": "1.3.1", - "@stablelib/x25519": "1.0.3", - "@types/elliptic": "6.4.14", - "buffer": "6.0.3", - "elliptic": "6.5.4", - "format-util": "^1.0.5", - "hash.js": "1.1.7", - "stream-browserify": "3.0.0" - } - }, - "../../node_modules/@atala/apollo/node_modules/@types/elliptic": { - "version": "6.4.14", - "license": "MIT", - "dependencies": { - "@types/bn.js": "*" - } - }, "../../node_modules/@babel/code-frame": { "version": "7.23.5", "dev": true, @@ -3645,36 +3638,6 @@ "url": "https://paulmillr.com/funding/" } }, - "../../node_modules/@noble/curves": { - "version": "1.2.0", - "license": "MIT", - "dependencies": { - "@noble/hashes": "1.3.2" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "../../node_modules/@noble/curves/node_modules/@noble/hashes": { - "version": "1.3.2", - "license": "MIT", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "../../node_modules/@noble/hashes": { - "version": "1.3.1", - "license": "MIT", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "../../node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "dev": true, @@ -4804,7 +4767,6 @@ }, "../../node_modules/@sinclair/typebox": { "version": "0.27.8", - "dev": true, "license": "MIT" }, "../../node_modules/@sindresorhus/merge-streams": { @@ -5047,6 +5009,7 @@ }, "../../node_modules/@types/bn.js": { "version": "5.1.5", + "dev": true, "license": "MIT", "dependencies": { "@types/node": "*" @@ -9160,10 +9123,6 @@ "node": ">= 6" } }, - "../../node_modules/format-util": { - "version": "1.0.5", - "license": "MIT" - }, "../../node_modules/from2": { "version": "2.3.0", "dev": true, @@ -19458,26 +19417,6 @@ "node": ">=8" } }, - "../../node_modules/stream-browserify": { - "version": "3.0.0", - "license": "MIT", - "dependencies": { - "inherits": "~2.0.4", - "readable-stream": "^3.5.0" - } - }, - "../../node_modules/stream-browserify/node_modules/readable-stream": { - "version": "3.6.2", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "../../node_modules/stream-combiner2": { "version": "1.1.1", "dev": true, diff --git a/demos/next/src/reducers/app.ts b/demos/next/src/reducers/app.ts index 8d502d60c..1e7a5611a 100644 --- a/demos/next/src/reducers/app.ts +++ b/demos/next/src/reducers/app.ts @@ -117,7 +117,7 @@ const appSlice = createSlice({ mediator: string }> ) => { - state.mediatorDID = action.payload.mediator + state.mediatorDID = SDK.Domain.DID.fromString(action.payload.mediator) }, [DBPreload.complete]: ( state, @@ -176,7 +176,6 @@ const appSlice = createSlice({ isAnswering: true, hasAnswered: false, error: null, - safeBody: action.meta.arg.message.safeBody, credentialFormat: action.meta.arg.message.credentialFormat }) }) diff --git a/package-lock.json b/package-lock.json index 4854a4e67..ba4a4b10d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,10 +22,10 @@ "@stablelib/x25519": "^1.0.3", "antlr4ts": "^0.5.0-alpha.4", "assert": "^2.0.0", - "axios": "^1.6.1", + "axios": "^1.3.1", "bn.js": "^5.2.1", "buffer": "^6.0.3", - "did-jwt": "^6.11.5", + "did-jwt": "^8.0.4", "did-resolver": "^4.1.0", "elliptic": "^6.5.4", "google-protobuf": "^3.21.2", @@ -2229,7 +2229,9 @@ "license": "BSD-3-Clause" }, "node_modules/@hyperledger/identus-apollo": { - "version": "1.3.6", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@hyperledger/identus-apollo/-/identus-apollo-1.4.2.tgz", + "integrity": "sha512-iFp9n6iHkfoMOFARymD9NREKCifh97e5ZNJarj0+JQND9bJkndrcrapIqnEmqwhnmjp0/w8OruQdw25c847UPw==", "dependencies": { "@noble/curves": "1.2.0", "@noble/hashes": "1.3.1", @@ -3048,6 +3050,11 @@ "sparse-bitfield": "^3.0.3" } }, + "node_modules/@multiformats/base-x": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@multiformats/base-x/-/base-x-4.0.1.tgz", + "integrity": "sha512-eMk0b9ReBbV23xXU693TAIrLyeO5iTgBZGSJfpqriG8UkYvr/hC9u9pyMlAakDNHWmbhMZCDs6KQO0jzKD8OTw==" + }, "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { "version": "5.1.1-v1", "dev": true, @@ -4279,10 +4286,6 @@ "version": "3.1.2", "license": "MIT" }, - "node_modules/@stablelib/aead": { - "version": "1.0.1", - "license": "MIT" - }, "node_modules/@stablelib/base64": { "version": "1.0.1", "license": "MIT" @@ -4298,39 +4301,6 @@ "version": "1.0.1", "license": "MIT" }, - "node_modules/@stablelib/chacha": { - "version": "1.0.1", - "license": "MIT", - "dependencies": { - "@stablelib/binary": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "node_modules/@stablelib/chacha20poly1305": { - "version": "1.0.1", - "license": "MIT", - "dependencies": { - "@stablelib/aead": "^1.0.1", - "@stablelib/binary": "^1.0.1", - "@stablelib/chacha": "^1.0.1", - "@stablelib/constant-time": "^1.0.1", - "@stablelib/poly1305": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "node_modules/@stablelib/constant-time": { - "version": "1.0.1", - "license": "MIT" - }, - "node_modules/@stablelib/ed25519": { - "version": "1.0.3", - "license": "MIT", - "dependencies": { - "@stablelib/random": "^1.0.2", - "@stablelib/sha512": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, "node_modules/@stablelib/hash": { "version": "1.0.1", "license": "MIT" @@ -4350,14 +4320,6 @@ "@stablelib/bytes": "^1.0.1" } }, - "node_modules/@stablelib/poly1305": { - "version": "1.0.1", - "license": "MIT", - "dependencies": { - "@stablelib/constant-time": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, "node_modules/@stablelib/random": { "version": "1.0.2", "license": "MIT", @@ -4375,15 +4337,6 @@ "@stablelib/wipe": "^1.0.1" } }, - "node_modules/@stablelib/sha512": { - "version": "1.0.1", - "license": "MIT", - "dependencies": { - "@stablelib/binary": "^1.0.1", - "@stablelib/hash": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, "node_modules/@stablelib/uuid": { "version": "1.0.2", "license": "MIT", @@ -4406,26 +4359,6 @@ "@stablelib/wipe": "^1.0.1" } }, - "node_modules/@stablelib/xchacha20": { - "version": "1.0.1", - "license": "MIT", - "dependencies": { - "@stablelib/binary": "^1.0.1", - "@stablelib/chacha": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "node_modules/@stablelib/xchacha20poly1305": { - "version": "1.0.1", - "license": "MIT", - "dependencies": { - "@stablelib/aead": "^1.0.1", - "@stablelib/chacha20poly1305": "^1.0.1", - "@stablelib/constant-time": "^1.0.1", - "@stablelib/wipe": "^1.0.1", - "@stablelib/xchacha20": "^1.0.1" - } - }, "node_modules/@types/babel__core": { "version": "7.20.5", "dev": true, @@ -5656,10 +5589,11 @@ } }, "node_modules/axios": { - "version": "1.7.2", - "license": "MIT", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.3.1.tgz", + "integrity": "sha512-78pWJsQTceInlyaeBQeYZ/QgZeWS8hGeKiIJiDKQe3hEyBb7sEMq0K4gjx+Va6WHTYO4zI/RRl8qGRzn0YMadA==", "dependencies": { - "follow-redirects": "^1.15.6", + "follow-redirects": "^1.15.0", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -5973,10 +5907,6 @@ "node": ">=6.0.0" } }, - "node_modules/bech32": { - "version": "2.0.0", - "license": "MIT" - }, "node_modules/before-after-hook": { "version": "3.0.2", "dev": true, @@ -7237,21 +7167,27 @@ } }, "node_modules/did-jwt": { - "version": "6.11.6", - "license": "Apache-2.0", - "dependencies": { - "@stablelib/ed25519": "^1.0.2", - "@stablelib/random": "^1.0.1", - "@stablelib/sha256": "^1.0.1", - "@stablelib/x25519": "^1.0.2", - "@stablelib/xchacha20poly1305": "^1.0.1", - "bech32": "^2.0.0", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/did-jwt/-/did-jwt-8.0.4.tgz", + "integrity": "sha512-KPtG7H+8GgKGMiDqFvOdNy5BBN3hpA+8xV7VygEnpst5oPIqjvcH3rTtnPF55a8bOxIzE2PudKGIXIQhekv7WA==", + "dependencies": { + "@noble/ciphers": "^0.5.0", + "@noble/curves": "^1.0.0", + "@noble/hashes": "^1.3.0", + "@scure/base": "^1.1.3", "canonicalize": "^2.0.0", - "did-resolver": "^4.0.0", - "elliptic": "^6.5.4", - "js-sha3": "^0.8.0", - "multiformats": "^9.6.5", - "uint8arrays": "^3.0.0" + "did-resolver": "^4.1.0", + "multibase": "^4.0.6", + "multiformats": "^9.6.2", + "uint8arrays": "3.1.1" + } + }, + "node_modules/did-jwt/node_modules/@noble/ciphers": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-0.5.3.tgz", + "integrity": "sha512-B0+6IIHiqEs3BPMT0hcRmHvEj2QHOLu+uwt+tqDDeVd0oyVzh7BPrDcPjRnV1PV/5LaknXJJQvOuRGR0zQJz+w==", + "funding": { + "url": "https://paulmillr.com/funding/" } }, "node_modules/did-resolver": { @@ -7336,8 +7272,9 @@ "license": "ISC" }, "node_modules/elliptic": { - "version": "6.5.5", - "license": "MIT", + "version": "6.5.6", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.6.tgz", + "integrity": "sha512-mpzdtpeCLuS3BmE3pO3Cpp5bbjlOPY2Q0PgoF+Od1XZrHLYI28Xe3ossCmYCQt11FQKEYd9+PF8jymTvtWJSHQ==", "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", @@ -11828,10 +11765,6 @@ "sourcemap-codec": "^1.4.8" } }, - "node_modules/js-sha3": { - "version": "0.8.0", - "license": "MIT" - }, "node_modules/js-tokens": { "version": "4.0.0", "dev": true, @@ -12980,6 +12913,19 @@ "version": "2.1.2", "license": "MIT" }, + "node_modules/multibase": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-4.0.6.tgz", + "integrity": "sha512-x23pDe5+svdLz/k5JPGCVdfn7Q5mZVMBETiC+ORfO+sor9Sgs0smJzAjfTbM5tckeCqnaUuMYoz+k3RXMmJClQ==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "@multiformats/base-x": "^4.0.1" + }, + "engines": { + "node": ">=12.0.0", + "npm": ">=6.0.0" + } + }, "node_modules/multiformats": { "version": "9.9.0", "license": "(Apache-2.0 AND MIT)" diff --git a/package.json b/package.json index 2bb1e74c2..c39a8dc3b 100644 --- a/package.json +++ b/package.json @@ -204,10 +204,10 @@ "@stablelib/x25519": "^1.0.3", "antlr4ts": "^0.5.0-alpha.4", "assert": "^2.0.0", - "axios": "^1.6.1", + "axios": "^1.3.1", "bn.js": "^5.2.1", "buffer": "^6.0.3", - "did-jwt": "^6.11.5", + "did-jwt": "^8.0.4", "did-resolver": "^4.1.0", "elliptic": "^6.5.4", "google-protobuf": "^3.21.2", diff --git a/tests/pollux/Pollux.test.ts b/tests/pollux/Pollux.test.ts index 239db6d59..441b98419 100644 --- a/tests/pollux/Pollux.test.ts +++ b/tests/pollux/Pollux.test.ts @@ -2083,7 +2083,11 @@ describe("Pollux", () => { }) it("Should Reject Creating an Anoncreds Presentation Submission using an invalid LinkSecret", async () => { + sandbox.stub(pollux as any, "fetchSchema").resolves(Fixtures.Credentials.Anoncreds.schema); + sandbox.stub(pollux as any, "fetchCredentialDefinition").resolves(Fixtures.Credentials.Anoncreds.credentialDefinition); + const credential = new AnonCredsCredential(Fixtures.Credentials.Anoncreds.credential); + expect(pollux.createPresentationSubmission( Fixtures.Credentials.Anoncreds.presentationRequest, credential, @@ -2094,20 +2098,12 @@ describe("Pollux", () => { }) - it("Should Reject Creating an Anoncreds Presentation Submission using an invalid LinkSecret", async () => { - const credential = new AnonCredsCredential(Fixtures.Credentials.Anoncreds.credential); - expect(pollux.createPresentationSubmission( - null as any, - credential, - Fixtures.Credentials.Anoncreds.linkSecret - )).to.eventually.be.rejectedWith( - 'Serialization Error: invalid type: unit value, expected struct PresentationRequestPayload' - ); - - }) + it("Should Reject Creating an Anoncreds Presentation Submission using an invalid presentationDefinition", async () => { + sandbox.stub(pollux as any, "fetchSchema").resolves(Fixtures.Credentials.Anoncreds.schema); + sandbox.stub(pollux as any, "fetchCredentialDefinition").resolves(Fixtures.Credentials.Anoncreds.credentialDefinition); - it("Should Reject Creating an Anoncreds Presentation Submission using an presentationDefinition", async () => { const credential = new AnonCredsCredential(Fixtures.Credentials.Anoncreds.credential); + expect(pollux.createPresentationSubmission( null as any, credential, @@ -2115,11 +2111,14 @@ describe("Pollux", () => { )).to.eventually.be.rejectedWith( 'Serialization Error: invalid type: unit value, expected struct PresentationRequestPayload' ); - }) it("Should Reject Creating an Anoncreds Presentation Submission using a wrong JWT Credential", async () => { + sandbox.stub(pollux as any, "fetchSchema").resolves(Fixtures.Credentials.Anoncreds.schema); + sandbox.stub(pollux as any, "fetchCredentialDefinition").resolves(Fixtures.Credentials.Anoncreds.credentialDefinition); + const credential = new JWTCredential(Fixtures.Credentials.JWT.credentialPayload) + expect(pollux.createPresentationSubmission( Fixtures.Credentials.Anoncreds.presentationRequest, credential,