{"name":"webcrypto-core","version":"1.0.14","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/webcrypto-core.d.ts","scripts":{"prepare":"npm run build","build":"rollup -c","test":"mocha","prepub":"npm run build","pub":"npm version patch && npm publish && 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":{"pvtsutils":"^1.0.4","tslib":"^1.10.0"},"devDependencies":{"@types/mocha":"^5.2.7","@types/node":"^10.14.17","coveralls":"^3.0.6","mocha":"^6.2.0","nyc":"^14.1.1","reflect-metadata":"^0.1.13","rollup":"^1.20.3","rollup-plugin-dts":"^0.14.0","ts-node":"^8.3.0","typescript":"^3.6.2"},"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":"8f2f506f96fee78e7e1065c90bff7b63d7daef13","_id":"webcrypto-core@1.0.14","_nodeVersion":"10.16.3","_npmVersion":"6.11.3","dist":{"integrity":"sha512-iGZQcH/o3Jv6mpvCbzan6uAcUcLTTnUCil6RVYakcNh5/QXIKRRC06EFxHru9lHgVKucZy3gG4OBiup0IsOr0g==","shasum":"c015088fbc9c235ebd8b35047a131c5ff58f7152","tarball":"http://registry-npm.ywwl.com/webcrypto-core/download/webcrypto-core-1.0.14.tgz","fileCount":5,"unpackedSize":95485,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdb1gzCRA9TVsSAnZWagAAEjQQAIjQLFmRxE1Rc3WJzphW\nrhBP+EfTrjq4OGVZp5L1azo9uyP0wHDi7mufPOmnbd6pXoorrLmb079mG6kz\nGzXEEd4nE4uPdxNIIkmRfO8jHgcKnw81kF7upTNkh45KPqGVk2x9Z8D40VRp\nz4p7LRkh69cpuFst+YlrFmr8/wMKPDFa/IwalxTajwFTCFzXEhmN+CZCUO1a\nVPGk4zYLvnQDAQD+ouqW/+049m9XUQ53Wptu8O0LacB2lfQw/JhkR7A5fbuy\nrhu8V20/k9JxONUFMgck0rogudTuqE5L3d0j0T8Bqwj7EHRLKi9muMLIcF/U\nT6tO7X+rV1oEAXLuHdco4BqD0F8ffpmOV0iKf+L0R0KkG/sN9k+flT+TYd0s\nWDZENGqfQ53Fxg8jgy9k5oY5x4VW0+3XNyTYOE37CvkXxrrmPHF5jFW6cR+8\nuG2LPS0P1BbBFVgfzNvo8lk02SzV1tdJhboC72pZSfIMp5WHkucE7QmEk/zx\nIc2IEcPZnXxKw89bQ23Lx7cjtb+3j0tMOvVXN6YSDyT/lNex2Q8eFcMIf5yG\nKdNvL7Xpe89mDoBbnYXlwKa6cWCMBBP4CYgvzIP7R8bFrPTFkshiECWxUIrJ\nC2DW+dZGC/C+DOGJ8lZP5ORiDgPY4yyM78TPo4sakqDNoQdBuWzckpY6j3zA\nwg20\r\n=GZ1H\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHSN6dTXl4vzRZrAckr9P5IE/L5dRl1RirUweaTPfWKEAiBRZyPN27edQHRZqIR5j2EFs5XgnFZWG1qYiqy85fwF8g=="}],"size":14689,"noattachment":false,"key":"/webcrypto-core/-/webcrypto-core-1.0.14.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.14_1567578163160_0.45754838086026717"},"_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":1567578163291,"_cnpm_publish_time":1567578163291,"dist-tags":{"latest":"2.0.0","next":"1.0.19-next.0"}}