All files crypto.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 4/4
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 211x   1x 39x     1x       12x     1x 23x     1x 26x    
import * as crypto from "@node-lightning/crypto";
 
export function sha256(data: Buffer): Buffer {
    return crypto.sha256(data);
}
 
export function ecdsaSign(
    message: Buffer,
    privKey: Buffer,
): { signature: Buffer; recovery: number } {
    return crypto.signWithRecovery(message, privKey);
}
 
export function ecdsaRecovery(message: Buffer, signature: Buffer, recoveryFlag: number): Buffer {
    return crypto.recoverPubKey(signature, recoveryFlag, message, true);
}
 
export function ecdsaVerify(pubkey: Buffer, message: Buffer, signature: Buffer): boolean {
    return crypto.verifySig(message, signature, pubkey);
}