Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/you21979/node-slip0013
implements SLIP-0013 : Authentication using deterministic hierarchy
https://github.com/you21979/node-slip0013
bitcoin bitid challenge-response slip0013
Last synced: about 2 months ago
JSON representation
implements SLIP-0013 : Authentication using deterministic hierarchy
- Host: GitHub
- URL: https://github.com/you21979/node-slip0013
- Owner: you21979
- License: mit
- Created: 2019-02-19T05:10:54.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-20T08:09:17.000Z (almost 6 years ago)
- Last Synced: 2024-10-08T00:41:31.758Z (3 months ago)
- Topics: bitcoin, bitid, challenge-response, slip0013
- Language: TypeScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-slip0013
## implements SLIP-0013 : Authentication using deterministic hierarchy
https://github.com/satoshilabs/slips/blob/master/slip-0013.md
## implements bitID
https://github.com/bitid/bitid/blob/master/BIP_draft.md
# install
```
npm i slip0013
```# sample
## additional install```
npm i bip39 bitcoinjs-lib bitcoinjs-message
```## bitid sample code
```
const slip13 = require("slip0013")
const bip39 = require("bip39")
const bip32 = require("bip32")
const bitcoin = require("bitcoinjs-lib")
const bitcoinMessage = require('bitcoinjs-message')const main = (mnemonic, password, uri) => {
const seed = bip39.mnemonicToSeed(mnemonic, password);
const masternode = bip32.fromSeed(seed);
const info = slip13.bitid.parseUri(uri)
const node = slip13.bitid.derive(masternode, info.resolve_uri);
const address = bitcoin.payments.p2pkh({ pubkey: node.publicKey }).addressconst signature = bitcoinMessage.sign (info.message_uri, node.privateKey, true)
console.log(info)
console.log(address)
console.log(signature.toString("base64"))
}
const uri = "bitid://bitid-demo.herokuapp.com/callback?x=32b5640fdec1e804&u=1"
const mnemonic = "inhale praise target steak garlic cricket paper better evil almost sadness crawl city banner amused fringe fox insect roast aunt prefer hollow basic ladder";
const password = ""
main(mnemonic, password, uri)
```