Add examples
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import {expect} from 'bun:test'
|
||||
|
||||
import {SecretWrap, PrivateWrap} from '../index'
|
||||
|
||||
const key_wraps = await SecretWrap.gen_key()
|
||||
const key_wrapped = await PrivateWrap.gen_keypair()
|
||||
|
||||
const cipher = await SecretWrap.encrypt(key_wrapped.privateKey, key_wraps)
|
||||
const box = cipher.toString()
|
||||
const unbox = SecretWrap.fromString(box)
|
||||
const plain = await unbox.decrypt(key_wraps)
|
||||
|
||||
expect(plain).toEqual(key_wrapped.privateKey)
|
||||
console.log("key-wraps-ecdh OK")
|
||||
Reference in New Issue
Block a user