@0xpolygonid/js-sdk 1.11.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,7 +27,6 @@ exports.Ed25519Provider = void 0;
27
27
  const providerHelpers = __importStar(require("../provider-helpers"));
28
28
  const ed25519_1 = require("@noble/curves/ed25519");
29
29
  const utils_1 = require("../../utils");
30
- const js_crypto_1 = require("@iden3/js-crypto");
31
30
  /**
32
31
  * Provider for Ed25519 keys
33
32
  * @public
@@ -78,23 +77,23 @@ class Ed25519Provider {
78
77
  * signs prepared payload of size,
79
78
  * with a key id
80
79
  * @param {KmsKeyId} keyId - key identifier
81
- * @param {Uint8Array} data - data to sign (32 bytes)
80
+ * @param {Uint8Array} digest - data to sign (32 bytes)
82
81
  * @returns {Promise<Uint8Array>} signature
83
82
  */
84
- async sign(keyId, data) {
83
+ async sign(keyId, digest) {
85
84
  const privateKeyHex = await this.privateKey(keyId);
86
- return ed25519_1.ed25519.sign((0, js_crypto_1.sha256)(data), privateKeyHex);
85
+ return ed25519_1.ed25519.sign(digest, privateKeyHex);
87
86
  }
88
87
  /**
89
88
  * Verifies a signature for the given message and key identifier.
90
- * @param message - The message to verify the signature against.
89
+ * @param digest - The message to verify the signature against.
91
90
  * @param signatureHex - The signature to verify, as a hexadecimal string.
92
91
  * @param keyId - The key identifier to use for verification.
93
92
  * @returns A Promise that resolves to a boolean indicating whether the signature is valid.
94
93
  */
95
- async verify(message, signatureHex, keyId) {
94
+ async verify(digest, signatureHex, keyId) {
96
95
  const publicKeyHex = await this.publicKey(keyId);
97
- return ed25519_1.ed25519.verify(signatureHex, (0, js_crypto_1.sha256)(message), publicKeyHex);
96
+ return ed25519_1.ed25519.verify(signatureHex, digest, publicKeyHex);
98
97
  }
99
98
  /**
100
99
  * Retrieves the private key for a given keyId from the key store.
@@ -1,7 +1,6 @@
1
1
  import * as providerHelpers from '../provider-helpers';
2
2
  import { ed25519 } from '@noble/curves/ed25519';
3
3
  import { bytesToHex } from '../../utils';
4
- import { sha256 } from '@iden3/js-crypto';
5
4
  /**
6
5
  * Provider for Ed25519 keys
7
6
  * @public
@@ -52,23 +51,23 @@ export class Ed25519Provider {
52
51
  * signs prepared payload of size,
53
52
  * with a key id
54
53
  * @param {KmsKeyId} keyId - key identifier
55
- * @param {Uint8Array} data - data to sign (32 bytes)
54
+ * @param {Uint8Array} digest - data to sign (32 bytes)
56
55
  * @returns {Promise<Uint8Array>} signature
57
56
  */
58
- async sign(keyId, data) {
57
+ async sign(keyId, digest) {
59
58
  const privateKeyHex = await this.privateKey(keyId);
60
- return ed25519.sign(sha256(data), privateKeyHex);
59
+ return ed25519.sign(digest, privateKeyHex);
61
60
  }
62
61
  /**
63
62
  * Verifies a signature for the given message and key identifier.
64
- * @param message - The message to verify the signature against.
63
+ * @param digest - The message to verify the signature against.
65
64
  * @param signatureHex - The signature to verify, as a hexadecimal string.
66
65
  * @param keyId - The key identifier to use for verification.
67
66
  * @returns A Promise that resolves to a boolean indicating whether the signature is valid.
68
67
  */
69
- async verify(message, signatureHex, keyId) {
68
+ async verify(digest, signatureHex, keyId) {
70
69
  const publicKeyHex = await this.publicKey(keyId);
71
- return ed25519.verify(signatureHex, sha256(message), publicKeyHex);
70
+ return ed25519.verify(signatureHex, digest, publicKeyHex);
72
71
  }
73
72
  /**
74
73
  * Retrieves the private key for a given keyId from the key store.
@@ -31,18 +31,18 @@ export declare class Ed25519Provider implements IKeyProvider {
31
31
  * signs prepared payload of size,
32
32
  * with a key id
33
33
  * @param {KmsKeyId} keyId - key identifier
34
- * @param {Uint8Array} data - data to sign (32 bytes)
34
+ * @param {Uint8Array} digest - data to sign (32 bytes)
35
35
  * @returns {Promise<Uint8Array>} signature
36
36
  */
37
- sign(keyId: KmsKeyId, data: Uint8Array): Promise<Uint8Array>;
37
+ sign(keyId: KmsKeyId, digest: Uint8Array): Promise<Uint8Array>;
38
38
  /**
39
39
  * Verifies a signature for the given message and key identifier.
40
- * @param message - The message to verify the signature against.
40
+ * @param digest - The message to verify the signature against.
41
41
  * @param signatureHex - The signature to verify, as a hexadecimal string.
42
42
  * @param keyId - The key identifier to use for verification.
43
43
  * @returns A Promise that resolves to a boolean indicating whether the signature is valid.
44
44
  */
45
- verify(message: Uint8Array, signatureHex: string, keyId: KmsKeyId): Promise<boolean>;
45
+ verify(digest: Uint8Array, signatureHex: string, keyId: KmsKeyId): Promise<boolean>;
46
46
  /**
47
47
  * Retrieves the private key for a given keyId from the key store.
48
48
  * @param {KmsKeyId} keyId - The identifier of the key to retrieve.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xpolygonid/js-sdk",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "SDK to work with Polygon ID",
5
5
  "main": "dist/node/cjs/index.js",
6
6
  "module": "dist/node/esm/index.js",