{"_id":"@0xbigboss/pocketjs-signer","_rev":"3-3dce0ad3c4e30185cc804d85ef6df019","name":"@0xbigboss/pocketjs-signer","dist-tags":{"latest":"2.1.1"},"versions":{"2.1.0":{"name":"@0xbigboss/pocketjs-signer","version":"2.1.0","keywords":[],"license":"MIT","_id":"@0xbigboss/pocketjs-signer@2.1.0","maintainers":[{"name":"0xbigboss","email":"0xbigboss@proton.me"}],"dist":{"shasum":"14bc6f1c8f274c00c0545806590e0da0a18fb8c1","tarball":"https://registry.npmjs.org/@0xbigboss/pocketjs-signer/-/pocketjs-signer-2.1.0.tgz","fileCount":28,"integrity":"sha512-taNpyoUHfb+xmJ7TatG2Im5LGMbK5uk5vwJfdpbx0y3xIRrZz/am6Z9Dp7xUQPRVOaCUT+eVZceJfx6Gg5tO8g==","signatures":[{"sig":"MEQCIFMzHHgE0ph/eBpY38a94sqdYNGIvmPw/N/OP9vQgzanAiAmt0vBGCEkZk6HHzmoqkizN0k+fpWLeI2XGfveCmRxzw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80876,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjORLsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqZzA//ddgW20BnKQVcSzgZnbWOILctfrHBx0hHVfORzOI53LLlurU6\r\nIMvw3GRDOyyjeLXOXhA2NTnXcU5bU5cnrDL5EMd97/VdB/XJ8KBRAbszAT0I\r\nksJ+ZuovRcqVZqjkUNd5CzGUSSiD1ttkEzAF3JL/yfGlOAkX6H+TRWlbYBLu\r\nrmOLU98NxpsV3iVZmmYw7JCN9IVF3uSayek4qK3zdhmE8L0ddMHLFv3+23rj\r\nhKQyLCi+nDYOwbAyf2eniN5vXkPLpnc/TiOhEW/j6rB5+B0aTdY0JRg3yc39\r\nToBp8eyhSNSkVZyTNytJ5+PqPqnjwveGCxdeGNd+bNuIMA7q883+RdxPdnwG\r\nH4ZqpWiQP75sIRduqa7+UwkuGJR+ZLNMu/mGQKv7vVotzWCKaftfLM6B1cyA\r\nyuxZi6E4jchBlTsC9b5Wh1Pc/Y45eDV3ifSiDgwhAWBZX4WIEU0Vk4FW9clB\r\nZg+iTQThaN1w5uCZDq6bcNfvi4xWDqUDtHN916jXhl4hitfGA/S7hueShqM0\r\n94V5DSaV7x0oQShgnAaLo/3GIC0F7B/4WZmzsh4f1pMsfs1KQoJHRAs9ZV/a\r\nimF3ZeRXUWSPEs0/9MyQnT9Mt1x8xY3tlRzlts7pYRd9zISfQ4dDWFFSlKId\r\nTRgKpsVGvr5ODfq6nK72qYDgW4xSpvRo6zY=\r\n=XUZT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.cjs","type":"module","_from":"file:0xbigboss-pocketjs-signer-2.1.0.tgz","types":"dist/src/index.d.ts","unpkg":"./dist/index.umd.js","module":"./dist/index.js","source":"src/index.ts","authors":["BigBoss <0xbigboss@proton.me>"],"exports":{"default":"./dist/index.js","require":"./dist/index.cjs"},"scripts":{"dev":"microbundle watch","test":"pnpm jest","build":"microbundle"},"_npmUser":{"name":"0xbigboss","email":"0xbigboss@proton.me"},"_resolved":"/private/var/folders/9b/khhz0hwd07z_p9n1wh5mqg_80000gn/T/64f4817ca9e286e512684849b220da00/0xbigboss-pocketjs-signer-2.1.0.tgz","_integrity":"sha512-taNpyoUHfb+xmJ7TatG2Im5LGMbK5uk5vwJfdpbx0y3xIRrZz/am6Z9Dp7xUQPRVOaCUT+eVZceJfx6Gg5tO8g==","_npmVersion":"8.15.0","description":"Signer for Pocket Network V0 accounts","directories":{},"_nodeVersion":"16.17.0","dependencies":{"debug":"^4.3.3","buffer":"^6.0.3","scrypt-js":"^3.0.1","@noble/ed25519":"^1.5.3","isomorphic-crypto":"^3.0.0","libsodium-wrappers":"^0.7.9","@0xbigboss/pocketjs-utils":"2.1.0","@0xbigboss/pocketjs-provider":"2.1.0","@0xbigboss/pocketjs-abstract-provider":"2.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.4.7","eslint":"7.32.0","ts-jest":"^27.1.3","prettier":"^2.5.1","typescript":"^4.5.5","@types/jest":"^27.4.0","microbundle":"^0.14.2","@0xbigboss/pocketjs-types":"2.1.0","@typescript-eslint/parser":"^5.10.2","@typescript-eslint/eslint-plugin":"^5.10.2"},"_npmOperationalInternal":{"tmp":"tmp/pocketjs-signer_2.1.0_1664684780759_0.2624439271464798","host":"s3://npm-registry-packages"}},"2.1.1":{"name":"@0xbigboss/pocketjs-signer","version":"2.1.1","keywords":[],"author":"","license":"MIT","_id":"@0xbigboss/pocketjs-signer@2.1.1","maintainers":[{"name":"0xbigboss","email":"0xbigboss@proton.me"}],"dist":{"shasum":"db51a7881011aaa151bd7d939b7ea988760c6cf5","tarball":"https://registry.npmjs.org/@0xbigboss/pocketjs-signer/-/pocketjs-signer-2.1.1.tgz","fileCount":28,"integrity":"sha512-zuTI2NYO/9s6wtwf3Hig36aNJiuMrfduXh9O6W0D5c4YtB63e7cP5PoWYQXNvaTxgVzlop+5YcP61dDQVnuMSQ==","signatures":[{"sig":"MEYCIQCAn5G149NP31uoBrzo/5BHGmYi3V/ci7+ldC3y5NhdnQIhAMxdIr9rehcnJfPe5Jjsy+ipbn8DdYxIl4GaMAx3FaLa","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":231984,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjXwYBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpyWxAAmwcoqseYpidhnOXYcr3D05sPP1mR+SgJ9MUzhf7vSvGKaG7X\r\nhD8eJwODq52C9Y1h9p5AknWz91Adpx37zHwyqiYtJpeiLoJBzZSlPFQuPrie\r\nbCu0iahn297ZOVEixmIhGhquIE284MaryxiBHlzzHbQjg4kavs0tZ+sN++6W\r\nP1cNqgsRtdPrSpAUjg9HeFspsz/0110VfGKN/lAFfJwvcaSqaFwVaayUL1Ki\r\n4BtyD2fWazQBllG7yRhl9DEk57sLHjQAgC/QhXQMCkn1A9E6FKxnipJ3guBW\r\nawuNnPP3NjKCBeoCQLo8u8SQ38Jzg6y/7wjFkkRJWbCGYVMcT2gIhEGVZOlW\r\nvjRBpZu5koTUHv+mmYm3mIB5CBlyloy4/he8zA9Nffm+6lUF6iYrtCp8PhcD\r\nYhDK/ujuaeXFW9DWBnuE6y+UUf5/i/Fpbq5rrVr9vmu0rWkwmV5voxnltied\r\nRQnVFUMD/iq38Ppq8jPUwBIQwyWZsGCtrQ9PbasNiq6yTJUUIIee4tHxis7i\r\nn4jhL48D3tlydyYqf5p2l6+X2jwX0rif4yQpgUz41i/50w8uB7tXVMwMlRCk\r\nHCCHsKd5Y1prmRNz/+Xb4Y8J9hxJq+h9LZE7evjMSY2OWHE2OgMQ7GOOrxVz\r\njF7Y6eqHMBI45/AaQ3cxTnnq1kDH3BzMNNs=\r\n=TleE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.cjs","type":"module","_from":"file:0xbigboss-pocketjs-signer-2.1.1.tgz","types":"dist/src/index.d.ts","unpkg":"./dist/index.umd.js","module":"./dist/index.js","source":"src/index.ts","exports":{"default":"./dist/index.js","require":"./dist/index.cjs"},"scripts":{"dev":"microbundle watch","test":"pnpm jest","build":"microbundle"},"_npmUser":{"name":"0xbigboss","email":"0xbigboss@proton.me"},"_resolved":"/private/var/folders/9b/khhz0hwd07z_p9n1wh5mqg_80000gn/T/f7886dd49735a944cbf5f2d85e9711ac/0xbigboss-pocketjs-signer-2.1.1.tgz","_integrity":"sha512-zuTI2NYO/9s6wtwf3Hig36aNJiuMrfduXh9O6W0D5c4YtB63e7cP5PoWYQXNvaTxgVzlop+5YcP61dDQVnuMSQ==","_npmVersion":"8.19.2","description":"Signer for Pocket Network V0 accounts","directories":{},"_nodeVersion":"18.12.0","dependencies":{"debug":"^4.3.3","buffer":"^6.0.3","scrypt-js":"^3.0.1","@noble/ed25519":"^1.5.3","isomorphic-crypto":"^3.0.0","libsodium-wrappers":"^0.7.9","@0xbigboss/pocketjs-utils":"2.1.1","@0xbigboss/pocketjs-provider":"2.1.1","@0xbigboss/pocketjs-abstract-provider":"2.1.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.4.7","eslint":"7.32.0","ts-jest":"^27.1.3","prettier":"^2.5.1","typescript":"^4.5.5","@types/jest":"^27.4.0","microbundle":"^0.14.2","@0xbigboss/pocketjs-types":"2.1.1","@typescript-eslint/parser":"^5.10.2","@typescript-eslint/eslint-plugin":"^5.10.2"},"_npmOperationalInternal":{"tmp":"tmp/pocketjs-signer_2.1.1_1667171840882_0.8791956933954197","host":"s3://npm-registry-packages"}}},"time":{"created":"2022-10-02T04:26:20.662Z","modified":"2026-06-24T17:39:15.271Z","2.1.0":"2022-10-02T04:26:20.958Z","2.1.1":"2022-10-30T23:17:21.071Z"},"license":"MIT","keywords":[],"description":"Signer for Pocket Network V0 accounts","maintainers":[{"email":"0xbigboss@proton.me","name":"alleneubank"}],"readme":"# Key Manager\n\nThis package houses both the abstract Key Manager interface we expose to people so that they build their own KeyManager, and an actual KeyManager ready to use for handling account-related operations.\n## Installation\nInstall through your package manager of choice:\n```\npnpm install @pokt-foundation/pocketjs-signer\n```\n\n## Usage\n\n```js \nimport { AbstractSigner, KeyManager } from '@pokt-foundation/pocketjs-signer'\n\n// For the AbstractSigner, just implement it!\nclass MySigner extends AbstractSigner {\n // Now override the required methods...\n}\n\n// For the KeyManager, there's a few ways you can initialize it:\n// 1. Create a random (new) account with the KeyManager\nconst randomAccount = await KeyManager.createRandom()\n\n// 2. Use a private key you own\nconst account = await KeyManager.fromPrivateKey(process.env.PRIVATE_KEY);\n\n// 3. Use a Portable-Private-Key file, stringified.\n// A PPK is generated by exporting an account through the `exportPPK` method.\nconst ppkAccount = await KeyManager.fromPPK({ password: process.env.PASS, ppk: process.env.PPK })\n\n// Now, you can use it!\n// Get your address\nconst address = account.getAddress()\n\n// Get your public key \nconst publicKey = account.getPublicKey()\n\n// Sign a message\nconst signedCoffee = account.sign(\"0xcafe\")\n\n```\n\n## KeyManager API\n\n### Constructor\nInstanciating through the constructor is only possible if all params are known beforehand. If not, use one of the initialization methods provided.\n\n#### address\n- type: 'String'\nThe address of the account to instanciate manually.\n\n#### privateKey\n- type: 'String'\nThe private key of the account to instanciate manually.\n\n#### publicKey\n- type: 'String'\nThe public key of the account to instanciate manually.\n\n### Methods\n#### static createRandom(): Promise<KeyManager>\nCreates a new, random pocket account. Can be called from the base class as it's static.\n\nReturns a `Promise<KeyManager>`: The new key manager instance with the account attached.\n\n#### static fromPrivateKey(privateKey): Promise<KeyManager>\nInstanciates a new KeyManager from a valid ED25519 private key.\n\nReturns a `Promise<KeyManager>`: The new key manager instance with the account attached.\n\n| Param      | Type     | Description                                           |\n|------------|----------|-------------------------------------------------------|\n| privateKey | `string` | The private key to use for instanciating the account. |\n\n#### static fromPPK({ password, ppk }): Promise<KeyManager>\nInstanciates a new KeyManager from a valid Portable-Private-Key file.\n\nReturns a `Promise<KeyManager>`: The new key manager instance with the account attached.\n\n| Param    | Type     | Description                                              |\n|----------|----------|----------------------------------------------------------|\n| password | `string` | The password of the account to instanciate from the PPK. |\n| ppk      | `string` | PPK, stringified. (PPKs are valid JSON files)            |\n\n#### exportPPK({ privateKey, password, hint }): Promise<string>\nExports a provided private key as a Portable-Private-Key, unlockable with the provided password.\n\nReturns a `Promise<string>`: A PPK, in stringified manner.\n\n| Param      | Type     | Description                             |\n|------------|----------|-----------------------------------------|\n| password   | `string` | The password to use in the PPK.         |\n| privateKey | `string` | The private key to create the PPK from. |\n| hint       | `string` | The password hint.                      |\n\n#### exportPPK({ password, hint }): Promise<string>\nExports the current account's private key as a Portable-Private-Key, unlockable with the provided password.\n\nReturns a `Promise<string>`: A PPK, in stringified manner.\n\n| Param      | Type     | Description                             |\n|------------|----------|-----------------------------------------|\n| password   | `string` | The password to use in the PPK.         |\n| hint       | `string` | The password hint.                      |\n\n#### sign(payload): Promise<string>\nSigns a valid hex-string payload with the imported private key.\n\nReturns a `Promise<string>`: The signed payload as a string.\n\n| Param   | Type     | Description              |\n|---------|----------|--------------------------|\n| payload | `string` | The hex payload to sign. |\n\n#### getAddress(): string\nGets the account address.\n\nReturns `string`: The attached account's address.\n\n#### getPublicKey(): string.\nGets teh account public key.\n\nReturns `string`: The attached account's public key.\n\n#### getPrivateKey(): string\nGets the account private key.\n\nReturns `string`: The attached account's private key.\n\n#### getAccount(): Account\nGets the attached account.\n\nReturns `Account`: The attached account in its entirety in an object.\n","readmeFilename":"README.md"}