Remove buffer dependency.

This commit is contained in:
Jack Hadrill
2022-02-17 19:22:26 +00:00
parent 881fd751dd
commit 6dec3496e8
4 changed files with 18 additions and 18 deletions

View File

@@ -3,9 +3,9 @@ import { encrypt } from '../src/encrypt'
test('Test nonce generation by public encrypt function.', () => {
// Given
const message = Buffer.from('Hello, World! This is a test message.')
const associatedData = Buffer.from('Some associated data.')
const key = Buffer.from('\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f')
const message = new TextEncoder().encode('Hello, World! This is a test message.')
const associatedData = new TextEncoder().encode('Some associated data.')
const key = Uint8Array.from([0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f])
// When
const ciphertext = encrypt(message, associatedData, key)