@notabene/verify-proof 1.11.0 → 1.12.0-next.2

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.
Files changed (79) hide show
  1. package/README.md +21 -15
  2. package/dist/bitcoin-3CW4MNAW.cjs +314 -0
  3. package/dist/bitcoin-3CW4MNAW.cjs.map +1 -0
  4. package/dist/bitcoin-QK53ILBF.js +312 -0
  5. package/dist/bitcoin-QK53ILBF.js.map +1 -0
  6. package/dist/cardano-DYBYEAAF.cjs +53 -0
  7. package/dist/cardano-DYBYEAAF.cjs.map +1 -0
  8. package/dist/cardano-WE6YXYLW.js +31 -0
  9. package/dist/cardano-WE6YXYLW.js.map +1 -0
  10. package/dist/chunk-E3V5ATTC.js +38 -0
  11. package/dist/chunk-E3V5ATTC.js.map +1 -0
  12. package/dist/chunk-OAXNH5XR.cjs +42 -0
  13. package/dist/chunk-OAXNH5XR.cjs.map +1 -0
  14. package/dist/concordium-QRNV23F7.js +45 -0
  15. package/dist/concordium-QRNV23F7.js.map +1 -0
  16. package/dist/concordium-YD34X2QM.cjs +47 -0
  17. package/dist/concordium-YD34X2QM.cjs.map +1 -0
  18. package/dist/cosmos-64MKE5FJ.cjs +683 -0
  19. package/dist/cosmos-64MKE5FJ.cjs.map +1 -0
  20. package/dist/cosmos-QMH7BK7S.js +681 -0
  21. package/dist/cosmos-QMH7BK7S.js.map +1 -0
  22. package/dist/eth-3DX3PXDU.cjs +37 -0
  23. package/dist/eth-3DX3PXDU.cjs.map +1 -0
  24. package/dist/eth-ICLGRJE5.js +34 -0
  25. package/dist/eth-ICLGRJE5.js.map +1 -0
  26. package/dist/index.cjs +68 -1
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +5 -0
  29. package/dist/index.d.ts +5 -2
  30. package/dist/index.js +66 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/solana-4KQFLZUC.js +342 -0
  33. package/dist/solana-4KQFLZUC.js.map +1 -0
  34. package/dist/solana-PQ5K4NGO.cjs +365 -0
  35. package/dist/solana-PQ5K4NGO.cjs.map +1 -0
  36. package/dist/tron-F5AARBY4.cjs +58 -0
  37. package/dist/tron-F5AARBY4.cjs.map +1 -0
  38. package/dist/tron-OBLPB2LN.js +53 -0
  39. package/dist/tron-OBLPB2LN.js.map +1 -0
  40. package/dist/xlm-5GODWWL2.cjs +28 -0
  41. package/dist/xlm-5GODWWL2.cjs.map +1 -0
  42. package/dist/xlm-GX2QGFLI.js +26 -0
  43. package/dist/xlm-GX2QGFLI.js.map +1 -0
  44. package/dist/xrpl-7HQLIDAK.cjs +1174 -0
  45. package/dist/xrpl-7HQLIDAK.cjs.map +1 -0
  46. package/dist/xrpl-YCDFXBGQ.js +1169 -0
  47. package/dist/xrpl-YCDFXBGQ.js.map +1 -0
  48. package/package.json +12 -2
  49. package/src/cardano.ts +2 -2
  50. package/src/concordium.ts +40 -284
  51. package/src/index.ts +31 -20
  52. package/src/solana.ts +1 -1
  53. package/src/tests/bitcoin.test.ts +335 -16
  54. package/src/tests/concordium.test.ts +96 -134
  55. package/src/tests/index.test.ts +7 -7
  56. package/src/tests/solana.test.ts +1 -1
  57. package/dist/bitcoin.d.ts +0 -2
  58. package/dist/cardano.d.ts +0 -2
  59. package/dist/concordium.d.ts +0 -15
  60. package/dist/cosmos.d.ts +0 -2
  61. package/dist/eth.d.ts +0 -4
  62. package/dist/index.modern.js +0 -2
  63. package/dist/index.modern.js.map +0 -1
  64. package/dist/index.umd.js +0 -2
  65. package/dist/index.umd.js.map +0 -1
  66. package/dist/solana.d.ts +0 -17
  67. package/dist/tests/bitcoin.test.d.ts +0 -1
  68. package/dist/tests/cardano.test.d.ts +0 -1
  69. package/dist/tests/concordium.test.d.ts +0 -1
  70. package/dist/tests/cosmos.test.d.ts +0 -1
  71. package/dist/tests/eth.test.d.ts +0 -1
  72. package/dist/tests/index.test.d.ts +0 -1
  73. package/dist/tests/solana.test.d.ts +0 -1
  74. package/dist/tests/tron.test.d.ts +0 -1
  75. package/dist/tests/xlm.test.d.ts +0 -1
  76. package/dist/tests/xrpl.test.d.ts +0 -1
  77. package/dist/tron.d.ts +0 -6
  78. package/dist/xlm.d.ts +0 -2
  79. package/dist/xrpl.d.ts +0 -5
@@ -7,216 +7,178 @@ import {
7
7
  } from "@notabene/javascript-sdk";
8
8
 
9
9
  describe("verifyConcordiumSignature", () => {
10
- // Test with valid signature against mainnet (makes network calls)
11
- it("returns verified proof when valid message and address on mainnet", async () => {
10
+ it("returns verified proof when valid presentation on testnet", async () => {
11
+ const proof: SignatureProof = {
12
+ "address": "ccd:9dd9ca4d19e9393877d2c44b70f89acb:3Soqc3mEU5WC4R9Qho9fxm4CJ1157q6qsJbPvtGV8iT8FbQdv2",
13
+ "attestation": "b74a8e64f1568f1fb22a57b033bc8ef2b8f6ba23ff8e831e7abfbb671927fda1",
14
+ "type": ProofTypes.CONCORDIUM,
15
+ "did": "did:pkh:ccd:9dd9ca4d19e9393877d2c44b70f89acb:3Soqc3mEU5WC4R9Qho9fxm4CJ1157q6qsJbPvtGV8iT8FbQdv2",
16
+ "proof": "{\"presentationContext\":\"b74a8e64f1568f1fb22a57b033bc8ef2b8f6ba23ff8e831e7abfbb671927fda1\",\"proof\":{\"created\":\"2025-12-10T10:39:14.395Z\",\"proofValue\":[],\"type\":\"ConcordiumWeakLinkingProofV1\"},\"type\":\"VerifiablePresentation\",\"verifiableCredential\":[{\"credentialSubject\":{\"id\":\"did:ccd:mainnet:cred:91a1f28bc42222096856a54fb157f7c80b9827457d4ece682b9592bca964948f01dce51a7deb392ea9bd0c1e1630d17b\",\"proof\":{\"created\":\"2025-12-10T10:39:14.395Z\",\"proofValue\":[{\"proof\":\"988f08d03bc8adaac4d51986dfaafe70874ab3bb22e8c09c32da5bfcd0ff0407203770533220e74ba4386acb36f7b7288e38c461279f7edf6f41b8b285d629280a5ca297e7fc42155222c5b1ad3cc74f770d5c87addbba6935ade425460b1616a587d9c45a4676f7fc751b31110cd37b25998c61d7d85c84e4db155491665e556778a9784e557799f06531bafe6b4b8ca2ce386d66f7759079eaff74b1e519550c9d137a13851c0987ee434feb6dae0ca659d67661b27e92d7cca9567a1a6ecd2175c574f5a6c2f4691597cbf3680f65abab72633d050746211c56961277064d694a31c2a93ef3b64c4957ff8261978a53d8b65d40ff23ddc7ee65d0ea0817702be58fbaec3954322e00667c6c94736eba8d3aa3f2686b89f257ca34c90ae1200000000785c57df969a45b25b1d39bdb388d33a756147e98f285891e83ce58eab3bb1f466c25a0946fc62513b16f3f02397b15418ebc131b5e1a8c0f05d6983cd3c44cc40ab8364c1aa209c2e8c0e8e84694587053542fd5cbb918f025723a5a0c200f08875728874571f50cb8b54d1c8629a10c76f0a982ad667efcfa280943f7c8753d3fa859a8d5d9837e6bdd5026d54546a3ae5918055208b5d2f77e0206d7861b4c472c634ec4cece107aeb14c42fe3d801aba38aa38e15785152e7c061561a5594a6cabb34f469b3121c15437df5d6ba0638ba3a192f2106d07e2f7bfd73310f669d3e8bdeb1b43244455d7bd7fa5917a1af2b23dc3433dac68ee4571bea2b0c22ce2ed665e22cee5676b9c3de0169926e72c847f7e3f2caa671e55ab5c4530205845b08ee12bba954f4a41e5638b05043a93ed212f402273c2b477f95f7b82ddbe4621f1758f80fcec726df755a76d0f585eda201dff2b91147cca5eae5d5319b7e1438c0f4af42b9fe4f7e845d0c643328ddd5dead96bfd345ae972312650a9ab6e6d7fa3d3f5d1fe68e5ff513095e3caa5bb21bec64dae007e62b4494986ac40b9e14b61255a84ea51780b8439adaeeae0b83a8bcee382491dd8e7b2f1921e8eeffe39a45bffd470b5a8f74d82ccdb8ccda651c387844f61704cc04f51d65fb9069900cb1febfc0b2ba02ffc857c45c12a7b306440e6627995d67353e9f6327b6f6cfa6ad0b859ea904f087a5b29a888043ba21ccb3e36da0a2da797310c2f2ce56c275d6fc48b60aade4b4e6bb6ff62d5f5be1a529c8d71cab2b0904fa306cb779a897872f5f047df7c7bee150ca6be6f3ad840a862ecc0793bb27f0594ff8741a4ab426b53d72acbdbde6c20a7c4399ca181d81a4b0ac437c23220f52ff8e9095ae35a53f8cd58913c4999a8153b656fabb162feafe8fc8708eaeb2b5ce0d347e5733cd685783271eaf564e05efce61996686ee9f50663204841ff30416061721a5cab8e1c80708809b58d2bc9c402da453e486ce08e0ec6c72c1f0e9dc15\",\"type\":\"AttributeInRange\"}],\"type\":\"ConcordiumZKProofV3\"},\"statement\":[{\"attributeTag\":\"dob\",\"lower\":\"19300101\",\"type\":\"AttributeInRange\",\"upper\":\"99990101\"}]},\"issuer\":\"did:ccd:mainnet:idp:1\",\"type\":[\"VerifiableCredential\",\"ConcordiumVerifiableCredential\"]}]}",
17
+ "wallet_provider": "Concordium Browser",
18
+ "status": ProofStatus.PENDING
19
+ };
20
+
21
+ const result = await verifyConcordiumSignature(proof);
22
+
23
+ expect(result.status).toBe(ProofStatus.VERIFIED);
24
+ }, 15000);
25
+
26
+ it("returns failed proof when proof field contains invalid JSON", async () => {
12
27
  const proof: SignatureProof = {
13
28
  address:
14
29
  "ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
15
30
  attestation:
16
- "I certify that\n\nccd:9dd9ca4d19e9393877d2c44b70f89acb account 3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF\n\nbelonged to did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5\n\non Thu, 12 Jun 2025 09:20:01 GMT",
31
+ "d9380ba535f3fc379d507e7fabba726104ff4640b05a7c5696d0b0830d3a1983",
17
32
  type: ProofTypes.CONCORDIUM,
18
- did: "did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5",
19
- proof:
20
- '{"0":{"0":"9b7263696072d4c5a0e060fec77bee5cb62ca9c8b674be864893f9d1dab75d28bf435efba9d4651ea1effdbd5b000f44d0d5be0fb10a11b3626a9a7be52e0d0d"}}',
33
+ did: "did:pkh:ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
34
+ proof: "invalid json string",
35
+ wallet_provider: "Concordium Browser",
21
36
  status: ProofStatus.PENDING,
22
- wallet_provider: "Concordium Wallet",
23
37
  };
24
-
25
- // Test against mainnet (makes network calls, calls isValidSignature)
26
- const result = await verifyConcordiumSignature(proof, {
27
- network: "mainnet",
28
- testMode: false,
29
- timeout: 10000 // 10 second timeout for tests
30
- });
31
-
32
- // This should either be VERIFIED (if account exists and signature is valid)
33
- // or FAILED (if account doesn't exist or signature is invalid)
34
- expect([ProofStatus.VERIFIED, ProofStatus.FAILED]).toContain(result.status);
35
- }, 15000); // 15 second test timeout
36
-
37
- // Test with valid signature against testnet (makes network calls)
38
- it("returns verified proof when valid message and address on testnet", async () => {
38
+
39
+ const result = await verifyConcordiumSignature(proof);
40
+ expect(result.status).toBe(ProofStatus.FAILED);
41
+ });
42
+
43
+ it("returns failed proof when proof field is empty string", async () => {
39
44
  const proof: SignatureProof = {
40
45
  address:
41
- "ccd:testnet:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
46
+ "ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
42
47
  attestation:
43
- "I certify that\n\nccd:testnet account 3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF\n\nbelonged to did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5\n\non Thu, 12 Jun 2025 09:20:01 GMT",
48
+ "d9380ba535f3fc379d507e7fabba726104ff4640b05a7c5696d0b0830d3a1983",
44
49
  type: ProofTypes.CONCORDIUM,
45
- did: "did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5",
46
- proof:
47
- '{"0":{"0":"9b7263696072d4c5a0e060fec77bee5cb62ca9c8b674be864893f9d1dab75d28bf435efba9d4651ea1effdbd5b000f44d0d5be0fb10a11b3626a9a7be52e0d0d"}}',
50
+ did: "did:pkh:ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
51
+ proof: "",
52
+ wallet_provider: "Concordium Browser",
48
53
  status: ProofStatus.PENDING,
49
- wallet_provider: "Concordium Wallet",
50
54
  };
51
-
52
- // Test against testnet (makes network calls, calls isValidSignature)
53
- const result = await verifyConcordiumSignature(proof, {
54
- network: "testnet",
55
- testMode: false,
56
- timeout: 10000 // 10 second timeout for tests
57
- });
58
-
59
- // This should either be VERIFIED (if account exists and signature is valid)
60
- // or FAILED (if account doesn't exist or signature is invalid)
61
- expect([ProofStatus.VERIFIED, ProofStatus.FAILED]).toContain(result.status);
62
- }, 15000); // 15 second test timeout
63
-
64
- // Test with non-existent account on mainnet (should fail but make network calls)
65
- it("returns failed proof when account is not found on mainnet", async () => {
55
+
56
+ const result = await verifyConcordiumSignature(proof);
57
+ expect(result.status).toBe(ProofStatus.FAILED);
58
+ });
59
+
60
+ it("returns failed proof when proof field is empty object", async () => {
66
61
  const proof: SignatureProof = {
67
62
  address:
68
63
  "ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
69
64
  attestation:
70
- "I certify that\n\nccd:9dd9ca4d19e9393877d2c44b70f89acb account 3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF\n\nbelonged to did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5\n\non Thu, 12 Jun 2025 09:20:01 GMT",
65
+ "d9380ba535f3fc379d507e7fabba726104ff4640b05a7c5696d0b0830d3a1983",
71
66
  type: ProofTypes.CONCORDIUM,
72
- did: "did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5",
73
- proof:
74
- '{"0":{"0":"9b7263696072d4c5a0e060fec77bee5cb62ca9c8b674be864893f9d1dab75d28bf435efba9d4651ea1effdbd5b000f44d0d5be0fb10a11b3626a9a7be52e0d0d"}}',
67
+ did: "did:pkh:ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
68
+ proof: "{}",
69
+ wallet_provider: "Concordium Browser",
75
70
  status: ProofStatus.PENDING,
76
- wallet_provider: "Concordium Wallet",
77
71
  };
78
-
79
- // Test against mainnet (makes network calls, calls isValidSignature)
80
- const result = await verifyConcordiumSignature(proof, {
81
- network: "mainnet",
82
- testMode: false,
83
- timeout: 10000
84
- });
85
72
 
73
+ const result = await verifyConcordiumSignature(proof);
86
74
  expect(result.status).toBe(ProofStatus.FAILED);
87
- }, 15000);
75
+ });
88
76
 
89
- // Test with non-existent account on testnet (should fail but make network calls)
90
- it("returns failed proof when account is not found on testnet", async () => {
77
+ it("returns failed proof when presentation is missing verifiableCredential", async () => {
91
78
  const proof: SignatureProof = {
92
79
  address:
93
- "ccd:testnet:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
80
+ "ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
94
81
  attestation:
95
- "I certify that\n\nccd:testnet account 3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF\n\nbelonged to did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5\n\non Thu, 12 Jun 2025 09:20:01 GMT",
82
+ "d9380ba535f3fc379d507e7fabba726104ff4640b05a7c5696d0b0830d3a1983",
96
83
  type: ProofTypes.CONCORDIUM,
97
- did: "did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5",
84
+ did: "did:pkh:ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
98
85
  proof:
99
- '{"0":{"0":"9b7263696072d4c5a0e060fec77bee5cb62ca9c8b674be864893f9d1dab75d28bf435efba9d4651ea1effdbd5b000f44d0d5be0fb10a11b3626a9a7be52e0d0d"}}',
86
+ '{"presentationContext":"d9380ba535f3fc379d507e7fabba726104ff4640b05a7c5696d0b0830d3a1983","proof":{"created":"2025-11-22T15:53:04.074Z","proofValue":[],"type":"ConcordiumWeakLinkingProofV1"},"type":"VerifiablePresentation"}',
87
+ wallet_provider: "Concordium Browser",
100
88
  status: ProofStatus.PENDING,
101
- wallet_provider: "Concordium Wallet",
102
89
  };
103
-
104
- // Test against testnet (makes network calls, calls isValidSignature)
105
- const result = await verifyConcordiumSignature(proof, {
106
- network: "testnet",
107
- testMode: true,
108
- timeout: 10000
109
- });
110
90
 
111
- expect(result.status).toBe(ProofStatus.VERIFIED);
112
- }, 15000);
91
+ const result = await verifyConcordiumSignature(proof);
92
+ expect(result.status).toBe(ProofStatus.FAILED);
93
+ });
113
94
 
114
- // Test network connectivity and timeout handling
115
- it("handles network timeouts gracefully", async () => {
95
+ it("returns failed proof when presentation has empty verifiableCredential array", async () => {
116
96
  const proof: SignatureProof = {
117
97
  address:
118
98
  "ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
119
99
  attestation:
120
- "I certify that\n\nccd:9dd9ca4d19e9393877d2c44b70f89acb account 3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF\n\nbelonged to did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5\n\non Thu, 12 Jun 2025 09:20:01 GMT",
100
+ "d9380ba535f3fc379d507e7fabba726104ff4640b05a7c5696d0b0830d3a1983",
121
101
  type: ProofTypes.CONCORDIUM,
122
- did: "did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5",
102
+ did: "did:pkh:ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
123
103
  proof:
124
- '{"0":{"0":"9b7263696072d4c5a0e060fec77bee5cb62ca9c8b674be864893f9d1dab75d28bf435efba9d4651ea1effdbd5b000f44d0d5be0fb10a11b3626a9a7be52e0d0d"}}',
104
+ '{"presentationContext":"d9380ba535f3fc379d507e7fabba726104ff4640b05a7c5696d0b0830d3a1983","proof":{"created":"2025-11-22T15:53:04.074Z","proofValue":[],"type":"ConcordiumWeakLinkingProofV1"},"type":"VerifiablePresentation","verifiableCredential":[]}',
105
+ wallet_provider: "Concordium Browser",
125
106
  status: ProofStatus.PENDING,
126
- wallet_provider: "Concordium Wallet",
127
107
  };
128
-
129
- // Test with very short timeout to trigger timeout handling
130
- const result = await verifyConcordiumSignature(proof, {
131
- network: "mainnet",
132
- testMode: false,
133
- timeout: 1, // 1ms timeout to force timeout
134
- retries: 1
135
- });
136
108
 
109
+ const result = await verifyConcordiumSignature(proof);
137
110
  expect(result.status).toBe(ProofStatus.FAILED);
138
- }, 10000);
111
+ });
139
112
 
140
- // Test mode tests (for comparison - these don't make network calls)
141
- it("returns failed proof when invalid message and address in test mode", async () => {
113
+ it("returns failed proof when presentation is missing presentationContext", async () => {
142
114
  const proof: SignatureProof = {
143
115
  address:
144
116
  "ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
145
117
  attestation:
146
- "I certify that\n\nccd:9dd9ca4d19e9393877d2c44b70f89acb account 3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF\n\nbelonged to did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5\n\non Thu, 12 Jun 2025 09:20:01 GMT",
147
- proof: '{}',
148
- did: "did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5",
149
- status: ProofStatus.PENDING,
150
- wallet_provider: "Concordium Wallet",
118
+ "d9380ba535f3fc379d507e7fabba726104ff4640b05a7c5696d0b0830d3a1983",
151
119
  type: ProofTypes.CONCORDIUM,
120
+ did: "did:pkh:ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
121
+ proof:
122
+ '{"proof":{"created":"2025-11-22T15:53:04.074Z","proofValue":[],"type":"ConcordiumWeakLinkingProofV1"},"type":"VerifiablePresentation","verifiableCredential":[{"credentialSubject":{"id":"did:ccd:testnet:cred:8f73851550a5d2c2ed4df215731cf9e3f33614d4be6c1c336f0f8858522c94afa34a759258a2b3281f9bacd0a8a3cd09","proof":{"created":"2025-11-22T15:53:04.074Z","proofValue":[{"proof":"test","type":"AttributeInRange"}],"type":"ConcordiumZKProofV3"},"statement":[{"attributeTag":"dob","lower":"19300101","type":"AttributeInRange","upper":"99990101"}]},"issuer":"did:ccd:testnet:idp:0","type":["VerifiableCredential","ConcordiumVerifiableCredential"]}]}',
123
+ wallet_provider: "Concordium Browser",
124
+ status: ProofStatus.PENDING,
152
125
  };
153
126
 
154
- // Use test mode to skip network calls
155
- const result = await verifyConcordiumSignature(proof, { testMode: true });
156
-
127
+ const result = await verifyConcordiumSignature(proof);
157
128
  expect(result.status).toBe(ProofStatus.FAILED);
158
129
  });
159
130
 
160
- it("handles invalid signature format in test mode", async () => {
131
+ it("returns failed proof when credential is missing credentialSubject", async () => {
161
132
  const proof: SignatureProof = {
162
133
  address:
163
134
  "ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
164
135
  attestation:
165
- "I certify that\n\nccd:9dd9ca4d19e9393877d2c44b70f89acb account 3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF\n\nbelonged to did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5\n\non Thu, 12 Jun 2025 09:20:01 GMT",
166
- proof: 'invalid json',
167
- did: "did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5",
168
- status: ProofStatus.PENDING,
169
- wallet_provider: "Concordium Wallet",
136
+ "d9380ba535f3fc379d507e7fabba726104ff4640b05a7c5696d0b0830d3a1983",
170
137
  type: ProofTypes.CONCORDIUM,
138
+ did: "did:pkh:ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
139
+ proof:
140
+ '{"presentationContext":"d9380ba535f3fc379d507e7fabba726104ff4640b05a7c5696d0b0830d3a1983","proof":{"created":"2025-11-22T15:53:04.074Z","proofValue":[],"type":"ConcordiumWeakLinkingProofV1"},"type":"VerifiablePresentation","verifiableCredential":[{"issuer":"did:ccd:testnet:idp:0","type":["VerifiableCredential","ConcordiumVerifiableCredential"]}]}',
141
+ wallet_provider: "Concordium Browser",
142
+ status: ProofStatus.PENDING,
171
143
  };
172
144
 
173
- // Use test mode to skip network calls
174
- const result = await verifyConcordiumSignature(proof, { testMode: true });
175
-
145
+ const result = await verifyConcordiumSignature(proof);
176
146
  expect(result.status).toBe(ProofStatus.FAILED);
177
147
  });
178
148
 
179
- it("handles non-concordium address", async () => {
149
+ it("returns failed proof with tampered proof signature", async () => {
180
150
  const proof: SignatureProof = {
181
- address: "eth:mainnet:0x1234567890abcdef",
182
- attestation: "test message",
183
- proof: '{"0":{"0":"9b7263696072d4c5a0e060fec77bee5cb62ca9c8b674be864893f9d1dab75d28bf435efba9d4651ea1effdbd5b000f44d0d5be0fb10a11b3626a9a7be52e0d0d"}}',
184
- did: "did:key:test",
185
- status: ProofStatus.PENDING,
186
- wallet_provider: "Test Wallet",
151
+ address:
152
+ "ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
153
+ attestation:
154
+ "d9380ba535f3fc379d507e7fabba726104ff4640b05a7c5696d0b0830d3a1983",
187
155
  type: ProofTypes.CONCORDIUM,
156
+ did: "did:pkh:ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
157
+ proof:
158
+ '{"presentationContext":"d9380ba535f3fc379d507e7fabba726104ff4640b05a7c5696d0b0830d3a1983","proof":{"created":"2025-11-22T15:53:04.074Z","proofValue":[],"type":"ConcordiumWeakLinkingProofV1"},"type":"VerifiablePresentation","verifiableCredential":[{"credentialSubject":{"id":"did:ccd:testnet:cred:8f73851550a5d2c2ed4df215731cf9e3f33614d4be6c1c336f0f8858522c94afa34a759258a2b3281f9bacd0a8a3cd09","proof":{"created":"2025-11-22T15:53:04.074Z","proofValue":[{"proof":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"AttributeInRange"}],"type":"ConcordiumZKProofV3"},"statement":[{"attributeTag":"dob","lower":"19300101","type":"AttributeInRange","upper":"99990101"}]},"issuer":"did:ccd:testnet:idp:0","type":["VerifiableCredential","ConcordiumVerifiableCredential"]}]}',
159
+ wallet_provider: "Concordium Browser",
160
+ status: ProofStatus.PENDING,
188
161
  };
189
162
 
190
- const result = await verifyConcordiumSignature(proof, { testMode: true });
191
-
163
+ const result = await verifyConcordiumSignature(proof);
192
164
  expect(result.status).toBe(ProofStatus.FAILED);
193
- });
165
+ }, 15000);
194
166
 
195
- // Test with a known valid account on mainnet (if available)
196
- it("tests with known valid mainnet account", async () => {
197
- // This test uses a potentially valid account address for testing
198
- // In a real scenario, you'd want to use an account that actually exists
167
+ it("returns failed proof with mismatched presentationContext and attestation", async () => {
199
168
  const proof: SignatureProof = {
200
169
  address:
201
- "ccd:9dd9ca4d19e9393877d2c44b70f89acb:4hVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoG",
170
+ "ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
202
171
  attestation:
203
- "I certify that\n\nccd:9dd9ca4d19e9393877d2c44b70f89acb account 4hVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoG\n\nbelonged to did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5\n\non Thu, 12 Jun 2025 09:20:01 GMT",
172
+ "0000000000000000000000000000000000000000000000000000000000000000",
204
173
  type: ProofTypes.CONCORDIUM,
205
- did: "did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5",
174
+ did: "did:pkh:ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
206
175
  proof:
207
- '{"0":{"0":"9b7263696072d4c5a0e060fec77bee5cb62ca9c8b674be864893f9d1dab75d28bf435efba9d4651ea1effdbd5b000f44d0d5be0fb10a11b3626a9a7be52e0d0d"}}',
176
+ '{"presentationContext":"d9380ba535f3fc379d507e7fabba726104ff4640b05a7c5696d0b0830d3a1983","proof":{"created":"2025-11-22T15:53:04.074Z","proofValue":[],"type":"ConcordiumWeakLinkingProofV1"},"type":"VerifiablePresentation","verifiableCredential":[{"credentialSubject":{"id":"did:ccd:testnet:cred:8f73851550a5d2c2ed4df215731cf9e3f33614d4be6c1c336f0f8858522c94afa34a759258a2b3281f9bacd0a8a3cd09","proof":{"created":"2025-11-22T15:53:04.074Z","proofValue":[{"proof":"a9f68ef2cb10cfe4b7734ab0464e6af952e9ebeb7d8701c00d6894ee64ee9f110d6dfbbdfd7de737ebaf0d3e85512ae98e7047e9db92d7d8bf5c4414f30443e13461bda7da17bd7a1e95d65add4e6fdc2d2da7338b9e2b71359a834df422d90682d490d1dc266806981c48cc39c1d7dfad0c86364cc1607d15dffe36a5f67b229f34567adcd9bbe249e9b3e521ecc4ccb260512d37da8cc7e61b224be723140b00412dfb57deb54ed8f0cd74e1cf31f64b50e649b7c262433f167c9e490cb06f4b12a3da45d25c45a76cfb94e21bf1b5950bb4edc83730ef882ecc376ff0e83957ef73535557ea865be9391f7948b6b34f5778025fcc681b469b9d1922e7605f1e768c0fd4280b6c1f338d7922a545536d5fb3c0e88b1da8b17020c9c26b544c00000007b15c3faa19a2f749f762be0f87820a299de52ccbea2e38dcc2c1275eca95e808bda09bffc4afdc0affca5e40308b2b00a1bf346359c0effc8c0cafbb17eb217cee0ac4239e053b5e058cd14fe8b687259255c5c9c110f11926f31760cf8ce4d2ae8fa37bdf19efaf35661fd2d31d45c535735e5af7871afbe8bea0783b01c1e66f62df3fce23309a7f743ebc7e27d9a5951821b5031c443310bb777ad4a04c3111ec017b18cdecab0a107f1a086bbfa513a2ed61e72665b8332e9f4809b04595a6bf76ed0ea0b38ca897aa5811a17df35bdab1a0a02ab6a8379acde4c9c01908de128821739028359e5173e7222fca0b8cad1206e0e6ca938a7bae3864445ca22ee60f7de2aceecb98d1f40a0c7a0519af09df4d7c536017c0236b7e579c73ea8aeb20762d31b3daa5a966f4f5824eb51ea037b3686cbd8a9d8daa0927fbe26ac1d9d41f0d96ce1896e6eaa69cfa88a09682079406a50718a47539999be699d4bfe2a414a13dc39d96a911e5113fab61a09b66346c74bc67c2bdbace3dcc74eca8e30bf2e64b2f577b0a4a9d484ff7696771e8e347bf870f51a9ef2d88b2bac8f53a0ae5ba2a537121b26977a57d585d8ef41596a8663ebada0626fcc4a919c115c8f766216abb76355970c5431152087d8e727aea7b245912ee35ca169bdf43ab89f1d2c857038faf337b7f0cfe16162fb43339a879159290116b95d64379d2a927b4b99e5aa50e784aa0b0ee930b17b31c778e09d3dd8879578179dc17e70f92252d0cc2226da0e70a0c1d6a375cca572818034242443f5f5e3d7bacff47d380e2698afc0e67fefc66fbb4e336744bde829f68ede5e4fac6315fd005471045fdee23a6f9c43ff69a2adddc597372f8acd2f02507ed99e195396412f181b207a3711ec68ce5b0811c46fe1be324fb64e8866d2850c16c33bb953a6ddf1bd8650f26db28333a7e2fd69f32e64778efd02c60730a96adad0fb12fa872d2c48268075c5335724f03d118b1e32593dc71e4141a5febcd078c1a85f21dd36d35af77","type":"AttributeInRange"}],"type":"ConcordiumZKProofV3"},"statement":[{"attributeTag":"dob","lower":"19300101","type":"AttributeInRange","upper":"99990101"}]},"issuer":"did:ccd:testnet:idp:0","type":["VerifiableCredential","ConcordiumVerifiableCredential"]}]}',
177
+ wallet_provider: "Concordium Browser",
208
178
  status: ProofStatus.PENDING,
209
- wallet_provider: "Concordium Wallet",
210
179
  };
211
-
212
- // Test against mainnet (makes network calls, calls isValidSignature)
213
- const result = await verifyConcordiumSignature(proof, {
214
- network: "mainnet",
215
- testMode: false,
216
- timeout: 10000
217
- });
218
-
219
- // Should fail because this account likely doesn't exist, but the network call should be made
180
+
181
+ const result = await verifyConcordiumSignature(proof);
220
182
  expect(result.status).toBe(ProofStatus.FAILED);
221
183
  }, 15000);
222
184
  });
@@ -328,13 +328,13 @@ describe("verifyProof", () => {
328
328
 
329
329
  describe("Concordium", () => {
330
330
  const proof: SignatureProof = {
331
- type: ProofTypes.CONCORDIUM,
332
- address: "ccd:9dd9ca4d19e9393877d2c44b70f89acb:3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF",
333
- attestation: "I certify that\n\nccd:9dd9ca4d19e9393877d2c44b70f89acb account 3thVBVWVwz1oHb4ob2VgehUGF7zyAJHkm5UDW8NdQKFKCvFnoF\n\nbelonged to did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5\n\non Thu, 12 Jun 2025 09:20:01 GMT",
334
- proof: '{"0":{"0":"9b7263696072d4c5a0e060fec77bee5cb62ca9c8b674be864893f9d1dab75d28bf435efba9d4651ea1effdbd5b000f44d0d5be0fb10a11b3626a9a7be52e0d0d"}}',
335
- did: "did:key:z6MksamQq4oVRktkeSDxs6pbixYFUaUca8xgCvnTVLQA5PC5",
336
- status: ProofStatus.PENDING,
337
- wallet_provider: "Concordium Wallet",
331
+ "address": "ccd:9dd9ca4d19e9393877d2c44b70f89acb:3Soqc3mEU5WC4R9Qho9fxm4CJ1157q6qsJbPvtGV8iT8FbQdv2",
332
+ "attestation": "b74a8e64f1568f1fb22a57b033bc8ef2b8f6ba23ff8e831e7abfbb671927fda1",
333
+ "type": ProofTypes.CONCORDIUM,
334
+ "did": "did:pkh:ccd:9dd9ca4d19e9393877d2c44b70f89acb:3Soqc3mEU5WC4R9Qho9fxm4CJ1157q6qsJbPvtGV8iT8FbQdv2",
335
+ "proof": "{\"presentationContext\":\"b74a8e64f1568f1fb22a57b033bc8ef2b8f6ba23ff8e831e7abfbb671927fda1\",\"proof\":{\"created\":\"2025-12-10T10:39:14.395Z\",\"proofValue\":[],\"type\":\"ConcordiumWeakLinkingProofV1\"},\"type\":\"VerifiablePresentation\",\"verifiableCredential\":[{\"credentialSubject\":{\"id\":\"did:ccd:mainnet:cred:91a1f28bc42222096856a54fb157f7c80b9827457d4ece682b9592bca964948f01dce51a7deb392ea9bd0c1e1630d17b\",\"proof\":{\"created\":\"2025-12-10T10:39:14.395Z\",\"proofValue\":[{\"proof\":\"988f08d03bc8adaac4d51986dfaafe70874ab3bb22e8c09c32da5bfcd0ff0407203770533220e74ba4386acb36f7b7288e38c461279f7edf6f41b8b285d629280a5ca297e7fc42155222c5b1ad3cc74f770d5c87addbba6935ade425460b1616a587d9c45a4676f7fc751b31110cd37b25998c61d7d85c84e4db155491665e556778a9784e557799f06531bafe6b4b8ca2ce386d66f7759079eaff74b1e519550c9d137a13851c0987ee434feb6dae0ca659d67661b27e92d7cca9567a1a6ecd2175c574f5a6c2f4691597cbf3680f65abab72633d050746211c56961277064d694a31c2a93ef3b64c4957ff8261978a53d8b65d40ff23ddc7ee65d0ea0817702be58fbaec3954322e00667c6c94736eba8d3aa3f2686b89f257ca34c90ae1200000000785c57df969a45b25b1d39bdb388d33a756147e98f285891e83ce58eab3bb1f466c25a0946fc62513b16f3f02397b15418ebc131b5e1a8c0f05d6983cd3c44cc40ab8364c1aa209c2e8c0e8e84694587053542fd5cbb918f025723a5a0c200f08875728874571f50cb8b54d1c8629a10c76f0a982ad667efcfa280943f7c8753d3fa859a8d5d9837e6bdd5026d54546a3ae5918055208b5d2f77e0206d7861b4c472c634ec4cece107aeb14c42fe3d801aba38aa38e15785152e7c061561a5594a6cabb34f469b3121c15437df5d6ba0638ba3a192f2106d07e2f7bfd73310f669d3e8bdeb1b43244455d7bd7fa5917a1af2b23dc3433dac68ee4571bea2b0c22ce2ed665e22cee5676b9c3de0169926e72c847f7e3f2caa671e55ab5c4530205845b08ee12bba954f4a41e5638b05043a93ed212f402273c2b477f95f7b82ddbe4621f1758f80fcec726df755a76d0f585eda201dff2b91147cca5eae5d5319b7e1438c0f4af42b9fe4f7e845d0c643328ddd5dead96bfd345ae972312650a9ab6e6d7fa3d3f5d1fe68e5ff513095e3caa5bb21bec64dae007e62b4494986ac40b9e14b61255a84ea51780b8439adaeeae0b83a8bcee382491dd8e7b2f1921e8eeffe39a45bffd470b5a8f74d82ccdb8ccda651c387844f61704cc04f51d65fb9069900cb1febfc0b2ba02ffc857c45c12a7b306440e6627995d67353e9f6327b6f6cfa6ad0b859ea904f087a5b29a888043ba21ccb3e36da0a2da797310c2f2ce56c275d6fc48b60aade4b4e6bb6ff62d5f5be1a529c8d71cab2b0904fa306cb779a897872f5f047df7c7bee150ca6be6f3ad840a862ecc0793bb27f0594ff8741a4ab426b53d72acbdbde6c20a7c4399ca181d81a4b0ac437c23220f52ff8e9095ae35a53f8cd58913c4999a8153b656fabb162feafe8fc8708eaeb2b5ce0d347e5733cd685783271eaf564e05efce61996686ee9f50663204841ff30416061721a5cab8e1c80708809b58d2bc9c402da453e486ce08e0ec6c72c1f0e9dc15\",\"type\":\"AttributeInRange\"}],\"type\":\"ConcordiumZKProofV3\"},\"statement\":[{\"attributeTag\":\"dob\",\"lower\":\"19300101\",\"type\":\"AttributeInRange\",\"upper\":\"99990101\"}]},\"issuer\":\"did:ccd:mainnet:idp:1\",\"type\":[\"VerifiableCredential\",\"ConcordiumVerifiableCredential\"]}]}",
336
+ "wallet_provider": "Concordium Browser",
337
+ "status": ProofStatus.PENDING
338
338
  };
339
339
 
340
340
  it("should verify proof", async () => {
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect } from "vitest";
2
2
  import { base58 } from "@scure/base";
3
- import nacl from "tweetnacl";
3
+ import * as nacl from "tweetnacl";
4
4
  import {
5
5
  ProofStatus,
6
6
  ProofTypes,
package/dist/bitcoin.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { SignatureProof } from "@notabene/javascript-sdk";
2
- export declare function verifyBTCSignature(proof: SignatureProof): Promise<SignatureProof>;
package/dist/cardano.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { SignatureProof } from "@notabene/javascript-sdk";
2
- export declare function verifyCIP8Signature(proof: SignatureProof): Promise<SignatureProof>;
@@ -1,15 +0,0 @@
1
- import { SignatureProof } from "@notabene/javascript-sdk";
2
- interface ConcordiumVerificationOptions {
3
- network?: "testnet" | "mainnet";
4
- timeout?: number;
5
- retries?: number;
6
- testMode?: boolean;
7
- }
8
- /**
9
- * Verifies a Concordium signature proof with proper cryptographic validation
10
- * @param proof The signature proof to verify
11
- * @param options Optional configuration for network and timeouts
12
- * @returns Promise resolving to the proof with updated status
13
- */
14
- export declare const verifyConcordiumSignature: (proof: SignatureProof, options?: ConcordiumVerificationOptions) => Promise<SignatureProof>;
15
- export {};
package/dist/cosmos.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { SignatureProof } from "@notabene/javascript-sdk";
2
- export declare function verifyCosmosSignature(proof: SignatureProof): Promise<SignatureProof>;
package/dist/eth.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { SignatureProof } from "@notabene/javascript-sdk";
2
- import { Hex } from "ox";
3
- export declare function verifyEIP191(address: Hex.Hex, message: string, proof: Hex.Hex): boolean;
4
- export declare function verifyPersonalSignEIP191(proof: SignatureProof): Promise<SignatureProof>;
@@ -1,2 +0,0 @@
1
- import{ProofStatus as e,ProofTypes as t}from"@notabene/javascript-sdk";import{encode as r}from"varuint-bitcoin";import n,{createBase58check as s,bech32 as o,base64 as i,base58 as c}from"@scure/base";import{Hash as a,PersonalMessage as u,Hex as h,Signature as d,Secp256k1 as f,Address as l,PublicKey as p,Bytes as y}from"ox";import b,{secp256k1 as g}from"@noble/curves/secp256k1";import{Verifier as A}from"bip322-js";import m from"tweetnacl";import w from"@cardano-foundation/cardano-verify-datasignature";import{Client as E}from"xrpl";import x from"@noble/curves/abstract/utils";import _ from"@noble/curves/ed25519";import{Keypair as H}from"@stellar/stellar-sdk";import{serializeSignDoc as I}from"@cosmjs/amino";function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},v.apply(null,arguments)}var S;!function(e){e.P2WPKH="p2wpkh",e.P2SH_P2WPKH="p2sh(p2wpkh)"}(S||(S={}));const D={bitcoin:{messagePrefix:"Bitcoin Signed Message:\n",pubKeyHashVersion:0,scriptHashVersion:5,bech32Prefix:"bc",isTestnet:!1},bitcoincash:{messagePrefix:"Bitcoin Signed Message:\n",pubKeyHashVersion:0,scriptHashVersion:5,bech32Prefix:"bc",isTestnet:!1},litecoin:{messagePrefix:"Litecoin Signed Message:\n",pubKeyHashVersion:48,scriptHashVersion:50,bech32Prefix:"ltc",isTestnet:!1},dogecoin:{messagePrefix:"Dogecoin Signed Message:\n",pubKeyHashVersion:30,scriptHashVersion:22,isTestnet:!1},dash:{messagePrefix:"DarkCoin Signed Message:\n",pubKeyHashVersion:76,scriptHashVersion:16,isTestnet:!1},zcash:{messagePrefix:"Zcash Signed Message:\n",pubKeyHashVersion:Uint8Array.from([28,184]),scriptHashVersion:Uint8Array.from([28,189]),isTestnet:!1},testnet:{messagePrefix:"Bitcoin Signed Message:\n",pubKeyHashVersion:111,scriptHashVersion:196,bech32Prefix:"tb",isTestnet:!0}};var L;function P(t,r){const{attestation:n,proof:s}=r;return v({},r,{status:A.verifySignature(t,n,s)?e.VERIFIED:e.FAILED})}function B(t,n,s){const o=function(e){if(e.match("^(bc1|tb1|ltc1).*"))return L.NATIVE;if(e.match("^[32M].*"))return L.SEGWIT;if(e.match("^[1nmL].*"))return L.LEGACY;if(e.match("^(D).*"))return L.DOGECOIN;if(e.match("^(q).*"))return L.BCH;if(e.match("^(t1|t3).*"))return L.LEGACY;if(e.match("^[X7].*"))return L.LEGACY;throw new Error("INVALID ADDRESS: ".concat(e).concat(" is not a valid or a supported address"))}(t),c=Boolean(s.bech32Prefix&&(o===L.NATIVE||o===L.SEGWIT&&!t.startsWith("1"))),u=function(e,t,n,s,o){const{compressed:c,segwitType:u,signature:h}=function(e){const t=i.decode(e);if(65!==t.length)throw new Error("Invalid signature length");const r=t[0]-27;if(r>15||r<0)throw new Error("Invalid signature parameter");const n=!!(12&r),s=3&r,o=g.Signature.fromCompact(t.slice(1));return{compressed:n,segwitType:8&r?4&r?S.P2WPKH:S.P2SH_P2WPKH:void 0,signature:o.addRecoveryBit(s)}}(n);if(s&&!c)throw new Error("checkSegwitAlways can only be used with a compressed pubkey signature flagbyte");const d=function(e,t){const n=(new TextEncoder).encode(t),s=(new TextEncoder).encode(e),o=r(s.length).buffer,i=new Uint8Array(n.length+o.byteLength+s.length);return i.set(n),i.set(new Uint8Array(o),n.length),i.set(s,n.length+o.byteLength),function(e){return a.sha256(a.sha256(e))}(i)}(e,o.messagePrefix),f=k(h.recoverPublicKey(d).toRawBytes(c));let l="";if(t.startsWith("q"))return l=V(o.pubKeyHashVersion,f),l.startsWith("1");if(u)l=u===S.P2SH_P2WPKH?V(o.scriptHashVersion,f):o.bech32Prefix?C(f,o.bech32Prefix):V(o.scriptHashVersion,f);else if(t.startsWith("3")&&!u){const e=new Uint8Array(22);e[0]=0,e[1]=20,e.set(f,2);const r=k(e),n=V(o.scriptHashVersion,r),s=V(o.scriptHashVersion,f);if(t===n||t===s)return!0;l=s}else if(t.startsWith("bc1q")||t.startsWith("tb1q")||t.startsWith("ltc1q"))l=o.bech32Prefix?C(f,o.bech32Prefix):V(o.pubKeyHashVersion,f);else if(s&&o.bech32Prefix)try{l=C(f,o.bech32Prefix)}catch(e){l=V(o.scriptHashVersion,f)}else l=V(o.pubKeyHashVersion,f);return l===t}(n.attestation,t,n.proof,c,s);return v({},n,{status:u?e.VERIFIED:e.FAILED})}!function(e){e.LEGACY="Legacy",e.NATIVE="Native SegWit",e.SEGWIT="SegWit",e.P2SH_SEGWIT="p2sh",e.BCH="Bitcoin Cash",e.ETHEREUM="Ethereum",e.DOGECOIN="Dogecoin",e.UNKNOWN="Unknown"}(L||(L={}));const U=s(a.sha256);function V(e,t){const r="number"==typeof e?Uint8Array.of(e):e,n=new Uint8Array(r.length+t.length);return n.set(r),n.set(t,r.length),U.encode(n)}function C(e,t="bc"){const r=o.toWords(e);return r.unshift(0),o.encode(t,r)}function k(e){return a.ripemd160(a.sha256(e))}function F(e,t){const r=[];let n=t;for(;n<e.length&&null!=(s=e[n])&&s.startsWith("- ");){var s;r.push(e[n].substring(2)),n++}return r}function O(e,t,r){try{const s=(n=h.fromString(t),a.keccak256(function(e){const t=h.from(e);return h.concat("0x19",h.fromString("TRON Signed Message:\n"+h.size(t)),t)}(n))),o=d.fromHex(r),i=f.recoverPublicKey({payload:s,signature:o}),u=`0x41${a.keccak256(`0x${p.toHex(i).slice(4)}`).substring(26)}`,l=y.from(u),b=y.from(a.sha256(a.sha256(u))).slice(0,4),g=y.concat(l,b);return c.encode(g)===e}catch(e){return!1}var n}var T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function M(e){var t={exports:{}};return e(t,t.exports),t.exports}var K=M(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0}),j=M(function(e,t){function r(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function n(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function s(e,...t){if(!r(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function o(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function i(e){for(let t=0;t<e.length;t++)e[t]=o(e[t]);return e}Object.defineProperty(t,"__esModule",{value:!0}),t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.Hash=t.nextTick=t.swap32IfBE=t.byteSwapIfBE=t.swap8IfBE=t.isLE=void 0,t.isBytes=r,t.anumber=n,t.abytes=s,t.ahash=function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");n(e.outputLen),n(e.blockLen)},t.aexists=function(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")},t.aoutput=function(e,t){s(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)},t.u8=function(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},t.u32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))},t.clean=function(...e){for(let t=0;t<e.length;t++)e[t].fill(0)},t.createView=function(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)},t.rotr=function(e,t){return e<<32-t|e>>>t},t.rotl=function(e,t){return e<<t|e>>>32-t>>>0},t.byteSwap=o,t.byteSwap32=i,t.bytesToHex=function(e){if(s(e),c)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=a[e[r]];return t},t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(c)return Uint8Array.fromHex(e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,s=0;t<r;t++,s+=2){const r=h(e.charCodeAt(s)),o=h(e.charCodeAt(s+1));if(void 0===r||void 0===o)throw new Error('hex string expected, got non-hex character "'+(e[s]+e[s+1])+'" at index '+s);n[t]=16*r+o}return n},t.asyncLoop=async function(e,r,n){let s=Date.now();for(let o=0;o<e;o++){n(o);const e=Date.now()-s;e>=0&&e<r||(await(0,t.nextTick)(),s+=e)}},t.utf8ToBytes=d,t.bytesToUtf8=function(e){return(new TextDecoder).decode(e)},t.toBytes=f,t.kdfInputToBytes=function(e){return"string"==typeof e&&(e=d(e)),s(e),e},t.concatBytes=function(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];s(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const s=e[t];r.set(s,n),n+=s.length}return r},t.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!=={}.toString.call(t))throw new Error("options should be object or undefined");return Object.assign(e,t)},t.createHasher=l,t.createOptHasher=p,t.createXOFer=y,t.randomBytes=function(e=32){if(K.crypto&&"function"==typeof K.crypto.getRandomValues)return K.crypto.getRandomValues(new Uint8Array(e));if(K.crypto&&"function"==typeof K.crypto.randomBytes)return Uint8Array.from(K.crypto.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")},t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],t.swap8IfBE=t.isLE?e=>e:e=>o(e),t.byteSwapIfBE=t.swap8IfBE,t.swap32IfBE=t.isLE?e=>e:i;const c=/* @__PURE__ */(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),a=/* @__PURE__ */Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),u={_0:48,_9:57,A:65,F:70,a:97,f:102};function h(e){return e>=u._0&&e<=u._9?e-u._0:e>=u.A&&e<=u.F?e-(u.A-10):e>=u.a&&e<=u.f?e-(u.a-10):void 0}function d(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}function f(e){return"string"==typeof e&&(e=d(e)),s(e),e}function l(e){const t=t=>e().update(f(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function p(e){const t=(t,r)=>e(r).update(f(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}function y(e){const t=(t,r)=>e(r).update(f(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}t.nextTick=async()=>{},t.Hash=class{},t.wrapConstructor=l,t.wrapConstructorWithOpts=p,t.wrapXOFConstructorWithOpts=y}),N=j,R=M(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.equal=t.concat=t.HEX_REGEX=void 0,t.HEX_REGEX=/^[A-F0-9]*$/iu,t.concat=function(e){return(0,N.concatBytes)(...e)},t.equal=function(e,t){if(e.byteLength!==t.byteLength)return!1;const r=new Int8Array(e),n=new Int8Array(t);for(let t=0;t!==e.byteLength;t++)if(r[t]!==n[t])return!1;return!0}}),W=M(function(e,t){var r=T&&T.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=T&&T.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.stringToHex=t.hexToString=t.hexToBytes=t.bytesToHex=void 0,t.bytesToHex=e=>(0,N.bytesToHex)(e instanceof Uint8Array?e:Uint8Array.from(e)).toUpperCase(),t.hexToBytes=e=>{const t=new Uint8Array(e.length/2);if(!R.HEX_REGEX.test(e))throw new Error("Invalid hex string");for(let r=0;r<t.length;r++){const n=2*r,s=e.slice(n,n+2),o=Number.parseInt(s,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t},t.hexToString=(e,r="utf8")=>new TextDecoder(r).decode((0,t.hexToBytes)(e)),t.stringToHex=e=>(0,t.bytesToHex)((new TextEncoder).encode(e)),t.randomBytes=N.randomBytes,n(R,t)}),G=M(function(e,t){function r(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const s=BigInt(32),o=BigInt(4294967295),i=Number(r>>s&o),c=Number(r&o),a=n?0:4;e.setUint32(t+(n?4:0),i,n),e.setUint32(t+a,c,n)}Object.defineProperty(t,"__esModule",{value:!0}),t.SHA512_IV=t.SHA384_IV=t.SHA224_IV=t.SHA256_IV=t.HashMD=void 0,t.setBigUint64=r,t.Chi=function(e,t,r){return e&t^~e&r},t.Maj=function(e,t,r){return e&t^e&r^t&r},t.HashMD=class extends N.Hash{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=(0,N.createView)(this.buffer)}update(e){(0,N.aexists)(this),e=(0,N.toBytes)(e),(0,N.abytes)(e);const{view:t,buffer:r,blockLen:n}=this,s=e.length;for(let o=0;o<s;){const i=Math.min(n-this.pos,s-o);if(i===n){const t=(0,N.createView)(e);for(;n<=s-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+i),this.pos),this.pos+=i,o+=i,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,N.aexists)(this),(0,N.aoutput)(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:s,isLE:o}=this;let{pos:i}=this;t[i++]=128,(0,N.clean)(this.buffer.subarray(i)),this.padOffset>s-i&&(this.process(n,0),i=0);for(let e=i;e<s;e++)t[e]=0;r(n,s-8,BigInt(8*this.length),o),this.process(n,0);const c=(0,N.createView)(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)c.setUint32(4*e,h[e],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:s,destroyed:o,pos:i}=this;return e.destroyed=o,e.finished=s,e.length=n,e.pos=i,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},t.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),t.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),t.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),t.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])}),$=M(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.toBig=t.shrSL=t.shrSH=t.rotrSL=t.rotrSH=t.rotrBL=t.rotrBH=t.rotr32L=t.rotr32H=t.rotlSL=t.rotlSH=t.rotlBL=t.rotlBH=t.add5L=t.add5H=t.add4L=t.add4H=t.add3L=t.add3H=void 0,t.add=m,t.fromBig=s,t.split=o;const r=/* @__PURE__ */BigInt(2**32-1),n=/* @__PURE__ */BigInt(32);function s(e,t=!1){return t?{h:Number(e&r),l:Number(e>>n&r)}:{h:0|Number(e>>n&r),l:0|Number(e&r)}}function o(e,t=!1){const r=e.length;let n=new Uint32Array(r),o=new Uint32Array(r);for(let i=0;i<r;i++){const{h:r,l:c}=s(e[i],t);[n[i],o[i]]=[r,c]}return[n,o]}const i=(e,t)=>BigInt(e>>>0)<<n|BigInt(t>>>0);t.toBig=i;const c=(e,t,r)=>e>>>r;t.shrSH=c;const a=(e,t,r)=>e<<32-r|t>>>r;t.shrSL=a;const u=(e,t,r)=>e>>>r|t<<32-r;t.rotrSH=u;const h=(e,t,r)=>e<<32-r|t>>>r;t.rotrSL=h;const d=(e,t,r)=>e<<64-r|t>>>r-32;t.rotrBH=d;const f=(e,t,r)=>e>>>r-32|t<<64-r;t.rotrBL=f;const l=(e,t)=>t;t.rotr32H=l;const p=(e,t)=>e;t.rotr32L=p;const y=(e,t,r)=>e<<r|t>>>32-r;t.rotlSH=y;const b=(e,t,r)=>t<<r|e>>>32-r;t.rotlSL=b;const g=(e,t,r)=>t<<r-32|e>>>64-r;t.rotlBH=g;const A=(e,t,r)=>e<<r-32|t>>>64-r;function m(e,t,r,n){const s=(t>>>0)+(n>>>0);return{h:e+r+(s/2**32|0)|0,l:0|s}}t.rotlBL=A;const w=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);t.add3L=w;const E=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;t.add3H=E;const x=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);t.add4L=x;const _=(e,t,r,n,s)=>t+r+n+s+(e/2**32|0)|0;t.add4H=_;const H=(e,t,r,n,s)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(s>>>0);t.add5L=H;const I=(e,t,r,n,s,o)=>t+r+n+s+o+(e/2**32|0)|0;t.add5H=I,t.default={fromBig:s,split:o,toBig:i,shrSH:c,shrSL:a,rotrSH:u,rotrSL:h,rotrBH:d,rotrBL:f,rotr32H:l,rotr32L:p,rotlSH:y,rotlSL:b,rotlBH:g,rotlBL:A,add:m,add3L:w,add3H:E,add4L:x,add4H:_,add5H:I,add5L:H}}),X=G,q=$,z=M(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sha512_224=t.sha512_256=t.sha384=t.sha512=t.sha224=t.sha256=t.SHA512_256=t.SHA512_224=t.SHA384=t.SHA512=t.SHA224=t.SHA256=void 0;const r=/* @__PURE__ */Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),n=/* @__PURE__ */new Uint32Array(64);class s extends X.HashMD{constructor(e=32){super(64,e,8,!1),this.A=0|X.SHA256_IV[0],this.B=0|X.SHA256_IV[1],this.C=0|X.SHA256_IV[2],this.D=0|X.SHA256_IV[3],this.E=0|X.SHA256_IV[4],this.F=0|X.SHA256_IV[5],this.G=0|X.SHA256_IV[6],this.H=0|X.SHA256_IV[7]}get(){const{A:e,B:t,C:r,D:n,E:s,F:o,G:i,H:c}=this;return[e,t,r,n,s,o,i,c]}set(e,t,r,n,s,o,i,c){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|s,this.F=0|o,this.G=0|i,this.H=0|c}process(e,t){for(let r=0;r<16;r++,t+=4)n[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=n[e-15],r=n[e-2],s=(0,N.rotr)(t,7)^(0,N.rotr)(t,18)^t>>>3,o=(0,N.rotr)(r,17)^(0,N.rotr)(r,19)^r>>>10;n[e]=o+n[e-7]+s+n[e-16]|0}let{A:s,B:o,C:i,D:c,E:a,F:u,G:h,H:d}=this;for(let e=0;e<64;e++){const t=d+((0,N.rotr)(a,6)^(0,N.rotr)(a,11)^(0,N.rotr)(a,25))+(0,X.Chi)(a,u,h)+r[e]+n[e]|0,f=((0,N.rotr)(s,2)^(0,N.rotr)(s,13)^(0,N.rotr)(s,22))+(0,X.Maj)(s,o,i)|0;d=h,h=u,u=a,a=c+t|0,c=i,i=o,o=s,s=t+f|0}s=s+this.A|0,o=o+this.B|0,i=i+this.C|0,c=c+this.D|0,a=a+this.E|0,u=u+this.F|0,h=h+this.G|0,d=d+this.H|0,this.set(s,o,i,c,a,u,h,d)}roundClean(){(0,N.clean)(n)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,N.clean)(this.buffer)}}t.SHA256=s;class o extends s{constructor(){super(28),this.A=0|X.SHA224_IV[0],this.B=0|X.SHA224_IV[1],this.C=0|X.SHA224_IV[2],this.D=0|X.SHA224_IV[3],this.E=0|X.SHA224_IV[4],this.F=0|X.SHA224_IV[5],this.G=0|X.SHA224_IV[6],this.H=0|X.SHA224_IV[7]}}t.SHA224=o;const i=/* @__PURE__ */(()=>q.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))))(),c=/* @__PURE__ */(()=>i[0])(),a=/* @__PURE__ */(()=>i[1])(),u=/* @__PURE__ */new Uint32Array(80),h=/* @__PURE__ */new Uint32Array(80);class d extends X.HashMD{constructor(e=64){super(128,e,16,!1),this.Ah=0|X.SHA512_IV[0],this.Al=0|X.SHA512_IV[1],this.Bh=0|X.SHA512_IV[2],this.Bl=0|X.SHA512_IV[3],this.Ch=0|X.SHA512_IV[4],this.Cl=0|X.SHA512_IV[5],this.Dh=0|X.SHA512_IV[6],this.Dl=0|X.SHA512_IV[7],this.Eh=0|X.SHA512_IV[8],this.El=0|X.SHA512_IV[9],this.Fh=0|X.SHA512_IV[10],this.Fl=0|X.SHA512_IV[11],this.Gh=0|X.SHA512_IV[12],this.Gl=0|X.SHA512_IV[13],this.Hh=0|X.SHA512_IV[14],this.Hl=0|X.SHA512_IV[15]}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:s,Cl:o,Dh:i,Dl:c,Eh:a,El:u,Fh:h,Fl:d,Gh:f,Gl:l,Hh:p,Hl:y}=this;return[e,t,r,n,s,o,i,c,a,u,h,d,f,l,p,y]}set(e,t,r,n,s,o,i,c,a,u,h,d,f,l,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|s,this.Cl=0|o,this.Dh=0|i,this.Dl=0|c,this.Eh=0|a,this.El=0|u,this.Fh=0|h,this.Fl=0|d,this.Gh=0|f,this.Gl=0|l,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let r=0;r<16;r++,t+=4)u[r]=e.getUint32(t),h[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|u[e-15],r=0|h[e-15],n=q.rotrSH(t,r,1)^q.rotrSH(t,r,8)^q.shrSH(t,r,7),s=q.rotrSL(t,r,1)^q.rotrSL(t,r,8)^q.shrSL(t,r,7),o=0|u[e-2],i=0|h[e-2],c=q.rotrSH(o,i,19)^q.rotrBH(o,i,61)^q.shrSH(o,i,6),a=q.rotrSL(o,i,19)^q.rotrBL(o,i,61)^q.shrSL(o,i,6),d=q.add4L(s,a,h[e-7],h[e-16]),f=q.add4H(d,n,c,u[e-7],u[e-16]);u[e]=0|f,h[e]=0|d}let{Ah:r,Al:n,Bh:s,Bl:o,Ch:i,Cl:d,Dh:f,Dl:l,Eh:p,El:y,Fh:b,Fl:g,Gh:A,Gl:m,Hh:w,Hl:E}=this;for(let e=0;e<80;e++){const t=q.rotrSH(p,y,14)^q.rotrSH(p,y,18)^q.rotrBH(p,y,41),x=q.rotrSL(p,y,14)^q.rotrSL(p,y,18)^q.rotrBL(p,y,41),_=p&b^~p&A,H=q.add5L(E,x,y&g^~y&m,a[e],h[e]),I=q.add5H(H,w,t,_,c[e],u[e]),v=0|H,S=q.rotrSH(r,n,28)^q.rotrBH(r,n,34)^q.rotrBH(r,n,39),D=q.rotrSL(r,n,28)^q.rotrBL(r,n,34)^q.rotrBL(r,n,39),L=r&s^r&i^s&i,P=n&o^n&d^o&d;w=0|A,E=0|m,A=0|b,m=0|g,b=0|p,g=0|y,({h:p,l:y}=q.add(0|f,0|l,0|I,0|v)),f=0|i,l=0|d,i=0|s,d=0|o,s=0|r,o=0|n;const B=q.add3L(v,D,P);r=q.add3H(B,I,S,L),n=0|B}({h:r,l:n}=q.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:s,l:o}=q.add(0|this.Bh,0|this.Bl,0|s,0|o)),({h:i,l:d}=q.add(0|this.Ch,0|this.Cl,0|i,0|d)),({h:f,l}=q.add(0|this.Dh,0|this.Dl,0|f,0|l)),({h:p,l:y}=q.add(0|this.Eh,0|this.El,0|p,0|y)),({h:b,l:g}=q.add(0|this.Fh,0|this.Fl,0|b,0|g)),({h:A,l:m}=q.add(0|this.Gh,0|this.Gl,0|A,0|m)),({h:w,l:E}=q.add(0|this.Hh,0|this.Hl,0|w,0|E)),this.set(r,n,s,o,i,d,f,l,p,y,b,g,A,m,w,E)}roundClean(){(0,N.clean)(u,h)}destroy(){(0,N.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}t.SHA512=d;class f extends d{constructor(){super(48),this.Ah=0|X.SHA384_IV[0],this.Al=0|X.SHA384_IV[1],this.Bh=0|X.SHA384_IV[2],this.Bl=0|X.SHA384_IV[3],this.Ch=0|X.SHA384_IV[4],this.Cl=0|X.SHA384_IV[5],this.Dh=0|X.SHA384_IV[6],this.Dl=0|X.SHA384_IV[7],this.Eh=0|X.SHA384_IV[8],this.El=0|X.SHA384_IV[9],this.Fh=0|X.SHA384_IV[10],this.Fl=0|X.SHA384_IV[11],this.Gh=0|X.SHA384_IV[12],this.Gl=0|X.SHA384_IV[13],this.Hh=0|X.SHA384_IV[14],this.Hl=0|X.SHA384_IV[15]}}t.SHA384=f;const l=/* @__PURE__ */Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),p=/* @__PURE__ */Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class y extends d{constructor(){super(28),this.Ah=0|l[0],this.Al=0|l[1],this.Bh=0|l[2],this.Bl=0|l[3],this.Ch=0|l[4],this.Cl=0|l[5],this.Dh=0|l[6],this.Dl=0|l[7],this.Eh=0|l[8],this.El=0|l[9],this.Fh=0|l[10],this.Fl=0|l[11],this.Gh=0|l[12],this.Gl=0|l[13],this.Hh=0|l[14],this.Hl=0|l[15]}}t.SHA512_224=y;class b extends d{constructor(){super(32),this.Ah=0|p[0],this.Al=0|p[1],this.Bh=0|p[2],this.Bl=0|p[3],this.Ch=0|p[4],this.Cl=0|p[5],this.Dh=0|p[6],this.Dl=0|p[7],this.Eh=0|p[8],this.El=0|p[9],this.Fh=0|p[10],this.Fl=0|p[11],this.Gh=0|p[12],this.Gl=0|p[13],this.Hh=0|p[14],this.Hl=0|p[15]}}t.SHA512_256=b,t.sha256=(0,N.createHasher)(()=>new s),t.sha224=(0,N.createHasher)(()=>new o),t.sha512=(0,N.createHasher)(()=>new d),t.sha384=(0,N.createHasher)(()=>new f),t.sha512_256=(0,N.createHasher)(()=>new b),t.sha512_224=(0,N.createHasher)(()=>new y)}),Y=z,Z=M(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sha224=t.SHA224=t.sha256=t.SHA256=void 0,t.SHA256=Y.SHA256,t.sha256=Y.sha256,t.SHA224=Y.SHA224,t.sha224=Y.sha224});const J=(T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(/*#__PURE__*/Object.defineProperty({default:function(e){return Array.isArray(e)?new Uint8Array(e):e}},"__esModule",{value:!0}));var Q=/*#__PURE__*/Object.defineProperty({default:function(e){function t(t){return e((0,J.default)(t))}return t.create=()=>{const t=e.create();return{update(e){return t.update((0,J.default)(e)),this},digest:()=>t.digest()}},t}},"__esModule",{value:!0}),ee=Z,te=M(function(e,t){var r=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sha256=void 0;const n=r(Q);t.sha256=(0,n.default)(ee.sha256)}),re=M(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.concatArgs=t.arrayEqual=void 0,t.arrayEqual=function(e,t){return e.length===t.length&&e.every((e,r)=>e===t[r])},t.concatArgs=function(...e){return e.flatMap(e=>"number"==typeof e?[e]:Array.from(e))}}),ne=M(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isValidClassicAddress=t.decodeAccountPublic=t.encodeAccountPublic=t.encodeNodePublic=t.decodeNodePublic=t.decodeAddress=t.decodeAccountID=t.encodeAddress=t.encodeAccountID=t.decodeSeed=t.encodeSeed=t.codec=void 0;const r=[1,225,75],s={sha256:te.sha256},o=new class{constructor(e){this._sha256=e.sha256,this._codec=n.base58xrp}encode(e,t){return this._encodeVersioned(e,t.versions,t.expectedLength)}decode(e,t){var r;const n=t.versions,s=t.versionTypes,o=this.decodeChecked(e);if(n.length>1&&!t.expectedLength)throw new Error("expectedLength is required because there are >= 2 possible versions");const i=null!==(r=t.expectedLength)&&void 0!==r?r:o.length-("number"==typeof n[0]?1:n[0].length),c=o.slice(0,-i),a=o.slice(-i);for(let e=0;e<n.length;e++){const t=Array.isArray(n[e])?n[e]:[n[e]];if((0,re.arrayEqual)(c,t))return{version:t,bytes:a,type:s?s[e]:null}}throw new Error("version_invalid: version bytes do not match any of the provided version(s)")}encodeChecked(e){const t=this._sha256(this._sha256(e)).slice(0,4);return this._encodeRaw(Uint8Array.from((0,re.concatArgs)(e,t)))}decodeChecked(e){const t=this._decodeRaw(e);if(t.byteLength<5)throw new Error("invalid_input_size: decoded data must have length >= 5");if(!this._verifyCheckSum(t))throw new Error("checksum_invalid");return t.slice(0,-4)}_encodeVersioned(e,t,r){if(!a(e,r))throw new Error("unexpected_payload_length: bytes.length does not match expectedLength. Ensure that the bytes are a Uint8Array.");return this.encodeChecked((0,re.concatArgs)(t,e))}_encodeRaw(e){return this._codec.encode(Uint8Array.from(e))}_decodeRaw(e){return this._codec.decode(e)}_verifyCheckSum(e){const t=this._sha256(this._sha256(e.slice(0,-4))).slice(0,4),r=e.slice(-4);return(0,re.arrayEqual)(t,r)}}(s);function i(e){return o.encode(e,{versions:[0],expectedLength:20})}function c(e){return o.decode(e,{versions:[0],expectedLength:20}).bytes}function a(e,t){return"byteLength"in e?e.byteLength===t:e.length===t}t.codec=o,t.encodeSeed=function(e,t){if(!a(e,16))throw new Error("entropy must have length 16");return o.encode(e,{expectedLength:16,versions:"ed25519"===t?r:[33]})},t.decodeSeed=function(e,t={versionTypes:["ed25519","secp256k1"],versions:[r,33],expectedLength:16}){return o.decode(e,t)},t.encodeAccountID=i,t.encodeAddress=i,t.decodeAccountID=c,t.decodeAddress=c,t.decodeNodePublic=function(e){return o.decode(e,{versions:[28],expectedLength:33}).bytes},t.encodeNodePublic=function(e){return o.encode(e,{versions:[28],expectedLength:33})},t.encodeAccountPublic=function(e){return o.encode(e,{versions:[35],expectedLength:33})},t.decodeAccountPublic=function(e){return o.decode(e,{versions:[35],expectedLength:33}).bytes},t.isValidClassicAddress=function(e){try{c(e)}catch(e){return!1}return!0}}),se=M(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isValidXAddress=t.decodeXAddress=t.xAddressToClassicAddress=t.encodeXAddress=t.classicAddressToXAddress=t.isValidClassicAddress=t.decodeAccountPublic=t.encodeAccountPublic=t.decodeNodePublic=t.encodeNodePublic=t.decodeAccountID=t.encodeAccountID=t.decodeSeed=t.encodeSeed=t.codec=void 0,Object.defineProperty(t,"codec",{enumerable:!0,get:function(){return ne.codec}}),Object.defineProperty(t,"encodeSeed",{enumerable:!0,get:function(){return ne.encodeSeed}}),Object.defineProperty(t,"decodeSeed",{enumerable:!0,get:function(){return ne.decodeSeed}}),Object.defineProperty(t,"encodeAccountID",{enumerable:!0,get:function(){return ne.encodeAccountID}}),Object.defineProperty(t,"decodeAccountID",{enumerable:!0,get:function(){return ne.decodeAccountID}}),Object.defineProperty(t,"encodeNodePublic",{enumerable:!0,get:function(){return ne.encodeNodePublic}}),Object.defineProperty(t,"decodeNodePublic",{enumerable:!0,get:function(){return ne.decodeNodePublic}}),Object.defineProperty(t,"encodeAccountPublic",{enumerable:!0,get:function(){return ne.encodeAccountPublic}}),Object.defineProperty(t,"decodeAccountPublic",{enumerable:!0,get:function(){return ne.decodeAccountPublic}}),Object.defineProperty(t,"isValidClassicAddress",{enumerable:!0,get:function(){return ne.isValidClassicAddress}});const r={main:Uint8Array.from([5,68]),test:Uint8Array.from([4,147])};function n(e,t,n){if(20!==e.length)throw new Error("Account ID must be 20 bytes");if(!1!==t&&t>4294967295)throw new Error("Invalid tag");const s=t||0,o=(0,W.concat)([n?r.test:r.main,e,Uint8Array.from([!1===t||null==t?0:1,255&s,s>>8&255,s>>16&255,s>>24&255,0,0,0,0])]);return ne.codec.encodeChecked(o)}function s(e){const t=ne.codec.decodeChecked(e),n=function(e){const t=e.slice(0,2);if((0,W.equal)(r.main,t))return!1;if((0,W.equal)(r.test,t))return!0;throw new Error("Invalid X-address: bad prefix")}(t);return{accountId:t.slice(2,22),tag:function(e){const t=e[22];if(t>=2)throw new Error("Unsupported X-address");if(1===t)return e[23]+256*e[24]+65536*e[25]+16777216*e[26];if(0!==t)throw new Error("flag must be zero to indicate no tag");if(!(0,W.equal)((0,W.hexToBytes)("0000000000000000"),e.slice(23,31)))throw new Error("remaining bytes must be zero");return!1}(t),test:n}}t.classicAddressToXAddress=function(e,t,r){return n((0,ne.decodeAccountID)(e),t,r)},t.encodeXAddress=n,t.xAddressToClassicAddress=function(e){const{accountId:t,tag:r,test:n}=s(e);return{classicAddress:(0,ne.encodeAccountID)(t),tag:r,test:n}},t.decodeXAddress=s,t.isValidXAddress=function(e){try{s(e)}catch(e){return!1}return!0}}),oe=M(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=t.RIPEMD160=t.md5=t.MD5=t.sha1=t.SHA1=void 0;const r=/* @__PURE__ */Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),n=/* @__PURE__ */new Uint32Array(80);class s extends X.HashMD{constructor(){super(64,20,8,!1),this.A=0|r[0],this.B=0|r[1],this.C=0|r[2],this.D=0|r[3],this.E=0|r[4]}get(){const{A:e,B:t,C:r,D:n,E:s}=this;return[e,t,r,n,s]}set(e,t,r,n,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)n[r]=e.getUint32(t,!1);for(let e=16;e<80;e++)n[e]=(0,N.rotl)(n[e-3]^n[e-8]^n[e-14]^n[e-16],1);let{A:r,B:s,C:o,D:i,E:c}=this;for(let e=0;e<80;e++){let t,a;e<20?(t=(0,X.Chi)(s,o,i),a=1518500249):e<40?(t=s^o^i,a=1859775393):e<60?(t=(0,X.Maj)(s,o,i),a=2400959708):(t=s^o^i,a=3395469782);const u=(0,N.rotl)(r,5)+t+c+a+n[e]|0;c=i,i=o,o=(0,N.rotl)(s,30),s=r,r=u}r=r+this.A|0,s=s+this.B|0,o=o+this.C|0,i=i+this.D|0,c=c+this.E|0,this.set(r,s,o,i,c)}roundClean(){(0,N.clean)(n)}destroy(){this.set(0,0,0,0,0),(0,N.clean)(this.buffer)}}t.SHA1=s,t.sha1=(0,N.createHasher)(()=>new s);const o=/* @__PURE__ */Math.pow(2,32),i=/* @__PURE__ */Array.from({length:64},(e,t)=>Math.floor(o*Math.abs(Math.sin(t+1)))),c=/* @__PURE__ */r.slice(0,4),a=/* @__PURE__ */new Uint32Array(16);class u extends X.HashMD{constructor(){super(64,16,8,!0),this.A=0|c[0],this.B=0|c[1],this.C=0|c[2],this.D=0|c[3]}get(){const{A:e,B:t,C:r,D:n}=this;return[e,t,r,n]}set(e,t,r,n){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n}process(e,t){for(let r=0;r<16;r++,t+=4)a[r]=e.getUint32(t,!0);let{A:r,B:n,C:s,D:o}=this;for(let e=0;e<64;e++){let t,c,u;e<16?(t=(0,X.Chi)(n,s,o),c=e,u=[7,12,17,22]):e<32?(t=(0,X.Chi)(o,n,s),c=(5*e+1)%16,u=[5,9,14,20]):e<48?(t=n^s^o,c=(3*e+5)%16,u=[4,11,16,23]):(t=s^(n|~o),c=7*e%16,u=[6,10,15,21]),t=t+r+i[e]+a[c],r=o,o=s,s=n,n+=(0,N.rotl)(t,u[e%4])}r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,o=o+this.D|0,this.set(r,n,s,o)}roundClean(){(0,N.clean)(a)}destroy(){this.set(0,0,0,0),(0,N.clean)(this.buffer)}}t.MD5=u,t.md5=(0,N.createHasher)(()=>new u);const h=/* @__PURE__ */Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),d=/* @__PURE__ */(()=>Uint8Array.from(new Array(16).fill(0).map((e,t)=>t)))(),f=/* @__PURE__ */(()=>d.map(e=>(9*e+5)%16))(),l=/* @__PURE__ */(()=>{const e=[[d],[f]];for(let t=0;t<4;t++)for(let r of e)r.push(r[t].map(e=>h[e]));return e})(),p=/* @__PURE__ */(()=>l[0])(),y=/* @__PURE__ */(()=>l[1])(),b=/* @__PURE__ */[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),g=/* @__PURE__ */p.map((e,t)=>e.map(e=>b[t][e])),A=/* @__PURE__ */y.map((e,t)=>e.map(e=>b[t][e])),m=/* @__PURE__ */Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),w=/* @__PURE__ */Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function E(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const x=/* @__PURE__ */new Uint32Array(16);class _ extends X.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:s}=this;return[e,t,r,n,s]}set(e,t,r,n,s){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)x[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,s=0|this.h1,o=s,i=0|this.h2,c=i,a=0|this.h3,u=a,h=0|this.h4,d=h;for(let e=0;e<5;e++){const t=4-e,f=m[e],l=w[e],b=p[e],_=y[e],H=g[e],I=A[e];for(let t=0;t<16;t++){const n=(0,N.rotl)(r+E(e,s,i,a)+x[b[t]]+f,H[t])+h|0;r=h,h=a,a=0|(0,N.rotl)(i,10),i=s,s=n}for(let e=0;e<16;e++){const r=(0,N.rotl)(n+E(t,o,c,u)+x[_[e]]+l,I[e])+d|0;n=d,d=u,u=0|(0,N.rotl)(c,10),c=o,o=r}}this.set(this.h1+i+u|0,this.h2+a+d|0,this.h3+h+n|0,this.h4+r+o|0,this.h0+s+c|0)}roundClean(){(0,N.clean)(x)}destroy(){this.destroyed=!0,(0,N.clean)(this.buffer),this.set(0,0,0,0,0)}}t.RIPEMD160=_,t.ripemd160=(0,N.createHasher)(()=>new _)}),ie=oe,ce=M(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=t.RIPEMD160=void 0,t.RIPEMD160=ie.RIPEMD160,t.ripemd160=ie.ripemd160}),ae=M(function(e,t){var r=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=void 0;const n=r(Q);t.ripemd160=(0,n.default)(ce.ripemd160)}),ue=M(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sha512_256=t.SHA512_256=t.sha512_224=t.SHA512_224=t.sha384=t.SHA384=t.sha512=t.SHA512=void 0,t.SHA512=Y.SHA512,t.sha512=Y.sha512,t.SHA384=Y.SHA384,t.sha384=Y.sha384,t.SHA512_224=Y.SHA512_224,t.sha512_224=Y.sha512_224,t.SHA512_256=Y.SHA512_256,t.sha512_256=Y.sha512_256}),he=M(function(e,t){var r=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sha512=void 0;const n=r(Q);t.sha512=(0,n.default)(ue.sha512)});class de{constructor(){this.hash=he.sha512.create()}static half(e){return(new de).add(e).first256()}add(e){return this.hash.update(e),this}addU32(e){const t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e),this.add(t)}finish(){return this.hash.digest()}first256(){return this.finish().slice(0,32)}first256BigInt(){return(0,x.bytesToNumberBE)(this.first256())}}var fe=/*#__PURE__*/Object.defineProperty({default:de},"__esModule",{value:!0}),le=M(function(e,t){var r=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.accountPublicFromPublicGenerator=t.derivePrivateKey=void 0;const n=r(fe),s=BigInt(0);function o(e,t){const r=b.secp256k1.CURVE.n;for(let o=0;o<=4294967295;o++){const i=(new n.default).add(e);void 0!==t&&i.addU32(t),i.addU32(o);const c=i.first256BigInt();if(c>s&&c<r)return c}throw new Error("impossible unicorn ;)")}t.derivePrivateKey=function(e,t={}){const r=t.validator,n=b.secp256k1.CURVE.n,s=o(e);return r?s:(o(b.secp256k1.ProjectivePoint.BASE.multiply(s).toRawBytes(!0),t.accountIndex||0)+s)%n},t.accountPublicFromPublicGenerator=function(e){const t=b.secp256k1.ProjectivePoint.fromHex(e),r=o(e,0),n=b.secp256k1.ProjectivePoint.BASE.multiply(r);return t.add(n).toRawBytes(!0)}}),pe=/*#__PURE__*/Object.defineProperty({default:{ok(e,t){if(!e)throw new Error(t)}}},"__esModule",{value:!0}),ye=M(function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.getAlgorithmFromPrivateKey=t.getAlgorithmFromPublicKey=t.getAlgorithmFromKey=void 0,function(e){e[e.NONE=-1]="NONE",e[e.ED25519=237]="ED25519",e[e.SECP256K1_PUB_X=2]="SECP256K1_PUB_X",e[e.SECP256K1_PUB_X_ODD_Y=3]="SECP256K1_PUB_X_ODD_Y",e[e.SECP256K1_PUB_XY=4]="SECP256K1_PUB_XY",e[e.SECP256K1_PRIVATE=0]="SECP256K1_PRIVATE"}(r||(r={}));const n={[`private_${r.NONE}_32`]:"ecdsa-secp256k1",[`private_${r.SECP256K1_PRIVATE}_33`]:"ecdsa-secp256k1",[`private_${r.ED25519}_33`]:"ed25519",[`public_${r.ED25519}_33`]:"ed25519",[`public_${r.SECP256K1_PUB_X}_33`]:"ecdsa-secp256k1",[`public_${r.SECP256K1_PUB_X_ODD_Y}_33`]:"ecdsa-secp256k1",[`public_${r.SECP256K1_PUB_XY}_65`]:"ecdsa-secp256k1"};function s(e){return e===r.NONE?"None":`0x${e.toString(16).padStart(2,"0")}`}function o(e,t){const{prefix:o,len:i}=function(e){return{prefix:e.length<2?r.NONE:parseInt(e.slice(0,2),16),len:e.length/2}}(e),c="private"===t&&32===i?r.NONE:o,a=n[`${t}_${c}_${i}`];if(!a)throw new Error(function({key:e,type:t,prefix:r,len:o}){const i=function(e){return Object.entries(n).filter(([t])=>t.startsWith(e)).map(([e,t])=>{const[,r,n]=e.split("_");return`${t.padEnd(17)} - Prefix: ${s(Number(r)).padEnd(6)} Length: ${n} bytes`}).join("\n")}(t);return`invalid_key:\n\nType: ${t}\nKey: ${e}\nPrefix: ${s(r)} \nLength: ${o} bytes\n\nAcceptable ${t} formats are:\n${i}\n`}({key:e,type:t,len:i,prefix:c}));return a}t.getAlgorithmFromKey=o,t.getAlgorithmFromPublicKey=function(e){return o(e,"public")},t.getAlgorithmFromPrivateKey=function(e){return o(e,"private")}}),be=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const ge=be(pe),Ae=be(fe);var me=/*#__PURE__*/Object.defineProperty({default:{deriveKeypair(e,t){const r=(0,le.derivePrivateKey)(e,t);return{privateKey:"00"+(0,W.bytesToHex)((0,x.numberToBytesBE)(r,32)),publicKey:(0,W.bytesToHex)(b.secp256k1.getPublicKey(r,!0))}},sign(e,t){ge.default.ok(66===t.length&&t.startsWith("00")||64===t.length);const r=66===t.length?t.slice(2):t;return b.secp256k1.sign(Ae.default.half(e),r,{lowS:!0,extraEntropy:void 0}).toDERHex(!0).toUpperCase()},verify(e,t,r){const n=b.secp256k1.Signature.fromDER(t);return b.secp256k1.verify(n,Ae.default.half(e),r)}}},"__esModule",{value:!0}),we=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const Ee=we(pe),xe=we(fe);var _e=/*#__PURE__*/Object.defineProperty({default:{deriveKeypair(e){const t=xe.default.half(e);return{privateKey:"ED"+(0,W.bytesToHex)(t),publicKey:"ED"+(0,W.bytesToHex)(_.ed25519.getPublicKey(t))}},sign:(e,t)=>(Ee.default.ok(e instanceof Uint8Array,"message must be array of octets"),Ee.default.ok(66===t.length,"private key must be 33 bytes including prefix"),(0,W.bytesToHex)(_.ed25519.sign(e,t.slice(2)))),verify:(e,t,r)=>(Ee.default.ok(66===r.length,"public key must be 33 bytes including prefix"),_.ed25519.verify(t,e,r.slice(2),{zip215:!1}))}},"__esModule",{value:!0}),He=M(function(e,t){var r=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.decodeSeed=t.deriveNodeAddress=t.deriveAddress=t.verify=t.sign=t.deriveKeypair=t.generateSeed=void 0,Object.defineProperty(t,"decodeSeed",{enumerable:!0,get:function(){return se.decodeSeed}});const n=r(fe),s=r(pe),o=r(me),i=r(_e);function c(e){return{"ecdsa-secp256k1":o.default,ed25519:i.default}[e]}function a(e){return(0,se.encodeAccountID)(function(e){return(0,ae.ripemd160)((0,te.sha256)(e))}(e))}t.generateSeed=function(e={}){s.default.ok(!e.entropy||e.entropy.length>=16,"entropy too short");const t=e.entropy?e.entropy.slice(0,16):(0,W.randomBytes)(16);return(0,se.encodeSeed)(t,"ed25519"===e.algorithm?"ed25519":"secp256k1")},t.deriveKeypair=function(e,t){var r;const s=(0,se.decodeSeed)(e),o=c("ed25519"===(null!==(r=null==t?void 0:t.algorithm)&&void 0!==r?r:s.type)?"ed25519":"ecdsa-secp256k1"),i=o.deriveKeypair(s.bytes,t),a=n.default.half("This test message should verify."),u=o.sign(a,i.privateKey);if(!o.verify(a,u,i.publicKey))throw new Error("derived keypair did not generate verifiable signature");return i},t.sign=function(e,t){return c((0,ye.getAlgorithmFromPrivateKey)(t)).sign((0,W.hexToBytes)(e),t)},t.verify=function(e,t,r){return c((0,ye.getAlgorithmFromPublicKey)(r)).verify((0,W.hexToBytes)(e),t,r)},t.deriveAddress=function(e){return a((0,W.hexToBytes)(e))},t.deriveNodeAddress=function(e){const t=(0,se.decodeNodePublic)(e);return a((0,le.accountPublicFromPublicGenerator)(t))}});const Ie=["wss://s1.ripple.com","wss://xrplcluster.com/","wss://s2.ripple.com/"];function ve(e){for(let n=0;n<e.length;n++){var t,r;return null!=(t=null==(r=e[n])||null==(r=r.tx_json)?void 0:r.SigningPubKey)?t:"0x"}throw new Error("No valid pubkey found in the latest transactions")}const Se={testnet:{grpcUrl:"https://grpc.testnet.concordium.com:20000",walletProxyUrl:"https://wallet-proxy.testnet.concordium.com"},mainnet:{grpcUrl:"https://grpc.mainnet.concordium.com:20000",walletProxyUrl:"https://wallet-proxy.mainnet.concordium.software"}},De={network:"testnet",timeout:5e4,retries:3,testMode:!0};function Le(e){try{if("string"==typeof e)return e;if(e&&"object"==typeof e){const t=e=>{if("string"==typeof e)return e;if(e&&"object"==typeof e)for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=e[r];if("string"==typeof n)return n;if("object"==typeof n){const e=t(n);if(e)return e}}return null},r=t(e);if(r)return r}throw new Error("Unable to extract signature from object")}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw new Error(`Invalid signature format: ${t}`)}}async function Pe(e,t){let r=new Error("No attempts made");for(let o=0;o<=t;o++)try{return await e()}catch(e){var n,s;const i=e instanceof Error?e:new Error(String(e));if(r=i,null!=(n=i.message)&&n.includes("Invalid signature")||null!=(s=i.message)&&s.includes("Account not found"))throw i;if(o===t)break;const c=Math.min(1e3*Math.pow(2,o),5e3);await new Promise(e=>setTimeout(e,c))}throw r}var Be=M(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.bech32m=t.bech32=void 0;const r="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={};for(let e=0;e<32;e++){const t=r.charAt(e);n[t]=e}function s(e){const t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function o(e){let t=1;for(let r=0;r<e.length;++r){const n=e.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+e+")";t=s(t)^n>>5}t=s(t);for(let r=0;r<e.length;++r){const n=e.charCodeAt(r);t=s(t)^31&n}return t}function i(e,t,r,n){let s=0,o=0;const i=(1<<r)-1,c=[];for(let n=0;n<e.length;++n)for(s=s<<t|e[n],o+=t;o>=r;)o-=r,c.push(s>>o&i);if(n)o>0&&c.push(s<<r-o&i);else{if(o>=t)return"Excess padding";if(s<<r-o&i)return"Non-zero padding"}return c}function c(e){return i(e,8,5,!0)}function a(e){const t=i(e,5,8,!1);if(Array.isArray(t))return t}function u(e){const t=i(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function h(e){let t;function i(e,r){if(e.length<8)return e+" too short";if(e.length>(r=r||90))return"Exceeds length limit";const i=e.toLowerCase(),c=e.toUpperCase();if(e!==i&&e!==c)return"Mixed-case string "+e;const a=(e=i).lastIndexOf("1");if(-1===a)return"No separator character for "+e;if(0===a)return"Missing prefix for "+e;const u=e.slice(0,a),h=e.slice(a+1);if(h.length<6)return"Data too short";let d=o(u);if("string"==typeof d)return d;const f=[];for(let e=0;e<h.length;++e){const t=h.charAt(e),r=n[t];if(void 0===r)return"Unknown character "+t;d=s(d)^r,e+6>=h.length||f.push(r)}return d!==t?"Invalid checksum for "+e:{prefix:u,words:f}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const r=i(e,t);if("object"==typeof r)return r},decode:function(e,t){const r=i(e,t);if("object"==typeof r)return r;throw new Error(r)},encode:function(e,n,i){if(e.length+7+n.length>(i=i||90))throw new TypeError("Exceeds length limit");let c=o(e=e.toLowerCase());if("string"==typeof c)throw new Error(c);let a=e+"1";for(let e=0;e<n.length;++e){const t=n[e];if(t>>5)throw new Error("Non 5-bit word");c=s(c)^t,a+=r.charAt(t)}for(let e=0;e<6;++e)c=s(c);c^=t;for(let e=0;e<6;++e)a+=r.charAt(c>>5*(5-e)&31);return a},toWords:c,fromWordsUnsafe:a,fromWords:u}}t.bech32=h("bech32"),t.bech32m=h("bech32m")});function Ue(e,...t){if(!((r=e)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");var r;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Ve(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Ce(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ke(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Fe(e,t){return e<<32-t|e>>>t}function Oe(e,t){return e<<t|e>>>32-t>>>0}function Te(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}(e)),Ue(e),e}class Me{}function Ke(e){const t=t=>e().update(Te(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function je(e,t,r){return e&t^~e&r}function Ne(e,t,r){return e&t^e&r^t&r}class Re extends Me{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=ke(this.buffer)}update(e){Ve(this),Ue(e=Te(e));const{view:t,buffer:r,blockLen:n}=this,s=e.length;for(let o=0;o<s;){const i=Math.min(n-this.pos,s-o);if(i===n){const t=ke(e);for(;n<=s-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+i),this.pos),this.pos+=i,o+=i,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Ve(this),function(e,t){Ue(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:s}=this;let{pos:o}=this;t[o++]=128,Ce(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const s=BigInt(32),o=BigInt(4294967295),i=Number(r>>s&o),c=Number(r&o),a=n?0:4;e.setUint32(t+(n?4:0),i,n),e.setUint32(t+a,c,n)}(r,n-8,BigInt(8*this.length),s),this.process(r,0);const i=ke(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const a=c/4,u=this.get();if(a>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<a;e++)i.setUint32(4*e,u[e],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:s,destroyed:o,pos:i}=this;return e.destroyed=o,e.finished=s,e.length=n,e.pos=i,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const We=/* @__PURE__ */Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ge=/* @__PURE__ */Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),$e=/* @__PURE__ */(()=>Uint8Array.from(new Array(16).fill(0).map((e,t)=>t)))(),Xe=/* @__PURE__ */(()=>$e.map(e=>(9*e+5)%16))(),qe=/* @__PURE__ */(()=>{const e=[[$e],[Xe]];for(let t=0;t<4;t++)for(let r of e)r.push(r[t].map(e=>Ge[e]));return e})(),ze=/* @__PURE__ */(()=>qe[0])(),Ye=/* @__PURE__ */(()=>qe[1])(),Ze=/* @__PURE__ */[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),Je=/* @__PURE__ */ze.map((e,t)=>e.map(e=>Ze[t][e])),Qe=/* @__PURE__ */Ye.map((e,t)=>e.map(e=>Ze[t][e])),et=/* @__PURE__ */Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),tt=/* @__PURE__ */Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function rt(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const nt=/* @__PURE__ */new Uint32Array(16);class st extends Re{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:s}=this;return[e,t,r,n,s]}set(e,t,r,n,s){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)nt[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,s=0|this.h1,o=s,i=0|this.h2,c=i,a=0|this.h3,u=a,h=0|this.h4,d=h;for(let e=0;e<5;e++){const t=4-e,f=et[e],l=tt[e],p=ze[e],y=Ye[e],b=Je[e],g=Qe[e];for(let t=0;t<16;t++){const n=Oe(r+rt(e,s,i,a)+nt[p[t]]+f,b[t])+h|0;r=h,h=a,a=0|Oe(i,10),i=s,s=n}for(let e=0;e<16;e++){const r=Oe(n+rt(t,o,c,u)+nt[y[e]]+l,g[e])+d|0;n=d,d=u,u=0|Oe(c,10),c=o,o=r}}this.set(this.h1+i+u|0,this.h2+a+d|0,this.h3+h+n|0,this.h4+r+o|0,this.h0+s+c|0)}roundClean(){Ce(nt)}destroy(){this.destroyed=!0,Ce(this.buffer),this.set(0,0,0,0,0)}}const ot=/* @__PURE__ */Ke(()=>new st),it=/* @__PURE__ */Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ct=/* @__PURE__ */new Uint32Array(64);class at extends Re{constructor(e=32){super(64,e,8,!1),this.A=0|We[0],this.B=0|We[1],this.C=0|We[2],this.D=0|We[3],this.E=0|We[4],this.F=0|We[5],this.G=0|We[6],this.H=0|We[7]}get(){const{A:e,B:t,C:r,D:n,E:s,F:o,G:i,H:c}=this;return[e,t,r,n,s,o,i,c]}set(e,t,r,n,s,o,i,c){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|s,this.F=0|o,this.G=0|i,this.H=0|c}process(e,t){for(let r=0;r<16;r++,t+=4)ct[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=ct[e-15],r=ct[e-2],n=Fe(t,7)^Fe(t,18)^t>>>3,s=Fe(r,17)^Fe(r,19)^r>>>10;ct[e]=s+ct[e-7]+n+ct[e-16]|0}let{A:r,B:n,C:s,D:o,E:i,F:c,G:a,H:u}=this;for(let e=0;e<64;e++){const t=u+(Fe(i,6)^Fe(i,11)^Fe(i,25))+je(i,c,a)+it[e]+ct[e]|0,h=(Fe(r,2)^Fe(r,13)^Fe(r,22))+Ne(r,n,s)|0;u=a,a=c,c=i,i=o+t|0,o=s,s=n,n=r,r=t+h|0}r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,o=o+this.D|0,i=i+this.E|0,c=c+this.F|0,a=a+this.G|0,u=u+this.H|0,this.set(r,n,s,o,i,c,a,u)}roundClean(){Ce(ct)}destroy(){this.set(0,0,0,0,0,0,0,0),Ce(this.buffer)}}const ut=/* @__PURE__ */Ke(()=>new at);function ht(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function dt(e){const t=(new TextEncoder).encode(e);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}async function ft(r,n){switch(r.type){case t.SelfDeclaration:return v({},r,{status:r.confirmed?e.VERIFIED:e.FAILED});case t.Screenshot:return v({},r,{status:r.url?e.FLAGGED:e.FAILED});case t.CIP8:return async function(t){const[r,,n]=t.address.split(/:/),s=t.chainSpecificData&&"cardanoCoseKey"in t.chainSpecificData?t.chainSpecificData.cardanoCoseKey:null;if("cardano"!==r||!s)return v({},t,{status:e.FAILED});try{return v({},t,{status:w(t.proof,s,t.attestation,n)?e.VERIFIED:e.FAILED})}catch(r){return v({},t,{status:e.FAILED})}}(r);case t.EIP191:return async function(t){const[r,,n]=t.address.split(/:/);if("eip155"!==r)return v({},t,{status:e.FAILED});const s=function(e,t,r){try{const n=u.getSignPayload(h.fromString(t)),s=d.fromHex(r),o=f.recoverPublicKey({payload:n,signature:s});return l.checksum(l.fromPublicKey(o)).toString()===l.checksum(e)}catch(e){return!1}}(n,t.attestation,t.proof);return v({},t,{status:s?e.VERIFIED:e.FAILED})}(r);case t.ED25519:return async function(t){const[r,,n]=t.address.split(/:/);if("solana"!==r)return v({},t,{status:e.FAILED});try{const r=c.decode(n),s=(new TextEncoder).encode(t.attestation),o=i.decode(t.proof);return v({},t,{status:m.sign.detached.verify(s,o,r)?e.VERIFIED:e.FAILED})}catch(r){return v({},t,{status:e.FAILED})}}(r);case t.SOL_SIWX:return async function(t){const[r]=t.address.split(/:/);if("solana"!==r)return v({},t,{status:e.FAILED});if(!t.chainSpecificData||!function(e){if(!e||"object"!=typeof e)return!1;const t=e;if(!t.account||"object"!=typeof t.account)return!1;const r=t.account;if("string"!=typeof r.address)return!1;if(!r.publicKey)return!1;if(!(r.publicKey instanceof Uint8Array)){const e=r.publicKey;if("object"!=typeof e)return!1;{const t=Object.keys(e).filter(e=>!isNaN(Number(e))).sort((e,t)=>Number(e)-Number(t));if(32!==t.length)return!1;{const n=t.map(t=>Number(e[t]));if(!n.every(e=>"number"==typeof e&&e>=0&&e<=255))return!1;r.publicKey=new Uint8Array(n)}}}if(!t.signedMessage)return!1;if(!(t.signedMessage instanceof Uint8Array)){const e=t.signedMessage;if("Buffer"!==e.type||!Array.isArray(e.data))return!1;t.signedMessage=new Uint8Array(e.data)}if(!t.signature)return!1;if(!(t.signature instanceof Uint8Array)){const e=t.signature;if("Buffer"!==e.type||!Array.isArray(e.data))return!1;t.signature=new Uint8Array(e.data)}if(!t.message||"object"!=typeof t.message)return!1;const n=t.message;if("object"==typeof n&&null!==n){const e=n;if(!e.address&&t.signedMessage instanceof Uint8Array)try{const r=(new TextDecoder).decode(t.signedMessage).split("\n");if(r.length>=2){const t=r[1].trim();t&&/^[a-zA-Z0-9]{32,44}$/.test(t)&&(e.address=t)}}catch(e){}}return!!function(e){return!(!e||"object"!=typeof e)&&"string"==typeof e.domain&&"string"==typeof e.address&&(void 0===e.statement||"string"==typeof e.statement)&&(void 0===e.uri||"string"==typeof e.uri)&&(void 0===e.version||"string"==typeof e.version)&&(void 0===e.chainId||"string"==typeof e.chainId)&&(void 0===e.nonce||"string"==typeof e.nonce)&&(void 0===e.issuedAt||"string"==typeof e.issuedAt)&&(void 0===e.expirationTime||"string"==typeof e.expirationTime)&&(void 0===e.notBefore||"string"==typeof e.notBefore)&&(void 0===e.requestId||"string"==typeof e.requestId)&&(void 0===e.resources||Array.isArray(e.resources))}(t.message)}(t.chainSpecificData))return v({},t,{status:e.FAILED});try{const r=t.chainSpecificData,n=(new TextDecoder).decode(r.signedMessage),s=function(e){try{const t=e.split("\n"),r=function(e){var t;const r=null==(t=e[0])?void 0:t.match(/^(.+) wants you to sign in with your Solana account:$/);if(!r)return null;const n=r[1],s=e[1];return s&&/^[a-zA-Z0-9]{32,44}$/.test(s)?{domain:n,address:s}:null}(t);if(!r)return null;const n=v({},r);let s=2;const o=function(e,t){let r=t;if(""===e[r]&&e[r+1]&&!e[r+1].includes(":")){r++;const t=e[r];return r++,""===e[r]&&r++,{statement:t,nextIndex:r}}return{nextIndex:r}}(t,s);void 0!==o.statement&&(n.statement=o.statement,s=o.nextIndex);const i=function(e,t){const r={},n=[{prefix:"URI: ",key:"uri"},{prefix:"Version: ",key:"version"},{prefix:"Chain ID: ",key:"chainId"},{prefix:"Nonce: ",key:"nonce"},{prefix:"Issued At: ",key:"issuedAt"},{prefix:"Expiration Time: ",key:"expirationTime"},{prefix:"Not Before: ",key:"notBefore"},{prefix:"Request ID: ",key:"requestId"}];let s=t;for(;s<e.length;){const t=e[s];if(t){if(t.startsWith("Resources:")){const t=F(e,s+1);if(t.length>0){r.resources=t,s+=t.length+1;continue}}for(const{prefix:e,key:s}of n)if(t.startsWith(e)){const n=t.substring(e.length);r[s]=n;break}s++}else s++}return r}(t,s);return Object.assign(n,i),n}catch(e){return null}}(n);return s&&function(e,t){if(e.domain!==t.domain||e.address!==t.address)return!1;const r=[{inputKey:"statement",parsedKey:"statement"},{inputKey:"uri",parsedKey:"uri"},{inputKey:"version",parsedKey:"version"},{inputKey:"chainId",parsedKey:"chainId"},{inputKey:"nonce",parsedKey:"nonce"},{inputKey:"issuedAt",parsedKey:"issuedAt"},{inputKey:"expirationTime",parsedKey:"expirationTime"},{inputKey:"notBefore",parsedKey:"notBefore"},{inputKey:"requestId",parsedKey:"requestId"},{inputKey:"resources",parsedKey:"resources",validator:(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&e.length===t.length&&e.every((e,r)=>e===t[r])}];for(const{inputKey:n,parsedKey:s,validator:o}of r){const r=t[n],i=e[s];if(void 0!==r)if(o){if(!o(r,i))return!1}else if(r!==i)return!1}return function(e){const t=Date.now();if(e.issuedAt){const r=new Date(e.issuedAt),n=864e5;if(Math.abs(r.getTime()-t)>n)return!1}return!(e.expirationTime&&new Date(e.expirationTime).getTime()<=t||e.notBefore&&new Date(e.notBefore).getTime()>t)}(e)}(s,r.message)?function(e){let t=`${e.domain} wants you to sign in with your Solana account:\n`;t+=`${e.address}`,e.statement&&(t+=`\n\n${e.statement}`);const r=function(e){const t=[],r=[{key:"uri",prefix:"URI: "},{key:"version",prefix:"Version: "},{key:"chainId",prefix:"Chain ID: "},{key:"nonce",prefix:"Nonce: "},{key:"issuedAt",prefix:"Issued At: "},{key:"expirationTime",prefix:"Expiration Time: "},{key:"notBefore",prefix:"Not Before: "},{key:"requestId",prefix:"Request ID: "},{key:"resources",prefix:"Resources:",formatter:e=>Array.isArray(e)&&e.length>0?["Resources:",...e.map(e=>`- ${e}`)]:[]}];for(const{key:n,prefix:s,formatter:o}of r){const r=e[n];if(void 0!==r)if(o){const e=o(r);t.push(...e)}else"string"==typeof r&&t.push(`${s}${r}`)}return t}(e);return r.length&&(t+=`\n\n${r.join("\n")}`),t}(s)!==n?v({},t,{status:e.FAILED}):v({},t,{status:m.sign.detached.verify(r.signedMessage,r.signature,r.account.publicKey)?e.VERIFIED:e.FAILED}):v({},t,{status:e.FAILED})}catch(r){return v({},t,{status:e.FAILED})}}(r);case t.XRP_ED25519:return async function(t,r){const[n,,s]=t.address.split(/:/);if("xrpl"!==n)return v({},t,{status:e.FAILED});if(r||(r=await async function(e){const t=Ie;for(const n of t)try{var r;const t=new E(n);await t.connect();const s=await t.request({command:"account_tx",account:e,binary:!1,limit:2,forward:!1});return await t.disconnect(),ve(null==(r=s.result)?void 0:r.transactions)}catch(e){let t="Connection to XRPL server failed";e instanceof Error&&(t+=`: ${e.message}`),console.error(t)}}(s)),!r)return v({},t,{status:e.FAILED});const o=function(e,t,r){return He.verify(Buffer.from(e).toString("hex"),r,t)}(t.attestation,r,t.proof);return v({},t,{status:o?e.VERIFIED:e.FAILED})}(r,n);case t.XLM_ED25519:return function(t){const[r,,n]=t.address.split(/:/);if("stellar"!==r)return v({},t,{status:e.FAILED});try{const r=H.fromPublicKey(n),s=Buffer.from(t.attestation,"utf-8"),o=Buffer.from(t.proof,"base64");return v({},t,{status:r.verify(s,o)?e.VERIFIED:e.FAILED})}catch(r){return v({},t,{status:e.FAILED})}}(r);case t.CONCORDIUM:return(async(t,r={})=>{const n=v({},De,r),[s,o,i]=t.address.split(/:/);if("ccd"!==s)return v({},t,{status:e.FAILED});let c=n.network;o&&(c=o.includes("testnet")?"testnet":"mainnet");try{let r;try{r=JSON.parse(t.proof)}catch(r){return v({},t,{status:e.FAILED})}if(!r||"object"!=typeof r||0===Object.keys(r).length)return v({},t,{status:e.FAILED});if(n.testMode)try{const n=Le(r);return!n||n.length<64||!/^[0-9a-fA-F]+$/.test(n)?v({},t,{status:e.FAILED}):v({},t,{status:e.VERIFIED})}catch(r){return v({},t,{status:e.FAILED})}const s=await Pe(()=>async function(e,t,r){const n=Se[t];try{const t=new AbortController,s=setTimeout(()=>t.abort(),r),o=await fetch(`${n.walletProxyUrl}/v0/accEncryptionKey/${e}`,{method:"GET",headers:{Accept:"application/json","User-Agent":"verify-proof/1.6.0"},signal:t.signal});return clearTimeout(s),o.ok}catch(e){if(e instanceof Error&&"AbortError"===e.name)throw new Error(`Account validation timeout after ${r}ms`);throw e}}(i,c,n.timeout),n.retries);if(!s)return v({},t,{status:e.FAILED});const o=await Pe(()=>async function(e,t){try{const t=Le(e);return!(!t||t.length<64)&&t.length>=64&&/^[0-9a-fA-F]+$/.test(t)}catch(e){if(e instanceof Error){var r,n,s;if(null!=(r=e.message)&&r.includes("timeout"))throw new Error(`Signature verification timeout after ${t}ms`);if(null!=(n=e.message)&&n.includes("UNAVAILABLE"))throw new Error("Concordium node unavailable");if(null!=(s=e.message)&&s.includes("NOT_FOUND"))return!1}throw e}}(r,n.timeout),n.retries);return v({},t,o?{status:e.VERIFIED}:{status:e.FAILED})}catch(r){return v({},t,{status:e.FAILED})}})(r);case t.COSMOS:return async function(t){try{const[r,,n]=t.address.split(/:/);if("cosmos"!==r)return v({},t,{status:e.FAILED});const s=ht(t.chainSpecificData.pub_key.value),o=ht(t.proof);if(function(e,t="cosmos"){const r=ut(e),n=ot(r);return Be.bech32.encode(t,Be.bech32.toWords(n))}(s)!==n)return v({},t,{status:e.FAILED});const i={chain_id:"",account_number:"0",sequence:"0",fee:{amount:[],gas:"0"},msgs:[{type:"sign/MsgSignData",value:{signer:n,data:dt(t.attestation)}}],memo:""},c=await I(i),a=ut(c);return v({},t,{status:g.verify(o,a,s)?e.VERIFIED:e.FAILED})}catch(r){return v({},t,{status:e.FAILED})}}(r);case t.EIP712:case t.BIP137:case t.BIP322:return async function(r){const[n,,s]=r.address.split(/:/);if("bip122"!==n)return v({},r,{status:e.FAILED});const o=function(e){return e.startsWith("1")||e.startsWith("3")||e.startsWith("bc1")?D.bitcoin:e.startsWith("t1")||e.startsWith("t3")?D.zcash:e.startsWith("L")||e.startsWith("M")||e.startsWith("ltc1")?D.litecoin:e.startsWith("D")||e.startsWith("A")?D.dogecoin:e.startsWith("X")||e.startsWith("7")?D.dash:e.startsWith("q")?D.bitcoincash:e.startsWith("tb1")?D.testnet:D.bitcoin}(s);if(!o)return v({},r,{status:e.FAILED});if(s.startsWith("t1")||s.startsWith("t3"))return B(s,r,o);if(o.isTestnet)return P(s,r);if((s.startsWith("bc1p")||s.startsWith("tb1p"))&&r.type===t.BIP137)return P(s,r);try{switch(r.type){case t.BIP137:return B(s,r,o);case t.BIP322:return P(s,r);default:return v({},r,{status:e.FAILED})}}catch(t){return v({},r,{status:e.FAILED})}}(r);case t.TIP191:return async function(t){const[r,,n]=t.address.split(/:/);return v({},t,"tron"!==r?{status:e.FAILED}:{status:O(n,t.attestation,t.proof)?e.VERIFIED:e.FAILED})}(r)}return r}export{ft as verifyProof};
2
- //# sourceMappingURL=index.modern.js.map