@0xpolygonid/js-sdk 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/esm/index.js +6 -6
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +62 -58
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/kms/key-providers/ed25519-provider.js +6 -7
- package/dist/node/esm/kms/key-providers/ed25519-provider.js +6 -7
- package/dist/types/kms/key-providers/ed25519-provider.d.ts +4 -4
- package/package.json +4 -4
|
@@ -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}
|
|
80
|
+
* @param {Uint8Array} digest - data to sign (32 bytes)
|
|
82
81
|
* @returns {Promise<Uint8Array>} signature
|
|
83
82
|
*/
|
|
84
|
-
async sign(keyId,
|
|
83
|
+
async sign(keyId, digest) {
|
|
85
84
|
const privateKeyHex = await this.privateKey(keyId);
|
|
86
|
-
return ed25519_1.ed25519.sign(
|
|
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
|
|
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(
|
|
94
|
+
async verify(digest, signatureHex, keyId) {
|
|
96
95
|
const publicKeyHex = await this.publicKey(keyId);
|
|
97
|
-
return ed25519_1.ed25519.verify(signatureHex,
|
|
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}
|
|
54
|
+
* @param {Uint8Array} digest - data to sign (32 bytes)
|
|
56
55
|
* @returns {Promise<Uint8Array>} signature
|
|
57
56
|
*/
|
|
58
|
-
async sign(keyId,
|
|
57
|
+
async sign(keyId, digest) {
|
|
59
58
|
const privateKeyHex = await this.privateKey(keyId);
|
|
60
|
-
return ed25519.sign(
|
|
59
|
+
return ed25519.sign(digest, privateKeyHex);
|
|
61
60
|
}
|
|
62
61
|
/**
|
|
63
62
|
* Verifies a signature for the given message and key identifier.
|
|
64
|
-
* @param
|
|
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(
|
|
68
|
+
async verify(digest, signatureHex, keyId) {
|
|
70
69
|
const publicKeyHex = await this.publicKey(keyId);
|
|
71
|
-
return ed25519.verify(signatureHex,
|
|
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}
|
|
34
|
+
* @param {Uint8Array} digest - data to sign (32 bytes)
|
|
35
35
|
* @returns {Promise<Uint8Array>} signature
|
|
36
36
|
*/
|
|
37
|
-
sign(keyId: KmsKeyId,
|
|
37
|
+
sign(keyId: KmsKeyId, digest: Uint8Array): Promise<Uint8Array>;
|
|
38
38
|
/**
|
|
39
39
|
* Verifies a signature for the given message and key identifier.
|
|
40
|
-
* @param
|
|
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(
|
|
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.
|
|
3
|
+
"version": "1.12.0",
|
|
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",
|
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
"@iden3/js-crypto": "1.1.0",
|
|
90
90
|
"@iden3/js-iden3-core": "1.3.1",
|
|
91
91
|
"@iden3/js-jsonld-merklization": "1.2.0",
|
|
92
|
-
"@iden3/js-jwz": "1.
|
|
92
|
+
"@iden3/js-jwz": "1.5.0",
|
|
93
93
|
"@iden3/js-merkletree": "1.2.0",
|
|
94
|
-
"ffjavascript": "0.
|
|
94
|
+
"ffjavascript": "0.3.0",
|
|
95
95
|
"rfc4648": "1.5.3",
|
|
96
|
-
"snarkjs": "0.7.
|
|
96
|
+
"snarkjs": "0.7.4"
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"@noble/curves": "^1.4.0",
|