Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
x-address-codec
Advanced tools
This is a meta package, that exposes an api factory. It's really not as boring as it sounds. We only ask you bring your own hash (create-hash, crypto) to the party, as we already provide a free base-x codec for your heavy lifting pleasure.
At the party, mostly people just stand around and encode/decode crypto coin address strings to bytes and back. Thrilling right?
We currently serve these alphabets. Make a pull request if you'd like to add one to the menu.
var apiFactory = require('../');
var createHash = require('create-hash');
var api = apiFactory({
// We probably have your favorite alphabet, if not, contact us
defaultAlphabet: 'stellar',
// But we insist you bring your own hash to the party :)
sha256: function(bytes) {
return createHash('sha256').update(new Buffer(bytes)).digest();
},
// We'll endow your api with encode|decode* for you
codecMethods : {
// public keys
AccountID : {version: 0x00},
// secrets
Seed: {version: 0x21}
},
// Why the hell don't we just export these versions too?
// Err.. Shutup :) We're getting to it.
});
var buf = new Buffer("00000000000000000000000000000000", 'hex');
// It can encode a Buffer
var encoded = api.encodeSeed(buf);
// It returns Array<Number>
var decoded = api.decodeSeed(encoded);
// It can of course encode an Array<Number> too
var reencoded = api.encodeSeed(decoded)
console.log(encoded);
console.log(reencoded);
// ps6JS7f14BuwFY8Mw6bTtLKWauoUp
// ps6JS7f14BuwFY8Mw6bTtLKWauoUp
console.log(decoded);
// [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
console.log(api.encode(decoded, {alphabet: 'ripple', version: 33}));
// sp6JS7f14BuwFY8Mw6bTtLKWauoUs
var prefix = api.codecs.stellar.findPrefix(16 /* bytes */, 'spaceMan');
var spacey = api.encode(decoded, {version: prefix});
console.log(spacey);
// spaceMan7qBfYEUBHSWDsZjJHctnNQi2pCTn
console.log(api.decode(spacey, {version: prefix}));
// [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
module.exports = api;
$ npm publish
console.log(api)
/*
{ Codec: [Function: AddressCodec],
codecs:
{ bitcoin:
{ alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz',
codec: [Object],
base: 58 },
ripple:
{ alphabet: 'rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz',
codec: [Object],
base: 58 },
tipple:
{ alphabet: 'RPShNAF39wBUDnEGHJKLM4pQrsT7VWXYZ2bcdeCg65jkm8ofqi1tuvaxyz',
codec: [Object],
base: 58 },
stellar:
{ alphabet: 'gsphnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCr65jkm8oFqi1tuvAxyz',
codec: [Object],
base: 58 } },
decode: [Function: decode],
encode: [Function: encode],
decodeAccountID: [Function],
encodeAccountID: [Function],
decodeSeed: [Function],
encodeSeed: [Function] }
*/
FAQs
crypto currency address codec
The npm package x-address-codec receives a total of 5,749 weekly downloads. As such, x-address-codec popularity was classified as popular.
We found that x-address-codec demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.