Add examples
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
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")
|
||||
Reference in New Issue
Block a user