{"name":"webcrypto-core","version":"1.4.0","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":"^2.0.44","@peculiar/json-schema":"^1.1.12","asn1js":"^2.1.1","pvtsutils":"^1.2.0","tslib":"^2.3.1"},"devDependencies":{"@types/asn1js":"^2.0.2","@types/mocha":"^9.0.0","@types/node":"^16.11.10","coveralls":"^3.1.1","mocha":"^9.1.3","nyc":"^15.1.0","rimraf":"^3.0.2","rollup":"^2.60.1","rollup-plugin-typescript2":"^0.31.1","ts-node":"^10.4.0","tslint":"^6.1.3","typescript":"^4.5.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":["lcov","text-summary","html"]},"mocha":{"require":"ts-node/register","extension":["ts"],"spec":["test/**/*.ts"]},"gitHead":"a66305b68768295b965c9c4e32476e4f4ebdefb5","_id":"webcrypto-core@1.4.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-HY3Zo0GcRIQUUDnlZ/shGjN+4f7LVMkdJZoGPog+oHhJsJdMz6iM8Za5xZ0t6qg7Fx/JXXz+oBv2J2p982hGTQ==","shasum":"9a395920792bcfa4605dc64aaf264156f79e873e","tarball":"http://registry-npm.ywwl.com/webcrypto-core/download/webcrypto-core-1.4.0.tgz","fileCount":70,"unpackedSize":153383,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhngDfCRA9TVsSAnZWagAAwqsP/iauFYpyOTeGMYwV3vYt\nTxRIN/YX9Y6rB7g+d/+6n7TXa9y2+MqY1ki2AJKO1u971SLSPzLJFiXGnHnG\nqtsf2n1HW+uXFghcCBgseVlRJobuCFhB4OS24NFwbjtFjN8x7YewkRQzR02O\nVVMFXh55a3oUGwe0U8puyBvVsT6SZeF8hX5yrost/yMfPHZvFZk3Zg+s0w5j\ncj41bt3zwpvbGb8RDsd2iqIpnlvYzJKHr2R+qJCMmE3e7PToH/Ha8qvAEvF7\nhJlFLJJsdf3Oos8CROFg/S+KBjh+Q3jmnCr/o/EzqSUaTWlgOHoc2HoWRXXk\nF/uMQQXHZYs2YBo2hdVnJ2HvAVMbann65lQ4MSpcnoZrLX2YP4dJM/d9lSL6\nDdvt0AWw8z5FFO/OcQMQbW4V/o1bqkoOMwwFDdujWO+90f8Uv1G/UvigGGNw\n7U5otWv6FI9x49+4DdsrDq/SLiKHr5noQsO2+sDmyFPUr4mGzBT8b8d+V1zL\nD/2VvXemdsjaLa97bXb8kRO/7kgzmmrtQo39MrITFYIwj/TQVDaTvgdW5VFR\nbAeYy6fjMdtfrhyJzUaHya+K2Gq2+bH2GnFjJ8yDiOdcc5f0tL9dlHJZSVUI\n8wBU60WMoDN9deb7yi6DmQSPgODl5dNAS6tsW7E6KccBPoDJKlZ2HpqmUle5\nJ1ay\r\n=a4nh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDU1eN8woOBBPIX4JTHf8YHKfEzTBnwvNj7SxFMyvbR/gIgKa6QfINEbIhbuENjEnCP2zMx/6a9+Ax0AqEILmVYTq0="}],"size":26222,"noattachment":false,"key":"/webcrypto-core/-/webcrypto-core-1.4.0.tgz"},"_npmUser":{"name":"microshine","email":"microshine@mail.ru"},"directories":{},"maintainers":[{"name":"peculiarventures","email":"info@peculiarventures.com"},{"name":"microshine","email":"microshine@mail.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webcrypto-core_1.4.0_1637744863132_0.09276805194286464"},"_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":1637744863323,"_cnpm_publish_time":1637744863323,"dist-tags":{"latest":"2.0.0","next":"1.0.19-next.0"}}