Make a public key / private key box
Example
```
const key = generateKey()
const obj = { "hello": "world" }
const encrypted = crypto.nacl.secretBox.encrypt(obj, key)
const decrypted = crypto.nacl.secretBox.decrypt(encrypted, key)
console.log(decrypted, obj) // should be shallow equal
```
Methods
# static decrypt(msg, key) → {object}
Parameters:
Name | Type | Description |
---|---|---|
msg |
string | |
key |
string |
- Could not decrypt message
error
object
# static encrypt(json, key) → {string}
Parameters:
Name | Type | Description |
---|---|---|
json |
object | |
key |
string |
Error
string