Adapt tests
This commit is contained in:
+7
-3
@@ -11,7 +11,8 @@ test('Private box', async () => {
|
||||
expect(de).not.toBeNull()
|
||||
|
||||
const box = await PrivateBox.encrypt(message, de!)
|
||||
const unbox = await box.decrypt(k.privateKey)
|
||||
expect(box).not.toBeNull()
|
||||
const unbox = await box!.decrypt(k.privateKey)
|
||||
expect(unbox).toEqual(message)
|
||||
})
|
||||
test('Private wrap', async () => {
|
||||
@@ -24,11 +25,14 @@ test('Private wrap', async () => {
|
||||
const message = crypto.getRandomValues(new Uint8Array(8))
|
||||
const k_wrapped = await SecretBox.gen(true)
|
||||
const boxed_message = await SecretBox.encrypt(message, k_wrapped)
|
||||
expect(boxed_message).not.toBeNull()
|
||||
|
||||
const box = await PrivateWrap.wrap(k_wrapped, de!)
|
||||
const unbox = await box.unwrap(k.privateKey)
|
||||
expect(box).not.toBeNull()
|
||||
const unbox = await box!.unwrap(k.privateKey)
|
||||
expect(unbox).not.toBeNull()
|
||||
|
||||
const unboxed_message = await boxed_message.decrypt(unbox!)
|
||||
const unboxed_message = await boxed_message!.decrypt(unbox!)
|
||||
expect(unboxed_message).toEqual(message)
|
||||
})
|
||||
test('Signature', async () => {
|
||||
|
||||
Reference in New Issue
Block a user