Enforce stronger types for ArrayBuffers and storage
This commit is contained in:
parent
61ac79e9ae
commit
8f5086227a
56 changed files with 748 additions and 675 deletions
|
@ -44,9 +44,9 @@ describe('synchronousCrypto', () => {
|
|||
|
||||
describe('encrypt+decrypt', () => {
|
||||
it('returns original input', () => {
|
||||
const iv = crypto.randomBytes(16);
|
||||
const key = crypto.randomBytes(32);
|
||||
const input = Buffer.from('plaintext');
|
||||
const iv = toArrayBuffer(crypto.randomBytes(16));
|
||||
const key = toArrayBuffer(crypto.randomBytes(32));
|
||||
const input = toArrayBuffer(Buffer.from('plaintext'));
|
||||
|
||||
const ciphertext = encrypt(key, input, iv);
|
||||
const plaintext = decrypt(key, ciphertext, iv);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue