{"_id":"akamai-edgeauth","_rev":"5-c02af726521764c8379f29c683d9886f","name":"akamai-edgeauth","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"akamai-edgeauth","version":"0.1.0","description":"Akamai Edge Authorization Token for Property Manager Behavior","main":"./lib/edgeAuth.js","scripts":{"test":"mocha --reporter spec --no-timeouts --ui bdd test/test-*"},"pre-commit":["test"],"repository":{"type":"git","url":"git+https://github.com/AstinCHOI/Akamai-EdgeAuth-Node.git"},"keywords":["edgeauth","akamai","token","authorization","property manager"],"author":{"name":"Astin Choi","email":"asciineo@gmail.com"},"license":"Apache-2.0","devDependencies":{"chai":"^3.5.0","mocha":"^3.2.0","pre-commit":"^1.2.2"},"gitHead":"daa0dd3c8c6382bdff486c991d72a8c535b6063b","bugs":{"url":"https://github.com/AstinCHOI/Akamai-EdgeAuth-Node/issues"},"homepage":"https://github.com/AstinCHOI/Akamai-EdgeAuth-Node#readme","_id":"akamai-edgeauth@0.1.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"asciineo","email":"asciineo@gmail.com"},"dist":{"integrity":"sha512-ZkukSca+WqOBKP5Er8li20j8njY7CmfClINM21UN+cEvBsSFWGxv8ec2TGggm2/DXRMzyIpBf2P/vAeuiVWcAA==","shasum":"6683ea06ab085260ae3a41af3e694a57db1913c2","tarball":"https://registry.npmjs.org/akamai-edgeauth/-/akamai-edgeauth-0.1.0.tgz","fileCount":8,"unpackedSize":48087,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFFmOs7km3n7QjpP7CRkPdW07Lw/0sMQhSlK7g2Oc/NqAiBRBhQvqOgvxja9KgPS8PYzqBFhJQ0KEkSDfQCH7Suz9Q=="}]},"maintainers":[{"name":"asciineo","email":"asciineo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/akamai-edgeauth_0.1.0_1520576180914_0.3702670676922737"},"_hasShrinkwrap":false},"0.1.1":{"name":"akamai-edgeauth","version":"0.1.1","description":"Akamai Edge Authorization Token for Property Manager Behavior","main":"./lib/edgeauth.js","scripts":{"test":"mocha --reporter spec --no-timeouts --ui bdd ./test/test-*"},"pre-commit":["test"],"repository":{"type":"git","url":"git+https://github.com/AstinCHOI/Akamai-EdgeAuth-Node.git"},"keywords":["edgeauth","akamai","token","authorization","property manager"],"author":{"name":"Astin Choi","email":"asciineo@gmail.com"},"license":"Apache-2.0","devDependencies":{"chai":"^4.1.2","mocha":"^5.0.4"},"gitHead":"483be147de0b1f4defe6225f1fbbed70204aed56","bugs":{"url":"https://github.com/AstinCHOI/Akamai-EdgeAuth-Node/issues"},"homepage":"https://github.com/AstinCHOI/Akamai-EdgeAuth-Node#readme","_id":"akamai-edgeauth@0.1.1","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"asciineo","email":"asciineo@gmail.com"},"dist":{"integrity":"sha512-EqbAmE0I8SYb9jJICK7oHAcqD1OFH7by7bGEkngvRIc/LRXzRXiGheV9lmDBVBaZ6Yi9x9OmU9T6nt4vsMMGmw==","shasum":"9d9b46e20f88de2fcc7ea3fcdfd380d360612a4a","tarball":"https://registry.npmjs.org/akamai-edgeauth/-/akamai-edgeauth-0.1.1.tgz","fileCount":8,"unpackedSize":48126,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDSSbpEubaFRHNPkS5F8DzBP8OIhVn0XMDTcxZzYBk7gwIgJniiSI41hHMEnev3YE1c5q6vgfKK7/pULIHpUaPOsBk="}]},"maintainers":[{"name":"asciineo","email":"asciineo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/akamai-edgeauth_0.1.1_1520581451457_0.07294105308723298"},"_hasShrinkwrap":false},"0.1.2":{"name":"akamai-edgeauth","version":"0.1.2","description":"Akamai Edge Authorization Token for Property Manager Behavior","main":"./lib/edgeauth.js","scripts":{"test":"mocha --reporter spec --no-timeouts --ui bdd ./test/test-*"},"pre-commit":["test"],"repository":{"type":"git","url":"git+https://github.com/AstinCHOI/Akamai-EdgeAuth-Node.git"},"keywords":["edgeauth","akamai","token","authorization","property manager"],"author":{"name":"Astin Choi","email":"asciineo@gmail.com"},"license":"Apache-2.0","devDependencies":{"chai":"^4.1.2","mocha":"^5.0.4"},"gitHead":"03491e49d0dfbc01924b9401ef0b5a8f35cc5491","bugs":{"url":"https://github.com/AstinCHOI/Akamai-EdgeAuth-Node/issues"},"homepage":"https://github.com/AstinCHOI/Akamai-EdgeAuth-Node#readme","_id":"akamai-edgeauth@0.1.2","_npmVersion":"5.6.0","_nodeVersion":"9.5.0","_npmUser":{"name":"asciineo","email":"asciineo@gmail.com"},"dist":{"integrity":"sha512-Orjd9U9uXzOAcpIc6YFJIGe+CD/Z1LNdo05JkorxZskZ7G0jC0o/cyC+FCa4p9QBCgbW2Z6U3tgoaOvAF13fjA==","shasum":"584816caee25c7a7ad68a68fd5741ae0bf278ca0","tarball":"https://registry.npmjs.org/akamai-edgeauth/-/akamai-edgeauth-0.1.2.tgz","fileCount":9,"unpackedSize":57513,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCcmodoI5Puu6/YM/ClPlJDtOlOcnw5aU5PUlvmGoGIHgIgGhEhP9YLDXcLlQQpyfByZaLfnSvolKEZfQCaPTqJTdU="}]},"maintainers":[{"name":"asciineo","email":"asciineo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/akamai-edgeauth_0.1.2_1521358436408_0.6017791730422588"},"_hasShrinkwrap":false},"0.2.0":{"name":"akamai-edgeauth","version":"0.2.0","description":"Akamai Edge Authorization Token for Property Manager Behavior","main":"./lib/edgeauth.js","scripts":{"test":"mocha --reporter spec --no-timeouts --ui bdd ./test/test-*"},"pre-commit":["test"],"repository":{"type":"git","url":"git+https://github.com/AstinCHOI/Akamai-EdgeAuth-Node.git"},"keywords":["edgeauth","akamai","token","authorization","property manager"],"author":{"name":"Astin Choi","email":"asciineo@gmail.com"},"license":"Apache-2.0","devDependencies":{"chai":"^4.1.2","mocha":"^5.0.4"},"gitHead":"a5dcc1a0dfd646c47cc96e9882322e5c75170903","bugs":{"url":"https://github.com/AstinCHOI/Akamai-EdgeAuth-Node/issues"},"homepage":"https://github.com/AstinCHOI/Akamai-EdgeAuth-Node#readme","_id":"akamai-edgeauth@0.2.0","_npmVersion":"5.8.0","_nodeVersion":"9.5.0","_npmUser":{"name":"asciineo","email":"asciineo@gmail.com"},"dist":{"integrity":"sha512-jMJFTAjWiVyhqyjDgN3+LkFfqoD6fdMlu0YnUdI/sK50fPY7JLIozsh0u8L1Ltdjgq6xpC0fz5LI9ydLNLnnWA==","shasum":"7c39a54a363ed30b41676a27d1cb926146e90cc9","tarball":"https://registry.npmjs.org/akamai-edgeauth/-/akamai-edgeauth-0.2.0.tgz","fileCount":9,"unpackedSize":57559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa+q3KCRA9TVsSAnZWagAA6dEP/jb3S+D3RJpaOF/sf6IB\nA1GZ/9AGUFSADs6l9VOQqBWFG+e6FUZijZkEbmAxZt/F3Dhlffj2x9GaCCxK\nojuzJnNrm3NniXbbR5DpzDC9ZDxniFpn9eQ/nNli7DFsbPaAi7P0Ep1liXDP\nbq6iQRIskz6s4n95t7fEmbq+KfvvxOANxrS/xioLULLXC1u6eQKOL+dfMxO1\ngzX4tlq9UPkfxItHZ7k063QZhaxopbOvSyOsFIZeuaesXMcS59CtiKeVDZW+\nwfpBSmFCosmqUhY1Q0rd4T9ik2sMoTi7w4+m4OA4iEiOtBFXPArQk/Lu02ev\nt22jS+42GmEAg7G3K3g4XSdaBz+EBS8VFV3z3Su0MUUt/wLhK60SHBK3sYfY\nqXq+Qs+PCXpX/NULyy1jOxZPufYgrrN9GHvIUXyXt3lGeFMMnxUuOA+jfCR7\nBCxelZRVFHeG76D66HiDKP+Tf3t4SPH6L96tENp8q7vMOrvGIdmAKGV4iInT\nw2O06Lpqo2K5TkrCGZdRTNwl6xxqOOZDgGukXtnsNji30yjNx6p4oi18Wd7L\noYVfxrBijyXUTigvDarcFdvCN7CybMfJ+/zMbiew5J5UYBrOgFdGoK5qllRh\nf7itGnqrkzVRdcxeYSbkcGzmg6vWm7cM9nHe6FdwqnmzMHUMVqDKhaTrIwt2\nLh9V\r\n=2N3z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHfXCe8lnFOshFERFj3Iaujeyyh60UFRjmFvye+5HLjuAiAlMYFe5i3/YfatOhjhLKmostSJu4ndlYON3GzYqFjz5w=="}]},"maintainers":[{"name":"asciineo","email":"asciineo@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/akamai-edgeauth_0.2.0_1526377929415_0.6672436181732915"},"_hasShrinkwrap":false}},"time":{"created":"2018-03-09T06:16:20.914Z","0.1.0":"2018-03-09T06:16:20.978Z","modified":"2022-04-11T13:11:20.242Z","0.1.1":"2018-03-09T07:44:11.522Z","0.1.2":"2018-03-18T07:33:56.471Z","0.2.0":"2018-05-15T09:52:09.524Z"},"maintainers":[{"name":"asciineo","email":"asciineo@gmail.com"}],"description":"Akamai Edge Authorization Token for Property Manager Behavior","homepage":"https://github.com/AstinCHOI/Akamai-EdgeAuth-Node#readme","keywords":["edgeauth","akamai","token","authorization","property manager"],"repository":{"type":"git","url":"git+https://github.com/AstinCHOI/Akamai-EdgeAuth-Node.git"},"author":{"name":"Astin Choi","email":"asciineo@gmail.com"},"bugs":{"url":"https://github.com/AstinCHOI/Akamai-EdgeAuth-Node/issues"},"license":"Apache-2.0","readme":"# Akamai-EdgeAuth: Akamai Edge Authorization Token for Node\n\n[![npm package](https://badge.fury.io/js/akamai-edgeauth.svg)](https://badge.fury.io/js/akamai-edgeauth)\n[![Build Status](https://travis-ci.org/AstinCHOI/Akamai-EdgeAuth-Node.svg?branch=master)](https://travis-ci.org/AstinCHOI/Akamai-EdgeAuth-Node)\n[![License](http://img.shields.io/:license-apache-blue.svg)](https://github.com/AstinCHOI/Akamai-EdgeAuth-Node/blob/master/LICENSE)\n\n[![npm package](https://nodei.co/npm/akamai-edgeauth.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/akamai-edgeauth/)\n\nAkamai-EdgeAuth is Akamai Edge Authorization Token in the HTTP Cookie, Query String and Header for a client.\nYou can configure it in the Property Manager at https://control.akamai.com.\nIt's the behaviors which is Auth Token 2.0 Verification and Segmented Media Protection.\n\nAkamai-EdgeAuth supports for Node.js 4.0+\n\n<div style=\"text-align:center\"><img src=https://github.com/AstinCHOI/akamai-asset/blob/master/edgeauth/edgeauth.png?raw=true/></div>\n\n\n## Installation\n\nTo install Akamai Edge Authorization Token with npm:  \n\n```Shell\n$ npm install akamai-edgeauth --save\n```\n  \n\n## Example\n\n```Javascript\nconst EdgeAuth = require('akamai-edgeauth')\nconst http = require('http') // Module for the test\n\n\nvar EA_HOSTNAME = 'edgeauth.akamaized.net'\nvar EA_ENCRYPTION_KEY = 'YourEncryptionKey' \nvar DURATION = 500 // seconds\n\n\n// Function just for the simple test\nfunction makeRequest(options, callback) {\n    var request = http.request(options, (res) => {\n        callback(res)\n    })\n    request.on('error', (err) => {\n        callback(err)\n    })\n    request.end()\n}\n```\n* EA_ENCRYPTION_KEY must be hexadecimal digit string with even-length.  \n* Don't expose EA_ENCRYPTION_KEY on the public repository.  \n\n\n#### URL parameter option\n\n```Javascript\n// [EXAMPLE 1] Cookie\nvar ea = new EdgeAuth({\n    key: EA_ENCRYPTION_KEY,\n    windowSeconds: DURATION,\n    escapeEarly: true\n})\nvar token = ea.generateURLToken(\"/akamai/edgeauth\")\nvar options = {\n    hostname: EA_HOSTNAME,\n    path: '/akamai/edgeauth',\n    'Cookie': `${ea.options.tokenName}=${token}`\n}\nmakeRequest(options, function(res) {\n    console.log(res.statusCode) // If pass, it won't response 403 code.\n})\n\n// [EXAMPLE 2] Query string\ntoken = ea.generateURLToken(\"/akamai/edgeauth\")\noptions = {\n    hostname: EA_HOSTNAME,\n    path: `/akamai/edgeauth?${ea.options.tokenName}=${token}`\n}\nmakeRequest(options, function(res) {\n    console.log(res.statusCode)\n})\n```\n* 'Escape token input' option in the Property Manager corresponds to 'escapeEarly' in the code.  \nEscape token input (on) == escapeEarly (true)  \nEscape token input (off) == escapeEarly (false)  \n\n* In [Example 2] for Query String, it's only okay for 'Ignore query string' option (on).\n* If you want to 'Ignore query string' option (off) using query string as your token, Please contact your Akamai representative.  \n\n\n#### ACL(Access Control List) parameter option\n\n```Javascript\n// [EXAMPLE 1] Header using *\nvar ea = new EdgeAuth({\n    key: EA_ENCRYPTION_KEY,\n    windowSeconds: DURATION,\n    escapeEarly: false\n})\nvar token = ea.generateURLToken(\"/akamai/edgeauth/*\")\nvar options = {\n    hostname: EA_HOSTNAME,\n    path: \"/akamai/edgeauth/something\",\n    headers: {[ea.options.tokenName]: token}\n}\nmakeRequest(options, function(res) {\n    console.log(res.statusCode)\n})\n\n\n// [EXAMPLE 2] Cookie using ACL delimiter\nvar ea = new EdgeAuth({\n    key: EA_ENCRYPTION_KEY,\n    windowSeconds: DURATION,\n    escapeEarly: false\n})\nvar acl = [\"/akamai/edgeauth/??\", \"/akamai/edgeauth/list/*\"]\nvar token = ea.generateURLToken(acl)\nvar options = {\n    hostname: EA_HOSTNAME,\n    path: \"/akamai/edgeauth/22\",\n    Cookie: `${ea.options.tokenName}: ${token}`\n}\nmakeRequest(options, function(res) {\n    console.log(res.statusCode)\n})\n\n```\n* ACL can use the wildcard(\\*, ?) in the path.\n* Don't use '!' in your path because it's ACL Delimiter\n* Use 'escapeEarly=false' as default setting but it doesn't matter turning on/off 'Escape token input' option in the Property Manager\n\n\n## Usage\n\n#### EdgeAuth Class\n\n```Javascript\nclass EdgeAuth {\n    constructor(options) {}\n}\n```\n\n| Parameter | Description |\n|-----------|-------------|\n| options.tokenType | Select a preset. (Not Supported Yet) |\n| options.tokenName | Parameter name for the new token. [ Default: \\_\\_token\\_\\_ ] |\n| options.key | Secret required to generate the token. It must be hexadecimal digit string with even-length. |\n| options.algorithm  | Algorithm to use to generate the token. ('sha1', 'sha256', or 'md5') [ Default: 'sha256' ] |\n| options.salt | Additional data validated by the token but NOT included in the token body. (It will be deprecated) |\n| options.startTime | What is the start time? (Use string 'now' for the current time) |\n| options.endTime | When does this token expire? endTime overrides windowSeconds |\n| options.windowSeconds | How long is this token valid for? |\n| options.fieldDelimiter | Character used to delimit token body fields. [ Default: ~ ] |\n| options.aclDelimiter | Character used to delimit acl. [ Default: ! ] |\n| options.escapeEarly | Causes strings to be url encoded before being used. |\n| options.verbose | Print all parameters. |\n\n\n#### EdgeAuth's Method\n\n```Javascript\ngenerateURLToken(url) {}\ngenerateACLToken(acl) {}\n\n// both return the authorization token string.\n```\n\n| Parameter | Description |\n|-----------|-------------|\n| url | Single URL path (String) |\n| acl | Access Control List can use the wildcard(\\*, ?). It can be String (single path) or Array (multi paths) |\n\n\n## Others\n\nIf you use the **Segmented Media Protection** behavior in AMD(Adaptive Media Delivery) Product, **tokenName(options.tokenName)** should be '**hdnts**'.\n\n<div style=\"text-align:center\"><img src=https://github.com/AstinCHOI/akamai-asset/blob/master/edgeauth/segmented_media_protection.png?raw=true/></div>\n\n\n## Command\n\nYou can use the command with [cms-edgeauth.js](https://github.com/AstinCHOI/Akamai-EdgeAuth-Node/blob/master/cms-edgeauth.js) in your terminal with [commander](https://www.npmjs.com/package/commander) to generate the token.\n\n```Shell\n$ npm install commander --save\n$ node cms-edgeauth.js --key YourEncryptionKey --window 5000 --url /hello/world --escape_early\n```\n\nUse -h or --help option for the detail.","readmeFilename":"README.md"}