Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getAddressHash(input) {
// eslint-disable-next-line camelcase
const firstHash = sha3_256(cbor.encode(input))
return blake2b(firstHash, 28)
}
return cb(new Error('the object passed has circular references'))
}
seen.push(val)
if (!(cid = val['/'])) {
return val
}
if (typeof cid === 'string') {
cid = new CID(cid.split('/')[0]).buffer
}
return new cbor.Tagged(CID_CBOR_TAG, Buffer.concat([
Buffer.from('00', 'hex'), cid
]))
})
if (!stop) {
try {
const data = cbor.encode(tagged)
cb(null, data)
} catch (err) {
cb(err)
}
}
}
tx.data().forEach((datum) => {
if(
datum
&& datum[0].toString() === '19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut'
&& datum[2].toString() == 'application/cbor'
) {
try {
results.push(cbor.decode(datum[1]));
} catch (err) {}
}
});
return results;
} else {
return tx.data(
'19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut',
cbor.encode(data),
'application/cbor',
'binary'
);
}
};
}
function getId() {
return blake2b(encode(TxAux(inputs, outputs, attributes)), 32).toString('hex')
}
function getRandomSaltForPasswordHash() {
const randBytes = Buffer.alloc(32)
window.crypto.getRandomValues(randBytes)
return encode(randBytes)
}
const parseAddress = (val) => {
return base58.encode(encode(val))
}
function encryptDerivationPath(derivationPath, hdPassphrase) {
const serializedDerivationPath = cbor.encode(new CborIndefiniteLengthArray(derivationPath))
return chacha20poly1305Encrypt(
serializedDerivationPath,
hdPassphrase,
Buffer.from('serokellfore')
)
}