@notabene/verify-proof 1.3.0 → 1.3.1
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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -2
- package/src/tests/index.test.ts +1 -1
- package/src/tests/xrpl.test.ts +9 -9
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@notabene/verify-proof",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.1",
|
4
4
|
"description": "Verify ownership proofs",
|
5
5
|
"source": "src/index.ts",
|
6
6
|
"type": "module",
|
@@ -45,7 +45,7 @@
|
|
45
45
|
"dependencies": {
|
46
46
|
"@cardano-foundation/cardano-verify-datasignature": "^1.0.11",
|
47
47
|
"@noble/curves": "^1.7.0",
|
48
|
-
"@notabene/javascript-sdk": "^2.
|
48
|
+
"@notabene/javascript-sdk": "^2.8.0-next.2",
|
49
49
|
"@scure/base": "^1.2.1",
|
50
50
|
"bip322-js": "^2.0.0",
|
51
51
|
"ox": "^0.2.2",
|
package/src/index.ts
CHANGED
@@ -37,9 +37,8 @@ export async function verifyProof(
|
|
37
37
|
case ProofTypes.EIP191:
|
38
38
|
return verifyPersonalSignEIP191(proof as SignatureProof);
|
39
39
|
case ProofTypes.ED25519:
|
40
|
-
if (proof.address.startsWith("solana")) {
|
41
40
|
return verifySolanaSignature(proof as SignatureProof);
|
42
|
-
|
41
|
+
case ProofTypes.XRP_ED25519:
|
43
42
|
return verifyPersonalSignXRPL(proof as SignatureProof, publicKey);
|
44
43
|
case ProofTypes.EIP712:
|
45
44
|
case ProofTypes.BIP137:
|
package/src/tests/index.test.ts
CHANGED
@@ -209,7 +209,7 @@ describe("verifyProof", () => {
|
|
209
209
|
});
|
210
210
|
describe("XRPL", () => {
|
211
211
|
const proof: SignatureProof = {
|
212
|
-
type: ProofTypes.
|
212
|
+
type: ProofTypes.XRP_ED25519,
|
213
213
|
address: "xrpl:1:rKnZzhH4YQCTVnAz16ea1Cgz5Ekhy83EHf",
|
214
214
|
did: "did:pkh:xrpl:1:rKnZzhH4YQCTVnAz16ea1Cgz5Ekhy83EHf",
|
215
215
|
attestation: "Ripple signature test",
|
package/src/tests/xrpl.test.ts
CHANGED
@@ -10,7 +10,7 @@ import {
|
|
10
10
|
|
11
11
|
describe("verifyPersonalSignXRPL", async () => {
|
12
12
|
// Create test wallets using seed
|
13
|
-
const
|
13
|
+
const xrp_ed25519 = Wallet.fromSeed("snoPBrXtMeMyMHUVTgbuqAfg1SUTb");
|
14
14
|
const message = "Ripple signature test";
|
15
15
|
|
16
16
|
function createXRPLProof(wallet: Wallet): SignatureProof {
|
@@ -18,7 +18,7 @@ describe("verifyPersonalSignXRPL", async () => {
|
|
18
18
|
const signature = sign(messageHex, wallet.privateKey);
|
19
19
|
|
20
20
|
return {
|
21
|
-
type: ProofTypes.
|
21
|
+
type: ProofTypes.XRP_ED25519,
|
22
22
|
address: `xrpl:1:${wallet.address}`,
|
23
23
|
did: `did:pkh:xrpl:1:${wallet.address}`,
|
24
24
|
attestation: message,
|
@@ -30,7 +30,7 @@ describe("verifyPersonalSignXRPL", async () => {
|
|
30
30
|
|
31
31
|
function existingXRPLProof(): SignatureProof {
|
32
32
|
return {
|
33
|
-
type: ProofTypes.
|
33
|
+
type: ProofTypes.XRP_ED25519,
|
34
34
|
proof: 'B080C34BCD2F1392420A5CB46C14772AC54841181CB3387A0793025C480A6A52292A869FB2B86B89EA33E096285F8CC45F5D35D4E29750BA8E127076CADF7906',
|
35
35
|
address: `xrpl:1:rGWNp4P9DJpDNhPc7t9GeHoQb8SCKWBfYV`,
|
36
36
|
did: `did:pkh:xrpl:1:rGWNp4P9DJpDNhPc7t9GeHoQb8SCKWBfYV`,
|
@@ -47,29 +47,29 @@ describe("verifyPersonalSignXRPL", async () => {
|
|
47
47
|
});
|
48
48
|
|
49
49
|
it("returns verified proof when valid secp256k1 signature", async () => {
|
50
|
-
const proof = createXRPLProof(
|
50
|
+
const proof = createXRPLProof(xrp_ed25519);
|
51
51
|
const result = await verifyPersonalSignXRPL(
|
52
52
|
proof,
|
53
|
-
|
53
|
+
xrp_ed25519.publicKey
|
54
54
|
);
|
55
55
|
expect(result.status).toBe(ProofStatus.VERIFIED);
|
56
56
|
});
|
57
57
|
|
58
58
|
it("returns failed proof when invalid message", async () => {
|
59
59
|
const proof = {
|
60
|
-
...createXRPLProof(
|
60
|
+
...createXRPLProof(xrp_ed25519),
|
61
61
|
attestation: "evil text",
|
62
62
|
};
|
63
63
|
const result = await verifyPersonalSignXRPL(
|
64
64
|
proof,
|
65
|
-
|
65
|
+
xrp_ed25519.publicKey
|
66
66
|
);
|
67
67
|
expect(result.status).toBe(ProofStatus.FAILED);
|
68
68
|
});
|
69
69
|
|
70
70
|
it("returns failed proof for non-XRPL address", async () => {
|
71
71
|
const proof: SignatureProof = {
|
72
|
-
type: ProofTypes.
|
72
|
+
type: ProofTypes.XRP_ED25519,
|
73
73
|
did: `did:pkh:eip155:1:0x123`,
|
74
74
|
wallet_provider: "XRPL",
|
75
75
|
address: "eip155:1:0x123",
|
@@ -80,7 +80,7 @@ describe("verifyPersonalSignXRPL", async () => {
|
|
80
80
|
|
81
81
|
const result = await verifyPersonalSignXRPL(
|
82
82
|
proof,
|
83
|
-
|
83
|
+
xrp_ed25519.publicKey
|
84
84
|
);
|
85
85
|
expect(result.status).toBe(ProofStatus.FAILED);
|
86
86
|
});
|