{"name":"isomorphic-webcrypto","version":"2.3.1","description":"webcrypto library for Node, React Native and IE11+","main":"./src/main.js","module":"./src/index.mjs","browser":{"./src/main.js":"./src/main.browser.js","./src/index.mjs":"./src/browser.mjs"},"types":"index.d.ts","scripts":{"build":"node build.js","prepublishOnly":"npm run build","test":"npm run build && npm run test:node && npm run test:react-native && npm run test:browser","test:node":"jest ./__tests__/node.js","test:react-native":"jest ./__tests__/react-native.js --config=jest.react-native.json","test:browser":"karma start karma.conf.js --single-run","test:EdgeVM":"npm run test:browser -- --browsers 'EdgeVM'","test:IE11VM":"npm run test:browser -- --browsers 'IE11VM'","release":"npm run test && npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"},"repository":{"type":"git","url":"git+https://github.com/kevlened/isomorphic-webcrypto.git"},"keywords":["isomorphic","webcrypto","small"],"license":"MIT","bugs":{"url":"https://github.com/kevlened/isomorphic-webcrypto/issues"},"homepage":"https://github.com/kevlened/isomorphic-webcrypto#readme","dependencies":{"@peculiar/webcrypto":"^1.0.19","asmcrypto.js":"^0.22.0","b64-lite":"^1.3.1","b64u-lite":"^1.0.1","msrcrypto":"^1.5.6","str2buf":"^1.3.0","webcrypto-shim":"^0.1.4","react-native-securerandom":"^0.1.1","expo-random":"*","@unimodules/core":"*","@unimodules/react-native-adapter":"*"},"devDependencies":{"ajv":"^6.5.2","bluebird":"^3.5.1","jasmine":"^3.4.0","jasmine-core":"^3.4.0","jest":"^24.9.0","karma":"^4.3.0","karma-chrome-launcher":"^3.1.0","karma-edge-launcher":"^0.4.2","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^2.0.1","karma-safari-launcher":"^1.0.0","karma-virtualbox-edge-launcher":"^1.1.8","karma-virtualbox-ie11-launcher":"^1.1.8","karma-webpack":"^3.0.0","react":"^16.9.0","react-native":"^0.60.5","webcrypto-liner":"^1.0.1","webcrypto-test-suite":"^0.4.0","webpack":"^4.16.1"},"optionalDependencies":{"react-native-securerandom":"^0.1.1","expo-random":"*","@unimodules/core":"*","@unimodules/react-native-adapter":"*"},"gitHead":"97b53afda89e579ea55285c8a3d784aa127f7eb9","_id":"isomorphic-webcrypto@2.3.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-12VaAT+TLxA5ILi3mee4QScwFqCBFzjZKIFu9z7gIuAR7TKaxrvAdeWN2qxWM4g/HujIABjadfp0HvfW2BawnQ==","shasum":"419b513aae8099fb9b6ab3b82d37c9c708b3fd6f","tarball":"http://registry-npm.ywwl.com/isomorphic-webcrypto/download/isomorphic-webcrypto-2.3.1.tgz","fileCount":17,"unpackedSize":401713,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJde5U/CRA9TVsSAnZWagAAS94QAIPBgOnD89DYq2BHuxr/\n1HHJyzy5Z8Yjv2iwU6HXaBw+nWNkR0AZ5HiTdIfUgPlrcYXPz4MczHqYciOV\noinvntv7hOfcN1ZELQisIFsr79CBzhRG4DuK/GmAEKTQlDMKhOTC96/hNDoc\nWE5X3i+vrHmTZGAeoLuafKrR7aNYQI+WHWBiWsEkCWFNEtM1gp6cEl7vSe9B\n16ofFKZC4H7LbMHzxVa0qRq4gGkhOTjFvc6uK51FzjhCoa1dIjz42vQpUUDi\niY9Y8C7xijAFLe/CXpCy6hybh0trR6QUTBDh7KdPLQlFY1EANMuXXmVKiVmN\nRjvltjD20ekH7ilPAq9jSnWzbFUcf3fRSeepJlPeFex2NyHwYluKOeU4iwXp\nSVOIDipT6eVKaD0A3IS//o5WnMQCmgiL/eMKaxPjMrJoHvKGIsho7xZ+UDbb\nNEKK4ZgSS7KnxTT1Vb1IksshKzEYkAL4Ovhyz9W2078X0IfVZ51Mf3MSpZBt\nvGRdyAMY8kfiXI+mAUEQUNSw6pQSnvALeZ2xfYQ2/ueQ1ogsiZc8ytYX2TsL\n/WUWptDhIX18ZubKCHGUMy4IWoSQXpx9m8+uuGtRqa3a79y6j+p/qCfovnmK\nJmHjInJvOr+xV+95b7F/JlzAVcWhbV9/v2XtRMgPXvh9NRZpbQ9k61rxGvtp\nuWEG\r\n=6Z0+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE77HUwBADWIwg/cdKWKmbktzg9kQEyCKVj6JJIG5Ov6AiEAowjo0dO3i5Y8WJgpjBwkn+cz+5gV2TACnXVaP1UIMrI="}],"size":56349,"noattachment":false,"key":"/isomorphic-webcrypto/-/isomorphic-webcrypto-2.3.1.tgz"},"maintainers":[{"name":"kevlened","email":"boyettel@gmail.com"}],"_npmUser":{"name":"kevlened","email":"boyettel@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/isomorphic-webcrypto_2.3.1_1568380222520_0.09911118531105001"},"_hasShrinkwrap":false,"readme":"# isomorphic-webcrypto [![NPM](https://img.shields.io/npm/v/isomorphic-webcrypto.svg)](https://npmjs.com/package/isomorphic-webcrypto) [![bundlephobia](https://img.shields.io/bundlephobia/minzip/isomorphic-webcrypto.svg)](https://bundlephobia.com/result?p=isomorphic-webcrypto)\nwebcrypto library for Node, React Native and IE11+\n\n## What?\n\nThere's [a great Node polyfill](https://github.com/PeculiarVentures/webcrypto) for the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API), but it's not isomorphic.\n\nIE11 and versions of Safari < 11 use an older version of the spec, so the browser implementation includes a [webcrypto-shim](https://github.com/vibornoff/webcrypto-shim) to iron out the differences. You'll still need to provide your own Promise polyfill.\n\nThere's currently no native crypto support in React Native, so [the Microsoft Research library](https://github.com/kevlened/msrCrypto) is exposed.\n\n> **Note:** If you're performing cross-platform jwt operations, consider [jwt-lite](https://www.npmjs.com/package/jwt-lite) or [jwt-verifier-lite](https://www.npmjs.com/package/jwt-verifier-lite) (for OpenID Connect), which build on `isomorphic-webcrypto`\n\n## Install\n\n`npm install isomorphic-webcrypto`\n\n## Usage\n\nThere's a simple hashing example below, but [there are many more WebCrypto examples here](https://github.com/diafygi/webcrypto-examples). This example requires you to `npm install hex-lite`.\n\n```javascript\nconst crypto = require('isomorphic-webcrypto')\nconst hex = require('hex-lite')\n// or\nimport crypto from 'isomorphic-webcrypto'\nimport hex from 'hex-lite'\n\ncrypto.subtle.digest(\n  { name: 'SHA-256' },\n  new Uint8Array([1,2,3]).buffer\n)\n.then(hash => {\n  // hashes are usually represented as hex strings\n  // hex-lite makes this easier\n  const hashString = hex.fromBuffer(hash);\n})\n```\n\n### React Native\n\nReact Native support is implemented using [the Microsoft Research library](https://github.com/kevlened/msrCrypto). The React Native environment only supports `Math.random()`, so [react-native-securerandom](https://github.com/rh389/react-native-securerandom) is used to provide proper entropy. This is handled automatically, except for `crypto.getRandomValues()`, which requires you wait:\n\n```javascript\nconst crypto = require('isomorphic-webcrypto')\n\n(async () => {\n  // Only needed for crypto.getRandomValues\n  // but only wait once, future calls are secure\n  await crypto.ensureSecure();\n  const array = new Uint8Array(1);\n  crypto.getRandomValues(array);\n  const safeValue = array[0];\n})()\n```\n\nWorking React Native examples:\n\n* Using [create-react-native-app](https://github.com/kevlened/webcrypto-react-native-examples/tree/master/crna) with Expo\n* Using an ejected [create-react-native-app](https://github.com/kevlened/webcrypto-react-native-examples/blob/master/crna-ejected)\n\n## I just want to drop in a script tag\n\nYou should use [the webcrypto-shim](https://github.com/vibornoff/webcrypto-shim) library directly:\n\n```html\n<!-- Any Promise polyfill will do -->\n<script src=\"https://unpkg.com/bluebird\"></script>\n<script src=\"https://unpkg.com/webcrypto-shim\"></script>\n```\n\n## Compatibility\n\n* IE11+\n* Safari 8+\n* Edge 12+\n* Chrome 43+\n* Opera 24+\n* Firefox 34+\n* Node 8+\n* React Native\n\nAlthough the library runs on IE11+, the level of functionality varies between implementations. The grid below shows the discrepancies between the latest versions of each environment.\n\n> __Legend__\n>\n> * **~** works with some caveats - see the \\_\\_tests__ directory for the caveats\n> * **?** untested\n> * **x** unsupported algorithm\n> * **strikethrough** broken method\n\n| Key                | Node                                                        | React Native                                                | Chrome/Firefox                                          | Safari                                                      | Edge                                                          | IE11                                                            |\n| ------------------ | ----------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------- | --------------------------------------------------------------- |\n| HS256              | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify       | importKey<br>exportKey<br>generateKey<br>sign<br>verify         |\n| HS384              | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify       | importKey<br>exportKey<br>generateKey<br>sign<br>verify         |\n| HS512              | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify       | x                                                               |\n| RS256              | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>~~generateKey~~<br>sign<br>verify | importKey<br>exportKey<br>generateKey<br>sign<br>verify | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | ~importKey<br>exportKey<br>~generateKey<br>~~sign~~<br>verify | ~importKey<br>~exportKey<br>generateKey<br>~~sign~~<br>verify   |\n| RS384              | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>~~generateKey~~<br>sign<br>verify | importKey<br>exportKey<br>generateKey<br>sign<br>verify | importKey<br>~~exportKey~~<br>generateKey<br>sign<br>verify | ~importKey<br>exportKey<br>~generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify         |\n| RS512              | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>~~generateKey~~<br>sign<br>verify | importKey<br>exportKey<br>generateKey<br>sign<br>verify | importKey<br>~~exportKey~~<br>generateKey<br>sign<br>verify | ~importKey<br>exportKey<br>~generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>~~sign~~<br>~~verify~~ |\n| PS256              | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>~~generateKey~~<br>sign<br>verify | importKey<br>exportKey<br>generateKey<br>sign<br>verify | importKey<br>~~exportKey~~<br>generateKey<br>sign<br>verify | ? | ? |\n| PS384              | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>~~generateKey~~<br>sign<br>verify | importKey<br>exportKey<br>generateKey<br>sign<br>verify | importKey<br>~~exportKey~~<br>generateKey<br>sign<br>verify | ? | ? |\n| PS512              | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>~~generateKey~~<br>sign<br>verify | importKey<br>exportKey<br>generateKey<br>sign<br>verify | importKey<br>~~exportKey~~<br>generateKey<br>sign<br>verify | ? | ? |\n| ES256              | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | x                                                             | x                                                               |\n| ES384              | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | x                                                             | x                                                               |\n| ES512              | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify     | importKey<br>exportKey<br>generateKey<br>sign<br>verify | x                                                           | x                                                             | x                                                               |\n| RSA1_5             | ? | ? | ? | ? | ? | ? |\n| RSA-OAEP           | ? | ? | ? | ? | ? | ? |\n| RSA-OAEP-256       | ? | ? | ? | ? | ? | ? |\n| A128KW             | ? | ? | ? | ? | ? | ? |\n| A192KW             | ? | ? | ? | ? | ? | ? |\n| A256KW             | ? | ? | ? | ? | ? | ? |\n| dir                | ? | ? | ? | ? | ? | ? |\n| ECDH-ES            | ? | ? | ? | ? | ? | ? |\n| ECDH-ES+A128KW     | ? | ? | ? | ? | ? | ? |\n| ECDH-ES+A192KW     | ? | ? | ? | ? | ? | ? |\n| ECDH-ES+A256KW     | ? | ? | ? | ? | ? | ? |\n| A128GCMKW          | ? | ? | ? | ? | ? | ? |\n| A192GCMKW          | ? | ? | ? | ? | ? | ? |\n| A256GCMKW          | ? | ? | ? | ? | ? | ? |\n| PBES2-HS256+A128KW | ? | ? | ? | ? | ? | ? |\n| PBES2-HS384+A192KW | ? | ? | ? | ? | ? | ? |\n| PBES2-HS512+A256KW | ? | ? | ? | ? | ? | ? |\n\nHere's a legend for the [JWA alg abbreviations](https://tools.ietf.org/html/rfc7518#section-3.1):\n\n| Key                | Signature, MAC or Key Management Algorithm                                    |\n| ------------------ | ----------------------------------------------------------------------------- |\n| HS256              | HMAC using SHA-256                                                            |\n| HS384              | HMAC using SHA-384                                                            |\n| HS512              | HMAC using SHA-512                                                            |\n| RS256              | RSASSA-PKCS1-v1_5 using SHA-256                                               |\n| RS384              | RSASSA-PKCS1-v1_5 using SHA-384                                               |\n| RS512              | RSASSA-PKCS1-v1_5 using SHA-512                                               |\n| ES256              | ECDSA using P-256 and SHA-256                                                 |\n| ES384              | ECDSA using P-384 and SHA-384                                                 |\n| ES512              | ECDSA using P-521 and SHA-512                                                 |\n| PS256              | RSASSA-PSS using SHA-256 and MGF1 with SHA-256                                |\n| PS384              | RSASSA-PSS using SHA-384 and MGF1 with SHA-384                                |\n| PS512              | RSASSA-PSS using SHA-512 and MGF1 with SHA-512                                |\n| RSA1_5             | RSAES-PKCS1-v1_5                                                              |\n| RSA-OAEP           | RSAES OAEP using default parameters                                           |\n| RSA-OAEP-256       | RSAES OAEP using SHA-256 and MGF1 with SHA-256                                |\n| A128KW             | AES Key Wrap with default initial value using 128-bit key                     |\n| A192KW             | AES Key Wrap with default initial value using 192-bit key                     |\n| A256KW             | AES Key Wrap with default initial value using 256-bit key                     |\n| dir                | Direct use of a shared symmetric key as the CEK                               |\n| ECDH-ES            | Elliptic Curve Diffie-Hellman Ephemeral Static key agreement using Concat KDF |\n| ECDH-ES+A128KW     | ECDH-ES using Concat KDF and CEK wrapped with \"A128KW\"                        |\n| ECDH-ES+A192KW     | ECDH-ES using Concat KDF and CEK wrapped with \"A192KW\"                        |\n| ECDH-ES+A256KW     | ECDH-ES using Concat KDF and CEK wrapped with \"A256KW\"                        |\n| A128GCMKW          | Key wrapping with AES GCM using 128-bit key                                   |\n| A192GCMKW          | Key wrapping with AES GCM using 192-bit key                                   |\n| A256GCMKW          | Key wrapping with AES GCM using 256-bit key                                   |\n| PBES2-HS256+A128KW | PBES2 with HMAC SHA-256 and \"A128KW\" wrapping                                 |\n| PBES2-HS384+A192KW | PBES2 with HMAC SHA-384 and \"A192KW\" wrapping                                 |\n| PBES2-HS512+A256KW | PBES2 with HMAC SHA-512 and \"A256KW\" wrapping                                 |\n\n## License\n\nMIT\n","publish_time":1568380222656,"_cnpm_publish_time":1568380222656,"dist-tags":{"latest":"2.3.8"}}