{"name":"webcrypto-core","version":"0.1.22","description":"Common layer to be used by crypto libraries based on WebCrypto API for input validation.","main":"dist/webcrypto-core.js","module":"dist/webcrypto-core.es.js","types":"index.d.ts","directories":{"test":"test"},"scripts":{"prepare":"npm run build","build":"npm run build:dist","build:es5":"rollup -c","build:map":"rollup -c -m","build:es2015":"rollup -c rollup.config.es.js","build:dist":"npm run build:es5 && npm run build:es2015","build:source":"tsc --declaration --declarationDir types","test":"mocha test","prepub":"npm run build","pub":"npm version patch && npm publish && git push","precoverage":"npm run build:map","coverage":"nyc npm test","precoveragehtml":"npm run coverage","coveragehtml":"nyc report -r html","predev":"if [ ! -f coverage/index.html ]; then mkdir coverage; cp .waiting.html coverage/index.html; fi","coveralls":"nyc report --reporter=text-lcov | coveralls"},"repository":{"type":"git","url":"git+https://github.com/PeculiarVentures/webcrypto-core.git"},"keywords":["webcrypto","crypto","polyfill","aes","rsa","sha","ec"],"dependencies":{"tslib":"^1.7.1"},"devDependencies":{"@types/node":"^8.10.14","coveralls":"^3.0.1","mocha":"^5.1.1","nyc":"^11.7.3","rollup":"^0.58.2","rollup-plugin-typescript":"^0.8.1","typescript":"^2.8.3"},"author":{"name":"PeculiarVentures"},"license":"MIT","bugs":{"url":"https://github.com/PeculiarVentures/webcrypto-core/issues"},"homepage":"https://github.com/PeculiarVentures/webcrypto-core#readme","banner":"// Copyright (c) 2017, Peculiar Ventures, All rights reserved.","gitHead":"c8348c515301ca37f6698f22b9a066917196f062","_id":"webcrypto-core@0.1.22","_npmVersion":"6.0.1","_nodeVersion":"8.11.1","_npmUser":{"name":"microshine","email":"microshine@mail.ru"},"dist":{"integrity":"sha512-UoNP+/3I74foiQLe1m4ToxoN3oloWnH3Na0TPWNzu/ALhDl1MbhgS0QEezdNNQbkj/6i9cf59k7LeOAAvd0hzg==","shasum":"59d78a8f50776206fcac2db3a7a1f4b928ceda48","tarball":"http://registry-npm.ywwl.com/webcrypto-core/download/webcrypto-core-0.1.22.tgz","fileCount":17,"unpackedSize":324885,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa+WHpCRA9TVsSAnZWagAAMXwQAKGzlyJ+pWm58U7B0xOI\nZgdUpQvJVo4evXu5/07u1g99JtLmKtc4Ap6xmqpFusoDU7qPThYTrAxx2ukh\na8seT5PoWmHeewDCF6DlYwC9Ew8bJ6/gXPplQrRbvbbFThczmuHOQj9/FlWD\nSiYllk102/tj5OLGWJls0NO0rxLBlmaGK8UsqWX0Z0xB9Ym6C6dv+iVVRVPt\n6Myxic/Zyu/oQjsorRy8BWOYhcju/1u1Hw/Tec86R/K4n1HBjMTep2y5nGyj\nG4mJwK9nYB2VBBLFX651vKYWnI1SAtj8fEssM0mAuugmc7G3jePyvw6plW3h\ndRNPdcWh/uRKZS2nPTHJyq1Ce3uL0FE+qSAaX86cgvs5SfO0iTpcsv2A2Rq9\n+9j0OmaJNs+0hs+9LKX1UO2djKYLbdj6/pSOmbJCafGX213vgSCP8JH77tQ5\nICglioZ80lJb3Ld5AawG1A934c6midg32OJvJPjyUGPCwtnvSKfgOnWkQ9rt\nmlWkhyjHeYooadSdYKsg0fYc5+D4HYX3aOzKIR864veMoHwzbMHwZo1D7jX/\nR58/KJwQFW+u5j21hOMzaFZdWJtaw1FiLIIKAssZXIKp8pRzXXQEg/2cfEJ3\na+FrkFZIHSQGlPvl2DxwRlvQdfCCoZe6wt3m2ej75jZ73ONdXlHlNogzfuNJ\naniX\r\n=IQnr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCuvT0OtD1lZMPzwJqDRJIeXX4N/V1nL6RJ3NL14DVPygIhAOfRPPEbdMd5UDCZw4zPenv8F8ksqAXHQ/B2D+R9ugo8"}],"size":36428,"noattachment":false,"key":"/webcrypto-core/-/webcrypto-core-0.1.22.tgz"},"maintainers":[{"name":"microshine","email":"microshine@mail.ru"},{"name":"peculiarventures","email":"info@peculiarventures.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webcrypto-core_0.1.22_1526292968557_0.9332701623237105"},"_hasShrinkwrap":false,"readme":"[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/PeculiarVentures/webcrypto-core/master/LICENSE)\n[![test](https://github.com/PeculiarVentures/webcrypto-core/actions/workflows/test.yml/badge.svg)](https://github.com/PeculiarVentures/webcrypto-core/actions/workflows/test.yml)\n[![Coverage Status](https://coveralls.io/repos/github/PeculiarVentures/webcrypto-core/badge.svg?branch=master)](https://coveralls.io/github/PeculiarVentures/webcrypto-core?branch=master)\n[![npm version](https://badge.fury.io/js/webcrypto-core.svg)](https://badge.fury.io/js/webcrypto-core)\n\n[![NPM](https://nodei.co/npm/webcrypto-core.png)](https://nodei.co/npm/webcrypto-core/)\n\n# webcrypto-core\n\nWe have created a number of WebCrypto polyfills including: [node-webcrypto-ossl](https://github.com/PeculiarVentures/node-webcrypto-ossl), [node-webcrypto-p11](https://github.com/PeculiarVentures/node-webcrypto-p11), and [webcrypto-liner](https://github.com/PeculiarVentures/webcrypto-liner).  `webcrypto-core` was designed to be a common layer to be used by all of these libraries for input validation.\n\nUnless you intend to create a WebCrypto polyfill this library is probably not useful to you.\n\n## Installing\n\n```\nnpm install webcrypto-core\n```\n\n## Example\n\nCurrent examples shows how you can implement your own WebCrypt interface\n\n```js\nconst core = require(\".\");\nconst crypto = require(\"crypto\");\n\nclass Sha1Provider extends core.ProviderCrypto {\n\n  constructor() {\n    super();\n\n    this.name = \"SHA-1\";\n    this.usages = [];\n  }\n\n  async onDigest(algorithm, data) {\n    const hash = crypto.createHash(\"SHA1\").update(Buffer.from(data)).digest();\n    return new Uint8Array(hash).buffer;\n  }\n\n}\n\nclass SubtleCrypto extends core.SubtleCrypto {\n  constructor() {\n    super();\n\n    // Add SHA1 provider to SubtleCrypto\n    this.providers.set(new Sha1Provider());\n  }\n}\n\nclass Crypto extends core.Crypto {\n\n  constructor() {\n    this.subtle = new SubtleCrypto();\n  }\n\n  getRandomValues(array) {\n    const buffer = Buffer.from(array.buffer);\n    crypto.randomFillSync(buffer);\n    return array;\n  }\n\n}\n\nconst webcrypto = new Crypto();\nwebcrypto.subtle.digest(\"SHA-1\", Buffer.from(\"TEST MESSAGE\"))\n  .then((hash) => {\n    console.log(Buffer.from(hash).toString(\"hex\")); // dbca505deb07e1612d944a69c0c851f79f3a4a60\n  })\n  .catch((err) => {\n    console.error(err);\n  });\n```","publish_time":1526292968671,"_cnpm_publish_time":1526292968671,"dist-tags":{"latest":"2.0.0","next":"1.0.19-next.0"}}