15 lines
481 B
TypeScript
15 lines
481 B
TypeScript
import {expect} from 'bun:test'
|
|
|
|
import {PrivateWrap} from '../index'
|
|
|
|
const key_wraps = await PrivateWrap.gen_keypair()
|
|
const key_wrapped = await PrivateWrap.gen_keypair()
|
|
|
|
const cipher = await PrivateWrap.encrypt(key_wrapped.privateKey, key_wraps.publicKey)
|
|
const box = await cipher.toString()
|
|
const unbox = await PrivateWrap.fromString(box)
|
|
const plain = await unbox.decrypt(key_wraps.privateKey)
|
|
|
|
expect(plain).toEqual(key_wrapped.privateKey)
|
|
console.log("ecdh-wraps-ecdh OK")
|