{"_id":"node-kms","_rev":"14-0ca86e8027fdfde2612ab1392e9dffe2","name":"node-kms","dist-tags":{"latest":"0.4.1"},"versions":{"0.3.0":{"name":"node-kms","version":"0.3.0","keywords":["kms","crypto","jose"],"author":{"name":"Cisco Systems, Inc.","email":"https://www.cisco.com"},"license":"Apache-2.0","_id":"node-kms@0.3.0","maintainers":[{"name":"linuxwolf","email":"linuxwolf@outer-planes.net"}],"contributors":[{"name":"Matthew A. Miller","email":"linuxwolf@outer-planes.net"},{"name":"Ian W. Remmel","email":"design@ianwremmel.com"}],"homepage":"https://github.com/cisco/node-kms#readme","bugs":{"url":"https://github.com/cisco/node-kms/issues"},"dist":{"shasum":"3f6eaaf61ae142ef208685d4fe80bc95262cfdb6","tarball":"https://registry.npmjs.org/node-kms/-/node-kms-0.3.0.tgz","integrity":"sha512-u2fQPI1IKQaUUpr//UoBC+p+D9h1ONr3PbP7sCiCiiwaRQ2VvxaauYINIF9wK3egheTcflwEANYTLhi7H4QeQQ==","signatures":[{"sig":"MEUCIQCRKV7BgtVaOg72JoD3CcfNsYQ2OmGA8j9+6UEp4pNwYAIgYqFBORlassemBaWTYj0WbI0SF2qlL5zDHYtd+YZyGXY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","_from":".","_shasum":"3f6eaaf61ae142ef208685d4fe80bc95262cfdb6","gitHead":"133ed31d69a755bc9eeab725703f9a2e84504a5e","scripts":{"test":"gulp test:nodejs"},"_npmUser":{"name":"linuxwolf","email":"linuxwolf@outer-planes.net"},"repository":{"url":"git+ssh://git@github.com/cisco/node-kms.git","type":"git"},"_npmVersion":"2.14.2","description":"A client implementation of the Key Management Service (KMS) for JavaScript -- for both node.js and browser.","directories":{},"_nodeVersion":"4.0.0","dependencies":{"uuid":"^2.0.1","node-jose":"^0.3.0","es6-promise":"^2.0.1","lodash.clone":"^3.0.2","lodash.clonedeep":"^3.0.1"},"devDependencies":{"del":"^1.1.1","chai":"^1.10.0","gulp":"^3.8.10","karma":"^0.12.31","mocha":"^2.1.0","yargs":"^3.18.0","istanbul":"^0.3.5","browserify":"^8.1.3","gulp-mocha":"^2.0.0","gulp-doctoc":"^0.1.2","gulp-eslint":"^0.5.0","gulp-rename":"^1.2.0","gulp-uglify":"^1.1.0","karma-mocha":"^0.1.10","lodash.omit":"^3.1.0","lodash.merge":"^3.3.1","run-sequence":"^1.0.2","vinyl-buffer":"^1.0.0","gulp-istanbul":"^0.6.0","gulp-sourcemaps":"^1.3.0","karma-browserify":"^3.0.1","vinyl-source-stream":"^1.0.0","karma-mocha-reporter":"^0.3.1","karma-sauce-launcher":"^0.2.14","karma-chrome-launcher":"^0.1.7","karma-safari-launcher":"^0.1.1","karma-firefox-launcher":"^0.1.4"}},"0.3.1":{"name":"node-kms","version":"0.3.1","keywords":["kms","crypto","jose"],"author":{"name":"Cisco Systems, Inc.","email":"https://www.cisco.com"},"license":"Apache-2.0","_id":"node-kms@0.3.1","maintainers":[{"name":"linuxwolf","email":"linuxwolf@outer-planes.net"}],"contributors":[{"name":"Matthew A. Miller","email":"linuxwolf@outer-planes.net"},{"name":"Ian W. Remmel","email":"design@ianwremmel.com"}],"homepage":"https://github.com/cisco/node-kms#readme","bugs":{"url":"https://github.com/cisco/node-kms/issues"},"dist":{"shasum":"eff039291d48e175154b64f5f3fba6e38fb4663d","tarball":"https://registry.npmjs.org/node-kms/-/node-kms-0.3.1.tgz","integrity":"sha512-AkY+k6LIDPep7hVZO3Q5CboH0wcjGAY94Xv7/EV4gDULZG6alZp+IUSoIHNxkx/+4RObGOnrD0ccu3NnfOvPIA==","signatures":[{"sig":"MEQCIFfnJeNu2IqHycRD0nB19ZB0z2+tLeZEcTXoiefeJicIAiBjQlUEeHe3oux6IivTMQq47eWpkmCFcBk5p0e0XWMDNw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","_from":".","_shasum":"eff039291d48e175154b64f5f3fba6e38fb4663d","gitHead":"d41142a931e59180ab10587ef4da27e029fd4b1a","scripts":{"test":"gulp test:nodejs"},"_npmUser":{"name":"linuxwolf","email":"linuxwolf@outer-planes.net"},"repository":{"url":"git+ssh://git@github.com/cisco/node-kms.git","type":"git"},"_npmVersion":"2.14.7","description":"A client implementation of the Key Management Service (KMS) for JavaScript -- for both node.js and browser.","directories":{},"_nodeVersion":"4.2.0","dependencies":{"uuid":"^2.0.1","node-jose":">=0.3.0 <1.0","es6-promise":"^2.0.1","lodash.clone":"^3.0.2","lodash.clonedeep":"^3.0.1"},"devDependencies":{"del":"^1.1.1","chai":"^1.10.0","gulp":"^3.8.10","karma":"^0.12.31","mocha":"^2.1.0","yargs":"^3.18.0","istanbul":"^0.3.5","browserify":"^8.1.3","gulp-mocha":"^2.0.0","gulp-doctoc":"^0.1.2","gulp-eslint":"^0.5.0","gulp-rename":"^1.2.0","gulp-uglify":"^1.1.0","karma-mocha":"^0.1.10","lodash.omit":"^3.1.0","lodash.merge":"^3.3.1","run-sequence":"^1.0.2","vinyl-buffer":"^1.0.0","gulp-istanbul":"^0.6.0","gulp-sourcemaps":"^1.3.0","karma-browserify":"^3.0.1","vinyl-source-stream":"^1.0.0","karma-mocha-reporter":"^0.3.1","karma-sauce-launcher":"^0.2.14","karma-chrome-launcher":"^0.1.7","karma-safari-launcher":"^0.1.1","karma-firefox-launcher":"^0.1.4"}},"0.3.2":{"name":"node-kms","version":"0.3.2","keywords":["kms","crypto","jose"],"author":{"name":"Cisco Systems, Inc.","email":"https://www.cisco.com"},"license":"Apache-2.0","_id":"node-kms@0.3.2","maintainers":[{"name":"linuxwolf","email":"linuxwolf@outer-planes.net"}],"contributors":[{"name":"Matthew A. Miller","email":"linuxwolf@outer-planes.net"},{"name":"Ian W. Remmel","email":"design@ianwremmel.com"}],"homepage":"https://github.com/cisco/node-kms#readme","bugs":{"url":"https://github.com/cisco/node-kms/issues"},"dist":{"shasum":"6de7e524808eec04c77feeb4ef64940e50e2b759","tarball":"https://registry.npmjs.org/node-kms/-/node-kms-0.3.2.tgz","integrity":"sha512-nQZ6H0UVQ4PiUWRoTvobvwHgAdRv8WMUzBiFbJK9FU5PmPWZwawa6wWve2wv+JK+we3q4qUNH/c1TdEj2Vwhqw==","signatures":[{"sig":"MEUCIGz+5FM/WqlocWLUcrRFnd0Bz8rxn5ceRJg+DFs94UrSAiEA6BO69zGW5hKoPLwT80cJVBCOGgC54AXeLzN0qAIgyLA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"lib/index.js","_from":".","_shasum":"6de7e524808eec04c77feeb4ef64940e50e2b759","gitHead":"0a932bec8452bbea47e87e8c2d136779baade6ee","scripts":{"test":"gulp test:nodejs"},"_npmUser":{"name":"linuxwolf","email":"linuxwolf@outer-planes.net"},"repository":{"url":"git+ssh://git@github.com/cisco/node-kms.git","type":"git"},"_npmVersion":"3.10.3","description":"A client implementation of the Key Management Service (KMS) for JavaScript -- for both node.js and browser.","directories":{},"_nodeVersion":"6.4.0","dependencies":{"uuid":"^2.0.1","node-jose":">=0.3.0 <1.0","es6-promise":"^2.0.1","lodash.clone":"^3.0.2","lodash.clonedeep":"^3.0.1"},"devDependencies":{"del":"^1.1.1","chai":"^1.10.0","gulp":"^3.8.10","karma":"^1.2.0","mocha":"^2.1.0","yargs":"^3.18.0","webpack":"^1.13.2","istanbul":"^0.3.5","gulp-mocha":"^2.0.0","gulp-doctoc":"^0.1.2","gulp-eslint":"^0.5.0","gulp-rename":"^1.2.0","gulp-uglify":"^1.1.0","karma-mocha":"^0.1.10","lodash.omit":"^3.1.0","lodash.merge":"^3.3.1","run-sequence":"^1.0.2","gulp-istanbul":"^0.6.0","karma-webpack":"^1.8.0","webpack-stream":"^3.2.0","karma-mocha-reporter":"^0.3.1","karma-sauce-launcher":"^0.2.14","karma-chrome-launcher":"^0.1.7","karma-safari-launcher":"^0.1.1","karma-firefox-launcher":"^0.1.4"},"_npmOperationalInternal":{"tmp":"tmp/node-kms-0.3.2.tgz_1471972402570_0.2206869733054191","host":"packages-12-west.internal.npmjs.com"}},"0.4.0":{"name":"node-kms","version":"0.4.0","keywords":["kms","crypto","jose"],"author":{"name":"Cisco Systems, Inc.","email":"https://www.cisco.com"},"license":"Apache-2.0","_id":"node-kms@0.4.0","maintainers":[{"name":"linuxwolf","email":"linuxwolf@outer-planes.net"},{"name":"mwegman","email":"mwegman@cisco.com"}],"contributors":[{"name":"Matthew A. Miller","email":"linuxwolf@outer-planes.net"},{"name":"Ian W. Remmel","email":"design@ianwremmel.com"}],"homepage":"https://github.com/cisco/node-kms#readme","bugs":{"url":"https://github.com/cisco/node-kms/issues"},"dist":{"shasum":"6d20f57fefb418b46e7128eb1ee218dfb8eec643","tarball":"https://registry.npmjs.org/node-kms/-/node-kms-0.4.0.tgz","fileCount":11,"integrity":"sha512-Tvhs7XTvBgWLZUrAeLKDqzvlomaZWwMoIXWImMc/IbvTijLoOrkovZo+PeW0ivf/8fBlg5EihPCwKg/dy9r+sA==","signatures":[{"sig":"MEUCIHIgMRQ1Tvea1Y5Q0rHAZVqXX/otEj49FcCxtsodsN//AiEAy6Es57ChuXkehzOO5n5IjA3ZgJkIKpA+itfPNPrGdHY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":32345,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkHLHCRA9TVsSAnZWagAAk7MP/RR2Chd7ATvY88pBw+BH\nk36WkSaLy3d3CyWz9k9BdMagBoCCGLU/MYNb+T2ZedwUK8/2e2KeVVFXpgX3\nzX+A1yMFuxWlH/WwZjJgABMCyy4mKiitLWA9FvqquLS7wgzfqlEt0Z75cDhC\n3hLgWp1ObFrenulQ9sPZ6DSzeq4z7pWQgQFgl/tfp8AcAt6m2qOWlsJ829MG\nV9/PpNsbb9If6hUeeRpyaWaFFPl0cqx68qomrKfLMW2bFyr9C4uau2bU35eZ\nvQAI/iZmNphhysd9YOeqhl1nDHFQmUrRtKRQWDyUy5L5wTDwYCzI9Oj1TARB\n7OiS/4LbH/LWDlMk7qU74bDLT2AhT8fhm4w/21wdcMpZgJcgGMeoVnTSVfj3\nhdq6/UGPNx64qOvbmqITonaeq6kuI1lCCvFJT2wjvKv5FETdpQ1t8sRXhLpd\nZRPOQ8kJkD1n2Vgr4WR66NJsULQ2se3dYZLGsWRdOPhf+/V/LEXknWm68of3\nub8Ni3UXuhogFaLgwt/VeiLKn2E02rf1HA0GP/ORfKydhhAtnHjA9Gi4KXf8\nAhpEJmskgyG+1y7paP5zLhB4KOLJ3SWw3YWEjrXlISXCHtt+Sah6EIIZSDWH\nAIj5MS0GzlxAZYm8ZfIKc1bhQ+P9X5SaAqiPrjfWms0Hz99Zv9FvNeyJmUKs\nG4JC\r\n=T8D4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","gitHead":"5f847853cc51c86dcea7717d1a13fc64812a515f","scripts":{"test":"gulp test:nodejs"},"_npmUser":{"name":"linuxwolf","email":"linuxwolf@outer-planes.net"},"repository":{"url":"git+ssh://git@github.com/cisco/node-kms.git","type":"git"},"_npmVersion":"6.14.6","description":"A client implementation of the Key Management Service (KMS) for JavaScript -- for both node.js and browser.","directories":{},"_nodeVersion":"10.22.1","dependencies":{"uuid":"^2.0.1","node-jose":"^2.0.0","es6-promise":"^2.0.1","lodash.clone":"^3.0.2","lodash.clonedeep":"^3.0.1"},"_hasShrinkwrap":false,"devDependencies":{"del":"^1.1.1","chai":"^1.10.0","gulp":"^3.8.10","karma":"^1.2.0","mocha":"^2.1.0","yargs":"^3.18.0","webpack":"^1.13.2","istanbul":"^0.3.5","gulp-mocha":"^2.0.0","gulp-doctoc":"^0.1.2","gulp-eslint":"^0.5.0","gulp-rename":"^1.2.0","gulp-uglify":"^1.1.0","karma-mocha":"^0.1.10","lodash.omit":"^3.1.0","lodash.merge":"^3.3.1","run-sequence":"^1.0.2","gulp-istanbul":"^0.6.0","karma-webpack":"^1.8.0","webpack-stream":"^3.2.0","karma-mocha-reporter":"^0.3.1","karma-sauce-launcher":"^0.2.14","karma-chrome-launcher":"^0.1.7","karma-safari-launcher":"^0.1.1","karma-firefox-launcher":"^0.1.4"},"_npmOperationalInternal":{"tmp":"tmp/node-kms_0.4.0_1603302086842_0.6530729463544636","host":"s3://npm-registry-packages"}},"0.4.1":{"name":"node-kms","version":"0.4.1","keywords":["kms","crypto","jose"],"author":{"name":"Cisco Systems, Inc.","email":"https://www.cisco.com"},"license":"Apache-2.0","_id":"node-kms@0.4.1","maintainers":[{"name":"linuxwolf","email":"linuxwolf@outer-planes.net"},{"name":"mwegman","email":"michael.wegman@gmail.com"},{"name":"justaugustus","email":"foo@auggie.dev"},{"name":"peter7cole","email":"peter7cole@gmail.com"}],"contributors":[{"name":"Matthew A. Miller","email":"linuxwolf@outer-planes.net"},{"name":"Ian W. Remmel","email":"design@ianwremmel.com"}],"homepage":"https://github.com/cisco/node-kms#readme","bugs":{"url":"https://github.com/cisco/node-kms/issues"},"dist":{"shasum":"0bd39dabaf0e6262ee58736616420442b52f82cf","tarball":"https://registry.npmjs.org/node-kms/-/node-kms-0.4.1.tgz","fileCount":11,"integrity":"sha512-qhrfrsEPooJCTDPc8yPaLIu8rHGKrSngK/X9eZziM0RUnMY3PtKU8PHmG5JokeNw7wokW8/dKtwEH5I24oW5ew==","signatures":[{"sig":"MEUCIEBgoesN1zrQSQ15I1hgQ3PkfsGlGxSmb55EMGo/Xhl+AiEA9Z4xpb1U25eqPQlVPkhoT9lqI3ieD8BrZxhEo4NT0DQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32067},"main":"lib/index.js","gitHead":"339a28b0054dd8a92cce7d08fffe42ff2e774bbd","scripts":{"test":"gulp test:nodejs"},"_npmUser":{"name":"peter7cole","email":"peter7cole@gmail.com"},"repository":{"url":"git+ssh://git@github.com/cisco/node-kms.git","type":"git"},"_npmVersion":"10.9.2","description":"A client implementation of the Key Management Service (KMS) for JavaScript -- for both node.js and browser.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"uuid":"^2.0.1","node-jose":"^2.2.0","es6-promise":"^2.0.1","lodash.clone":"^3.0.2","lodash.clonedeep":"^3.0.1"},"_hasShrinkwrap":false,"devDependencies":{"del":"^1.1.1","chai":"^1.10.0","gulp":"^3.8.10","karma":"^1.2.0","mocha":"^2.1.0","yargs":"^3.18.0","webpack":"^1.13.2","istanbul":"^0.3.5","gulp-mocha":"^2.0.0","gulp-doctoc":"^0.1.2","gulp-eslint":"^0.5.0","gulp-rename":"^1.2.0","gulp-uglify":"^1.1.0","karma-mocha":"^0.1.10","lodash.omit":"^3.1.0","lodash.merge":"^3.3.1","run-sequence":"^1.0.2","gulp-istanbul":"^0.6.0","karma-webpack":"^1.8.0","webpack-stream":"^3.2.0","karma-mocha-reporter":"^0.3.1","karma-sauce-launcher":"^0.2.14","karma-chrome-launcher":"^0.1.7","karma-safari-launcher":"^0.1.1","karma-firefox-launcher":"^0.1.4"},"_npmOperationalInternal":{"tmp":"tmp/node-kms_0.4.1_1749154102541_0.24145322377937384","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2015-09-21T16:49:00.369Z","modified":"2025-06-26T18:27:47.884Z","0.3.0":"2015-09-21T16:49:00.369Z","0.3.1":"2015-10-13T21:43:59.791Z","0.3.2":"2016-08-23T17:13:22.825Z","0.4.0":"2020-10-21T17:41:27.005Z","0.4.1":"2025-06-05T20:08:22.727Z"},"bugs":{"url":"https://github.com/cisco/node-kms/issues"},"author":{"name":"Cisco Systems, Inc.","email":"https://www.cisco.com"},"license":"Apache-2.0","homepage":"https://github.com/cisco/node-kms#readme","keywords":["kms","crypto","jose"],"repository":{"url":"git+ssh://git@github.com/cisco/node-kms.git","type":"git"},"description":"A client implementation of the Key Management Service (KMS) for JavaScript -- for both node.js and browser.","contributors":[{"name":"Matthew A. Miller","email":"linuxwolf@outer-planes.net"},{"name":"Ian W. Remmel","email":"design@ianwremmel.com"}],"maintainers":[{"email":"linuxwolf@outer-planes.net","name":"linuxwolf"},{"email":"michael.wegman@gmail.com","name":"mwegman"},{"email":"chdubois@cisco.com","name":"chrisaduboiscisco"},{"email":"coread@cisco.com","name":"coread"},{"email":"foo@auggie.dev","name":"justaugustus"},{"email":"peter7cole@gmail.com","name":"peter7cole"}],"readme":"# node-kms #\n\nA JavaScript implementation of Key Management Service (KMS) for current web browsers and node.js-based servers.  The KMS API is described in [[draft-abiggs-saag-key-management-service-02](https://tools.ietf.org/html/draft-abiggs-saag-key-management-service-02)].\n\n<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n<a name='toc'>\n\n- [Installing](#installing)\n- [Basics](#basics)\n- [KeyObjects](#keyobjects)\n  - [Creating](#creating)\n  - [Importing/Exporting](#importingexporting)\n  - [Obtaining a `node-jose` Key](#obtaining-a-node-jose-key)\n- [Contexts](#contexts)\n  - [Creating and Initializing](#creating-and-initializing)\n  - [Generating an Ephemeral EC Key](#generating-an-ephemeral-ec-key)\n  - [Deriving an Ephemeral Shared Key](#deriving-an-ephemeral-shared-key)\n- [Requests](#requests)\n  - [Creating](#creating-1)\n  - [Wrapping](#wrapping)\n- [Responses](#responses)\n  - [Creating](#creating-2)\n  - [Unwrapping](#unwrapping)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n## Installing ##\n\nTo install the latest from [NPM](https://npmjs.com/):\n\n```\n  npm install node-kms\n```\n\nOr to install a specific release:\n\n```\n  npm install node-kms@0.3.0\n```\n\nAlternatively, the latest unpublished code can be installed directly from the repository:\n\n```\n  npm install git+ssh://git@github.com:cisco/node-kms.git\n```\n\n## Basics ##\n\nRequire the library as normal:\n\n```\nvar KMS = require('node-kms');\n```\n\nThis library uses [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for many operations.\n\nThis library supports [Browserify](http://browserify.org/).  To use in a web browser, `require('node-kms')` and bundle with the rest of your app.\n\n## KeyObjects ##\n\nA KMS KeyObject wraps a JSON Web Key (JWK) to provide more semantics: a URI to locate it; the creating user and client; the date/time of when a key is created, bound, and/or expires; and the owning resource (once bound).\n\n### Creating ###\n\nTo create an empty KeyObject:\n\n```\nvar keyobj = new KMS.KeyObject();\n```\n\nNone of the KMS.KeyObject properties are set.\n\nAlternatively, to create a KeyObject from a JSON or POJO representation:\n\n```\n// {input} is one of:\n// *  a JSON object (where date/times are RFC3339-encoded Strings)\n// *  a POJO (where date/times are Date objects)\nvar keyobj = new.KeyObject(input);\n```\n\n### Importing/Exporting ###\n\n**NOTE**: The JSON representation includes all properties for a KeyObject, including the full JWK (if present).  This can expose secret key material if not carefully handled; do not save to durable storage without protecting it (e.g., encrypting to a JWE).\n\nTo import a KeyObject from a JSON object:\n\n```\n// {input} is one of:\n// *  a JSON object (where date/times are RFC3339-encoded Strings)\n// *  a POJO (where date/times are Date objects)\n// *  an existing KeyObject instance\nkeyobj = KMS.fromObject(input);\n```\n\nIn the case where `input` is already a KeyObject, it is returned as-is.\n\nTo export a KeyObject to a JSON object:\n\n```\nvar output = keyobj.toJSON();\n```\n\n### Obtaining a `node-jose` Key ###\n\nTo convert the `jwk` property of a KeyObject to a `node-jose` Key (to use for encryption or signatures):\n\n```\nvar jwk;\nkeyobj.asKey().\n    then(function(result) {\n      // {result} is a jose.JWK.Key\n      jwk = result;\n    });\n```\n\nIf `jwk` is not set on the KeyObject, the returned Promise is rejected.\n\n## Contexts ##\n\nThe KMS.Context holds onto information necessary to wrap Requests and unwrap Responses.\n\n### Creating and Initializing ###\n\nTo create an empty Context:\n\n```\nvar kmsCtx = new KMS.Context();\n```\n\nNone of the Context properties are set.\n\nTo finish initializing the Context, set the `clientInfo` and `serverInfo` properties:\n\n```\n// {clientId} is a String containing an identifier for the client or session\n// {userId} is a String containing the user's identifier\n// {oauth2token} is a String containing an OAuth2 Bearer token\nkmsCtx.clientInfo = {\n  clientId: clientId,\n  credential: {\n    userId: userId,\n    bearer: oauth2token\n  }\n};\n// {serverPublicKey} is a JWK JSON object\nkmsCtx.serverInfo = {\n  key: serverPublicKey\n};\n```\n\n### Generating an Ephemeral EC Key ###\n\nTo create a KeyObject representing the local ECDH key:\n\n```\nkmsCtx.createECDHKey().\n    then(function(result) {\n      // {result} is a KMS.KeyObject wrapping a \"EC\" JWK\n      kmsCtx.ephemeralKey = result;\n    })\n```\n\n### Deriving an Ephemeral Shared Key ###\n\nTo derive an ephemeral shared key -- such as the result of the ECDHE handshake:\n\n```\n// {remoteECDH} is a KMS.KeyObject wrapping a \"EC\" JWK\nkmsCrx.deriveEphemeralKey(remoteECDH).\n    then(function(result) {\n      // {result} is a KMS.KeyObject wrapping a \"oct\" JWK\n      kmsCtx.ephemeralKey = result;\n    });\n```\n\n## Requests ##\n\nThe KMS.Request embodies a single request from a client to the KMS.\n\nA Request instance has the following (read/write) properties:\n\n* `body` -- the full (plaintext) JSON to be sent to the KMS\n* `requestId` -- the unique id for this request\n* `uri` -- the URI of the request (e.g., \"/ecdhe/\", \"/resources\", etc.)\n* `method` -- the method (verb) for the request (e.g., \"create\", \"retrieve\", etc.)\n* `wrapped` -- the wrapped (encrypted) `body`\n\nWhen a new `body` is set, the previous `requestId`, `method`, and `uri` are remembered, overwriting any new values that might have been in the provided JSON.\n\n### Creating ###\n\nTo create an empty request:\n\n```\nvar request = new KMS.Request();\n```\n\nTo create a request starting with a constructed body:\n\n```\n// {input} is a JSON object representing the request \nvar request = new KMS.Request(input);\n```\n\n### Wrapping ###\n\nTo wrap (encrypt) the Request into a JWE for transmitting to a KMS server, using an ephemeral shared key:\n\n```\nvar output;\nrequest.wrap(kmsCtx).\n    then(function(result) {\n      // {result} is a String of the JWE in the Compact Serialization\n      // request.wrapped is also set to {result}\n      output = result;\n    });\n```\n\n## Responses ##\n\nThe KMS.Response embodies a single response to a client from the KMS.\n\nA Response instance has the following (read/write) properties:\n\n* `body` -- the full (plaintext) JSON received from the KMS\n* `requestId` -- the id for the corresponding request\n* `status` -- the status code of the response\n* `reason` -- the string reason (if any)\n* `wrapped` -- the protected (encrypted or signed) `body`\n\n### Creating ###\n\nTo create an empty KMS.Response:\n\n```\nvar response = new KMS.Response();\n```\n\nTo creat a KMS.Response with a received wrapped body:\n\n```\n// {input} is a String of the JWE (or JWS) using the Compact Serialization\nvar response = new KMS.Response(input);\n```\n\n### Unwrapping ###\n\nTo unwrap a response into the plaintext body:\n\n```\nvar input;\nresponse.unwrap(kmsCtx).\n    then(function(result) {\n      // {result} is the plaintext JSON object\n      // response.body is also set to {result}\n      input = result;\n    });\n```\n","readmeFilename":"README.md","users":{"shanewholloway":true}}