{"name":"webcrypto-core","version":"1.7.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/index.d.ts","scripts":{"test":"mocha","build":"rollup -c","clear":"rimraf build/*","rebuild":"npm run clear && npm run build","lint":"tslint -p .","lint:fix":"tslint --fix -p .","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","shake"],"dependencies":{"@peculiar/asn1-schema":"^2.0.44","@peculiar/json-schema":"^1.1.12","@typescript/lib-dom":"npm:@types/web","asn1js":"^2.2.0","pvtsutils":"^1.2.2","tslib":"^2.3.1"},"devDependencies":{"@peculiar/webcrypto":"^1.3.1","@types/asn1js":"^2.0.2","@types/mocha":"^9.1.0","@types/node":"^17.0.21","coveralls":"^3.1.1","mocha":"^9.2.1","nyc":"^15.1.0","rimraf":"^3.0.2","rollup":"^2.69.0","rollup-plugin-dts":"^4.2.0","rollup-plugin-typescript2":"^0.31.2","ts-node":"^10.6.0","tslint":"^6.1.3","typescript":"^4.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":["lcov","text-summary"]},"mocha":{"require":"ts-node/register","extension":["ts"],"spec":["test/**/*.ts"]},"gitHead":"c1e5a1592e5bbd800fc84afbd8a98abeddd96070","_id":"webcrypto-core@1.7.0","_nodeVersion":"16.14.0","_npmVersion":"8.3.1","dist":{"integrity":"sha512-7d2yeX62KSjpy8wM6/aJsuKDQjYRlTobxFxh/UM9VPS5usePpsjy5j2Y9Mv0k7dSuUxMo0BaIVmnRRcindi2sA==","shasum":"7c1a7e65253d874e081c6d5fbcc48f59bd840137","tarball":"http://registry-npm.ywwl.com/webcrypto-core/download/webcrypto-core-1.7.0.tgz","fileCount":6,"unpackedSize":163157,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiIf/AACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo6wA/+JkRRCN3nsmTEiBztBIQeLPez49wPhMg89JzUBV23YSO2hvYp\r\n2Y1AXbqRA7mqnKGKhuA3RCiXAO2LMwM5eZ79GMRpQ+pKYlu+E42annJZ3A8x\r\nWkFi66UYz7W5PcHOAqkVzzbE+IBTMSJ45pv88kBpYRVDBjygZk5h5/9UIerw\r\n5LOvzCLbap/uZ+kjwJDDnYFoaG4lny+d+PrJONmKUKtqnoHZbHx04rz449Zf\r\nroHL5z6MwhPMG0rqkOAChEWQtXSqymqtDUTE/scge9/3OMceeBezfQTvfsw3\r\n3Qrm5jUbZX0oyQJ3HEFo9LlWIRKrwN7Yo6OnN1FmiTfKLEMTKbsVuBExeUpO\r\nsEQJ24/+bqgs2jhIf0aTv2URELbLVQh0tjHHmAsOnNETHPjl3/SKafzJyat/\r\nTPzhfIoqi7bOCgvg9urj3GjD4WdN1np3s/miOFFO2hHBkl+MOSl85CHwiM6K\r\nRZfc4LVOuZ62TuUKtFlmr/1X2bOx5dIMlzwE8gzjQwET5f3cRbER0Nonp74X\r\nEZy14jY/1K28u2ameW/CYadqGA7I4Z3cwQkfLKmU1uB5AVrBalvKaJw9JMSG\r\nh5JE01TI+q4LmRSJ63wzXooUC/iBE5+yuXA/o8wcfLtgV0khlaqu2xOkC8BZ\r\nFzkZ1hOqMQD5DvA42SRZYYGhNjwQ/rxAZaE=\r\n=UAsM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCNBuM7DcQzww2Jg3ezZQAqOmcQoTRTsYUzIl5jBY6BfQIhAIUugDtbX3srVYJ/oxKdkmvFPB77T49p81yyU92i5MPP"}],"size":26178,"noattachment":false,"key":"/webcrypto-core/-/webcrypto-core-1.7.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.7.0_1646395328470_0.9825741768642597"},"_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":1646395328654,"_cnpm_publish_time":1646395328654,"dist-tags":{"latest":"2.0.0","next":"1.0.19-next.0"}}