Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('cleanup', function (t) {
leveljs.destroy(name, function () {})
t.end()
})
}
});
const keyLoader = new PrivateKeyLoader(identity, {
accessTokenProvider,
virgilCrypto,
brainKeyCrypto,
keyEntryStorage,
apiUrl: opts.apiUrl,
});
const cardManager = new CardManager({
cardCrypto,
cardVerifier,
accessTokenProvider,
retryOnUnauthorized: true,
apiUrl: opts.apiUrl,
});
const groupStorageLeveldown = leveljs(opts.groupStorageName!);
return {
identity,
virgilCrypto,
cardManager,
accessTokenProvider,
keyEntryStorage,
keyLoader,
groupStorageLeveldown,
};
}
constructor(location) {
super(location)
this.instance = leveljs(location)
}
private async startInternal(): Promise {
const primaryPrivateKey = common.stringToPrivateKey(constants.PRIVATE_NET_PRIVATE_KEY);
const primaryPublicKey = common.stringToECPoint(constants.PRIVATE_NET_PUBLIC_KEY);
crypto.addPublicKey(primaryPrivateKey, primaryPublicKey);
const settings = createMain({
address: common.uInt160ToString(crypto.privateKeyToScriptHash(primaryPrivateKey)),
standbyValidators: [common.ecPointToString(primaryPublicKey)],
privateNet: true,
});
const storage = levelupStorage({
db: LevelUp(this.options.type === 'persistent' ? Level(this.options.id) : MemDown()),
context: { messageMagic: settings.messageMagic },
});
const blockchain = await Blockchain.create({
settings,
storage,
vm,
});
const nodeOptions = {
consensus: {
privateKey: common.privateKeyToString(primaryPrivateKey),
privateNet: true,
},
};
const node = new Node({
blockchain,
DB.destroy = function destroy(db, callback) {
Level.destroy(db, callback);
};
destroy: function(cb) {
require('level-js').destroy('drafts', cb)
},