Coder Social home page Coder Social logo

js-ectoken's Introduction

@edgio/ectoken

JavaScript implementation of Edgio token (ectoken)

Table of Contents

Background

JavaScript implementation of the "Edgio Token" (ectoken) - see main repo ectoken for more details.

Install

$ npm install @edgio/ectoken

Usage

const { ECToken, encrypt, decrypt } = require('@edgio/ectoken')

const ec_token = new ECToken()
ec_token.addValue('ec_country_allow', 'US')
// Add additional directives in the same way.

const token = await encrypt('my-secret-key', ec_token)
const plaintext = await decrypt('my-secret-key', token)

If installing this library as a replacement for ectoken-nodejs, import the V3 namespace instead:

const { V3 } = require('@edgio/ectoken')

const token = await V3.encrypt('my-secret-key', 'some_param=valueA&some_other_param=valueB')
const plaintext = await V3.decrypt('my-secret-key', token)

Please Note: because this version of the token generator uses crypto.subtle, the encrypt and decrypt functions are now asynchronous.

The ECToken helper class is optional for both the namespaced and non-namespaced import variations. The encrypt function will accept either an ECToken object or a plain string.

Contribute

We welcome issues, questions, and pull requests.

License

This project is licensed under the terms of the Apache 2.0 open source license. Please refer to the License-2.0.txt file for the full terms.

js-ectoken's People

Contributors

tmountjr avatar arsalandotme avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.