bun i cripta
import { config, encode, decode } from 'cripta' const opts = await config({ key: 'your-secret-key' }) const encoded = await encode('hic sunt dracones', opts) console.log('Encoded: ', encoded) console.log('Decoded: ', await decode(encoded, opts))
The Cripta can encrypt all primitive types: array, object, string, number, bigint, boolean, Symbol, undefined and null.
See an example of object encryption:
// encoding const encoded = await encode({ name: 'John Doe', email: '[email protected]' }, opts) console.log('Encoded object: ', encoded) // retrieve the object from encoded value const decoded = await decode(encoded, opts) console.log('Decoded object: ', decoded)
This package is licensed under the MIT license © HUB