edge-core-js
Version:
Edge account & wallet management library
29 lines (23 loc) • 572 B
JavaScript
import crypto from 'crypto'
import { makeNodeDisklet } from 'disklet'
import fetch from 'node-fetch'
import { scrypt } from '../../util/crypto/scrypt'
/**
* Creates the io resources needed to run the Edge core on node.js.
*
* @param {string} path Location where data should be written to disk.
*/
export function makeNodeIo(path) {
return {
// Crypto:
random(bytes) {
return Uint8Array.from(crypto.randomBytes(bytes))
},
scrypt,
// Local io:
disklet: makeNodeDisklet(path),
// Networking:
fetch,
fetchCors: fetch
}
}