mirror of https://github.com/xwiki-labs/cryptpad
allocate blockSeed as Uint8Array
This commit is contained in:
parent
7aa7b82c60
commit
cfc81e8c96
|
@ -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);
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue