{"bugs":{"url":"https://github.com/pedrouid/eccrypto-js/issues"},"dist":{"shasum":"1b9324c913e490000f3ad4bb050a9a9319449359","tarball":"https://registry.npmjs.org/eccrypto-js/-/eccrypto-js-5.0.0-beta.0.tgz","fileCount":113,"integrity":"sha512-frVaArWRm9bC3gIrgx1Bddo9sPlNIUhzA+pxAUc8+GSCBzlIymwp16/oAAqvUDnr15XiAocSDid8H7rKgigzCg==","signatures":[{"sig":"MEUCIQDlpepbs7gDDsDUN+1xwUm/2QbF11b9ACbHqWF79yVqGAIgcAmDkhi9BiqJQeT5BspvsnVprGqg1su/RG35UdHVxIk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":754441,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUDNZCRA9TVsSAnZWagAAC10QAJ3tbhBlAtgJF85mco5p\nliVPJ9iksr2sATJ/qh5FORNwGz93StuyM3FoPQP84XDQRiKniJKaedlxwd/m\n1oOFRohymsHfGgTqGh414LgjbR/6TGmoPiEzcMvHxvhDZwOqJhRU7z4RswZD\nKelXxhHN6tyZPGsZVpTHTBqUH5ssGTHEuIGhxhnnYRwu221PkayhP7HexrSC\ndLVikQVQW6do0Og+tkDgvcqziLN00QhdWLs04HCVKgSiPW25u3cPJUmqGmZp\nsHSQzpyBdF2IwO9qJTdMPz4GUrihRbcWaAGQcH3gafAs4rmRL+xFs92m+aVd\nCKoSiohoX0pbrCa0H9cu6Kvz9arN4Zl0ntkAtc0rgaCQzQK5Zxj63nHPIFpF\nfaHNsR65XUr8kVNbkPiJj284Z/NKkaL2kvkcNwNIP+jzqRi5jo3iM3bSAC+U\n0kyv+BYgUXYdoMopCCjTCNz0JuGPHKRKs1ke8QZhrn43bvk4fezSyJd1CNWL\nVbH80KsP14HeGoHvodv7brKK+dJPCm9NfjDj6aYJx0/VMaQF2s/seRPpujIm\nhn8LsgFZSEiOrdv0wVVdUtOtoFstt5x6laFux32Hek9LM1uk/U8nY+HycMil\nSfQuz0U4VD0gjwJ7GQMUXaZm+1FCiQFceb71l6mYAu8cnz3uIEVtd3887HuF\nMWei\r\n=lzQT\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","gitHead":"81b0d29c1a0c63e9663a8bd2c1fac4a208919350","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":"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"},"_npmVersion":"6.13.7","description":"Elliptic curve cryptography library (NodeJS, Browser and Pure JS)","directories":{},"maintainers":[{"name":"pedrouid","email":"pedrogomes94@gmail.com"}],"_nodeVersion":"13.7.0","dependencies":{"aes-js":"3.1.2","hash.js":"1.1.7","js-sha3":"0.8.0","bs58check":"2.1.2","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.0_1582314329266_0.9422921280753722","host":"s3://npm-registry-packages"},"_id":"eccrypto-js@5.0.0-beta.0","version":"5.0.0-beta.0"}