{"id":20597068,"url":"https://github.com/tradle/kiki","last_synced_at":"2026-04-16T16:33:53.168Z","repository":{"id":35337467,"uuid":"39599645","full_name":"tradle/kiki","owner":"tradle","description":"Wrappers for DSA, EC, Bitcoin and other keys to provide a common API for signing/verifying/importing/exporting","archived":false,"fork":false,"pushed_at":"2016-02-14T19:55:08.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-17T00:53:12.303Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tradle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-23T23:33:15.000Z","updated_at":"2016-01-15T20:19:34.000Z","dependencies_parsed_at":"2022-08-25T20:51:34.387Z","dependency_job_id":null,"html_url":"https://github.com/tradle/kiki","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tradle%2Fkiki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tradle%2Fkiki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tradle%2Fkiki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tradle%2Fkiki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tradle","download_url":"https://codeload.github.com/tradle/kiki/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242231441,"owners_count":20093636,"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-16T08:20:08.032Z","updated_at":"2026-04-16T16:33:53.139Z","avatar_url":"https://github.com/tradle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kiki\n\nWrappers for DSA, EC, Bitcoin and other keys to provide a common API for signing/verifying/importing/exporting\n\n_this module is used by [Tradle](https://github.com/tradle/about/wiki)_\n\n## Usage\n\n```js\nvar kiki = require('kiki');\nvar Keys = kiki.Keys\n\n// load ec public key\nvar ecPubKey = new Keys.EC({\n  pub: '022ee9fefd1b275d4ee1e7c41157cd4753ad4cbd0cbfdc76eef85ebae230bf27ee'\n})\n\n// load ec private key\nvar ecPrivKey = new Keys.EC({\n  priv: '01762d59097688a1f1cd241aadee4cb1bd3d37017f71501b28e85ecdab5349c2'\n})\n\n// new ec private key\nvar newECKey = Keys.EC.gen({\n  curve: 'ed25519'\n})\n\n// new bitcoin key\nvar btcKey = Keys.Bitcoin.gen({\n  networkName: 'bitcoin'\n})\n\n// new dsa key\nvar dsaKey = Keys.DSA.gen()\n\n// keys with metadata\nbtcKey = Keys.Bitcoin.gen({\n  networkName: 'testnet',\n  // arbitrary metadata\n  label: 'most excellent key',\n  purpose: 'messaging'\n})\n\n```\n\n## sync API (may not be supported for some keys)\n\n```js\nvar sig = ecKey.signSync('hey ho') \nvar verified = ecKey.verifySync('hey ho', sig)\n```\n\n## async API (supported for all keys)\n\n```js\necKey.sign('hey ho', function (err, sig) {\n  // async is supported for all\n  ecKey.verify('hey ho', function (err, verified) {\n    // verified is a boolean\n  })\n})\n```\n\n## export\n\n```js\nvar pub = ecKey.exportPublic()\nvar priv = ecKey.exportPrivate()\n```\n\n### pub\n\n```json\n{\n  \"curve\": \"ed25519\",\n  \"fingerprint\": \"de26dffa5dc9e3866ea23d9120578b768b945b1385d8393d275d715470dd6056\",\n  \"type\": \"ec\",\n  \"value\": \"022ee9fefd1b275d4ee1e7c41157cd4753ad4cbd0cbfdc76eef85ebae230bf27ee\",\n  // whatever metadata you added\n  \"purpose\": \"sign\",\n  \"label\": \"one key to rule them all\"\n}\n```\n\n### priv\n\n```json\n{\n  \"curve\": \"ed25519\",\n  \"fingerprint\": \"de26dffa5dc9e3866ea23d9120578b768b945b1385d8393d275d715470dd6056\",\n  \"priv\": \"01762d59097688a1f1cd241aadee4cb1bd3d37017f71501b28e85ecdab5349c2\",\n  \"type\": \"ec\",\n  \"value\": \"022ee9fefd1b275d4ee1e7c41157cd4753ad4cbd0cbfdc76eef85ebae230bf27ee\",\n  // whatever metadata you added\n  \"purpose\": \"sign\",\n  \"label\": \"one key to rule them all\"\n}\n```\n\n## import\n\n```js\n// recover to typed instance (ECKey/DSAKey/etc.)\nvar ecKey = kiki.toKey(pub || priv) \n```\n\n## Key API\n\n### (static) gen(options)\n\nGenerate a new key. Different keys may have different required properties (this asymmetry can't be avoided.)\n\n### hasDeterministicSig()\n\nSome keys have deterministic signatures - same outputs for the same inputs. Some don't.\n\n### parsePub(pubKeyString)\n\n### parsePriv(privKeyString)\n\n### fingerprint()\n\n### pubKeyString()\n\n### exportPublic()\n\n### exportPrivate()\n\n## mock \"secure element\" API\n\nSimple mock for a \"secure element\" type API, where you don't have access to the private keys. Give it a public key, an operation and data, and it will perform signing, decrypting, etc.\n\n```js\nvar kiki = require('kiki').kiki\nvar secureEl = kiki(privKeys) // setup the mock secure element\nsecureEl.sign(pubKey, msg, callback)\nsecureEl.ecdh(ecPubKey1, ecPubKey2, callback)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftradle%2Fkiki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftradle%2Fkiki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftradle%2Fkiki/lists"}