{"_id":"@algersoft/kriegerrand-utils","_rev":"1-63667c6cfc7b53f5c933315d2d2acd46","name":"@algersoft/kriegerrand-utils","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.4":{"name":"@algersoft/kriegerrand-utils","version":"1.0.4","description":"js utilities for kriegerrand","main":"index.js","directories":{"lib":"lib","test":"tests"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/Algersoft/kriegerrand-utils.git"},"keywords":["kriegerrand"],"author":{"name":"algersoft"},"license":"ISC","bugs":{"url":"https://github.com/Algersoft/kriegerrand-utils/issues"},"homepage":"https://github.com/Algersoft/kriegerrand-utils#readme","gitHead":"2bd03183563b91841f1b1025ebef8f100fb4d824","_id":"@algersoft/kriegerrand-utils@1.0.4","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"algersoft","email":"algersoft@protonmail.com"},"dist":{"integrity":"sha512-7KXuAK5WfyPwlIU1eHtZ6pGR68KbEMpHZ5H+qDPZ6x+RZdE6nA9AryyQLlKiGA7Yb622oOCYvSsF/IWXpxaRzg==","shasum":"31639ef8add5e540b9f224fc276697bda6cfc1b1","tarball":"https://registry.npmjs.org/@algersoft/kriegerrand-utils/-/kriegerrand-utils-1.0.4.tgz","fileCount":16,"unpackedSize":3171020,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcNKWACRA9TVsSAnZWagAATlYP/3+FlKc9yEX6LPZks5vm\noXuy52TMhXP9BDyupyaHGvUH3D4YG6+ZyHxRCy+p6Zqqiv62ikjcOAo4CdEQ\nAHucUuLhQ4+MVxGNcI/hpmcMe8Eq6ysGczA/TcWgMYzAoyp/C1Alf6PN3Sm1\nSffxVrd6XqxyZySGrm9kp7ojI7APl0RPAOZwRl7ZtjDVAp+FsvzhNRmhbjtf\nfcLXDEs6UrMaBEX3cNOFnIWyg87u2ZVMI9ljTrM7MOZXIhdKs4SysPHEha5Q\nhq5qvi3vKq/T4xF1b6U1+OrAx5owUMX7fwqYFMuOLsplf8/jbB6rD5Tv4kCT\n6CbT/c5DkWz3LrOsmHlfLka9pOLuGM9vvp8BBnMJV0mMPry9TO83MD05sHRd\nW8Nr3AYErNsHE/7GN8liKz/d+z6FnB0aqVJgBj6mhWCBocgk/D76tAKFx6zn\nDjV6efhpBgn5ex7aSWc1fTdXrctUmPoJxMKVmOQDor+f02HhlhUNnSsHlKOD\nU7V5U/ifwUj7uWhRB3zQsruwVIpltF2cu8GlRfqK8RQSPonkqzy6NFsqjtuP\nUkdPhb46N9S11tzmj2czf6V2PBp/iMsr+H0rx1yxv2BXFi891+HI947d/Zag\ncC0Oe87HvxW5SULvknGIyfsFT1X/Yj78ZsjVCehywWYzUYPlFjMHXwiDXPyl\ndVpT\r\n=Fav6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDqE12+DR21/sFAt+R4yX9smhxANTtEq5ukzj+xe8fKmQIhAMV3oXZMX4keqcmXexDf4mwxkd2BoN5mdafmYnQhapSp"}]},"maintainers":[{"name":"algersoft","email":"algersoft@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/kriegerrand-utils_1.0.4_1546954111633_0.09004176858414392"},"_hasShrinkwrap":false}},"time":{"created":"2019-01-08T13:28:31.454Z","1.0.4":"2019-01-08T13:28:31.792Z","modified":"2022-04-04T12:51:15.718Z"},"maintainers":[{"name":"algersoft","email":"algersoft@protonmail.com"}],"description":"js utilities for kriegerrand","homepage":"https://github.com/Algersoft/kriegerrand-utils#readme","keywords":["kriegerrand"],"repository":{"type":"git","url":"git+https://github.com/Algersoft/kriegerrand-utils.git"},"author":{"name":"algersoft"},"bugs":{"url":"https://github.com/Algersoft/kriegerrand-utils/issues"},"license":"ISC","readme":"![image](https://raw.githubusercontent.com/Algersoft/Kriegerrand/master/logos/Krieggerrand-logo-git.png)\r\n\r\n# Kriegerrand Javascript Utilities\r\n\r\n## Disclaimer\r\n\r\n***Use of this code in its current state may lead to unexpected results***\r\n\r\nThis repository contains highly experimental code  with the goal of making it possible to interact with a daemon including wallet functionaity (sending/receiving transactions) without the need for `kriegerrand-service` or `wallet-api` using Node.js. By using the code in this repo, you understand that some functions may not work, others may work but be untested, while others may upset you.\r\n\r\nThe best way to address such situations is to submit a Pull Request to resolve the issue you're running into.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm i git+https://github.com/Algersoft/kriegerrand-utils\r\n```\r\n\r\n## Initialization\r\n\r\n### JavaScript\r\n\r\n```javascript\r\nconst KriegerrandUtils = require('kriegerrand-utils')\r\nconst coinUtils = new KriegerrandUtils()\r\n```\r\n\r\n### TypeScript\r\n\r\n```typescript\r\nimport KriegerrandUtils = require('kriegerrand-utils');\r\nconst coinUtils = new KriegerrandUtils()\r\n```\r\n\r\nYou can find type definitions [here](index.d.ts)\r\n\r\n### Forking\r\n\r\nIf initializing for a different CryptoNote project you can specify the configuration.\r\nAll parameters are optional.\r\n\r\n```javascript\r\nconst KriegerrandUtils = require('kriegerrand-utils')\r\nconst coinUtils = new KriegerrandUtils({\r\n  /* The amount of decimals your coin has */\r\n  coinUnitPlaces: 8,\r\n\r\n  /* Your address prefix - this can be found in CryptoNoteConfig */\r\n  addressPrefix: 6581243850,\r\n\r\n  /* The amount of keccak iterations to be performed when creating seeds and\r\n     addresses. Should be a large number if your are supplying poor entropy\r\n     to the createNewSeed / createNewAddress functions. */\r\n  keccakIterations: 100,\r\n\r\n  /* The default network fee to use in atomic units */\r\n  defaultNetworkFee: 10\r\n})\r\n```\r\n\r\n## Public Methods\r\n\r\n#### createNewSeed([entropy], [iterations])\r\n\r\nCreates a new address seed using the provided entropy or if entropy is undefined, uses a randomly selected entropy source.\r\n\r\n#### createNewAddress([entropy], [language], [addressPrefix])\r\n\r\nCreates a new [address](#address) using the provided entropy, language (for the mnemonic), and address prefix if supplied.\r\n\r\n#### createAddressFromSeed(seed, [language], [addressPrefix])\r\n\r\nCreates a new [address](#address) using the provided seed, language (for the mnemonic), and address prefix if supplied.\r\n\r\n#### createAddressFromMnemonic(mnemonic, [language], [addressPrefix])\r\n\r\nCreates a new [address](#address) using the provided mnemonic, language (for the mnemonic), and address prefix if supplied.\r\n\r\n#### createAddressFromKeys(privateSpendKey, privateViewKey, [addressPrefix])\r\n\r\nCreates a new [address](#address) using the provided private spend key, private view key, and address prefix if supplied.\r\n\r\n#### decodeAddressPrefix(address)\r\n\r\nDecodes the [address prefix](#decoded-address-prefix) from the specified CryptoNote public address.\r\n\r\n#### decodeAddress(address, [addressPrefix])\r\n\r\nDecodes the address into the public key pairs, prefix, payment ID, etc. Returns a [decoded address](#decoded-address) object.\r\n\r\n#### encodeRawAddress(rawAddress)\r\n\r\nEncodes the rawAddress using CN-Base58 encoding.\r\n\r\n#### encodeAddress(publicViewKey, publicSpendKey, [paymentId], [addressPrefix])\r\n\r\nEncodes the publicViewKey, publicSpendKey, and payment ID into a standard CryptoNote address (or Integrated address if payment ID is supplied)\r\n\r\n#### createIntegratedAddress(address, paymentId, [addressPrefix])\r\n\r\nCreates an Integrated Address using the supplied address and payment ID.\r\n\r\n#### privateKeyToPublicKey(privateKey)\r\n\r\nGets the corresponding private key from the given public key.\r\n\r\n#### scanTransactionOutputs(transactionPublicKey, outputs, privateViewKey, publicSpendKey, [privateSpendKey])\r\n\r\n*Documentation In Progress*\r\n\r\n#### isOurTransactionOutput(transactionPublicKey, output, privateViewKey, publicSpendKey, [privateSpendKey])\r\n\r\n*Documentation In Progress*\r\n\r\n#### generateKeyImage(transactionPublicKey, privateViewKey, publicSpendKey, privateSpendKey, outputIndex)\r\n\r\n*Documentation In Progress*\r\n\r\n#### createTransaction(ourKeys, transfers, ourOutputs, randomOuts, mixin, feeAmount, [paymentId], [unlockTime])\r\n\r\n*Documentation In Progress*\r\n\r\n#### serializeTransaction(transaction)\r\n\r\n*Documentation In Progress*\r\n\r\n#### generateKeyDerivation(transactionPublicKey, privateViewKey)\r\n\r\nCreates the key 'derivation' given a transaction public key, and the private view key.\r\nCan then be supplied to underivePublicKey, to determine if the transaction output belongs to you.\r\nReturns a string.\r\n\r\n#### underivePublicKey(derivation, outputIndex, outputKey)\r\n\r\nGiven the output index in the transaction, and the outputs key, along with a\r\nderivation from `generateKeyDerivation`, this method will return a public spend key.\r\nIf the public spend key matches your public spend key, the transaction output is yours.\r\nReturns a string.\r\n\r\n## Common Data Structures\r\n\r\n#### Address\r\n\r\n```javascript\r\n{\r\n  spend: {\r\n    privateKey: '517f0d3c5438416adad752557fdf001acfea189d35af8bba326c86928cc6100e',\r\n    publicKey: '0b5a6ed3fde5470fe13a6e817b5b4caf4ce014e65155ae2f6db66a3b9ad6e819'\r\n  },\r\n  view: {\r\n    privateKey: '40cf3cdab84ef0c2c17c100ffb1ba3cb1c86e22f2c4bed766a465d466b210a0f',\r\n    publicKey: '1909af618bef1ecd30339fe12fb133bbaad05cc0ea365caf02254a5f3ae735df'\r\n  },\r\n  address: 'journal oven badge scrub scenic february fancy bagpipe edited repent smidgen lobster bypass vapidly doorway present olive answers enhanced mocked decay smidgen present raking repent',\r\n  seed: '517f0d3c5438416adad752557fdf001acfea189d35af8bba326c86928cc6100e'\r\n}\r\n```\r\n\r\n#### Decoded Address\r\n\r\n```javascript\r\n{ publicViewKey: 'f0ba225065e1b9c2e43165b3e41f10fcb768853126dfa7e612a3df2deb332492',\r\n  publicSpendKey: 'f71e440f9a5aab08dbdab0f4f36bba813660a0600f109b1371dc53be33f23c99',\r\n  paymentId: '',\r\n  encodedPrefix: '9df6ee01',\r\n  prefix: 3914525,\r\n  rawAddress: '9df6ee01f71e440f9a5aab08dbdab0f4f36bba813660a0600f109b1371dc53be33f23c99f0ba225065e1b9c2e43165b3e41f10fcb768853126dfa7e612a3df2deb332492cc073a66' }\r\n```\r\n\r\n#### Decoded Address Prefix\r\n\r\n```javascript\r\n{ prefix: '9df6ee01',\r\n  base58: 'KREGR',\r\n  decimal: 3170026480963,\r\n  hexadecimal: '0x2e2144d6543' }\r\n```\r\n\r\n### Credits\r\n\r\nForked from turtlecoin/turtlecoin-utils\r\n\r\nSpecial thanks goes out to:\r\n\r\n* TurtleCoin: [TRTL](https://github.com/turtlecoin/turtlecoin)\r\n* Lucas Jones\r\n* Paul Shapiro\r\n* Luigi111\r\n* [The MyMonero Project](https://github.com/mymonero/mymonero-app-js)\r\n* The Masari Project: [gnock](https://github.com/gnock)\r\n* The Plentum Project: [DaveLong](https://github.com/DaveLong)\r\n","readmeFilename":"README.md"}