{"_id":"@citahub/cita-signer","_rev":"3-b08c32b766d70debaa2ff0c9b1298d47","name":"@citahub/cita-signer","dist-tags":{"latest":"2.6.2"},"versions":{"2.6.0":{"name":"@citahub/cita-signer","version":"2.6.0","main":"lib/index.js","private":false,"repository":{"type":"git","url":"https://github.com/citahub/cita-sdk-js/tree/master/packages/cita-signer"},"author":{"name":"Keith","email":"keithwhisper@gmail.com"},"license":"MIT","scripts":{"start":"nodemon src/index.js","protoc":"protoc --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts --ts_out=./proto-js --proto_path=cita-proto --js_out=import_style=commonjs,binary:./proto-js cita-proto/blockchain.proto","build":"cross-env ../../node_modules/.bin/tsc","test":"npm run test:v2","test:v0":"cross-env VERSION=0 ../../node_modules/.bin/jest","test:v1":"cross-env VERSION=1 ../../node_modules/.bin/jest","test:v2":"cross-env VERSION=2 ../../node_modules/.bin/jest"},"dependencies":{"elliptic":"^6.4.0","fstream":"1.0.12","google-protobuf":"^3.5.0","sm-series-crypto":"^0.2.1","web3":"1.0.0-beta.37"},"devDependencies":{"ts-protoc-gen":"^0.12.0"},"publishConfig":{"access":"public"},"jest":{"verbose":true,"testURL":"http://localhost/"},"gitHead":"c779ddab45d74bfdd6a82f9af3bbd3b111fb704c","description":"[![Travis](https://travis-ci.org/citahub/cita-sdk-js.svg?branch=develop)](https://travis-ci.org/citahub/cita-sdk-js) ![npm (scoped)](https://img.shields.io/npm/v/@citahub/cita-signer.svg) [![MIT](https://img.shields.io/badge/License-MIT-green.svg)](https:","_id":"@citahub/cita-signer@2.6.0","_nodeVersion":"10.16.3","_npmVersion":"6.13.1","dist":{"integrity":"sha512-M8F707AQez3UMqtWpshPuseslDLqgSUEziUN/LXio0p2YYC/rZGDSO8LjKJXc/rfneVC+55cD6Y1inAo4LAw6w==","shasum":"82de46dd8a6d24bdd450a48e76b388fd29848242","tarball":"https://registry.npmjs.org/@citahub/cita-signer/-/cita-signer-2.6.0.tgz","fileCount":45,"unpackedSize":188147,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd5hFhCRA9TVsSAnZWagAAuWoP/3KHmOVqmyN/vWfGkQEU\nb12dcbxGFAaTbzCUQOMgnnMtAuY8Vv3vMNhNx061EePt2BqiW60j/ChBE/TT\nOjzgiz+wQQgj0EI4VjxtHURqkriSTVAnwqiv6sHRWSJOAtSLPQScMiDU/iFe\nRp1yCqEoY3acCeiv60aLQjM7vV8x48T6KnmKvRW//CqZNDEgtnpjYOyVNRDA\nQsxaMHAc7hPlgl8MhNRzQQTZ1uHpK/O6JSeMg7hyQYJJ83f+A+zTkhehENd+\nmgKifHXiNezeu8Pw18qgobsnbJDEBGv8jMS4oJ9WhCOsMiB5gUmMFa7IdzMz\nmpMmJvZgxkcOFEGS/oj3cqc7gvG8k4hoVCj39ZaokPYIfqALo1umJ3o/TB1F\n2SWX8T46pf312xBge59iYSdmmE9iHo+GJ0atg1d0pWEDjC1/Z3yyTG2MHlPY\nDJ6svbI234p/o9+IiXLYuSLtwnWCOIF51cCppVzXy7+jbxt9I3TdygRlXVyK\nAKS5hnVP+S3Dtfa7KI8z8Ya2qRmHgwFQ/sGFEcMus1rbJIXgKO1X8RRyah6w\na1WHklfUpayiIt6pjaxOfeKNwZ/tHut7wSOD0+pFtnI7sgAgGwTllnka+OLE\nXRWpiad+rXA2MI34LL0uBIlNK94umQbn9XZYUCEYAe2oiaP0GZjaKP3j6OCx\nq3UN\r\n=Nym1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDe8YSsZWQDzDLfy0paWAGrKH67jkocX/GBpF0Ii56xgQIgHOaqQhW0M9XdxDe8VjeEJlermmMw5J7uDu9po35APoI="}]},"maintainers":[{"name":"wee911","email":"qiuzengyuan@rivtower.com"},{"name":"citahub-op","email":"citahub-op@rivtower.com"}],"_npmUser":{"name":"wee911","email":"qiuzengyuan@rivtower.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cita-signer_2.6.0_1575358817271_0.18830491332318933"},"_hasShrinkwrap":false},"2.6.1":{"name":"@citahub/cita-signer","version":"2.6.1","main":"lib/index.js","private":false,"repository":{"type":"git","url":"https://github.com/citahub/cita-sdk-js/tree/master/packages/cita-signer"},"author":{"name":"Keith","email":"keithwhisper@gmail.com"},"license":"MIT","scripts":{"start":"nodemon src/index.js","protoc":"protoc --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts --ts_out=./proto-js --proto_path=cita-proto --js_out=import_style=commonjs,binary:./proto-js cita-proto/blockchain.proto","build":"cross-env ../../node_modules/.bin/tsc","test":"npm run test:v2","test:v0":"cross-env VERSION=0 ../../node_modules/.bin/jest","test:v1":"cross-env VERSION=1 ../../node_modules/.bin/jest","test:v2":"cross-env VERSION=2 ../../node_modules/.bin/jest"},"dependencies":{"elliptic":"^6.5.3","fstream":"1.0.12","google-protobuf":"^3.5.0","sm-series-crypto":"^0.2.1","web3":"^1.3.0"},"devDependencies":{"ts-protoc-gen":"^0.12.0"},"publishConfig":{"access":"public"},"jest":{"verbose":true,"testURL":"http://localhost/"},"gitHead":"c779ddab45d74bfdd6a82f9af3bbd3b111fb704c","description":"[![Travis](https://travis-ci.org/citahub/cita-sdk-js.svg?branch=develop)](https://travis-ci.org/citahub/cita-sdk-js) ![npm (scoped)](https://img.shields.io/npm/v/@citahub/cita-signer.svg) [![MIT](https://img.shields.io/badge/License-MIT-green.svg)](https:","_id":"@citahub/cita-signer@2.6.1","_nodeVersion":"10.21.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-WvRydkwOjo5IUgq9qgZNM3KS/tic/ozC6ha5UeXjmib20GlwUbLryWBi6QqKMuudmR+zrSHRIvj964y23aM7Yg==","shasum":"23875cc4a9b4c450778c6667385ecb41eab401c2","tarball":"https://registry.npmjs.org/@citahub/cita-signer/-/cita-signer-2.6.1.tgz","fileCount":47,"unpackedSize":206961,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfjoCjCRA9TVsSAnZWagAA4ZoP/RZTtFH8+//5sImfc6EX\nKrLhoJMaRM+bd+d4ypSeCSSiHNSxj1xXjwpf4BSSdwyyAdkANGkyH4YiFe20\nHNnr1fcBRvD/K+iQ9O2R7ZT6vg1tcioLpadhKTEtir/2NCRV4HQqKkME0qGy\nmeuOllw5twpUgMXj/h8FYjaeAbdNkF06Yl4PCw0TXHp0g4RVfQ0P5fB65C/q\n96gegeeUcRqfiid7V9rz7eva6c7qrHWUbCQBjUtylIWBpfJPzoYgZLks8lsu\nBYOZlaRQw+M577dvIJ4pxxJqL0LobRysAzKruPvuOKUclBkBx+LcfxaeqYaW\nZSZPschzq/C2u8MgO2iu+aKb9tfN6/bKBS47hSkQJj85ibeOfDGHtSOTUdj5\n1ojVmB1WPZLGm84OZbIX0iN/FhP+9Bqz4rnHuHmpdOsafVhUb3C02tc13tuE\nbyEs3yenqaBgfMWQWNyiB03y+vNPpqHMmUaUThrY5tEIg/mBMoE/+GHAd+sr\nMZQd1pHRMOK+ARVfWLy1JWY7uPOcXEucnB4DsXm9ofVxXUIU1Bl5xnZZq8jn\n3zJVq39qahtT+DS7iVMwCcI2OqqcEDha7y90f0vfCdYYZbVr4yH5PBEhJzno\n8Nz5opvs11NjbmCTGkLa8AyL7nxcH24LhqsYBaFHUIDeSGrvLnoF8Gkpe968\nsEB0\r\n=7Xo5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDhXDplnKCX22XymLeg1ERm6RZ0cMTn8ahcv39nwO36PAIhAIihtwG/g8qu0j+XkvruD54imCN/si46tyR70OTKN2to"}]},"maintainers":[{"name":"wee911","email":"qiuzengyuan@rivtower.com"},{"name":"citahub-op","email":"citahub-op@rivtower.com"}],"_npmUser":{"name":"wee911","email":"qiuzengyuan@rivtower.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cita-signer_2.6.1_1603174562805_0.40550631911048773"},"_hasShrinkwrap":false},"2.6.2":{"name":"@citahub/cita-signer","version":"2.6.2","main":"lib/index.js","private":false,"repository":{"type":"git","url":"https://github.com/citahub/cita-sdk-js/tree/master/packages/cita-signer"},"author":{"name":"Keith","email":"keithwhisper@gmail.com"},"license":"MIT","scripts":{"start":"nodemon src/index.js","protoc":"protoc --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts --ts_out=./proto-js --proto_path=cita-proto --js_out=import_style=commonjs,binary:./proto-js cita-proto/blockchain.proto","build":"npx cross-env ../../node_modules/.bin/tsc","test":"npm run test:v2","test:v0":"npx cross-env VERSION=0 ../../node_modules/.bin/jest","test:v1":"npx cross-env VERSION=1 ../../node_modules/.bin/jest","test:v2":"npx cross-env VERSION=2 ../../node_modules/.bin/jest"},"dependencies":{"elliptic":"^6.5.3","fstream":"1.0.12","google-protobuf":"^3.5.0","sm-series-crypto":"^0.2.1","web3":"^1.3.0"},"devDependencies":{"ts-protoc-gen":"^0.12.0"},"publishConfig":{"access":"public"},"jest":{"verbose":true,"testURL":"http://localhost/"},"gitHead":"c779ddab45d74bfdd6a82f9af3bbd3b111fb704c","description":"[![Travis](https://travis-ci.org/citahub/cita-sdk-js.svg?branch=develop)](https://travis-ci.org/citahub/cita-sdk-js) ![npm (scoped)](https://img.shields.io/npm/v/@citahub/cita-signer.svg) [![MIT](https://img.shields.io/badge/License-MIT-green.svg)](https:","_id":"@citahub/cita-signer@2.6.2","_nodeVersion":"10.24.1","_npmVersion":"6.14.12","dist":{"integrity":"sha512-E/yMTXV3RcqOPYcLz6VGzk3eOF0njO+puZPhlSHvhyNMyOcfaihEqV55eUO8SI8WQpJW/+fDUjhVXUGsEoYiSw==","shasum":"c6cdbd8e814b820fde016a36c40f2a01747eea5c","tarball":"https://registry.npmjs.org/@citahub/cita-signer/-/cita-signer-2.6.2.tgz","fileCount":20,"unpackedSize":170456,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiIetBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrQ4g//eLN405xFsg3u8uQq3sB6eodx91KVhe9+ofJ/ccpJnH5ABvjD\r\nlNBRbufuijPCxPzhAlsYUZc7ELgjQyXkiM9DWdJn+vXpBX46F9EI70jxaKUI\r\ndg7pm0GGl7Th8IcRAbyDyMqtTYS3O7S5ABqlmNvHgHYgZxjyddcMH73Zqorx\r\ntKdPJQAdFYEf/lHpablYDFyE6p5gxHVshWbSLhXjUHL1kouwCcx0UpMJ1Mhg\r\nXuW4pS9K+QU3JXf3xFY80AD+L6I3YZrseBnCCR1nYWgKmQhcXVU9fI/Zd2EA\r\nolJZdWNgIZxxPqd8kT+/hy3Z1WbYkw5bVb1C7JCtQbW0Cvn/lXOeuWj6n9eL\r\ngUOL6caXg9z84ODdU1WtkZ/QSfh1vbfmwTU+oGSpbLtwT4WHvUMqtKw9EObI\r\nqklwTWlYeCF6CXTgmm43A4E+X5R6KGBJkzRwbzCnv9PcyGy6eZDnOEeopUJF\r\nVChhU9Hzg6JdrTsHyl6iz6dA32huNLdqiyZIKcz6T5c6tDTl0aYiiHWyeAqt\r\n63qVqL3nP6xBRZ41Lt15P4NgYGF4h00Qo6Abibb8bhfkF7BI6NFgxVFbIsW9\r\nqnzQFbYBlISSu6kTkCyvZwYWwS4T7B2pIc9d+0EiEA5+p0Qr9zHhT2E6I5hz\r\nHM6vUFlCCb6In6dbypBF45dZeHVLSqJ0dzY=\r\n=1Om3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG7EpoErAKtm4bbbLE3iKJ814Upf0Ju+G75b/h7mQ359AiEAjkP1tezXbb9aiMROfkN1CbzFR/PRyvFnpG6oIen6LP8="}]},"_npmUser":{"name":"wee911","email":"qiuzengyuan@rivtower.com"},"directories":{},"maintainers":[{"name":"citahub-op","email":"citahub-op@rivtower.com"},{"name":"wee911","email":"qiuzengyuan@rivtower.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cita-signer_2.6.2_1646390081576_0.3767008207638254"},"_hasShrinkwrap":false}},"time":{"created":"2019-12-03T07:40:17.035Z","2.6.0":"2019-12-03T07:40:17.603Z","modified":"2022-04-04T23:05:19.514Z","2.6.1":"2020-10-20T06:16:02.942Z","2.6.2":"2022-03-04T10:34:41.704Z"},"maintainers":[{"name":"citahub-op","email":"citahub-op@rivtower.com"},{"name":"wee911","email":"qiuzengyuan@rivtower.com"}],"description":"[![Travis](https://travis-ci.org/citahub/cita-sdk-js.svg?branch=develop)](https://travis-ci.org/citahub/cita-sdk-js) ![npm (scoped)](https://img.shields.io/npm/v/@citahub/cita-signer.svg) [![MIT](https://img.shields.io/badge/License-MIT-green.svg)](https:","repository":{"type":"git","url":"https://github.com/citahub/cita-sdk-js/tree/master/packages/cita-signer"},"author":{"name":"Keith","email":"keithwhisper@gmail.com"},"license":"MIT","readme":"[![Travis](https://travis-ci.org/citahub/cita-sdk-js.svg?branch=develop)](https://travis-ci.org/citahub/cita-sdk-js)\n![npm (scoped)](https://img.shields.io/npm/v/@citahub/cita-signer.svg)\n[![MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://img.shields.io/npm/v/@citahub/cita-signer.svg)\n\n[中文文档](https://github.com/citahub/cita-sdk-js/blob/develop/docs/zh-CN/cita-signer.md)\n\n# cita-signer\n\nThis package is the signing module.\n\n### API\n\n```javascript\n/**\n * @method signer\n * @desc sign a transaction\n * @param {object} transaction object\n * @param {string} [externalPrivateKey] - if external private key exsits, the one in transaction object will be overriden\n * @return {string} signedTransaction\n */\nsigner({\n  privateKey: '0x7cc34429d268cdf33e1595d9aa3c56bfcb785c24b7f6dd031fe059d93d8e92d9',\n  data:\n    '6060604052341561000f57600080fd5b60d38061001d6000396000f3006060604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c14606e575b600080fd5b3415605857600080fd5b606c60048080359060200190919050506094565b005b3415607857600080fd5b607e609e565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a723058202d9a0979adf6bf48461f24200e635bc19cd1786efbcfc0608eb1d76114d405860029',\n  nonce: '47',\n  quota: 2.1e13,\n  validUntilBlock: 114930,\n  version: 2,\n  chainId: 1,\n  value: '0',\n})\n\n/**\n * @method unsigner\n * @desc unsign a signed transaction\n * @param {string} signed transaction\n * @return {object} unsigned transaction\n * {\n *    crypot: 0,\n *    sender: {\n *      address: 'f74b3a9c67d4b657dd335e1d5f57e7ef7d160470',\n *      publicKey: '708e8f442b8b94735d09c7f32eb05c0831f1f888dbbde5f979c0fd0613808facb857207c420b1c75a62612995a78455c2c21756e28a0a1c881d62ea3d6f975f0',\n *    },\n *    signature: '9941c2619195b833b3292a6aeb5aa568ee0a8cd5eef67e1ff77612c87121b65866483ba0c79d88445ad368459c600fbf52b6d0c20aaa507ecdaf233ff4cf2c4701',\n *    transaction: {\n *      chainId: 1,\n *      data: [...],\n *      nonce: '2e96d7a387092faa' ,\n *      quota: 1e8,\n *      to: '',\n *      validUntilBlock: 663228,\n *      value: [...],\n *      version: 2,\n *    }\n * }\n */\nunsigner(transactionContent)\n```\n\n### Basic Usage\n\n```javascript\nimport signer, { unsigner } from '@citahub/cita-signer'\n\nconst transaction = {\n  privateKey: '0x7cc34429d268cdf33e1595d9aa3c56bfcb785c24b7f6dd031fe059d93d8e92d9',\n  nonce: 9999999,\n  quota: 1e10,\n  data:\n    '6060604052341561000f57600080fd5b60d38061001d6000396000f3006060604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c14606e575b600080fd5b3415605857600080fd5b606c60048080359060200190919050506094565b005b3415607857600080fd5b607e609e565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a723058202d9a0979adf6bf48461f24200e635bc19cd1786efbcfc0608eb1d76114d405860029',\n  chainId: 1,\n  version: 2,\n  validUntilBlock: 999999999,\n}\n\nconst signed = sign(transaction)\nconst unsignedTransaction = unsigner(signed)\n```\n\n### In the case of no private key\n\nIf the transaction has no private key and `web3.eth.accounts.wallet` is empty, the returned msg will be plain transaction.\n","readmeFilename":"README.md"}