{"name":"webcrypto-core","version":"1.0.15","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.mjs","types":"build/types/index.d.ts","scripts":{"prepare":"npm run build","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","test":"mocha","prepub":"npm run rebuild","pub":"npm version patch && npm publish","postpub":"git push && git push --tags origin master","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":{"pvtsutils":"^1.0.6","tslib":"^1.10.0"},"devDependencies":{"@types/mocha":"^5.2.7","@types/node":"^10.17.6","coveralls":"^3.0.9","mocha":"^6.2.2","nyc":"^14.1.1","reflect-metadata":"^0.1.13","rimraf":"^3.0.0","rollup":"^1.27.8","rollup-plugin-typescript2":"^0.25.3","ts-node":"^8.5.4","typescript":"^3.7.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"]},"gitHead":"e75350eca9534a54081dcbf5a9db293464400792","_id":"webcrypto-core@1.0.15","_nodeVersion":"12.13.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-PA4VeKekgPxlmp18Opd4hrdOvtjsJCHyKpNfCyjLWEFIh/7M37QCFgCssx/MVBuNHBkzs9Q7W8Rm4BFgCKheUQ==","shasum":"eeb445f613619acaca85b9b9ae046d1998f066f4","tarball":"http://registry-npm.ywwl.com/webcrypto-core/download/webcrypto-core-1.0.15.tgz","fileCount":45,"unpackedSize":110193,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd6ZlbCRA9TVsSAnZWagAA7KQP/3AHw/OF49BHJAnb3rwG\no8EO8NGhcmQX8DXo47bHM3m3nvEDZIg7Cs7PP1qWpRDJg86TWmTthDsm7qmF\nJzUqbALcWaU96uE+NdfWZnqWB2JN2geZywyHcGMr2gum7D34j2dxVtri4Rdo\nXOctekL+oebjtRsclgyI/s/J2IMlzzIizb0sJIAjq6YAAd1qSOt+JrsAlE55\nUymKJ9+0RmgHIl22VdN/aDPWSF1JX/vKwRbvB2DncubtgP6zfdBoB2hrT7yc\n8ZW/I+wQdqNjng5r3GfF3aLAmYszkAqLenmEqR62lw6crKdyy7I701tqUgB/\nIPGwwFg4MyAG35bvDdPE+CdLpQwZR3eWZ4W3hACyNED03YQ1pZ9jsjfhiQ+k\nD90Ao3P9pCyXUdLWuY0O9+8G7klVwyl7aK3ukATgRaEdeNler8TrU3dnKpk/\nuxoY6tkaiTyFePXli4tXDr0q+K6zLqY9IEijFuulSLhlg3bRqNO1YtwJDA3g\nchXBHH4h1i0ul87H6b5NqtscU2uPAml9mhERyHjGqPApFBVJ8NT70A55yWkP\nHxeh5ENMB8cYLEDrfs2y5QKDahxLydGBvXZURfAzCpbacnIXUk6PVZq5h5Ni\nIDSssTa1ECdYgRS/nqf5576SKbQoiwI6pyVWaK60zwk8c7Gr7ICp8StbsovI\nb5mb\r\n=dBTu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAr8fSWtvtVJT2jqJmm5R0vMvvqDokr8hggpyJX7SffxAiBnHTi7CnOIsmIQFHmS9YjoJ8u2QSFGXP159o7ShIfbmw=="}],"size":17678,"noattachment":false,"key":"/webcrypto-core/-/webcrypto-core-1.0.15.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.15_1575590235209_0.8875198729898106"},"_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":1575590235356,"_cnpm_publish_time":1575590235356,"dist-tags":{"latest":"2.0.0","next":"1.0.19-next.0"}}