Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/libauth/src/lib/key/key-utils.ts>validateSecp256k1PrivateKey

An ultra-lightweight, zero-dependency JavaScript library for Bitcoin Cash, Bitcoin, and Bitauth applications.
Go to Latest
variable validateSecp256k1PrivateKey
import { validateSecp256k1PrivateKey } from "https://deno.land/x/libauth@v2.0.0-alpha.6/src/lib/key/key-utils.ts";

Verify that a private key is valid for the Secp256k1 curve. Returns true for success, or false on failure.

Private keys are 256-bit numbers encoded as a 32-byte, big-endian Uint8Array. Nearly every 256-bit number is a valid secp256k1 private key. Specifically, any 256-bit number greater than 0x01 and less than 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140 is a valid private key. This range is part of the definition of the secp256k1 elliptic curve parameters.

This method does not require a Secp256k1 implementation.

type

(privateKey: Uint8Array) => unknown