{"_id":"b-address-codec","_rev":"3-c10b11b34caba6e96fe6cc8fa5684cde","name":"b-address-codec","description":"crypto currency address codec","dist-tags":{"latest":"0.7.2"},"versions":{"0.7.2":{"name":"b-address-codec","version":"0.7.2","license":"ISC","description":"crypto currency address codec","files":["dist/npm/*"],"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 test && 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/bluzelle/javascript-style-guide/es6/eslintrc'; fi; eslint -c eslintrc src/*.js"},"repository":{"type":"git","url":"git://github.com/bluzelle/b-address-codec.git"},"engines":{"node":">=0.12.0"},"gitHead":"f5cfda5629a29d451c36dd87e8a2514872e661ef","bugs":{"url":"https://github.com/bluzelle/b-address-codec/issues"},"homepage":"https://github.com/bluzelle/b-address-codec#readme","_id":"b-address-codec@0.7.2","_shasum":"3fd6e05f47b99f14a9d9c7dde584bd25aba056b4","_from":".","_npmVersion":"2.15.8","_nodeVersion":"4.4.7","_npmUser":{"name":"njmurarka","email":"neeraj@bluzelle.com"},"dist":{"shasum":"3fd6e05f47b99f14a9d9c7dde584bd25aba056b4","tarball":"https://registry.npmjs.org/b-address-codec/-/b-address-codec-0.7.2.tgz","integrity":"sha512-46bFeUb0MR/7m6ZQNFCbffzCftDl7TFQeW0wgUaPgvYK4L7e+wLwHdVNA1umetun/fgN0Lg1iRHBXLA38H61SA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCiMG4tpE2Pi4dcBnRmJnUqECRSOMidd0FVlHXD2X/k1gIhAPi+bI0brMk+h/6DuPrMd8l+1t4SczFbw+hVjTqYr9IZ"}]},"maintainers":[{"name":"njmurarka","email":"neeraj@bluzelle.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/b-address-codec-0.7.2.tgz_1482838133628_0.09086592961102724"}}},"readme":"# b-address-codec [![NPM](https://img.shields.io/npm/v/b-address-codec.svg)](https://npmjs.org/package/b-address-codec) [![Build Status](https://img.shields.io/travis/bluzelle/b-address-codec/master.svg)](https://travis-ci.org/bluzelle/b-address-codec) [![codecov.io](http://codecov.io/github/bluzelle/b-address-codec/coverage.svg?branch=master)](http://codecov.io/github/bluzelle/b-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* bluzelle\n* tipple\n* bitcoin\n* stellar\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 bluzelle one if we chose :)\n\n```js\nconsole.log(api.encode(decoded, {alphabet: 'bluzelle', 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     bluzelle:\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  decode: [Function: decode],\n  encode: [Function: encode],\n  decodeAccountID: [Function],\n  encodeAccountID: [Function],\n  decodeSeed: [Function],\n  encodeSeed: [Function] }\n*/\n```\n","maintainers":[{"name":"njmurarka","email":"neeraj@bluzelle.com"}],"time":{"modified":"2022-06-13T03:59:01.446Z","created":"2016-12-27T11:28:55.711Z","0.7.2":"2016-12-27T11:28:55.711Z"},"homepage":"https://github.com/bluzelle/b-address-codec#readme","repository":{"type":"git","url":"git://github.com/bluzelle/b-address-codec.git"},"bugs":{"url":"https://github.com/bluzelle/b-address-codec/issues"},"license":"ISC","readmeFilename":"README.md"}