Skip to content

Commit

Permalink
run fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
heliuchuan committed Nov 21, 2024
1 parent dca4159 commit a1dba8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/crypto/secp256k1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ export class Secp256k1PublicKey extends PublicKey {
const { message, recoveryBit } = args;
const signature = isHexInput(args.signature) ? new Secp256k1Signature(args.signature) : args.signature;
const signatureBytes: Uint8Array = signature.bcsToBytes();

const r = bytesToNumberBE(signatureBytes.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p.
if (!inRange(r, BigInt(1), secp256k1P)) throw new Error("Invalid secp256k1 signature - r ≥ p");
const s = bytesToNumberBE(signatureBytes.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n.
if (!inRange(s, BigInt(1), secp256k1N)) throw new Error("Invalid secp256k1 signature - s ≥ n");
const nobleSig = new secp256k1.Signature(r, s);

const messageToVerify = convertSigningMessage(message);
const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();
const messageSha3Bytes = sha3_256(messageBytes);
Expand Down

0 comments on commit a1dba8a

Please sign in to comment.