Switch from Uint8Array.from to new Uint8Array

This commit is contained in:
Daniel Huigens 2021-05-28 17:06:15 +02:00
parent 5ae7fc4444
commit 0ca83cf121
3 changed files with 4 additions and 4 deletions

View File

@ -109,7 +109,7 @@ const util = {
throw new Error('Zero MPI');
}
const stripped = bin.subarray(bin.length - Math.ceil(bitSize / 8));
const prefix = Uint8Array.from([(bitSize & 0xFF00) >> 8, bitSize & 0xFF]);
const prefix = new Uint8Array([(bitSize & 0xFF00) >> 8, bitSize & 0xFF]);
return util.concatUint8Array([prefix, stripped]);
},

View File

@ -827,11 +827,11 @@ V+HOQJQxXJkVRYa3QrFUehiMzTeqqMdgC6ZqJy7+
expect(rawNotations.length).to.equal(2);
expect(rawNotations[0].name).to.equal('test@example.com');
expect(rawNotations[0].value).to.deep.equal(Uint8Array.from(['2'.charCodeAt(0)]));
expect(rawNotations[0].value).to.deep.equal(new Uint8Array(['2'.charCodeAt(0)]));
expect(rawNotations[0].humanReadable).to.equal(true);
expect(rawNotations[1].name).to.equal('test@example.com');
expect(rawNotations[1].value).to.deep.equal(Uint8Array.from(['3'.charCodeAt(0)]));
expect(rawNotations[1].value).to.deep.equal(new Uint8Array(['3'.charCodeAt(0)]));
expect(rawNotations[1].humanReadable).to.equal(true);
});

View File

@ -922,7 +922,7 @@ hUhMKMuiM3pRwdIyDOItkUWQmjEEw7/XmhgInkXsCw==
expect(signature.rawNotations.length).to.equal(1);
const notation = signature.rawNotations[0];
expect(notation.name).to.equal('test@key.com');
expect(notation.value).to.deep.equal(Uint8Array.from([0x01, 0x02, 0x03]));
expect(notation.value).to.deep.equal(new Uint8Array([0x01, 0x02, 0x03]));
expect(notation.humanReadable).to.equal(false);
});