]> git.codecow.com Git - libnemo.git/commitdiff
Deprecate unused constant.
authorChris Duncan <chris@zoso.dev>
Fri, 5 Dec 2025 22:17:48 +0000 (14:17 -0800)
committerChris Duncan <chris@zoso.dev>
Fri, 5 Dec 2025 22:17:48 +0000 (14:17 -0800)
src/lib/crypto/secp256k1.ts

index 6b5cf9f05a2a74bf2c482e0b70fbe2b8cb678937..f5d8ad8a30ad4e97b55d8f4aa0d780d3e88fe2ad 100644 (file)
@@ -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