{"name":"webcrypto-core","version":"1.0.1","description":"Common layer to be used by crypto libraries based on WebCrypto API for input validation.","main":"index.js","types":"types/index.d.ts","scripts":{"prepare":"npm run build","build":"npm run build:defs && npm run build:js","build:defs":"tsc --declaration --outDir types --emitDeclarationOnly","build:js":"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.3","tslib":"^1.9.3"},"devDependencies":{"@types/mocha":"^5.2.5","@types/node":"^10.12.18","coveralls":"^3.0.2","mocha":"^5.2.0","nyc":"^13.1.0","rollup":"^1.1.2","rollup-plugin-typescript":"^1.0.0","ts-node":"^8.0.1","typescript":"^3.2.4"},"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.","nyc":{"extension":[".ts",".tsx"],"include":["src/**/*.ts"],"exclude":["**/*.d.ts"],"reporter":["text-summary","html"]},"gitHead":"ac6a9f46e1a351117d419d06e1e25e08139ddcf1","_id":"webcrypto-core@1.0.1","_nodeVersion":"10.13.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-9+BE7tCP/rtTfPsh5US99gB4Al0pAGxNwReJ95JujApF4qU63Jx8bRsCEpFX7B+2gTxMyrSIWQJctlAETN1JJg==","shasum":"2e7ebd433907024ffc97ab70827922fa4f16375c","tarball":"http://registry-npm.ywwl.com/webcrypto-core/download/webcrypto-core-1.0.1.tgz","fileCount":49,"unpackedSize":80325,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcSvzWCRA9TVsSAnZWagAAW3UP/A3nSUqJf+CGOju8HQA0\n2utAuISJm5kF/wXKFEFWYpc0CoURW+rBOWKb32mvrmffJbqs3bSmn2QhacO3\n8t30yNXmm7rcJZQFtgw1dNq6Uinjk/QAdP+8XABgstXnoEPqaw7/M8hVedGT\ny3bM2Mz2WLP3hYNzZgX1cPQtjx8IqaeI34knHt+jqI4ON3GcTgzmE7npG+oH\nDot77GdzDtniQkHlpl079o7U+brdrk1P+BvqmUbJkW/D5K9JvVXbughD6ZIs\nXoDGqyLib6gZxrrNpUosFzdF5Kt1obHVtXcoT21HhVcucDFw5DslMiLVLOD+\nSroEBCvs24PZTD5Ym/gFU9C7P0owYkSAmbZ8x/Bf2IYIBxxkZ8dmUvXJtXBw\nVRNfqyOtp1uF+wzu/3XenJFPLcHRI2X4c5+wws6x8u6JykH7dXOpgOpVRFOZ\n/IJ/CYYl8WYlaDmSfTcQMjxg95cYkX1x2/pARXywVTisYkusep4QsIryPzdR\nj+be2qOJ++n4IqIO3Gq0M9ybKy6waihtE/OSR8aqNHcS7Ztp0BEqJqc4AdYA\njLQ27G9Cf9406HwZhpq03VkLhgt0lAcTf6zJMD2haM+kxk71VxwiDdHWTmb5\n/ZdHjv1HkH05hKE1rq4t/0YaLuqicMLxM8/ncw/ltpTSDi/OIn21pdFtAIPm\nCnff\r\n=WnQa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDpvUoV+HpGRyKVCHrDDcnBMly1QNUvnC/v/LOA20HPeQIgZpnoZzLhSdHHbMPpfCdWLBcYafV05Gs/KO/H5/Lw66Y="}],"size":13097,"noattachment":false,"key":"/webcrypto-core/-/webcrypto-core-1.0.1.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.1_1548418261437_0.7538661107718356"},"_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":1548418261527,"_cnpm_publish_time":1548418261527,"dist-tags":{"latest":"2.0.0","next":"1.0.19-next.0"}}