{"bugs":{"url":"https://github.com/pedrouid/eccrypto-js/issues"},"dist":{"shasum":"db35bc4f51c68ee4dd314001109ab6511de85bde","tarball":"https://registry.npmjs.org/eccrypto-js/-/eccrypto-js-5.0.0-beta.5.tgz","fileCount":106,"integrity":"sha512-inPlZ1p7DoDytwF+qHJoEBVNcafdo1Wy9pSLBd1q4IMev0plHOi+qNdAKc82BbHKr28d3c4ezzvqYL9PRMh/Og==","signatures":[{"sig":"MEUCIQCnzJLE9Urno/w2P5TgWeHExo4JDNhx4aodcGUbJbE2HQIgVK30hYxkqdRgWVA52O6N3zly7D88Hl24r8Ss4ykKtlQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":640949,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJemFMWCRA9TVsSAnZWagAACf4P/jX8CyG60w71VzyiBicM\n5jbLd8GdQRbij8UcZQDLuIBpBPCIKfxXZ06rIh9CUORpix10Bqwp2bhpIF0e\nKoIVly6ymWs3NxWW5Jopg9c5ug74x9SWTX63hlC9bJnsqhkfuhxhg3HAA5QC\np0sKcwaq2xE4y1N8VQN4K09w2DaLB0tWDdzillmlIJCbeNekiLBW67HvTguP\nghWq7nhqAR/EjP4SiHq7deX3kjHaTAb/LOrbyeS+C2LY55mXLxauItQDt6GJ\nEeOFHfBbs6CvyoKqBfBfsGc+SEZB2OITG/4pwMeTvGamG1l/gpyUbBLRRExU\nhbTrAfZap5VaWVkoFFl5RmZb/mqTedgUJK9voqhow9IiNQlr/8TjkOW4QMEf\nRegbM4t3i6nFDxa1lIf+uw6YCYsaHpZpuUd5ptRwmEgrqmyK4hMR5/Bi6BEF\n8gxafvw9jq5IYmK8cLQMTh8cbn+2oUSQCDyzfHImYEjeKwyBfo3iOOKtza+W\njtdfdYuv59Nb/RWnMlH3EXjV8Nlk3VBBZrWmtb0+ZjKxhzJbnux50yvJ3zcL\nIb4GHzaFwwAchpZ14kNnO2ZZojLnv0EwnLzw3UYQICAHhZboQxCUnes8MPx0\nyixwUxmM4/xBRt/ap/jJYkniVFuWB23XAWxmLMVLvfs5O8EFqyXVp2qUkU6x\nZiuT\r\n=1M3r\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","name":"eccrypto-js","husky":{"hooks":{"pre-commit":"yarn lint"}},"types":"dist/cjs/index.d.ts","unpkg":"dist/umd/index.min.js","author":{"name":"Pedro Gomes","email":"github.com/pedrouid"},"readme":"# eccrypto-js [![npm version](https://badge.fury.io/js/eccrypto-js.svg)](https://badge.fury.io/js/eccrypto-js)\n\nElliptic curve cryptography library (NodeJS, Browser and Pure JS)\n\n## Description\n\nThis library is a port from [eccrypto](https://github.com/bitchan/eccrypto) it makes use of native libraries on NodeJS and Browser enviroments with pure javascript fallbacks.\n\n## Usage\n\n### RandomBytes\n\n```typescript\nimport * as eccryptoJS from 'eccrypto-js';\n\nconst length = 32;\nconst key = eccryptoJS.randomBytes(length);\n\n// key.length === length\n```\n\n### AES\n\n```typescript\nimport * as eccryptoJS from 'eccrypto-js';\n\nconst key = eccryptoJS.randomBytes(32);\nconst iv = eccryptoJS.randomBytes(16);\n\nconst str = 'test message to encrypt';\nconst msg = eccryptoJS.utf8ToBuffer(str);\n\nconst ciphertext = await eccryptoJS.aesCbcEncrypt(iv, key, msg);\n\nconst decrypted = await eccryptoJS.aesCbcDecrypt(iv, key, ciphertext);\n\n// decrypted.toString() === str\n```\n\n### HMAC\n\n```typescript\nimport * as eccryptoJS from 'eccrypto-js';\n\nconst key = eccryptoJS.randomBytes(32);\nconst iv = eccryptoJS.randomBytes(16);\n\nconst macKey = eccryptoJS.concatBuffers(iv, key);\nconst dataToMac = eccryptoJS.concatBuffers(iv, key, msg);\n\nconst mac = await eccryptoJS.hmacSha256Sign(macKey, dataToMac);\n\nconst result = await eccryptoJS.hmacSha256Verify(macKey, dataToMac, mac);\n\n// result will return true if match\n```\n\n### SHA2\n\n```typescript\nimport * as eccryptoJS from 'eccrypto-js';\n\n// SHA256\nconst str = 'test message to hash';\nconst msg = eccryptoJS.utf8ToBuffer(str);\nconst hash = await eccryptoJS.sha256(str);\n\n// SHA512\nconst str = 'test message to hash';\nconst msg = eccryptoJS.utf8ToBuffer(str);\nconst hash = await eccryptoJS.sha512(str);\n```\n\n### SHA3\n\n```typescript\nimport * as eccryptoJS from 'eccrypto-js';\n\n// SHA3\nconst str = 'test message to hash';\nconst msg = eccryptoJS.utf8ToBuffer(str);\nconst hash = await eccryptoJS.sha3(str);\n\n// KECCAK256\nconst str = 'test message to hash';\nconst msg = eccryptoJS.utf8ToBuffer(str);\nconst hash = await eccryptoJS.keccak256(str);\n```\n\n### ECDSA\n\n```typescript\nimport * as eccryptoJS from 'eccrypto-js';\n\nconst keyPair = eccryptoJS.generateKeyPair();\n\nconst str = 'test message to hash';\nconst msg = eccryptoJS.utf8ToBuffer(str);\nconst hash = await eccryptoJS.sha256(str);\n\nconst sig = await eccryptoJS.sign(keyPair.privateKey, hash);\n\nawait eccryptoJS.verify(keyPair.publicKey, msg, sig);\n\n// verify will throw if signature is BAD\n```\n\n### ECDH\n\n```typescript\nimport * as eccryptoJS from 'eccrypto-js';\n\nconst keyPairA = eccryptoJS.generateKeyPair();\nconst keyPairB = eccryptoJS.generateKeyPair();\n\nconst sharedKey1 = await eccryptoJS.derive(\n  keyPairA.privateKey,\n  keyPairB.publicKey\n);\n\nconst sharedKey2 = await eccryptoJS.derive(\n  keyPairB.privateKey,\n  keyPairA.publicKey\n);\n\n// sharedKey1.toString('hex') === sharedKey2.toString('hex')\n```\n\n### ECIES\n\n```typescript\nimport * as eccryptoJS from 'eccrypto-js';\n\nconst keyPair = eccryptoJS.generateKeyPair();\n\nconst str = 'test message to encrypt';\nconst msg = eccryptoJS.utf8ToBuffer(str);\n\nconst encrypted = await eccryptoJS.encrypt(keyPairB.publicKey, msg);\n\nconst decrypted = await eccryptoJS.decrypt(keyPairB.privateKey, encrypted);\n\n// decrypted.toString() === str\n```\n\n## License\n\n[MIT License](LICENSE.md)\n","license":"MIT","scripts":{"lint":"tsdx lint src test","test":"tsdx test ./test","build":"yarn clean && yarn build:cjs && yarn build:umd","clean":"rm -rf dist","start":"tsdx watch","prepare":"yarn lint && yarn build && yarn test","build:cjs":"./node_modules/.bin/tsc -p tsconfig.cjs.json","build:umd":"webpack"},"_npmUser":{"name":"pedrouid","email":"pedrogomes94@gmail.com"},"homepage":"https://github.com/pedrouid/eccrypto-js","keywords":["ecc","ecdsa","ecdh","ecies","crypto","cryptography","secp256k1","K-256","elliptic","curve"],"prettier":{"semi":true,"printWidth":80,"singleQuote":true,"trailingComma":"es5"},"repository":{"url":"git+https://github.com/pedrouid/eccrypto-js.git","type":"git"},"description":"Elliptic curve cryptography library (NodeJS, Browser and Pure JS)","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2020 Pedro Gomes\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","maintainers":[{"name":"pedrouid","email":"pedrogomes94@gmail.com"}],"dependencies":{"aes-js":"3.1.2","hash.js":"1.1.7","js-sha3":"0.8.0","enc-utils":"1.3.0","secp256k1":"3.8.0","randombytes":"2.1.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tsdx":"0.12.3","husky":"4.2.1","tslib":"1.10.0","webpack":"4.41.6","eccrypto":"1.1.3","typescript":"3.7.5","@types/jest":"25.1.1","@types/node":"13.7.0","webpack-cli":"3.3.11","@types/aes-js":"3.1.0","@types/eccrypto":"1.1.1","@types/elliptic":"6.4.12","@types/randombytes":"2.0.0","@peculiar/webcrypto":"1.0.22"},"_npmOperationalInternal":{"tmp":"tmp/eccrypto-js_5.0.0-beta.5_1587041045871_0.6207362757105059","host":"s3://npm-registry-packages"},"_id":"eccrypto-js@5.0.0-beta.5","version":"5.0.0-beta.5"}