From: Chris Duncan Date: Fri, 5 Dec 2025 22:17:48 +0000 (-0800) Subject: Deprecate unused constant. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=dbbc714af8cafe5a332d68cb704dfaac42df9730;p=libnemo.git Deprecate unused constant. --- diff --git a/src/lib/crypto/secp256k1.ts b/src/lib/crypto/secp256k1.ts index 6b5cf9f..f5d8ad8 100644 --- a/src/lib/crypto/secp256k1.ts +++ b/src/lib/crypto/secp256k1.ts @@ -46,8 +46,7 @@ export class Secp256k1 { static Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n static L: 32 = 32 // field / group byte length - static L2: 64 = 64 - static pkLength: 33 = 33 + static C: 33 = 33 // byte length of SEC1 compressed form of coordinate pair // ## Helpers // ---------- @@ -245,7 +244,7 @@ export class Secp256k1 { const tail = bytes.subarray(1) const x = this.bytesToBigint(tail.subarray(0, this.L)) // No actual validation is done here: use .assertValidity() - if (length === this.pkLength && (head === 0x02 || head === 0x03)) { + if (length === this.C && (head === 0x02 || head === 0x03)) { // Equation is y² == x³ + ax + b. We calculate y from x. // y = √y²; there are two solutions: y, -y. Determine proper solution based on prefix let y = this.lift_x(x) @@ -317,7 +316,7 @@ export class Secp256k1 { static isValidPublicKey (pk: Bytes): boolean { try { const l = pk.length - if (l !== this.pkLength) return false + if (l !== this.C) return false return !!this.pointFromBytes(pk) } catch (error) { return false