{"_id":"d-address-codec","_rev":"1-1be1b91565192a53e3b2d94c216abceb","name":"d-address-codec","dist-tags":{"latest":"0.7.2"},"versions":{"0.7.2":{"name":"d-address-codec","version":"0.7.2","license":"ISC","description":"crypto currency address codec","main":"dist/npm/","directories":{"test":"test"},"dependencies":{"base-x":"1.0.1"},"devDependencies":{"assert-diff":"1.0.1","babel":"5.8.23","babel-core":"5.8.25","babel-eslint":"4.1.3","babel-loader":"5.3.2","bn.js":"3.2.0","codecov.io":"0.1.6","coveralls":"2.11.4","create-hash":"1.1.2","eslint":"1.6.0","eventemitter2":"0.4.14","hash.js":"1.0.3","istanbul":"0.3.21","lodash":"3.10.1","map-stream":"0.1.0","mocha":"2.3.3","nock":"2.13.0","webpack":"1.12.2","yargs":"3.26.0"},"scripts":{"build":"gulp","compile":"babel -i runtime -d dist/npm/ src/","compile-with-source-maps":"babel -i runtime -s -t -d dist/npm/ src/","prepublish":"npm run compile","test":"istanbul test _mocha","codecov":"cat ./coverage/coverage.json | ./node_modules/codecov.io/bin/codecov.io.js","lint":"if ! [ -f eslintrc ]; then curl -o eslintrc 'https://raw.githubusercontent.com/xdv/javascript-style-guide/es6/eslintrc'; fi; eslint -c eslintrc src/*.js"},"repository":{"type":"git","url":"git://github.com/xdv/d-address-codec.git"},"engines":{"node":">=0.12.0"},"gitHead":"624e3c34161c73f5152b58137adae8fb2e20fe39","bugs":{"url":"https://github.com/xdv/d-address-codec/issues"},"homepage":"https://github.com/xdv/d-address-codec#readme","_id":"d-address-codec@0.7.2","_nodeVersion":"12.20.0","_npmVersion":"6.14.8","_npmUser":{"name":"marlonhanks","email":"support@kedia.co"},"maintainers":[{"name":"marlonhanks","email":"support@kedia.co"}],"dist":{"integrity":"sha512-+e7bsWkfOqBEsFjvfgFTFE4NAU7/n6ZfqfpGBuC98t6YDkJlZbZNSZaaPUnL/LsGhKzAg6jkudl+PStUAxujCw==","shasum":"545c4f101ba6934378f905923792e281b747c6b6","tarball":"https://registry.npmjs.org/d-address-codec/-/d-address-codec-0.7.2.tgz","fileCount":6,"unpackedSize":17958,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf0vxiCRA9TVsSAnZWagAAwVgP/2mwDShIBsQDR7Rb18N3\nJqSFBYvEpb+Bxg5cdjoY37KY5nG5iskdRBj1lxQTuLBLrpUjhtcpb9uAjj8P\nHQuTOz5HzEYy/kOoDt22AoGxNjMj14CVcdY/1RKVijnl7Q88MaozK2YU0jiu\nxe2FcrJuJ/ojZ7rlFdTbMvP/nR8JBBXeyFA9yuCntmdRrAsh87v+mSr+Va0b\n+mwG0IPNpKED257/WPI1rFot6fbW8JPyvnu62ZHFtiQU0vKv2UqHDLqZcQCh\nXyfZOfKSgYK2i2JHjpCpgHSeJatvuxwKhK+mSi/OrIWYlyvvZxcuzSpdFeR3\nugDtavo8WUh4v1UuCw5Mx6l0L67TLxsbQSXhHzBscJsqgCPa04BkO9Ftmrgz\nFZhTnzSDLRQnkzBw90G2Y/qiW6v5zsGz62mlj73Z7qev5W8FQOnJSJE6QuVY\n8aQ3Z94/htIzc6v/i+NGUZBx8ziaV2toBoQrBj6+yO9/Apz2hTS7UKy1Ihku\neXTVty8YfSSm8c0f3vp7uI31CMFMXgsqMy6ehYMS/OyX/PBNEnd+rmYPAlZu\ny6fZFA9Yas0ky994DYxB+jIdlxMtISZTw60zLn+zv5Tbf7RCZwDsiUrrKGXT\niJy+UxKzl4lKKKTb8pYKVApGh9UHIG1fn7SeocqXtiUZa6KoUMN2u/hGQvAE\nuhjR\r\n=iAhh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH3ZHn6qi+qd9DgrgRZCk3fYDczQc9um6NI4jH57opErAiAD4rFoO+MnI5bLl1ezDgHs/D/QqN5rP7mParTPfk4cYA=="}]},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/d-address-codec_0.7.2_1607662689660_0.6460448053989072"},"_hasShrinkwrap":false}},"time":{"created":"2020-12-11T04:58:09.659Z","0.7.2":"2020-12-11T04:58:09.799Z","modified":"2022-04-28T02:57:03.994Z"},"maintainers":[{"name":"marlonhanks","email":"support@kedia.co"}],"description":"crypto currency address codec","homepage":"https://github.com/xdv/d-address-codec#readme","repository":{"type":"git","url":"git://github.com/xdv/d-address-codec.git"},"bugs":{"url":"https://github.com/xdv/d-address-codec/issues"},"license":"ISC","readme":"# d-address-codec [![NPM](https://img.shields.io/npm/v/d-address-codec.svg)](https://npmjs.org/package/d-address-codec) [![Build Status](https://img.shields.io/travis/xdv/d-address-codec/master.svg)](https://travis-ci.org/xdv/d-address-codec) [![codecov.io](http://codecov.io/github/xdv/d-address-codec/coverage.svg?branch=master)](http://codecov.io/github/xdv/d-address-codec?branch=master)\n\nThis is a meta package, that exposes an api factory. It's really not as boring\nas it sounds. We only ask you bring your own hash\n([create-hash](https://www.npmjs.com/package/create-hash),\n [crypto](https://nodejs.org/api/crypto.html)) to the party, as we already\nprovide a free [base-x](https://github.com/dcousens/base-x) codec for your\nheavy lifting pleasure.\n\n# What, what? This does what exactly ?\n\nAt the party, mostly people just stand around and encode/decode crypto coin\naddress strings to bytes and back. Thrilling right?\n\n# Alphabet Soup\n\nWe currently serve these alphabets. Make a pull request if you'd like to add one\nto the menu.\n\n* divvy\n* ripple\n* tipple\n* bitcoin\n* stellar\n* payshares\n\n# API\n\n```js\nvar apiFactory = require('../');\nvar createHash = require('create-hash');\n\nvar api = apiFactory({\n  // We probably have your favorite alphabet, if not, contact us\n  defaultAlphabet: 'stellar',\n  // But we insist you bring your own hash to the party :)\n  sha256: function(bytes) {\n    return createHash('sha256').update(new Buffer(bytes)).digest();\n  },\n  // We'll endow your api with encode|decode* for you\n  codecMethods : {\n    // public keys\n    AccountID : {version: 0x00},\n    // secrets\n    Seed: {version: 0x21}\n  },\n  // Why the hell don't we just export these versions too?\n  // Err.. Shutup :) We're getting to it.\n});\n\nvar buf = new Buffer(\"00000000000000000000000000000000\", 'hex');\n// It can encode a Buffer\nvar encoded = api.encodeSeed(buf);\n// It returns Array<Number>\nvar decoded = api.decodeSeed(encoded);\n// It can of course encode an Array<Number> too\nvar reencoded = api.encodeSeed(decoded)\n\nconsole.log(encoded);\nconsole.log(reencoded);\n// ps6JS7f14BuwFY8Mw6bTtLKWauoUp\n// ps6JS7f14BuwFY8Mw6bTtLKWauoUp\n\nconsole.log(decoded);\n// [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]\n```\n\n## We could actually encode the seed as a divvy one if we chose :)\n\n```js\nconsole.log(api.encode(decoded, {alphabet: 'divvy', version: 33}));\n// sp6JS7f14BuwFY8Mw6bTtLKWauoUs\n```\n\n## Wait, what if we wanted to create a prefix for the new nifty spaceMan secrets?\n```js\nvar prefix = api.codecs.stellar.findPrefix(16 /* bytes */, 'spaceMan');\nvar spacey = api.encode(decoded, {version: prefix});\nconsole.log(spacey);\n// spaceMan7qBfYEUBHSWDsZjJHctnNQi2pCTn\nconsole.log(api.decode(spacey, {version: prefix}));\n// [ 0, 0, 0, 0,   0, 0, 0, 0,   0, 0, 0, 0,   0, 0, 0, 0 ]\n```\n\n## You may as well make a little mini module, and export it :)\n\n```js\nmodule.exports = api;\n```\n\n## Hell, you could even npm publish it :)\n```bash\n$ npm publish\n```\n\n## Anway, what is actually exported here?\n```js\nconsole.log(api)\n/*\n{ Codec: [Function: AddressCodec],\n  codecs:\n   { bitcoin:\n      { alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz',\n        codec: [Object],\n        base: 58 },\n     divvy:\n      { alphabet: 'dpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcreCg65jkm8oFqi1tuvAxyz',\n        codec: [Object],\n        base: 58 },\n     ripple:\n      { alphabet: 'rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz',\n        codec: [Object],\n        base: 58 },\n     tipple:\n      { alphabet: 'RPShNAF39wBUDnEGHJKLM4pQrsT7VWXYZ2bcdeCg65jkm8ofqi1tuvaxyz',\n        codec: [Object],\n        base: 58 },\n     stellar:\n      { alphabet: 'gsphnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCr65jkm8oFqi1tuvAxyz',\n        codec: [Object],\n        base: 58 } },\n     payshares:\n      { alphabet: 'xsphnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCr65jkm8oFqi1tuvAgyz',\n        codec: [Object],\n        base: 58 } },\n  decode: [Function: decode],\n  encode: [Function: encode],\n  decodeAccountID: [Function],\n  encodeAccountID: [Function],\n  decodeSeed: [Function],\n  encodeSeed: [Function] }\n*/\n```\n","readmeFilename":"README.md"}