How to use the crypto-hash.sha256 function in crypto-hash

To help you get started, we’ve selected a few crypto-hash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atomiclabs / hyperdex / app / marketmaker / index.js View on Github external
options = {
			...options,
			gui: 'hyperdex',
			userhome: os.homedir(),
			netid: 9999, // TODO: Set this to `0` when mm v2 is production ready
			rpcport: port,
			rpccors: is.development ? 'http://localhost:8080' : 'app://-',
			coins,
		};

		this.port = options.rpcport;

		if (options.seedPhrase) {
			// eslint-disable-next-line camelcase
			options.rpc_password = await sha256(options.seedPhrase);
			options.passphrase = options.seedPhrase;
			delete options.seedPhrase;
		} else {
			throw new Error('The `seedPhrase` option is required');
		}

		// NOTE: It's very important that this is a different directory than mm v1, as the database is not compatible
		// TODO: Update the path here when mm v2 is production ready
		const cwd = await makeDir(path.join(electron.app.getPath('userData'), 'marketmaker2-test'));

		logger.log('Spawning Marketmaker with options:', JSON.stringify({
			...options,
			passphrase: '',
			rpc_password: '', // eslint-disable-line camelcase
		}));
github atomiclabs / hyperdex / app / renderer / containers / Login.js View on Github external
const initApi = async seedPhrase => {
	let url = config.get('marketmakerUrl');
	if (url) {
		console.log('Using custom marketmaker URL:', url);
	} else {
		const port = await ipc.callMain('start-marketmaker', seedPhrase);
		url = `http://127.0.0.1:${port}`;
	}

	return new Api({
		endpoint: url,
		rpcPassword: await sha256(seedPhrase),
		concurrency: 10,
	});
};

crypto-hash

Tiny hashing module that uses the native crypto API in Node.js and the browser

MIT
Latest version published 5 months ago

Package Health Score

72 / 100
Full package analysis

Popular crypto-hash functions