Initial import

This commit is contained in:
Nicholas Dudfield
2015-06-17 19:58:42 +07:00
parent 2b42427634
commit 85eee0e651
3 changed files with 107 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
# .gitignore
# Ignore vim swap files.
*.swp
# Ignore SCons support files.
.sconsign.dblite
# Ignore python compiled files.
*.pyc
# Ignore Macintosh Desktop Services Store files.
.DS_Store
# Ignore backup/temps
*~
# Ignore object files.
*.o
build/
tags
bin/rippled
Debug/*.*
Release/*.*
# Ignore locally installed node_modules
node_modules
!test/node_modules
# Ignore tmp directory.
tmp
# Ignore database directory.
db/*.db
db/*.db-*
# Ignore customized configs
rippled.cfg
validators.txt
test/config.js
# Ignore coverage files
/lib-cov
/src-cov
/coverage.html
/coverage
# Ignore IntelliJ files
.idea
# Ignore npm-debug
npm-debug.log
# Ignore dist folder, build for bower
dist/
# Ignore flow output directory
out/
# Ignore perf test cache
scripts/cache
eslintrc

View File

@@ -0,0 +1,30 @@
var hashjs = require('hash.js');
var apiFactory = require('coin-address-codec');
var VER_NODE_PUBLIC = 28;
var VER_NODE_PRIVATE = 32;
var VER_ACCOUNT_ID = 0;
var VER_FAMILY_SEED = 33;
function sha256(bytes) {
return hashjs.sha256().update(bytes).digest();
}
var api = apiFactory({sha256: sha256, defaultAlphabet: 'ripple'});
function addVersion(name, version) {
function add(symbol, func) {
api[symbol+name] = function(string) {
return api[symbol](string, {version: version});
}
}
add('decode')
add('encode')
}
addVersion('Seed', VER_FAMILY_SEED);
addVersion('AccountID', VER_ACCOUNT_ID);
addVersion('NodePublic', VER_NODE_PUBLIC);
addVersion('NodePrivate', VER_NODE_PRIVATE);
module.exports = api;

View File

@@ -0,0 +1,14 @@
{
"name": "ripple-address-codec",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"hash.js": "^1.0.3"
}
}