Resolve "feat(Primitives): Have Bytes Primitive extends Uint8Array (if possible)"

This commit is contained in:
devperate
2025-04-28 02:49:25 +00:00
committed by Jim Hamill
parent 1d5e3131c8
commit d4398439c7
19 changed files with 296 additions and 269 deletions
+5 -5
View File
@@ -78,7 +78,7 @@ export class PublicKey {
* @returns The created Public Key entity.
*/
public static fromHex(publicKeyHex: string): PublicKey {
return new this(Bytes.fromHex(publicKeyHex).toBytes());
return new this(Bytes.fromHex(publicKeyHex));
}
/**
@@ -232,11 +232,11 @@ export class PublicKey {
signature: Uint8Array | string,
): boolean {
if (typeof messageHash === 'string') {
messageHash = Bytes.fromHex(messageHash).toBytes();
messageHash = Bytes.fromHex(messageHash);
}
if (typeof signature === 'string') {
signature = Bytes.fromHex(signature).toBytes();
signature = Bytes.fromHex(signature);
}
const validity = secp256k1.verifySignatureDER(
@@ -261,11 +261,11 @@ export class PublicKey {
signature: Uint8Array | string,
): boolean {
if (typeof messageHash === 'string') {
messageHash = Bytes.fromHex(messageHash).toBytes();
messageHash = Bytes.fromHex(messageHash);
}
if (typeof signature === 'string') {
signature = Bytes.fromHex(signature).toBytes();
signature = Bytes.fromHex(signature);
}
const validity = secp256k1.verifySignatureSchnorr(