0.0.2 • Published 4 months ago

crypticstorage v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Cryptic Storage

Browser & Server compatible encrypted storage

Cryptic is a thin wrapper around Web Crypto and sets sane defaults to allow quickly implementing encryption in your application.

Getting Started

Install crypticstorage via NPM

npm install crypticstorage

Example

// Simple example

// import '../node_modules/crypticstorage/cryptic.js';
import { Cryptic } from 'crypticstorage';

const salt = Cryptic.bufferToHex(Cryptic.randomBytes(32))
const iv = Cryptic.bufferToHex(Cryptic.randomBytes(16))

const cryptic = Cryptic.create(
  decryptPass,
  salt,
)

let encryptedText = await cryptic.encrypt(
  'text to encrypt',
  iv,
);

console.log('Encrypted Text', encryptedText)

let decryptedText = await cryptic.decrypt(
  encryptedText,
  iv,
);

console.log('Decrypted Text', decryptedText)

Breaking Changes

Deprecation warning: Cryptic.encryptString renamed to Cryptic.create

Breaking Change: Cryptic.encryptString now expects salt in HEX format instead of a string. If stored as plain string, convert with the example below.

const cryptic = Cryptic.create(
  encryptPass,
  Cryptic.bufferToHex(
    Cryptic.stringToBuffer(salt)
  )
)
0.0.2

4 months ago

0.0.1-1

8 months ago

0.0.1-0

8 months ago