@@ -3,7 +3,6 @@ import { AbstractPrivateKeyStore, KmsKeyId, KmsKeyType } from '../store';
3
3
import * as providerHelpers from '../provider-helpers' ;
4
4
import { ed25519 } from '@noble/curves/ed25519' ;
5
5
import { bytesToHex } from '../../utils' ;
6
- import { sha256 } from '@iden3/js-crypto' ;
7
6
8
7
/**
9
8
* Provider for Ed25519 keys
@@ -61,24 +60,24 @@ export class Ed25519Provider implements IKeyProvider {
61
60
* signs prepared payload of size,
62
61
* with a key id
63
62
* @param {KmsKeyId } keyId - key identifier
64
- * @param {Uint8Array } data - data to sign (32 bytes)
63
+ * @param {Uint8Array } digest - data to sign (32 bytes)
65
64
* @returns {Promise<Uint8Array> } signature
66
65
*/
67
- async sign ( keyId : KmsKeyId , data : Uint8Array ) : Promise < Uint8Array > {
66
+ async sign ( keyId : KmsKeyId , digest : Uint8Array ) : Promise < Uint8Array > {
68
67
const privateKeyHex = await this . privateKey ( keyId ) ;
69
- return ed25519 . sign ( sha256 ( data ) , privateKeyHex ) ;
68
+ return ed25519 . sign ( digest , privateKeyHex ) ;
70
69
}
71
70
72
71
/**
73
72
* Verifies a signature for the given message and key identifier.
74
- * @param message - The message to verify the signature against.
73
+ * @param digest - The message to verify the signature against.
75
74
* @param signatureHex - The signature to verify, as a hexadecimal string.
76
75
* @param keyId - The key identifier to use for verification.
77
76
* @returns A Promise that resolves to a boolean indicating whether the signature is valid.
78
77
*/
79
- async verify ( message : Uint8Array , signatureHex : string , keyId : KmsKeyId ) : Promise < boolean > {
78
+ async verify ( digest : Uint8Array , signatureHex : string , keyId : KmsKeyId ) : Promise < boolean > {
80
79
const publicKeyHex = await this . publicKey ( keyId ) ;
81
- return ed25519 . verify ( signatureHex , sha256 ( message ) , publicKeyHex ) ;
80
+ return ed25519 . verify ( signatureHex , digest , publicKeyHex ) ;
82
81
}
83
82
84
83
/**
0 commit comments