This commit is contained in:
@@ -13,13 +13,13 @@ beforeAll(async () => {
|
||||
})
|
||||
|
||||
test('base case', async () => {
|
||||
const box = await PrivateWrap.encrypt(message, k1.publicKey)
|
||||
const unboxed = await box.decrypt(k1.privateKey)
|
||||
const box = await PrivateWrap.wrap(message, k1.publicKey)
|
||||
const unboxed = await box.unwrap(k1.privateKey)
|
||||
expect(unboxed).toEqual(message)
|
||||
})
|
||||
test("Different key can't decrypt", async () => {
|
||||
const box = await PrivateWrap.encrypt(message, k1.publicKey)
|
||||
const unboxed = await box.decrypt(k2.privateKey)
|
||||
const box = await PrivateWrap.wrap(message, k1.publicKey)
|
||||
const unboxed = await box.unwrap(k2.privateKey)
|
||||
expect(unboxed).toBeNull()
|
||||
})
|
||||
|
||||
@@ -35,7 +35,7 @@ test('Key generation', async () => {
|
||||
})
|
||||
|
||||
test('serialization', async () => {
|
||||
const box = await PrivateWrap.encrypt(message, k1.publicKey)
|
||||
const box = await PrivateWrap.wrap(message, k1.publicKey)
|
||||
|
||||
const ser = await box.toString()
|
||||
const de = await PrivateWrap.fromString(ser)
|
||||
|
||||
Reference in New Issue
Block a user