{"name":"webcrypto-core","version":"1.7.6","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.1.6","@peculiar/json-schema":"^1.1.12","asn1js":"^3.0.1","pvtsutils":"^1.3.2","tslib":"^2.4.0"},"devDependencies":{"@types/mocha":"^10.0.1","@types/node":"^18.13.0","coveralls":"^3.1.1","mocha":"^10.2.0","nyc":"^15.1.0","rimraf":"^4.1.2","rollup":"^3.15.0","rollup-plugin-dts":"^5.1.1","rollup-plugin-typescript2":"^0.34.1","ts-node":"^10.9.1","tslint":"^6.1.3","typescript":"^4.9.5"},"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":"9915086f879308afad4a7c4b0fd424796d95fa39","_id":"webcrypto-core@1.7.6","_nodeVersion":"16.19.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-TBPiewB4Buw+HI3EQW+Bexm19/W4cP/qZG/02QJCXN+iN+T5sl074vZ3rJcle/ZtDBQSgjkbsQO/1eFcxnSBUA==","shasum":"e32c4a12a13de4251f8f9ef336a6cba7cdec9b55","tarball":"http://registry-npm.ywwl.com/webcrypto-core/download/webcrypto-core-1.7.6.tgz","fileCount":6,"unpackedSize":163060,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGfo3uWAEhKxr+O7Pad+L9QamxIHyeyAUxT5cy4YIeeEAiEAplzR74v6L9jfW66wJaDBMnL91KdTalaShkOjO4M3bwU="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5nF5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo5uw/8Cmo0SKc8WpbpaZvML01P3B0UKFdtr7pmJBn8Fhom5UfpjMNi\r\nH9g91CLyXUAWmKYUJ1Vo2kRXRFlxF/N6yeqN95xCYc/5B8HuR5MaBFhi4moZ\r\nzZgsrIpxEbVsEox/M8XrJxVKHIEAbipuVYfZBtwwMFz76p9p7AI4uUOs+QY6\r\nDkD3BoUcUBr6Bw1Z9EY/hg1Ovc7x+r3sM/hr/JJYoQWPKJhoK1NDTtIbP2VG\r\nvXlPNGgj/vFH2XnUrBrDzxQ7v4xO8reKZn8pCe8LxRRHuPokO5nTiSfM8z4l\r\nJ/shPGI/Nd7Y0VMD5bA53+cLOTuM6QZYaX4AexofG8sm6Sl7DC8vNPA2YL3K\r\nD0ZUK3fKbzbkls1WS+g3FwwiVeqAcvq0s8Tfe0b6OImdZKlVX6Z7ZjUawxbw\r\n7HpyWOBLBWmB3sod1o7UNy0E37FkhRcKPEIraBYJYl7KIRGgBwmGVzecvxcz\r\nDNDBf6jNK3RY505Q0Iw01NDjLrxDa5TVMA9f3SWZbAJMW51PxqdYv/rUMVDH\r\n3lT7NvBv7usHrvpkMKbaVAVdjoHZGaPqPGWKZosqKutCH+no0eGsEngHDANr\r\nyAdbEOnkbzGgHCDh/W9Ux0kgpqii2EBUnDGpNFlJ+hGHE1SyJtaPSCwK2UKu\r\ntBgVrrr7JhKnYxryERzG8sntO+OfEAmC85E=\r\n=KZIb\r\n-----END PGP SIGNATURE-----\r\n","size":26174,"noattachment":false,"key":"/webcrypto-core/-/webcrypto-core-1.7.6.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.6_1676046713524_0.8578312919087547"},"_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":1676046713797,"_cnpm_publish_time":1676046713797,"dist-tags":{"latest":"2.0.0","next":"1.0.19-next.0"}}