{"id":19178036,"url":"https://github.com/cmdruid/signer","last_synced_at":"2025-07-29T15:14:09.977Z","repository":{"id":182154235,"uuid":"668031695","full_name":"cmdruid/signer","owner":"cmdruid","description":"Software signing device and reference implementation of the Signer API.","archived":false,"fork":false,"pushed_at":"2024-03-29T22:09:43.000Z","size":297,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-04T09:45:41.650Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cmdruid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-18T21:28:35.000Z","updated_at":"2023-07-18T21:29:42.000Z","dependencies_parsed_at":"2023-12-24T01:20:12.601Z","dependency_job_id":"7e71669d-d3e1-4530-bec0-7d1fcd1c44ce","html_url":"https://github.com/cmdruid/signer","commit_stats":null,"previous_names":["cmdruid/signer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmdruid%2Fsigner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmdruid%2Fsigner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmdruid%2Fsigner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmdruid%2Fsigner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmdruid","download_url":"https://codeload.github.com/cmdruid/signer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240254908,"owners_count":19772506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T10:36:18.018Z","updated_at":"2025-02-23T01:21:13.670Z","avatar_url":"https://github.com/cmdruid.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Signer\n\nProvides `Seed`, `Signer`, and `Wallet` tools for handling Bitcoin transactions.\n\n\u003e Note: This README is outdated. Updated readme coming soon!\n\n## Seed API\n\n```ts\nimport { Seed } from '@cmdcode/signer'\n\ninterface Seed {\n  // Generate random seed (256 bits).\n  gen_random () =\u003e Buff\n  // Generate random seed words (12 / 24).\n  gen_words (size :? 12 | 24) =\u003e string\n  // Import a seed from a password-encrypted payload.\n  from_encrypted (\n    payload : Bytes,\n    secret  : Bytes\n  ) =\u003e Promise\u003cBuff\u003e\n  // Import a seed from a list of seed words.\n  from_words (\n    words     : string | string[],\n    password ?: string\n  ) =\u003e Buff\n  // Export a seed as a password-encrypted payload.\n  to_encrypted (\n    seed   : Bytes,\n    secret : Bytes\n  ) =\u003e Promise\u003cBuff\u003e\n}\n```\n\n## Signer API\n\n```ts\nimport { KeyPair, Signer } from '@cmdcode/signer'\n\nclass Signer {\n  // Generate a signer from a random seed.\n  static generate () =\u003e Signer\n  // Import a signer from a password-encrypted payload.\n  static from_encrypted (\n    payload: string,\n    secret: string\n  ) =\u003e Promise\u003cSigner\u003e\n  // Import a signer from a seed phrase.\n  static from_words (\n    words: string | string[], \n    pass?: string\n  ) =\u003e Signer\n  // Create a new Signer class.\n  constructor (seed: Bytes) =\u003e Signer\n  // Get the sha256 hash of the pubkey.\n  get id     () =\u003e string\n  // Get the pubkey of the signer.\n  get pubkey () =\u003e string\n  // Get a BIP32 wallet using the signer's internal seed.\n  get wallet () =\u003e Wallet\n  // Get a Diffe-Hellman shared secret from another pubkey.\n  ecdh (pubkey: Bytes) =\u003e Buff\n  // Export the signer's seed as a password-encrypted payload.\n  export_seed (secret: string) =\u003e Promise\u003cstring\u003e\n  // Export the signer's seed as an encrypted nip-04 nostr note.\n  export_note (pubkey: string) =\u003e Promise\u003cSignedEvent\u003e\n  // Generate a pubnonce for a given message.\n  gen_nonce (\n    message  : Bytes, \n    options ?: SignOptions\n  ) =\u003e Buff\n  // Generate an HMAC signature for a given message.\n  hmac (message: Bytes) =\u003e Buff\n  // Create a partial signature from a musig context object.\n  musign (\n    context  : MusigContext, \n    auxdata  : Bytes, \n    options ?: SignOptions\n  ) =\u003e Buff\n  // Create a compact digital proof for a given content string.\n  notarize (\n    content : string, \n    params  : Params\n  ): Promise\u003cstring\u003e\n  // Sign a message using BIP340-schnorr scheme.\n  sign (\n    message  : Bytes,\n    options ?: SignOptions\n  ) =\u003e string\n}\n\ninterface SignOptions {\n  aux         ?: Bytes | null // Add aux data to nonce generation.\n  nonce_tweak ?: Bytes        // Add a tweak to the nonce value.\n  key_tweak   ?: Bytes        // Add a tweak to the key value.\n}\n```\n\n## Wallet API\n\n```ts\nimport { ExtendedKey, Wallet, MasterWallet } from '@cmdcode/signer'\n\n/**\n * Base class method for defining an extended key.\n */\n\nclass ExtendedKey {\n  constructor(hd : HDKey)\n  \n  get hd()     : HDKey  // Get internal HDKey object.\n  get index()  : number // Get index value of current key.\n  get pubkey() : string // Get pubkey value of current key.\n  get xpub()   : string // Get xpub value of current key.\n\n  // Get an address for the curent key.\n  address (network?: Network) =\u003e string\n}\n\n/**\n * Wallet class for creating and managing accounts.\n */\n\nclass Wallet extends ExtendedKey {\n  // Import a wallet from a raw seed.\n  static from_seed  (seed: Bytes) =\u003e Wallet\n  // Import a wallet from BIP39 seed words.\n  static from_words (words: string | string[]) =\u003e Wallet\n  // Import a wallet from an xpub.\n  static from_xpub  (xpub: string) =\u003e Wallet\n  // Create a wallet from an HDKey object.\n  constructor (hdkey: HDKey)\n  // Check if a given account exists within the wallet.\n  has_account (extkey: string | HDKey) =\u003e boolean\n  // Get an account key at the given account (index) number.\n  get_account (acct: number, index?: number) =\u003e KeyRing\n  // Generate a new account with a random index.\n  new_account () =\u003e KeyRing\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmdruid%2Fsigner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmdruid%2Fsigner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmdruid%2Fsigner/lists"}