Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createUnsignedTxn() {
const { state, props } = this;
const validContracts = need.contracts(props.contracts);
const validPoint = need.point(props.pointCursor);
// TODO: move this to a lib for validating things
const hexRegExp = /[0-9A-Fa-f]{64}/g;
if (hexRegExp.test(state.newNetworkSeed)) {
// derive network keys
const pair = kg.deriveNetworkKeys(state.newNetworkSeed);
const pencr = addHexPrefix(pair.crypt.public);
const pauth = addHexPrefix(pair.auth.public);
const txn = azimuth.ecliptic.configureKeys(
validContracts,
validPoint,
pencr,
pauth,
1,
state.discontinuity
);
return Just(txn);
}
checkKeysMatch(networkSeed, pointDetails) {
const crypub = pointDetails.encryptionKey;
const sgnpub = pointDetails.authenticationKey;
const { crypt, auth } = kg.deriveNetworkKeys(networkSeed);
const keysmatch =
crypub === addHexPrefix(crypt.public) &&
sgnpub === addHexPrefix(auth.public);
return keysmatch;
}