Signer
Provides Seed
, Signer
, and Wallet
tools for handling Bitcoin transactions.
Note: This README is outdated. Updated readme coming soon!
Seed API
import { Seed } from '@cmdcode/signer'
interface Seed {
gen_random () => Buff
gen_words (size :? 12 | 24) => string
from_encrypted (
payload : Bytes,
secret : Bytes
) => Promise<Buff>
from_words (
words : string | string[],
password ?: string
) => Buff
to_encrypted (
seed : Bytes,
secret : Bytes
) => Promise<Buff>
}
Signer API
import { KeyPair, Signer } from '@cmdcode/signer'
class Signer {
static generate () => Signer
static from_encrypted (
payload: string,
secret: string
) => Promise<Signer>
static from_words (
words: string | string[],
pass?: string
) => Signer
constructor (seed: Bytes) => Signer
get id () => string
get pubkey () => string
get wallet () => Wallet
ecdh (pubkey: Bytes) => Buff
export_seed (secret: string) => Promise<string>
export_note (pubkey: string) => Promise<SignedEvent>
gen_nonce (
message : Bytes,
options ?: SignOptions
) => Buff
hmac (message: Bytes) => Buff
musign (
context : MusigContext,
auxdata : Bytes,
options ?: SignOptions
) => Buff
notarize (
content : string,
params : Params
): Promise<string>
sign (
message : Bytes,
options ?: SignOptions
) => string
}
interface SignOptions {
aux ?: Bytes | null
nonce_tweak ?: Bytes
key_tweak ?: Bytes
}
Wallet API
import { ExtendedKey, Wallet, MasterWallet } from '@cmdcode/signer'
class ExtendedKey {
constructor(hd : HDKey)
get hd() : HDKey
get index() : number
get pubkey() : string
get xpub() : string
address (network?: Network) => string
}
class Wallet extends ExtendedKey {
static from_seed (seed: Bytes) => Wallet
static from_words (words: string | string[]) => Wallet
static from_xpub (xpub: string) => Wallet
constructor (hdkey: HDKey)
has_account (extkey: string | HDKey) => boolean
get_account (acct: number, index?: number) => KeyRing
new_account () => KeyRing
}