Skip to content

Edgio/js-ectoken

Repository files navigation

@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

  1. Clone this repo.
  2. cd into the repo directory
  3. Run npm install

Usage

This library is provided in CommonJS (CJS) format. To include the library in a script, require it:

const { ECToken, encrypt, decrypt } = require('./ECToken.js')

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)

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.