Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adorsys/jwe-codec

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adorsys/jwe-codec

Codec to encrypt any javascript value into a JsonWebEncryption (JWE)

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9K
decreased by-37.32%
Maintainers
2
Weekly downloads
 
Created
Source

:closed_lock_with_key: jwe-codec :closed_lock_with_key:

Travis Coveralls npm npm Conventional Commits JavaScript Style Guide styled with prettier NpmLicense

A library for encrypting/decrypting any JavaScript value as JsonWebEncryption (JWE)

Features

  • Promise based interface
  • Encrypting/Decrypting anything from (number, string, boolean, array, date, regex, buffer, object)
  • TypeScript support
  • support for symetric JsonWebKeys { kty: 'oct' }
  • supported algorithms 'A256KW', 'A256GCM', 'A256GCMKW', 'A128CBC-HS256'
  • Continous integration with Travis

Installation

npm install @adorsys/jwe-codec

Usage

const jwe = require('@adorsys/jwe-codec')

const key = {
  kty: 'oct',
    alg: 'A256GCM',
    use: 'enc',
    k: '123456789abcdefghijklmnopqrstuvwxyz12345678'
}

...
with async/await
...

;(async () => {
    const codec = await jwe(key)
    const cipher = await codec.encrypt(42)
    // => eyJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiZGlyIiwia2lkIjoialpESEVqN0ZhR3N5OHNUSUZLRWlnejB4TjFEVWlBZWp0S1ZNcEl2Z3dqOCJ9..lipFQHmBiBhsTRqE.4rLjRCOj7JZIKOpToIhOp8cJgvfNWl4Yo__VnkO7yRIYjrCLdGRl5fcR.9S_DwYmkpdLap1yyYYq44A​​​​​
    const answer = await codec.decrypt(cipher) 
    // => 42
})()
with Promises
...

jwe(key).then(codec => {
    codec.encrypt(42).then(cipher => {
        codec.decrypt(cipher).then(answer => {
            console.log(answer) // 42
        })
    })
})

Credits

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


Francis Pouatcha
🤔

jkroepke
💻🐛

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

Keywords

FAQs

Package last updated on 05 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc