From 77181cf108eb5acbfb0bad3a99cac226bfe7ce35 Mon Sep 17 00:00:00 2001 From: maxufeng Date: Wed, 30 Oct 2024 18:41:34 +0800 Subject: [PATCH 1/2] feat: add astron token-registry test file and update dependency --- package-lock.json | 27 +- package.json | 4 +- .../ethereumAstronTokenRegistryStatus.test.ts | 495 ++++++++++++++++++ .../documentAstronNotIssuedTokenRegistry.ts | 38 ++ .../v2/documentAstronValidWithToken.ts | 38 ++ .../v3/astronTokenRegistry-issued.json | 70 +++ .../v3/astronTokenRegistry-wrapped.json | 70 +++ 7 files changed, 726 insertions(+), 16 deletions(-) create mode 100644 src/verifiers/documentStatus/tokenRegistry/ethereumAstronTokenRegistryStatus.test.ts create mode 100644 test/fixtures/v2/documentAstronNotIssuedTokenRegistry.ts create mode 100644 test/fixtures/v2/documentAstronValidWithToken.ts create mode 100644 test/fixtures/v3/astronTokenRegistry-issued.json create mode 100644 test/fixtures/v3/astronTokenRegistry-wrapped.json diff --git a/package-lock.json b/package-lock.json index 3b0e02b1..d04d2ca7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,9 @@ "version": "0.0.0-development", "license": "Apache-2.0", "dependencies": { - "@tradetrust-tt/dnsprove": "^2.13.2", + "@tradetrust-tt/dnsprove": "^2.14.0", "@tradetrust-tt/document-store": "^2.7.0", - "@tradetrust-tt/token-registry": "^4.9.0", + "@tradetrust-tt/token-registry": "^4.12.0", "@tradetrust-tt/tradetrust": "^6.9.0", "axios": "^1.7.2", "debug": "^4.3.1", @@ -5093,9 +5093,9 @@ } }, "node_modules/@tradetrust-tt/dnsprove": { - "version": "2.13.2", - "resolved": "https://registry.npmjs.org/@tradetrust-tt/dnsprove/-/dnsprove-2.13.2.tgz", - "integrity": "sha512-/OPqpqLAfRwxaalOtQHQN5iTfzFHYzToRX6kzYFhtiuUAiaWJIPZqwFDXCh8u5sUwBO03BdqS3S5VXNltm/h+g==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/@tradetrust-tt/dnsprove/-/dnsprove-2.14.0.tgz", + "integrity": "sha512-5TIONCiqnMz+9IeN1yBagCUB3DFUBSEQwhTKVLrBJ9j+/wO4VxdOzKhagKHkic7FaSNPRi7QqlCFBsNi47AU8Q==", "dependencies": { "axios": "1.7.2", "debug": "^4.3.1", @@ -5111,11 +5111,11 @@ "integrity": "sha512-wMTQkZ4FNzYvlWwaeKCHuV8fYxw+kefI38dTMHY5fpV3B5oaapePFGKHDs+4IrV1ZVFHQbqR/r/MP7dNwwjJDA==" }, "node_modules/@tradetrust-tt/token-registry": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/@tradetrust-tt/token-registry/-/token-registry-4.9.0.tgz", - "integrity": "sha512-U7FTclon+FtbwCJv0eP0J6jL7qQ3xjLrF9LcB+EFbTQo/jOnD/fzoUaeC47X+jneZoMJ0k2XS5WBGGN7fKWsrA==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@tradetrust-tt/token-registry/-/token-registry-4.12.0.tgz", + "integrity": "sha512-5CWoqXE4RZX65lZCjp+QcYW4hv9+BzU/MVLXjVbXKyb7RJmbw/TcGmI5YPs55FzSYIxls+hZnhQMCBY4r05CsQ==", "dependencies": { - "@typechain/ethers-v5": "~10.0.0" + "@typechain/ethers-v5": "10.2.1" }, "peerDependencies": { "ethers": ">=5.0.8" @@ -5187,19 +5187,18 @@ "dev": true }, "node_modules/@typechain/ethers-v5": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-10.0.0.tgz", - "integrity": "sha512-Kot7fwAqnH96ZbI8xrRgj5Kpv9yCEdjo7mxRqrH7bYpEgijT5MmuOo8IVsdhOu7Uog4ONg7k/d5UdbAtTKUgsA==", + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-10.2.1.tgz", + "integrity": "sha512-n3tQmCZjRE6IU4h6lqUGiQ1j866n5MTCBJreNEHHVWXa2u9GJTaeYyU1/k+1qLutkyw+sS6VAN+AbeiTqsxd/A==", "dependencies": { "lodash": "^4.17.15", "ts-essentials": "^7.0.1" }, "peerDependencies": { "@ethersproject/abi": "^5.0.0", - "@ethersproject/bytes": "^5.0.0", "@ethersproject/providers": "^5.0.0", "ethers": "^5.1.3", - "typechain": "^8.0.0", + "typechain": "^8.1.1", "typescript": ">=4.3.0" } }, diff --git a/package.json b/package.json index 836ffc9c..1ed46bef 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,9 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@tradetrust-tt/dnsprove": "^2.13.2", + "@tradetrust-tt/dnsprove": "^2.14.0", "@tradetrust-tt/document-store": "^2.7.0", - "@tradetrust-tt/token-registry": "^4.9.0", + "@tradetrust-tt/token-registry": "^4.12.0", "@tradetrust-tt/tradetrust": "^6.9.0", "axios": "^1.7.2", "debug": "^4.3.1", diff --git a/src/verifiers/documentStatus/tokenRegistry/ethereumAstronTokenRegistryStatus.test.ts b/src/verifiers/documentStatus/tokenRegistry/ethereumAstronTokenRegistryStatus.test.ts new file mode 100644 index 00000000..d196639f --- /dev/null +++ b/src/verifiers/documentStatus/tokenRegistry/ethereumAstronTokenRegistryStatus.test.ts @@ -0,0 +1,495 @@ +import { v3, WrappedDocument } from "@tradetrust-tt/tradetrust"; +import { documentDidSigned } from "../../../../test/fixtures/v2/documentDidSigned"; +import { documentAstronValidWithToken } from "../../../../test/fixtures/v2/documentAstronValidWithToken"; +import { documentMixedIssuance } from "../../../../test/fixtures/v2/documentMixedIssuance"; +import { documentAstronNotIssuedTokenRegistry } from "../../../../test/fixtures/v2/documentAstronNotIssuedTokenRegistry"; +import { openAttestationEthereumTokenRegistryStatus } from "./ethereumTokenRegistryStatus"; +import { documentNotIssuedWithDocumentStore } from "../../../../test/fixtures/v2/documentNotIssuedWithDocumentStore"; + +import v3TokenRegistryIssuedRaw from "../../../../test/fixtures/v3/astronTokenRegistry-issued.json"; +import v3TokenRegistryWrappedRaw from "../../../../test/fixtures/v3/astronTokenRegistry-wrapped.json"; + +import { generateProvider } from "../../../common/utils"; + +const v3TokenRegistryWrapped = v3TokenRegistryWrappedRaw as WrappedDocument; +const v3TokenRegistryIssued = v3TokenRegistryIssuedRaw as WrappedDocument; + +const options = { + provider: generateProvider({ + network: "astron", + providerType: "jsonrpc", + url: "http://astronlayer2.bitfactory.cn:8545", + }), +}; + +describe("test", () => { + describe("v2", () => { + it("should return false when document does not have data", async () => { + const documentWithoutData: any = { ...documentAstronValidWithToken, data: null }; + const shouldVerify = openAttestationEthereumTokenRegistryStatus.test(documentWithoutData, options); + expect(shouldVerify).toBe(false); + }); + + it("should return false when document does not have issuers", async () => { + const documentWithoutIssuer: any = { + ...documentAstronValidWithToken, + data: { ...documentAstronValidWithToken.data, issuers: null }, + }; + const shouldVerify = openAttestationEthereumTokenRegistryStatus.test(documentWithoutIssuer, options); + expect(shouldVerify).toBe(false); + }); + + it("should return false when document uses document store", async () => { + const shouldVerify = openAttestationEthereumTokenRegistryStatus.test(documentNotIssuedWithDocumentStore, options); + expect(shouldVerify).toBe(false); + }); + + it("should return false when document uses did signing", async () => { + const shouldVerify = openAttestationEthereumTokenRegistryStatus.test(documentDidSigned, options); + + expect(shouldVerify).toBe(false); + }); + }); + + describe("v3", () => { + it("should return true for documents using token registry", async () => { + const shouldVerify = openAttestationEthereumTokenRegistryStatus.test(v3TokenRegistryIssued, options); + + expect(shouldVerify).toBe(true); + }); + it("should return false when document does not have OpenAttestationMetadata", async () => { + const documentWithoutOpenAttestationMetadata: any = { + ...v3TokenRegistryWrapped, + openAttestationMetadata: null, + }; + + const shouldVerify = openAttestationEthereumTokenRegistryStatus.test( + documentWithoutOpenAttestationMetadata, + options + ); + + expect(shouldVerify).toBe(false); + }); + + it("should return false when document does not have identityProof", async () => { + const documentWithoutIdentityProof: any = { + ...v3TokenRegistryWrapped, + openAttestationMetadata: { + ...v3TokenRegistryWrapped.openAttestationMetadata, + identityProof: null, + }, + }; + + const shouldVerify = openAttestationEthereumTokenRegistryStatus.test(documentWithoutIdentityProof, options); + + expect(shouldVerify).toBe(false); + }); + + it("should return false when document does not have proof", async () => { + const documentWithoutProof: any = { + ...v3TokenRegistryWrapped, + openAttestationMetadata: { + ...v3TokenRegistryWrapped.openAttestationMetadata, + proof: null, + }, + }; + + const shouldVerify = openAttestationEthereumTokenRegistryStatus.test(documentWithoutProof, options); + + expect(shouldVerify).toBe(false); + }); + + it("should return false when document does not have template", async () => { + const documentWithoutTemplate: any = { + ...v3TokenRegistryWrapped, + openAttestationMetadata: { + ...v3TokenRegistryWrapped.openAttestationMetadata, + template: null, + }, + }; + + const shouldVerify = openAttestationEthereumTokenRegistryStatus.test(documentWithoutTemplate, options); + + expect(shouldVerify).toBe(false); + }); + + it("should return false when document uses document store", async () => { + const documentUsesDocumentStore: any = { + ...v3TokenRegistryWrapped, + openAttestationMetadata: { + ...v3TokenRegistryWrapped.openAttestationMetadata, + proof: { + ...v3TokenRegistryWrapped.openAttestationMetadata.proof, + method: "DOCUMENT_STORE", + }, + }, + }; + + const shouldVerify = openAttestationEthereumTokenRegistryStatus.test(documentUsesDocumentStore, options); + + expect(shouldVerify).toBe(false); + }); + + it("should return false when document uses did signing", async () => { + const shouldVerify = openAttestationEthereumTokenRegistryStatus.test(documentDidSigned, options); + + expect(shouldVerify).toBe(false); + }); + }); +}); + +describe("verify", () => { + describe("v2", () => { + it("should return an invalid fragment when token registry is invalid", async () => { + const documentWithInvalidTokenRegistry: any = { + ...documentAstronNotIssuedTokenRegistry, + data: { + ...documentAstronNotIssuedTokenRegistry.data, + issuers: [ + { + ...documentAstronNotIssuedTokenRegistry.data.issuers[0], + tokenRegistry: "0fb5b63a-aaa5-4e6e-a6f4-391c0f6ba423:string:0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + }, + ], + }, + }; + + const fragment = await openAttestationEthereumTokenRegistryStatus.verify( + documentWithInvalidTokenRegistry, + options + ); + expect(fragment).toMatchInlineSnapshot(` + Object { + "data": Object { + "details": Array [ + Object { + "address": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "minted": false, + "reason": Object { + "code": 1, + "codeString": "DOCUMENT_NOT_MINTED", + "message": "Token registry is not found", + }, + }, + ], + "mintedOnAll": false, + }, + "name": "OpenAttestationEthereumTokenRegistryStatus", + "reason": Object { + "code": 1, + "codeString": "DOCUMENT_NOT_MINTED", + "message": "Token registry is not found", + }, + "status": "INVALID", + "type": "DOCUMENT_STATUS", + } + `); + }); + + it("should return an invalid fragment when token registry does not exist", async () => { + const documentWithMissingTokenRegistry: any = { + ...documentAstronNotIssuedTokenRegistry, + data: { + ...documentAstronNotIssuedTokenRegistry.data, + issuers: [ + { + ...documentAstronNotIssuedTokenRegistry.data.issuers[0], + tokenRegistry: "0fb5b63a-aaa5-4e6e-a6f4-391c0f6ba423:string:0x0000000000000000000000000000000000000000", + }, + ], + }, + }; + + const fragment = await openAttestationEthereumTokenRegistryStatus.verify( + documentWithMissingTokenRegistry, + options + ); + + expect(fragment).toMatchInlineSnapshot(` + Object { + "data": Object { + "details": Array [ + Object { + "address": "0x0000000000000000000000000000000000000000", + "minted": false, + "reason": Object { + "code": 1, + "codeString": "DOCUMENT_NOT_MINTED", + "message": "Token registry is not found", + }, + }, + ], + "mintedOnAll": false, + }, + "name": "OpenAttestationEthereumTokenRegistryStatus", + "reason": Object { + "code": 1, + "codeString": "DOCUMENT_NOT_MINTED", + "message": "Token registry is not found", + }, + "status": "INVALID", + "type": "DOCUMENT_STATUS", + } + `); + }); + + it("should return an invalid fragment when document with token registry has not been minted", async () => { + const fragment = await openAttestationEthereumTokenRegistryStatus.verify( + documentAstronNotIssuedTokenRegistry, + options + ); + + expect(fragment).toMatchInlineSnapshot(` + Object { + "data": Object { + "details": Array [ + Object { + "address": "0x0D5da59B93e8AC9b1781CE5694fbcE626586F4c9", + "minted": false, + "reason": Object { + "code": 1, + "codeString": "DOCUMENT_NOT_MINTED", + "message": "Document has not been issued under token registry", + }, + }, + ], + "mintedOnAll": false, + }, + "name": "OpenAttestationEthereumTokenRegistryStatus", + "reason": Object { + "code": 1, + "codeString": "DOCUMENT_NOT_MINTED", + "message": "Document has not been issued under token registry", + }, + "status": "INVALID", + "type": "DOCUMENT_STATUS", + } + `); + }); + + it("should return a valid fragment when document with token registry has been minted", async () => { + const fragment = await openAttestationEthereumTokenRegistryStatus.verify(documentAstronValidWithToken, options); + + expect(fragment).toMatchInlineSnapshot(` + Object { + "data": Object { + "details": Array [ + Object { + "address": "0x0D5da59B93e8AC9b1781CE5694fbcE626586F4c9", + "minted": true, + }, + ], + "mintedOnAll": true, + }, + "name": "OpenAttestationEthereumTokenRegistryStatus", + "status": "VALID", + "type": "DOCUMENT_STATUS", + } + `); + }); + + it("should return an error fragment when document has 2 issuers with token registry", async () => { + const documentHasTwoIssuersWithTokenRegistry: any = { + ...documentAstronValidWithToken, + data: { + ...documentAstronValidWithToken.data, + issuers: [documentAstronValidWithToken.data.issuers[0], documentAstronValidWithToken.data.issuers[0]], + }, + }; + + const fragment = await openAttestationEthereumTokenRegistryStatus.verify( + documentHasTwoIssuersWithTokenRegistry, + options + ); + + expect(fragment).toMatchInlineSnapshot(` + Object { + "data": [Error: Only one issuer is allowed for tokens], + "name": "OpenAttestationEthereumTokenRegistryStatus", + "reason": Object { + "code": 5, + "codeString": "INVALID_ISSUERS", + "message": "Only one issuer is allowed for tokens", + }, + "status": "ERROR", + "type": "DOCUMENT_STATUS", + } + `); + }); + + it("should return an error fragment when used with other issuance methods", async () => { + const fragment = await openAttestationEthereumTokenRegistryStatus.verify(documentMixedIssuance, options); + + expect(fragment).toMatchInlineSnapshot(` + Object { + "data": [Error: Only one issuer is allowed for tokens], + "name": "OpenAttestationEthereumTokenRegistryStatus", + "reason": Object { + "code": 5, + "codeString": "INVALID_ISSUERS", + "message": "Only one issuer is allowed for tokens", + }, + "status": "ERROR", + "type": "DOCUMENT_STATUS", + } + `); + }); + }); + + describe("v3", () => { + it("should return an invalid fragment when token registry is invalid", async () => { + const documentWithInvalidTokenRegistry: any = { + ...v3TokenRegistryWrapped, + openAttestationMetadata: { + ...v3TokenRegistryWrapped.openAttestationMetadata, + proof: { + ...v3TokenRegistryWrapped.openAttestationMetadata.proof, + value: "0xabcd", + }, + }, + }; + + const fragment = await openAttestationEthereumTokenRegistryStatus.verify( + documentWithInvalidTokenRegistry, + options + ); + + expect(fragment).toMatchInlineSnapshot(` + Object { + "data": Object { + "details": Object { + "address": "0xabcd", + "minted": false, + "reason": Object { + "code": 1, + "codeString": "DOCUMENT_NOT_MINTED", + "message": "Invalid token registry address", + }, + }, + "mintedOnAll": false, + }, + "name": "OpenAttestationEthereumTokenRegistryStatus", + "reason": Object { + "code": 1, + "codeString": "DOCUMENT_NOT_MINTED", + "message": "Invalid token registry address", + }, + "status": "INVALID", + "type": "DOCUMENT_STATUS", + } + `); + }); + + it("should return an invalid fragment when token registry does not exist", async () => { + const documentWithMissingTokenRegistry: any = { + ...v3TokenRegistryWrapped, + openAttestationMetadata: { + ...v3TokenRegistryWrapped.openAttestationMetadata, + proof: { + ...v3TokenRegistryWrapped.openAttestationMetadata.proof, + value: "0x0000000000000000000000000000000000000000", + }, + }, + }; + + const fragment = await openAttestationEthereumTokenRegistryStatus.verify( + documentWithMissingTokenRegistry, + options + ); + + expect(fragment).toMatchInlineSnapshot(` + Object { + "data": Object { + "details": Object { + "address": "0x0000000000000000000000000000000000000000", + "minted": false, + "reason": Object { + "code": 1, + "codeString": "DOCUMENT_NOT_MINTED", + "message": "Token registry is not found", + }, + }, + "mintedOnAll": false, + }, + "name": "OpenAttestationEthereumTokenRegistryStatus", + "reason": Object { + "code": 1, + "codeString": "DOCUMENT_NOT_MINTED", + "message": "Token registry is not found", + }, + "status": "INVALID", + "type": "DOCUMENT_STATUS", + } + `); + }); + + it("should return an invalid fragment when document with token registry has not been minted", async () => { + const fragment = await openAttestationEthereumTokenRegistryStatus.verify(v3TokenRegistryWrapped, options); + + expect(fragment).toMatchInlineSnapshot(` + Object { + "data": Object { + "details": Object { + "address": "0x0D5da59B93e8AC9b1781CE5694fbcE626586F4c9", + "minted": false, + "reason": Object { + "code": 1, + "codeString": "DOCUMENT_NOT_MINTED", + "message": "Document has not been issued under token registry", + }, + }, + "mintedOnAll": false, + }, + "name": "OpenAttestationEthereumTokenRegistryStatus", + "reason": Object { + "code": 1, + "codeString": "DOCUMENT_NOT_MINTED", + "message": "Document has not been issued under token registry", + }, + "status": "INVALID", + "type": "DOCUMENT_STATUS", + } + `); + }); + + it("should return a valid fragment when document with token registry has been minted", async () => { + const fragment = await openAttestationEthereumTokenRegistryStatus.verify(v3TokenRegistryIssued, options); + + expect(fragment).toMatchInlineSnapshot(` + Object { + "data": Object { + "details": Object { + "address": "0x0D5da59B93e8AC9b1781CE5694fbcE626586F4c9", + "minted": true, + }, + "mintedOnAll": true, + }, + "name": "OpenAttestationEthereumTokenRegistryStatus", + "status": "VALID", + "type": "DOCUMENT_STATUS", + } + `); + }); + }); +}); + +describe("skip", () => { + it("should return the skip fragment", async () => { + const fragment = await openAttestationEthereumTokenRegistryStatus.skip( + documentAstronNotIssuedTokenRegistry, + options + ); + expect(fragment).toMatchInlineSnapshot(` + Object { + "name": "OpenAttestationEthereumTokenRegistryStatus", + "reason": Object { + "code": 4, + "codeString": "SKIPPED", + "message": "Document issuers doesn't have \\"tokenRegistry\\" property or TOKEN_REGISTRY method", + }, + "status": "SKIPPED", + "type": "DOCUMENT_STATUS", + } + `); + }); +}); diff --git a/test/fixtures/v2/documentAstronNotIssuedTokenRegistry.ts b/test/fixtures/v2/documentAstronNotIssuedTokenRegistry.ts new file mode 100644 index 00000000..7b3bc7b2 --- /dev/null +++ b/test/fixtures/v2/documentAstronNotIssuedTokenRegistry.ts @@ -0,0 +1,38 @@ +import { SchemaId, v2, WrappedDocument } from "@tradetrust-tt/tradetrust"; + +interface CustomDocument extends v2.OpenAttestationDocument { + recipient: { + name: string; + }; +} + +export const documentAstronNotIssuedTokenRegistry: WrappedDocument = { + version: SchemaId.v2, + data: { + id: "afaecf00-c60e-4b2d-8e89-00058291cc64:string:53b75bbe", + $template: { + name: "9aca2fb8-6c44-44ef-b216-1af29fd17900:string:GOVTECH_DEMO", + type: "762eb970-b6f8-48d1-84f4-658ed4d9e4d8:string:EMBEDDED_RENDERER", + url: "0a6d97f1-e2c2-4745-9618-43a12d5e5917:string:https://demo-renderer.opencerts.io", + }, + issuers: [ + { + name: "f296229f-5787-43f8-b99c-e9a8a4fd83af:string:caict astron", + tokenRegistry: "99b518eb-d5bd-43d1-b7bd-c33bb6f659ee:string:0x0D5da59B93e8AC9b1781CE5694fbcE626586F4c9", + identityProof: { + type: "2c4ebeeb-3add-4253-859f-a1517c71c321:string:DNS-TXT", + location: "617e3f57-06ad-4db4-ae9c-0f486ad8ea9c:string:astronlayer2.bitfactory.cn", + }, + }, + ], + recipient: { + name: "def72d81-06b0-488e-9823-c025ac6cd48d:string:caict", + }, + }, + signature: { + type: "SHA3MerkleProof", + targetHash: "636f9fdece5c77d2be5278576819d8f1c36e9a594f2c3675327165356b680ec8", + proof: [], + merkleRoot: "636f9fdece5c77d2be5278576819d8f1c36e9a594f2c3675327165356b680ec8", + }, +}; diff --git a/test/fixtures/v2/documentAstronValidWithToken.ts b/test/fixtures/v2/documentAstronValidWithToken.ts new file mode 100644 index 00000000..280b6ddf --- /dev/null +++ b/test/fixtures/v2/documentAstronValidWithToken.ts @@ -0,0 +1,38 @@ +import { SchemaId, v2, WrappedDocument } from "@tradetrust-tt/tradetrust"; + +interface CustomDocument extends v2.OpenAttestationDocument { + recipient: { + name: string; + }; +} + +export const documentAstronValidWithToken: WrappedDocument = { + version: SchemaId.v2, + data: { + id: "dca1ce12-d96e-4969-8849-13ce5c7a0bb0:string:53b75bbe", + $template: { + name: "f4c6f2e9-4d70-45df-b811-f9a1131c23ee:string:GOVTECH_DEMO", + type: "e7a91e7a-f68b-437c-85bc-f27925e1306c:string:EMBEDDED_RENDERER", + url: "d3383e4c-9132-46de-9aff-a900bc1acc26:string:https://demo-renderer.opencerts.io", + }, + issuers: [ + { + name: "273d6f8c-da18-46cf-b4d6-df87177f0816:string:caict astron", + tokenRegistry: "d3c8f3e7-577d-4abe-9b75-4ea9e9570f44:string:0x0D5da59B93e8AC9b1781CE5694fbcE626586F4c9", + identityProof: { + type: "7f16acb8-eff4-4dc7-b80d-6abd006f8930:string:DNS-TXT", + location: "15414aad-d0f8-47f0-8a21-1f7f2775ce2f:string:astronlayer2.bitfactory.cn", + }, + }, + ], + recipient: { + name: "a3ba2c31-a8fe-4489-a478-f0050ce3654e:string:caict", + }, + }, + signature: { + type: "SHA3MerkleProof", + targetHash: "af1e44ff058bde3770776d09d5a1b9f8eb210ca62f8c1cf93cff3c0ba0ec575a", + proof: [], + merkleRoot: "af1e44ff058bde3770776d09d5a1b9f8eb210ca62f8c1cf93cff3c0ba0ec575a", + }, +}; diff --git a/test/fixtures/v3/astronTokenRegistry-issued.json b/test/fixtures/v3/astronTokenRegistry-issued.json new file mode 100644 index 00000000..aa16ee06 --- /dev/null +++ b/test/fixtures/v3/astronTokenRegistry-issued.json @@ -0,0 +1,70 @@ +{ + "version": "https://schema.openattestation.com/3.0/schema.json", + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://schemata.openattestation.com/com/openattestation/1.0/DrivingLicenceCredential.json", + "https://schemata.openattestation.com/com/openattestation/1.0/OpenAttestation.v3.json", + "https://schemata.openattestation.com/com/openattestation/1.0/CustomContext.json" + ], + "reference": "SERIAL_NUMBER_123", + "name": "Republic of Singapore Driving Licence", + "issuanceDate": "2010-01-01T19:23:24Z", + "validFrom": "2010-01-01T19:23:24Z", + "issuer": { + "id": "https://example.com", + "type": "OpenAttestationIssuer", + "name": "DEMO STORE" + }, + "type": [ + "VerifiableCredential", + "DrivingLicenceCredential", + "OpenAttestationCredential" + ], + "credentialSubject": { + "id": "did:example:SERIAL_NUMBER_123", + "class": [ + { + "type": "3", + "effectiveDate": "2010-01-01T19:23:24Z" + }, + { + "type": "3A", + "effectiveDate": "2010-01-01T19:23:24Z" + } + ] + }, + "openAttestationMetadata": { + "template": { + "name": "CUSTOM_TEMPLATE", + "type": "EMBEDDED_RENDERER", + "url": "https://localhost:3000/renderer" + }, + "proof": { + "type": "OpenAttestationProofMethod", + "method": "TOKEN_REGISTRY", + "value": "0x0D5da59B93e8AC9b1781CE5694fbcE626586F4c9" + }, + "identityProof": { + "type": "DNS-TXT", + "identifier": "astronlayer2.bitfactory.cn" + } + }, + "attachments": [ + { + "fileName": "sample.pdf", + "mimeType": "application/pdf", + "data": "BASE64_ENCODED_FILE" + } + ], + "proof": { + "type": "OpenAttestationMerkleProofSignature2018", + "proofPurpose": "assertionMethod", + "targetHash": "4916814ca7a0b9e9872094de337fa4427414d9bbdcf069e503a8146c96acd700", + "proofs": [], + "merkleRoot": "4916814ca7a0b9e9872094de337fa4427414d9bbdcf069e503a8146c96acd700", + "salts": "W3sidmFsdWUiOiIzMDBkZDUwMjgxM2Q4ZTUxMjk1MDdiMzBlZmM1MDNlMzgxODNjMjVmZTE5OTBlODg3OWJlYzU2YjY5YWMyMjA3IiwicGF0aCI6InZlcnNpb24ifSx7InZhbHVlIjoiZDI2YTIwNWJjMzkxMTVmNGJlZGQ3NjM0YzlhMDgzOTI1ZjhlMTI0MDZhZTJiOTYzZWMwMGNlZDZkNTQwYjcwYyIsInBhdGgiOiJAY29udGV4dFswXSJ9LHsidmFsdWUiOiJjMDZmMjdlZmZiZTZiNDU1NTI3YWVkODkyZTE0ZGRkNWFjZjBhNWI0Y2MzNDIxY2MwZTU3ZWFiOGRlYzRhYTg1IiwicGF0aCI6IkBjb250ZXh0WzFdIn0seyJ2YWx1ZSI6IjRiOGVjNTE4YWYwMTc5NzliZTRkYTNiMGJlYTYzODQ5MWYzZWY4MzNjZjcwZmQ1YjU3ZWMzNDlmOWIzYzcyY2QiLCJwYXRoIjoiQGNvbnRleHRbMl0ifSx7InZhbHVlIjoiMjU4M2Y0YmJhOTg3MWFjOTJjZDIwZWZiZjk1M2Q4MjZiZmU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0aW9uTWV0YWRhdGEucHJvb2YudmFsdWUifSx7InZhbHVlIjoiYWE0MzFmNjg5YThiMTEwYWY4MjVkMTA0NTdhMzNjYzYzY2M2NjkwZDY4YmMxMGI0YTZlZGE2ZTVlZDY1MjVlNiIsInBhdGgiOiJvcGVuQXR0ZXN0YXRpb25NZXRhZGF0YS5pZGVudGl0eVByb29mLnR5cGUifSx7InZhbHVlIjoiMmI4YTMwMTYxYzUxMDMxYjkwYTNkNzJiOWRmZWRiNjBhN2IwY2IyYjM4ZGQ1ZWJlN2U0ZmIxMzFhMjFmMzk5MCIsInBhdGgiOiJvcGVuQXR0ZXN0YXRpb25NZXRhZGF0YS5pZGVudGl0eVByb29mLmlkZW50aWZpZXIifSx7InZhbHVlIjoiMDAyZjE1NmFkMTEzZGZhMTQzOWExNDllMmU1YWY5NzNjNjViYzIyZjI2YmU4OWYwMWU0MDNlYWIxNmI0ZDY2MiIsInBhdGgiOiJhdHRhY2htZW50c1swXS5maWxlTmFtZSJ9LHsidmFsdWUiOiIyODk5ZmFlZGNmMTJhYjAxYzJhYThiNWU4MDg3ODNlZmIzYzQxMzkzYzcwZTE5ZTExNDJiYjZmOTFmOGE1NjIyIiwicGF0aCI6ImF0dGFjaG1lbnRzWzBdLm1pbWVUeXBlIn0seyJ2YWx1ZSI6IjgyYjk5ZmE4OWI0N2I0OGMwY2M4MDNjZjI5MWFhZGIyYTc3OTRkY2M3NWE2ZGFjODA4Yzc2NWY2MjlmOWU1MWIiLCJwYXRoIjoiYXR0YWNobWVudHNbMF0uZGF0YSJ9XQ==", + "privacy": { + "obfuscated": [] + } + } + } \ No newline at end of file diff --git a/test/fixtures/v3/astronTokenRegistry-wrapped.json b/test/fixtures/v3/astronTokenRegistry-wrapped.json new file mode 100644 index 00000000..837c2db0 --- /dev/null +++ b/test/fixtures/v3/astronTokenRegistry-wrapped.json @@ -0,0 +1,70 @@ +{ + "version": "https://schema.openattestation.com/3.0/schema.json", + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://schemata.openattestation.com/com/openattestation/1.0/DrivingLicenceCredential.json", + "https://schemata.openattestation.com/com/openattestation/1.0/OpenAttestation.v3.json", + "https://schemata.openattestation.com/com/openattestation/1.0/CustomContext.json" + ], + "reference": "SERIAL_NUMBER_123", + "name": "Republic of Singapore Driving Licence", + "issuanceDate": "2010-01-01T19:23:24Z", + "validFrom": "2010-01-01T19:23:24Z", + "issuer": { + "id": "https://example.com", + "type": "OpenAttestationIssuer", + "name": "DEMO STORE" + }, + "type": [ + "VerifiableCredential", + "DrivingLicenceCredential", + "OpenAttestationCredential" + ], + "credentialSubject": { + "id": "did:example:SERIAL_NUMBER_123", + "class": [ + { + "type": "3", + "effectiveDate": "2010-01-01T19:23:24Z" + }, + { + "type": "3A", + "effectiveDate": "2010-01-01T19:23:24Z" + } + ] + }, + "openAttestationMetadata": { + "template": { + "name": "CUSTOM_TEMPLATE", + "type": "EMBEDDED_RENDERER", + "url": "https://localhost:3000/renderer" + }, + "proof": { + "type": "OpenAttestationProofMethod", + "method": "TOKEN_REGISTRY", + "value": "0x0D5da59B93e8AC9b1781CE5694fbcE626586F4c9" + }, + "identityProof": { + "type": "DNS-TXT", + "identifier": "astronlayer2.bitfactory.cn" + } + }, + "attachments": [ + { + "fileName": "sample.pdf", + "mimeType": "application/pdf", + "data": "BASE64_ENCODED_FILE" + } + ], + "proof": { + "type": "OpenAttestationMerkleProofSignature2018", + "proofPurpose": "assertionMethod", + "targetHash": "79f882eef734ebd7306f796ebb648996ea85d7d09d353aec9d59bf72166f3e91", + "proofs": [], + "merkleRoot": "79f882eef734ebd7306f796ebb648996ea85d7d09d353aec9d59bf72166f3e91", + "salts": "W3sidmFsdWUiOiI1NGE5NjQ0ODMwY2IwNWY4NWQyOWVkNmZhMWYxNGRkNjJkZGY4NDg4YWJiN2U3ODM4NzQ0YjdjNmE3NTY4ZjMxIiwicGF0aCI6InZlcnNpb24ifSx7InZhbHVlIjoiMTU2NGRhMzJlNDJlYjI4ZGEzNT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Y4ZDFkMTUyNWQ3ZGRmIiwicGF0aCI6ImF0dGFjaG1lbnRzWzBdLm1pbWVUeXBlIn0seyJ2YWx1ZSI6IjY1YzhiZGNkZTM0MGZhYzhkMDJlZTM0YjQzOTQ5YTZlZjUyOGIwYjM1Mjg2YTIzZWJjNWVkMjM3ODUzYjBhMjYiLCJwYXRoIjoiYXR0YWNobWVudHNbMF0uZGF0YSJ9XQ==", + "privacy": { + "obfuscated": [] + } + } + } \ No newline at end of file From 588a54a7d77f809562d93faaf02a3c8b8be82f6d Mon Sep 17 00:00:00 2001 From: maxufeng Date: Fri, 1 Nov 2024 14:20:15 +0800 Subject: [PATCH 2/2] chore: update test case to verify v2 token-registry document valid --- .../tokenRegistry/ethereumAstronTokenRegistryStatus.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/verifiers/documentStatus/tokenRegistry/ethereumAstronTokenRegistryStatus.test.ts b/src/verifiers/documentStatus/tokenRegistry/ethereumAstronTokenRegistryStatus.test.ts index d196639f..1f228be8 100644 --- a/src/verifiers/documentStatus/tokenRegistry/ethereumAstronTokenRegistryStatus.test.ts +++ b/src/verifiers/documentStatus/tokenRegistry/ethereumAstronTokenRegistryStatus.test.ts @@ -24,6 +24,11 @@ const options = { describe("test", () => { describe("v2", () => { + it("should return true for documents using token registry", async () => { + const shouldVerify = openAttestationEthereumTokenRegistryStatus.test(documentAstronValidWithToken, options); + + expect(shouldVerify).toBe(true); + }); it("should return false when document does not have data", async () => { const documentWithoutData: any = { ...documentAstronValidWithToken, data: null }; const shouldVerify = openAttestationEthereumTokenRegistryStatus.test(documentWithoutData, options);