Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.
I've tried to make it as lean and unobtrusive as possible.
errors/AppError.js
var KeyEncoder = require('key-encoder') | |
var VirgilCrypto = require('virgil-crypto').VirgilCrypto | |
var HDKey = require('hdkey') | |
const secp256k1 = require('secp256k1') | |
var keyEncoder = new KeyEncoder('secp256k1') | |
var hdKey = HDKey.fromMasterSeed(Buffer.from(SEED, 'hex')) | |
var childKey = hdKey.derive(PATH) |