Options
All
  • Public
  • Public/Protected
  • All
Menu

Crypto Codecs

styled with prettier Travis Coveralls Dev Dependencies Donate

A project for encrypting and decrypting anything

Features

  • Support for JWE (Json Web Encryption)
  • Promise based interfaces
  • Encrypting and Decrypting everything (number, string, boolean, array, date, regex, buffer, object)

Installation

npm install @adorsys/crypto-codecs

Usage

import { codecs, util } from 'crypto-codecs'
// ...or
const { codecs, util } = require('../src')

// Without providing a key
codecs.jwe()
  .then(codec => {
    codec.encrypt({test: 42})
      .then(cipher => codec.decrypt(cipher))
      .then(value => value) // {test: 42}
  })
  .catch(err => console.log(err))

// With providing a key
let Key
util.jwk.generate()
  .then(k => {
    // remember key for later use
    Key = k
    return codecs.jwe({Key})
  })
  .then(codec => codec.encrypt({test: 42}))
  .then(cipher => codecs.jwe({Key}).then(codec => codec.decrypt(cipher)))
  .then(value => value) // {test: 42}
  .catch(err => console.log(err))

API

@adorsys/crypto-codecs

Credits

Made with :heart: by gradorsys and all these wonderful contributors (emoji key):


Francis Pouatcha
🤔

This project follows the all-contributors specification. Contributions of any kind are welcome!

Index

Interfaces

Functions

Object literals

Functions

generate

jwe

Object literals

Const codecs

codecs: object

jwe

jwe: jwe

Const keyDefaults

keyDefaults: object

alg

alg: string = "A256GCM"

kty

kty: string = "oct"

use

use: string = "enc"

Const util

util: object

jwk

jwk: object

Type declaration

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc