Skip to content

Commit

Permalink
Merge pull request #303 from massalabs/302-rename-validate-signature-…
Browse files Browse the repository at this point in the history
…digest-param-to-data

Rename `digest` to `data` in `isSignatureValid` and `isEvmSignatureValid`
  • Loading branch information
Ben-Rey authored Oct 20, 2023
2 parents 941979b + 8fb31ce commit 9b15063
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions assembly/env/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ export namespace env {

@external("massa", "assembly_script_signature_verify")
export declare function isSignatureValid(
digest: string,
data: string,
signature: string,
publicKey: string,
): bool;

@external("massa", "assembly_script_evm_signature_verify")
export declare function isEvmSignatureValid(
digest: StaticArray<u8>,
data: StaticArray<u8>,
signature: StaticArray<u8>,
publicKey: StaticArray<u8>,
): bool;
Expand Down
12 changes: 6 additions & 6 deletions assembly/std/utils/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ export function toBase58(data: string): string {
* Checks if a signature is valid.
*
* @param publicKey - base58check encoded public key.
* @param digest - digest message.
* @param data - The data that was signed.
* @param signature - base58check encoded signature.
*
* @returns 'true' if the signature is valid, 'false' otherwise.
*
*/
export function isSignatureValid(
publicKey: string,
digest: string,
data: string,
signature: string,
): bool {
return env.isSignatureValid(digest, signature, publicKey);
return env.isSignatureValid(data, signature, publicKey);
}

/**
* Checks if an EVM signature is valid.
*
* @param digest - Digest message.
* @param data - The data that was signed.
* @param signature - Expects a SECP256K1 signature in full ETH format.
* Format: (r, s, v) v will be ignored.
* Length: 65 bytes
Expand All @@ -59,11 +59,11 @@ export function isSignatureValid(
*
*/
export function isEvmSignatureValid(
digest: StaticArray<u8>,
data: StaticArray<u8>,
signature: StaticArray<u8>,
publicKey: StaticArray<u8>,
): bool {
return env.isEvmSignatureValid(digest, signature, publicKey);
return env.isEvmSignatureValid(data, signature, publicKey);
}

/**
Expand Down

0 comments on commit 9b15063

Please sign in to comment.