allocate blockSeed as Uint8Array

This commit is contained in:
ansuz 2018-06-28 15:21:13 +02:00
parent 7aa7b82c60
commit cfc81e8c96
2 changed files with 4 additions and 1 deletions

View File

@ -47,7 +47,7 @@ define([
var edSeed = opt.edSeed = dispense(32);
// 64 more bytes to seed an additional signing key
opt.blockSeed = dispense(64);
opt.blockSeed = new Uint8Array(dispense(64));
var blockKeys = opt.blockKeys = Block.genkeys(opt.blockSeed);
opt.blockHash = Block.getBlockHash(blockKeys);

View File

@ -23,6 +23,9 @@ define([
// should be deterministic from a seed...
Block.genkeys = function (seed) {
if (!(seed instanceof Uint8Array)) {
throw new Error('INVALID_SEED_FORMAT');
}
if (!seed || typeof(seed.length) !== 'number' || seed.length < 64) {
throw new Error('INVALID_SEED_LENGTH');
}