etkframework
Version:
First test release of Etk over colored coins SDK
82 lines (66 loc) • 2.51 kB
JavaScript
// #!/usr/local/bin/node --harmony
/**
* Etk Operations library.
* A wrapper using Colored Coins COLU SDK to initialize the colu object.
*
* Copyright (C) 2015 Akul Mathur
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Parts of the software are provided under separate licenses, as follows:
"colu-nodejs" SDK is under the MIT License
"pbkdf2-sha256" is under the BSD License
"bip38" is under the MIT License
"scryptsy" is under the MIT License
"coinstring" is under the MIT License
* Core Developer(s): @codecakes Akul Mathur akul at earthbenign dot com
* Maintainer(s):
* @codecakes Akul Mathur akul at earthbenign dot com
*/
;
const
/**
* helper function to create settings
*/
path = require("path"),
settingsCreate = require('./opHelper/settingsHelper').settingsCreate,
//minified client side version of the the main colu library
Colu = require("colu"),
et_int = function et_int(network, apiKey, cb) {
/** Seed Key Initialization
* Returns the private seed key.
*@params:
* cb: Call gets the Pvt Key as argument.
* You can use it to store it into a DB.
*/
const
//initialize colu object with settings
colu = new Colu(settingsCreate(network, apiKey, undefined));
//INITIALIZING THE COLU OBJECT
colu.on('connect', function ColuInit() {
//get a Pvt HD Seed key
/*
var privateSeed = colu.hdwallet.getPrivateSeed();
console.log("New privateSeed: ",privateSeed)*/
cb(colu.hdwallet.getPrivateSeed());
});
//initialize the above method
colu.init();
};
module.exports = {
et_int: et_int,
settingsCreate:settingsCreate,
};
/**
* debuging purpose
et_int(function cb(seed) {
console.log(seed);
})
*/