}
static keygen: KeygenFn = this.createKeygen(this.getPublicKey)
- /** Math, hex, byte helpers. Not in `utils` because utils share API with noble-curves. */
- static etc = {
- hexToBytes: this.hexToBytes as (hex: string) => Bytes,
- bytesToHex: this.bytesToHex as (bytes: Bytes) => string,
- concatBytes: this.concatBytes as (...arrs: Bytes[]) => Bytes,
- bytesToNumberBE: this.bytesToBigint as (a: Bytes) => bigint,
- numberToBytesBE: this.bigintTo32Bytes as (n: bigint) => Bytes,
- mod: this.M as (a: bigint, md?: bigint) => bigint,
- invert: this.invert as (num: bigint, md?: bigint) => bigint, // math utilities
- secretKeyToScalar: this.secretKeyToScalar as typeof this.secretKeyToScalar,
- abytes: this.abytes as typeof this.abytes,
- }
-
- /** Curve-specific utilities for private keys. */
- static utils = {
- isValidSecretKey: this.isValidSecretKey as typeof this.isValidSecretKey,
- isValidPublicKey: this.isValidPublicKey as typeof this.isValidPublicKey,
- randomSecretKey: this.randomSecretKey as () => Bytes,
- }
-
// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code.
// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
static getTag = (tag: string) => Uint8Array.from('BIP0340/' + tag, (c) => c.charCodeAt(0))