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