{"name":"webcrypto-core","version":"1.0.20","description":"Common layer to be used by crypto libraries based on WebCrypto API for input validation.","main":"build/webcrypto-core.js","module":"build/webcrypto-core.es.js","types":"build/types/index.d.ts","scripts":{"prepare":"npm run build","test":"mocha","build":"npm run build:module && npm run build:types","clear":"rimraf build/*","rebuild":"npm run clear && npm run build","build:module":"rollup -c","build:types":"tsc -p tsconfig.types.json","lint":"tslint -p .","lint:fix":"tslint --fix -p .","prepub":"npm run lint && npm run rebuild","pub":"npm version patch && npm publish","postpub":"git push && git push --tags origin master","prepub:next":"npm run lint && npm run rebuild","pub:next":"npm version prerelease --preid=next && npm publish --tag next","postpub:next":"git push","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":{"@peculiar/asn1-schema":"^1.1.2","@peculiar/json-schema":"^1.1.10","asn1js":"^2.0.26","pvtsutils":"^1.0.10","tslib":"^1.11.1"},"devDependencies":{"@types/mocha":"^7.0.2","@types/node":"^10.17.20","coveralls":"^3.0.11","mocha":"^7.1.1","nyc":"^15.0.1","reflect-metadata":"^0.1.13","rimraf":"^3.0.2","rollup":"^2.6.1","rollup-plugin-typescript2":"^0.26.0","ts-node":"^8.8.2","tslint":"^6.1.1","typescript":"^3.8.3"},"author":{"name":"PeculiarVentures"},"license":"MIT","bugs":{"url":"https://github.com/PeculiarVentures/webcrypto-core/issues"},"homepage":"https://github.com/PeculiarVentures/webcrypto-core#readme","nyc":{"extension":[".ts",".tsx"],"include":["src/**/*.ts"],"exclude":["**/*.d.ts"],"reporter":["text-summary","html"]},"mocha":{"require":"ts-node/register","extension":["ts"],"spec":["test/**/*.ts"]},"gitHead":"86e065a7c2f74833b239496f58fbcef71ffc1573","_id":"webcrypto-core@1.0.20","_nodeVersion":"12.13.1","_npmVersion":"6.14.4","dist":{"integrity":"sha512-bVLusJAHfTS47hZrVTUKVuXFDgI5dD9Cwmpv4fNnDc5HzqMLlil0M0ngAeVV/+BHkUvs0IVH7NUpU1RLxOHHjQ==","shasum":"fe09882dec97180dd2dcfc05e35f8b491e2346a7","tarball":"http://registry-npm.ywwl.com/webcrypto-core/download/webcrypto-core-1.0.20.tgz","fileCount":60,"unpackedSize":127365,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJem1mICRA9TVsSAnZWagAAtiIQAKF6dZfRZudS3MuP3kBg\nx+n+eK/rqzFxAHAJXAD5RsptnUDROX6a7g3ZaWDc2t/aE6kTO/Jla8XTggiX\n1l9lBM2Jd2fKUTzNz3RiF+toqTo/VWIs5gxTnMT4RDKgCjlPaOY+57HDkj8N\nQKp/UdAwTJayJ7+zYdjZS+0bS3J7xpqc+5CYw1ovpSpA2U6qoXq1MDroDxNj\necyZccuyi4ZuOMe5J7X/2tO1BgIGq2daFugcC2Rva9R+OWatfogn3wuNyf6D\nLpub59mGvtaG7ToK7Qtj+KC6AyY+xQfrsJcu9ce1BfR3Fc0SIMBoEk/l+SY3\nIbFOu11AZwcbyE62Tmsra8XPscZFBcQ04Z8cRTLBinHU10jeQjkgO3rKDvUf\ns1Jp0+M8RZ0J7sN5xPqjR3H+4EHyPLcI1wcA8m7pEhkzT6I0OX8ebPWRw1Bi\nYBczkRSvVAxZHDWbEpdqReqg6zHow6mbHyVmCg+c9i9O1V5fCXcfeuWHyY19\n0wNYnUKskG5I4c2WksFGW3+DI8nGTF1bZcjiaAZKzQ5IBMiDfLdlpZWOGl0p\noS8EPEOUEiz874F7ysi4GGvRy0h5/rq6C97H+n6wJ+LdTtYRsM3CDG8xRID/\nzTADvxWBghHaAmFZA1OoSLhf3+NNxHh/ydHukSS8DYl0G6qS7Kws5FP/jaQs\nhiIg\r\n=q/yz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDQGvibZIK2Gr7kmeHiG39C6zCRQrPiSkNJ9hNObgIkCAIgBIaNPGkGBb75lAVIWRv+NEDNoUD5pey9VmL6iSslGcQ="}],"size":21220,"noattachment":false,"key":"/webcrypto-core/-/webcrypto-core-1.0.20.tgz"},"maintainers":[{"name":"microshine","email":"microshine@mail.ru"},{"name":"peculiarventures","email":"info@peculiarventures.com"}],"_npmUser":{"name":"microshine","email":"microshine@mail.ru"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webcrypto-core_1.0.20_1587239303636_0.20367608056922415"},"_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":1587239303762,"_cnpm_publish_time":1587239303762,"dist-tags":{"latest":"2.0.0","next":"1.0.19-next.0"}}