Skip to content

Latest commit

History

History
46 lines (32 loc) 路 1.28 KB

File metadata and controls

46 lines (32 loc) 路 1.28 KB

Cript位
Start new PR in StackBlitz Codeflownpm package


Install

bun i cripta

Usage

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: 'john@example.com'
}, opts)

console.log('Encoded object: ', encoded)

// retrieve the object from encoded value
const decoded = await decode(encoded, opts)
console.log('Decoded object: ', decoded)

License

This package is licensed under the MIT licenseHUB