@notabene/verify-proof 1.12.0-next.2 → 1.12.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{concordium-QRNV23F7.js → concordium-55YCWLCX.js} +16 -18
- package/dist/concordium-55YCWLCX.js.map +1 -0
- package/dist/{concordium-YD34X2QM.cjs → concordium-5FMO6ONK.cjs} +16 -18
- package/dist/concordium-5FMO6ONK.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -2
- package/src/concordium.ts +22 -27
- package/src/tests/xrpl.test.ts +8 -6
- package/dist/concordium-QRNV23F7.js.map +0 -1
- package/dist/concordium-YD34X2QM.cjs.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Buffer } from 'buffer';
|
|
2
2
|
import './chunk-E3V5ATTC.js';
|
|
3
3
|
import { ProofStatus } from '@notabene/javascript-sdk';
|
|
4
|
-
import { ConcordiumGRPCWebClient, getPublicData, verifyPresentation } from '@concordium/web-sdk';
|
|
5
4
|
|
|
6
5
|
if (typeof globalThis !== 'undefined' && !globalThis.Buffer) { globalThis.Buffer = Buffer; }
|
|
6
|
+
var CONCORDIUM_VERIFIER_URL = "https://web3id-verifier.mainnet.concordium.software";
|
|
7
7
|
var verifyConcordiumSignature = async (proof) => {
|
|
8
|
+
const [ns] = proof.address.split(/:/);
|
|
9
|
+
if (ns !== "ccd") {
|
|
10
|
+
return { ...proof, status: ProofStatus.FAILED };
|
|
11
|
+
}
|
|
8
12
|
try {
|
|
9
|
-
const grpcWebClient = new ConcordiumGRPCWebClient(
|
|
10
|
-
"https://grpc.mainnet.concordium.software",
|
|
11
|
-
2e4
|
|
12
|
-
);
|
|
13
13
|
const presentationJson = JSON.parse(proof.proof);
|
|
14
14
|
if (presentationJson.presentationContext !== proof.attestation) {
|
|
15
15
|
throw new Error("Presentation context does not match attestation");
|
|
@@ -17,17 +17,15 @@ var verifyConcordiumSignature = async (proof) => {
|
|
|
17
17
|
if (!presentationJson.verifiableCredential || presentationJson.verifiableCredential.length === 0) {
|
|
18
18
|
throw new Error("Verifiable credential is missing or empty");
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
publicData.map((p) => p.inputs)
|
|
30
|
-
);
|
|
20
|
+
const response = await fetch(`${CONCORDIUM_VERIFIER_URL}/v0/verify`, {
|
|
21
|
+
method: "POST",
|
|
22
|
+
headers: { "Content-Type": "application/json" },
|
|
23
|
+
body: JSON.stringify(presentationJson)
|
|
24
|
+
});
|
|
25
|
+
if (!response.ok) {
|
|
26
|
+
const errorText = await response.text();
|
|
27
|
+
throw new Error(`Verifier returned ${response.status}: ${errorText}`);
|
|
28
|
+
}
|
|
31
29
|
return {
|
|
32
30
|
...proof,
|
|
33
31
|
status: ProofStatus.VERIFIED
|
|
@@ -41,5 +39,5 @@ var verifyConcordiumSignature = async (proof) => {
|
|
|
41
39
|
};
|
|
42
40
|
|
|
43
41
|
export { verifyConcordiumSignature };
|
|
44
|
-
//# sourceMappingURL=concordium-
|
|
45
|
-
//# sourceMappingURL=concordium-
|
|
42
|
+
//# sourceMappingURL=concordium-55YCWLCX.js.map
|
|
43
|
+
//# sourceMappingURL=concordium-55YCWLCX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/concordium.ts"],"names":[],"mappings":";;;;;AAGA,IAAM,uBAAA,GACJ,qDAAA;AAOK,IAAM,yBAAA,GAA4B,OACvC,KAAA,KAC4B;AAC5B,EAAA,MAAM,CAAC,EAAE,CAAA,GAAI,KAAA,CAAM,OAAA,CAAQ,MAAM,GAAG,CAAA;AAEpC,EAAA,IAAI,OAAO,KAAA,EAAO;AAChB,IAAA,OAAO,EAAE,GAAG,KAAA,EAAO,MAAA,EAAQ,YAAY,MAAA,EAAO;AAAA,EAChD;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,gBAAA,GAAmB,IAAA,CAAK,KAAA,CAAM,KAAA,CAAM,KAAK,CAAA;AAG/C,IAAA,IAAI,gBAAA,CAAiB,mBAAA,KAAwB,KAAA,CAAM,WAAA,EAAa;AAC9D,MAAA,MAAM,IAAI,MAAM,iDAAiD,CAAA;AAAA,IACnE;AAGA,IAAA,IACE,CAAC,gBAAA,CAAiB,oBAAA,IAClB,gBAAA,CAAiB,oBAAA,CAAqB,WAAW,CAAA,EACjD;AACA,MAAA,MAAM,IAAI,MAAM,2CAA2C,CAAA;AAAA,IAC7D;AAGA,IAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CAAM,CAAA,EAAG,uBAAuB,CAAA,UAAA,CAAA,EAAc;AAAA,MACnE,MAAA,EAAQ,MAAA;AAAA,MACR,OAAA,EAAS,EAAE,cAAA,EAAgB,kBAAA,EAAmB;AAAA,MAC9C,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,gBAAgB;AAAA,KACtC,CAAA;AAED,IAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,MAAA,MAAM,SAAA,GAAY,MAAM,QAAA,CAAS,IAAA,EAAK;AACtC,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,kBAAA,EAAqB,SAAS,MAAM,CAAA,EAAA,EAAK,SAAS,CAAA,CAAE,CAAA;AAAA,IACtE;AAGA,IAAA,OAAO;AAAA,MACL,GAAG,KAAA;AAAA,MACH,QAAQ,WAAA,CAAY;AAAA,KACtB;AAAA,EACF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO;AAAA,MACL,GAAG,KAAA;AAAA,MACH,QAAQ,WAAA,CAAY;AAAA,KACtB;AAAA,EACF;AACF","file":"concordium-55YCWLCX.js","sourcesContent":["import { ProofStatus, SignatureProof } from \"@notabene/javascript-sdk\";\nimport { VerifiablePresentation } from \"@concordium/web-sdk\";\n\nconst CONCORDIUM_VERIFIER_URL =\n \"https://web3id-verifier.mainnet.concordium.software\";\n\n/**\n * Verifies a Concordium signature proof using Concordium's hosted verifier service\n * @param proof The signature proof to verify\n * @returns Promise resolving to the proof with updated status\n */\nexport const verifyConcordiumSignature = async (\n proof: SignatureProof,\n): Promise<SignatureProof> => {\n const [ns] = proof.address.split(/:/);\n\n if (ns !== \"ccd\") {\n return { ...proof, status: ProofStatus.FAILED };\n }\n\n try {\n const presentationJson = JSON.parse(proof.proof) as VerifiablePresentation;\n\n // Validate presentation context matches attestation\n if (presentationJson.presentationContext !== proof.attestation) {\n throw new Error(\"Presentation context does not match attestation\");\n }\n\n // Validate verifiableCredential exists and is not empty\n if (\n !presentationJson.verifiableCredential ||\n presentationJson.verifiableCredential.length === 0\n ) {\n throw new Error(\"Verifiable credential is missing or empty\");\n }\n\n // Use Concordium's hosted verifier instead of gRPC\n const response = await fetch(`${CONCORDIUM_VERIFIER_URL}/v0/verify`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(presentationJson),\n });\n\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(`Verifier returned ${response.status}: ${errorText}`);\n }\n\n // If we get here, the proof is valid\n return {\n ...proof,\n status: ProofStatus.VERIFIED,\n };\n } catch {\n return {\n ...proof,\n status: ProofStatus.FAILED,\n };\n }\n};\n"]}
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
var buffer = require('buffer');
|
|
4
4
|
require('./chunk-OAXNH5XR.cjs');
|
|
5
5
|
var javascriptSdk = require('@notabene/javascript-sdk');
|
|
6
|
-
var webSdk = require('@concordium/web-sdk');
|
|
7
6
|
|
|
8
7
|
if (typeof globalThis !== 'undefined' && !globalThis.Buffer) { globalThis.Buffer = buffer.Buffer; }
|
|
8
|
+
var CONCORDIUM_VERIFIER_URL = "https://web3id-verifier.mainnet.concordium.software";
|
|
9
9
|
var verifyConcordiumSignature = async (proof) => {
|
|
10
|
+
const [ns] = proof.address.split(/:/);
|
|
11
|
+
if (ns !== "ccd") {
|
|
12
|
+
return { ...proof, status: javascriptSdk.ProofStatus.FAILED };
|
|
13
|
+
}
|
|
10
14
|
try {
|
|
11
|
-
const grpcWebClient = new webSdk.ConcordiumGRPCWebClient(
|
|
12
|
-
"https://grpc.mainnet.concordium.software",
|
|
13
|
-
2e4
|
|
14
|
-
);
|
|
15
15
|
const presentationJson = JSON.parse(proof.proof);
|
|
16
16
|
if (presentationJson.presentationContext !== proof.attestation) {
|
|
17
17
|
throw new Error("Presentation context does not match attestation");
|
|
@@ -19,17 +19,15 @@ var verifyConcordiumSignature = async (proof) => {
|
|
|
19
19
|
if (!presentationJson.verifiableCredential || presentationJson.verifiableCredential.length === 0) {
|
|
20
20
|
throw new Error("Verifiable credential is missing or empty");
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
publicData.map((p) => p.inputs)
|
|
32
|
-
);
|
|
22
|
+
const response = await fetch(`${CONCORDIUM_VERIFIER_URL}/v0/verify`, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers: { "Content-Type": "application/json" },
|
|
25
|
+
body: JSON.stringify(presentationJson)
|
|
26
|
+
});
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
const errorText = await response.text();
|
|
29
|
+
throw new Error(`Verifier returned ${response.status}: ${errorText}`);
|
|
30
|
+
}
|
|
33
31
|
return {
|
|
34
32
|
...proof,
|
|
35
33
|
status: javascriptSdk.ProofStatus.VERIFIED
|
|
@@ -43,5 +41,5 @@ var verifyConcordiumSignature = async (proof) => {
|
|
|
43
41
|
};
|
|
44
42
|
|
|
45
43
|
exports.verifyConcordiumSignature = verifyConcordiumSignature;
|
|
46
|
-
//# sourceMappingURL=concordium-
|
|
47
|
-
//# sourceMappingURL=concordium-
|
|
44
|
+
//# sourceMappingURL=concordium-5FMO6ONK.cjs.map
|
|
45
|
+
//# sourceMappingURL=concordium-5FMO6ONK.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/concordium.ts"],"names":["ProofStatus"],"mappings":";;;;;;;AAGA,IAAM,uBAAA,GACJ,qDAAA;AAOK,IAAM,yBAAA,GAA4B,OACvC,KAAA,KAC4B;AAC5B,EAAA,MAAM,CAAC,EAAE,CAAA,GAAI,KAAA,CAAM,OAAA,CAAQ,MAAM,GAAG,CAAA;AAEpC,EAAA,IAAI,OAAO,KAAA,EAAO;AAChB,IAAA,OAAO,EAAE,GAAG,KAAA,EAAO,MAAA,EAAQA,0BAAY,MAAA,EAAO;AAAA,EAChD;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,gBAAA,GAAmB,IAAA,CAAK,KAAA,CAAM,KAAA,CAAM,KAAK,CAAA;AAG/C,IAAA,IAAI,gBAAA,CAAiB,mBAAA,KAAwB,KAAA,CAAM,WAAA,EAAa;AAC9D,MAAA,MAAM,IAAI,MAAM,iDAAiD,CAAA;AAAA,IACnE;AAGA,IAAA,IACE,CAAC,gBAAA,CAAiB,oBAAA,IAClB,gBAAA,CAAiB,oBAAA,CAAqB,WAAW,CAAA,EACjD;AACA,MAAA,MAAM,IAAI,MAAM,2CAA2C,CAAA;AAAA,IAC7D;AAGA,IAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CAAM,CAAA,EAAG,uBAAuB,CAAA,UAAA,CAAA,EAAc;AAAA,MACnE,MAAA,EAAQ,MAAA;AAAA,MACR,OAAA,EAAS,EAAE,cAAA,EAAgB,kBAAA,EAAmB;AAAA,MAC9C,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,gBAAgB;AAAA,KACtC,CAAA;AAED,IAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,MAAA,MAAM,SAAA,GAAY,MAAM,QAAA,CAAS,IAAA,EAAK;AACtC,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,kBAAA,EAAqB,SAAS,MAAM,CAAA,EAAA,EAAK,SAAS,CAAA,CAAE,CAAA;AAAA,IACtE;AAGA,IAAA,OAAO;AAAA,MACL,GAAG,KAAA;AAAA,MACH,QAAQA,yBAAA,CAAY;AAAA,KACtB;AAAA,EACF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO;AAAA,MACL,GAAG,KAAA;AAAA,MACH,QAAQA,yBAAA,CAAY;AAAA,KACtB;AAAA,EACF;AACF","file":"concordium-5FMO6ONK.cjs","sourcesContent":["import { ProofStatus, SignatureProof } from \"@notabene/javascript-sdk\";\nimport { VerifiablePresentation } from \"@concordium/web-sdk\";\n\nconst CONCORDIUM_VERIFIER_URL =\n \"https://web3id-verifier.mainnet.concordium.software\";\n\n/**\n * Verifies a Concordium signature proof using Concordium's hosted verifier service\n * @param proof The signature proof to verify\n * @returns Promise resolving to the proof with updated status\n */\nexport const verifyConcordiumSignature = async (\n proof: SignatureProof,\n): Promise<SignatureProof> => {\n const [ns] = proof.address.split(/:/);\n\n if (ns !== \"ccd\") {\n return { ...proof, status: ProofStatus.FAILED };\n }\n\n try {\n const presentationJson = JSON.parse(proof.proof) as VerifiablePresentation;\n\n // Validate presentation context matches attestation\n if (presentationJson.presentationContext !== proof.attestation) {\n throw new Error(\"Presentation context does not match attestation\");\n }\n\n // Validate verifiableCredential exists and is not empty\n if (\n !presentationJson.verifiableCredential ||\n presentationJson.verifiableCredential.length === 0\n ) {\n throw new Error(\"Verifiable credential is missing or empty\");\n }\n\n // Use Concordium's hosted verifier instead of gRPC\n const response = await fetch(`${CONCORDIUM_VERIFIER_URL}/v0/verify`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(presentationJson),\n });\n\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(`Verifier returned ${response.status}: ${errorText}`);\n }\n\n // If we get here, the proof is valid\n return {\n ...proof,\n status: ProofStatus.VERIFIED,\n };\n } catch {\n return {\n ...proof,\n status: ProofStatus.FAILED,\n };\n }\n};\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ async function verifyProof(proof, publicKey) {
|
|
|
42
42
|
return verifyStellarSignature(proof);
|
|
43
43
|
}
|
|
44
44
|
case javascriptSdk.ProofTypes.CONCORDIUM: {
|
|
45
|
-
const { verifyConcordiumSignature } = await import('./concordium-
|
|
45
|
+
const { verifyConcordiumSignature } = await import('./concordium-5FMO6ONK.cjs');
|
|
46
46
|
return verifyConcordiumSignature(proof);
|
|
47
47
|
}
|
|
48
48
|
case javascriptSdk.ProofTypes.COSMOS: {
|
package/dist/index.js
CHANGED
|
@@ -40,7 +40,7 @@ async function verifyProof(proof, publicKey) {
|
|
|
40
40
|
return verifyStellarSignature(proof);
|
|
41
41
|
}
|
|
42
42
|
case ProofTypes.CONCORDIUM: {
|
|
43
|
-
const { verifyConcordiumSignature } = await import('./concordium-
|
|
43
|
+
const { verifyConcordiumSignature } = await import('./concordium-55YCWLCX.js');
|
|
44
44
|
return verifyConcordiumSignature(proof);
|
|
45
45
|
}
|
|
46
46
|
case ProofTypes.COSMOS: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notabene/verify-proof",
|
|
3
|
-
"version": "1.12.0-next.
|
|
3
|
+
"version": "1.12.0-next.4",
|
|
4
4
|
"description": "Verify ownership proofs",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@cardano-foundation/cardano-verify-datasignature": "^1.0.11",
|
|
55
|
-
"@concordium/web-sdk": "^11.0.0",
|
|
56
55
|
"@cosmjs/amino": "^0.34.0",
|
|
57
56
|
"@noble/curves": "^1.7.0",
|
|
58
57
|
"@notabene/javascript-sdk": "2.11.0-next.2",
|
package/src/concordium.ts
CHANGED
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import { ProofStatus, SignatureProof } from "@notabene/javascript-sdk";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
getPublicData,
|
|
7
|
-
} from "@concordium/web-sdk";
|
|
2
|
+
import { VerifiablePresentation } from "@concordium/web-sdk";
|
|
3
|
+
|
|
4
|
+
const CONCORDIUM_VERIFIER_URL =
|
|
5
|
+
"https://web3id-verifier.mainnet.concordium.software";
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
|
-
* Verifies a Concordium signature proof
|
|
8
|
+
* Verifies a Concordium signature proof using Concordium's hosted verifier service
|
|
11
9
|
* @param proof The signature proof to verify
|
|
12
|
-
* @param options Optional configuration for network and timeouts
|
|
13
10
|
* @returns Promise resolving to the proof with updated status
|
|
14
11
|
*/
|
|
15
12
|
export const verifyConcordiumSignature = async (
|
|
16
13
|
proof: SignatureProof,
|
|
17
14
|
): Promise<SignatureProof> => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
);
|
|
15
|
+
const [ns] = proof.address.split(/:/);
|
|
16
|
+
|
|
17
|
+
if (ns !== "ccd") {
|
|
18
|
+
return { ...proof, status: ProofStatus.FAILED };
|
|
19
|
+
}
|
|
24
20
|
|
|
25
|
-
|
|
21
|
+
try {
|
|
26
22
|
const presentationJson = JSON.parse(proof.proof) as VerifiablePresentation;
|
|
27
23
|
|
|
28
24
|
// Validate presentation context matches attestation
|
|
@@ -38,20 +34,19 @@ export const verifyConcordiumSignature = async (
|
|
|
38
34
|
throw new Error("Verifiable credential is missing or empty");
|
|
39
35
|
}
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
);
|
|
37
|
+
// Use Concordium's hosted verifier instead of gRPC
|
|
38
|
+
const response = await fetch(`${CONCORDIUM_VERIFIER_URL}/v0/verify`, {
|
|
39
|
+
method: "POST",
|
|
40
|
+
headers: { "Content-Type": "application/json" },
|
|
41
|
+
body: JSON.stringify(presentationJson),
|
|
42
|
+
});
|
|
48
43
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
);
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
const errorText = await response.text();
|
|
46
|
+
throw new Error(`Verifier returned ${response.status}: ${errorText}`);
|
|
47
|
+
}
|
|
54
48
|
|
|
49
|
+
// If we get here, the proof is valid
|
|
55
50
|
return {
|
|
56
51
|
...proof,
|
|
57
52
|
status: ProofStatus.VERIFIED,
|
package/src/tests/xrpl.test.ts
CHANGED
|
@@ -28,21 +28,23 @@ describe("verifyPersonalSignXRPL", async () => {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
const existingXRPLPublicKey = 'ED33CE53E97678D4C9016377B944716D80833098E666BB2BE160C5BE84C310E1D7';
|
|
32
|
+
|
|
33
|
+
function existingXRPLProof(): SignatureProof {
|
|
32
34
|
return {
|
|
33
35
|
type: ProofTypes.XRP_ED25519,
|
|
34
|
-
proof: '
|
|
35
|
-
address: `xrpl:1:
|
|
36
|
-
did: `did:pkh:xrpl:1:
|
|
36
|
+
proof: '30DC5E837D23A408414E270C9E79E7BEE4450D4FD89E1A42B94BA5C36728011A0D47BF6036464BDDE842F90F72BFD0F521504EF8F181F41421B1748EAA8DBC04',
|
|
37
|
+
address: `xrpl:1:rUe11XPvngHVzwS61wDwj98unworBbRDNc`,
|
|
38
|
+
did: `did:pkh:xrpl:1:rUe11XPvngHVzwS61wDwj98unworBbRDNc`,
|
|
37
39
|
status: ProofStatus.PENDING,
|
|
38
40
|
wallet_provider: "XRPL",
|
|
39
|
-
attestation: "I certify that\n\nxrpl:1 account
|
|
41
|
+
attestation: "I certify that\n\nxrpl:1 account rUe11XPvngHVzwS61wDwj98unworBbRDNc\n\nbelonged to did:key:z6Mkq3vnQfZFLVe2UXBUTgonfEhzYr9QF7xvkSSpdt9LXeY6\n\non Thu, 06 Mar 2025 10:34:43 GMT"
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
it("returns verified proof when valid existing XRPL proof", async () => {
|
|
44
46
|
const proof = existingXRPLProof();
|
|
45
|
-
const result = await verifyPersonalSignXRPL(proof,
|
|
47
|
+
const result = await verifyPersonalSignXRPL(proof, existingXRPLPublicKey);
|
|
46
48
|
expect(result.status).toBe(ProofStatus.VERIFIED);
|
|
47
49
|
});
|
|
48
50
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/concordium.ts"],"names":[],"mappings":";;;;;;AAcO,IAAM,yBAAA,GAA4B,OACvC,KAAA,KAC4B;AAC5B,EAAA,IAAI;AAEF,IAAA,MAAM,gBAAgB,IAAI,uBAAA;AAAA,MACxB,0CAAA;AAAA,MACA;AAAA,KACF;AAGA,IAAA,MAAM,gBAAA,GAAmB,IAAA,CAAK,KAAA,CAAM,KAAA,CAAM,KAAK,CAAA;AAG/C,IAAA,IAAI,gBAAA,CAAiB,mBAAA,KAAwB,KAAA,CAAM,WAAA,EAAa;AAC9D,MAAA,MAAM,IAAI,MAAM,iDAAiD,CAAA;AAAA,IACnE;AAGA,IAAA,IACE,CAAC,gBAAA,CAAiB,oBAAA,IAClB,gBAAA,CAAiB,oBAAA,CAAqB,WAAW,CAAA,EACjD;AACA,MAAA,MAAM,IAAI,MAAM,2CAA2C,CAAA;AAAA,IAC7D;AAEA,IAAA,MAAM,OAAA,GAAU,MAAM,aAAA,CAAc,0BAAA,EAA2B;AAE/D,IAAA,MAAM,aAAa,MAAM,aAAA;AAAA,MACvB,aAAA;AAAA,MACA,SAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,kBAAA;AAAA,MACE,gBAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA,CAAW,GAAA,CAAI,CAAC,CAAA,KAAM,EAAE,MAAM;AAAA,KAChC;AAEA,IAAA,OAAO;AAAA,MACL,GAAG,KAAA;AAAA,MACH,QAAQ,WAAA,CAAY;AAAA,KACtB;AAAA,EACF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO;AAAA,MACL,GAAG,KAAA;AAAA,MACH,QAAQ,WAAA,CAAY;AAAA,KACtB;AAAA,EACF;AACF","file":"concordium-QRNV23F7.js","sourcesContent":["import { ProofStatus, SignatureProof } from \"@notabene/javascript-sdk\";\nimport {\n ConcordiumGRPCWebClient,\n verifyPresentation,\n VerifiablePresentation,\n getPublicData,\n} from \"@concordium/web-sdk\";\n\n/**\n * Verifies a Concordium signature proof with proper cryptographic validation\n * @param proof The signature proof to verify\n * @param options Optional configuration for network and timeouts\n * @returns Promise resolving to the proof with updated status\n */\nexport const verifyConcordiumSignature = async (\n proof: SignatureProof,\n): Promise<SignatureProof> => {\n try {\n // Merge with default options\n const grpcWebClient = new ConcordiumGRPCWebClient(\n \"https://grpc.mainnet.concordium.software\",\n 20000\n );\n\n // verifiable presentation parsed from proof\n const presentationJson = JSON.parse(proof.proof) as VerifiablePresentation;\n\n // Validate presentation context matches attestation\n if (presentationJson.presentationContext !== proof.attestation) {\n throw new Error(\"Presentation context does not match attestation\");\n }\n\n // Validate verifiableCredential exists and is not empty\n if (\n !presentationJson.verifiableCredential ||\n presentationJson.verifiableCredential.length === 0\n ) {\n throw new Error(\"Verifiable credential is missing or empty\");\n }\n\n const context = await grpcWebClient.getCryptographicParameters();\n\n const publicData = await getPublicData(\n grpcWebClient,\n \"Mainnet\",\n presentationJson\n );\n\n verifyPresentation(\n presentationJson,\n context,\n publicData.map((p) => p.inputs)\n );\n\n return {\n ...proof,\n status: ProofStatus.VERIFIED,\n };\n } catch {\n return {\n ...proof,\n status: ProofStatus.FAILED,\n };\n }\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/concordium.ts"],"names":["ConcordiumGRPCWebClient","getPublicData","verifyPresentation","ProofStatus"],"mappings":";;;;;;;;AAcO,IAAM,yBAAA,GAA4B,OACvC,KAAA,KAC4B;AAC5B,EAAA,IAAI;AAEF,IAAA,MAAM,gBAAgB,IAAIA,8BAAA;AAAA,MACxB,0CAAA;AAAA,MACA;AAAA,KACF;AAGA,IAAA,MAAM,gBAAA,GAAmB,IAAA,CAAK,KAAA,CAAM,KAAA,CAAM,KAAK,CAAA;AAG/C,IAAA,IAAI,gBAAA,CAAiB,mBAAA,KAAwB,KAAA,CAAM,WAAA,EAAa;AAC9D,MAAA,MAAM,IAAI,MAAM,iDAAiD,CAAA;AAAA,IACnE;AAGA,IAAA,IACE,CAAC,gBAAA,CAAiB,oBAAA,IAClB,gBAAA,CAAiB,oBAAA,CAAqB,WAAW,CAAA,EACjD;AACA,MAAA,MAAM,IAAI,MAAM,2CAA2C,CAAA;AAAA,IAC7D;AAEA,IAAA,MAAM,OAAA,GAAU,MAAM,aAAA,CAAc,0BAAA,EAA2B;AAE/D,IAAA,MAAM,aAAa,MAAMC,oBAAA;AAAA,MACvB,aAAA;AAAA,MACA,SAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAAC,yBAAA;AAAA,MACE,gBAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA,CAAW,GAAA,CAAI,CAAC,CAAA,KAAM,EAAE,MAAM;AAAA,KAChC;AAEA,IAAA,OAAO;AAAA,MACL,GAAG,KAAA;AAAA,MACH,QAAQC,yBAAA,CAAY;AAAA,KACtB;AAAA,EACF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO;AAAA,MACL,GAAG,KAAA;AAAA,MACH,QAAQA,yBAAA,CAAY;AAAA,KACtB;AAAA,EACF;AACF","file":"concordium-YD34X2QM.cjs","sourcesContent":["import { ProofStatus, SignatureProof } from \"@notabene/javascript-sdk\";\nimport {\n ConcordiumGRPCWebClient,\n verifyPresentation,\n VerifiablePresentation,\n getPublicData,\n} from \"@concordium/web-sdk\";\n\n/**\n * Verifies a Concordium signature proof with proper cryptographic validation\n * @param proof The signature proof to verify\n * @param options Optional configuration for network and timeouts\n * @returns Promise resolving to the proof with updated status\n */\nexport const verifyConcordiumSignature = async (\n proof: SignatureProof,\n): Promise<SignatureProof> => {\n try {\n // Merge with default options\n const grpcWebClient = new ConcordiumGRPCWebClient(\n \"https://grpc.mainnet.concordium.software\",\n 20000\n );\n\n // verifiable presentation parsed from proof\n const presentationJson = JSON.parse(proof.proof) as VerifiablePresentation;\n\n // Validate presentation context matches attestation\n if (presentationJson.presentationContext !== proof.attestation) {\n throw new Error(\"Presentation context does not match attestation\");\n }\n\n // Validate verifiableCredential exists and is not empty\n if (\n !presentationJson.verifiableCredential ||\n presentationJson.verifiableCredential.length === 0\n ) {\n throw new Error(\"Verifiable credential is missing or empty\");\n }\n\n const context = await grpcWebClient.getCryptographicParameters();\n\n const publicData = await getPublicData(\n grpcWebClient,\n \"Mainnet\",\n presentationJson\n );\n\n verifyPresentation(\n presentationJson,\n context,\n publicData.map((p) => p.inputs)\n );\n\n return {\n ...proof,\n status: ProofStatus.VERIFIED,\n };\n } catch {\n return {\n ...proof,\n status: ProofStatus.FAILED,\n };\n }\n};\n"]}
|