]> git.codecow.com Git - libnemo.git/commitdiff
Fix bit shifting and remove redundant promise return.
authorChris Duncan <chris@zoso.dev>
Sun, 30 Nov 2025 08:44:00 +0000 (00:44 -0800)
committerChris Duncan <chris@zoso.dev>
Sun, 30 Nov 2025 08:44:00 +0000 (00:44 -0800)
src/lib/crypto/bip44.ts

index 3e2562648a6e066363ac45471d2a5f4269940fa2..cbb9114850d61c18b749ab2f73fdbe4b74edbf2f 100644 (file)
@@ -120,7 +120,8 @@ export class Bip44 {
        static ser256 (integer: bigint): Uint8Array<ArrayBuffer> {
                let bytes = new Uint8Array(32)
                for (let i = bytes.byteLength - 1; i >= 0; i--) {
-                       bytes[i] = Number((integer >> BigInt(i * 8)) & 0xffn)
+                       bytes[i] = Number(integer & 0xffn)
+                       integer >>= 8n
                }
                return bytes
        }
@@ -137,9 +138,6 @@ export class Bip44 {
                return crypto.subtle.importKey('raw', key, { name: 'HMAC', hash: 'SHA-512' }, false, ['sign'])
                        .then(pk => {
                                return crypto.subtle.sign('HMAC', pk, data)
-                                       .then(signature => {
-                                               return signature
-                                       })
                        })
        }
 }