{"_id":"@bitbounti-oss/tangly","_rev":"4-7771198f9e5294e86d3aa97f8541dcdf","name":"@bitbounti-oss/tangly","dist-tags":{"latest":"1.0.0-beta"},"versions":{"1.0.0-beta":{"name":"@bitbounti-oss/tangly","version":"1.0.0-beta","description":"A library for storing and querying identity related data on the IOTA Tangle","main":"./lib/tangly.js","scripts":{"demo":"http-server -o","dev":"webpack --progress --colors --watch --env dev","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/BitBounti/tangly.git"},"keywords":["iota","tangle","library","javascript","nodejs","API"],"author":{"name":"Eric Butterfield"},"license":"ISC","bugs":{"url":"https://github.com/BitBounti/tangly/issues"},"homepage":"https://github.com/BitBounti/tangly#readme","peerDependencies":{"iota.lib.js":"^0.4.7","crypto-js":"^3.1.9-1"},"devDependencies":{"babel-cli":"^6.26.0","babel-core":"^6.26.0","babel-eslint":"^8.0.3","babel-loader":"^7.1.2","babel-plugin-add-module-exports":"^0.2.1","babel-preset-env":"^1.6.1","http-server":"^0.11.1","path":"^0.12.7","webpack":"^3.0.0","yargs":"^11.0.0"},"dependencies":{"crypto-js":"^3.1.9-1","iota.lib.js":"^0.4.7"},"gitHead":"55d5bcf5335e67e6f4d114eb933bcf3402ba2651","_id":"@bitbounti-oss/tangly@1.0.0-beta","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"ewbutterfield","email":"ewbutterfield@gmail.com"},"dist":{"integrity":"sha512-lkE3zTdBO+UNcxSWGfhUbXUMBiZ9ie6MhdqvEv87uskMYyoM6s7NIJBiNGL777rJwj2P/Ojx+jIdDN2PAjArKA==","shasum":"b01beda90ee1e17bf8b418ee9846e1e5dd075dd5","tarball":"https://registry.npmjs.org/@bitbounti-oss/tangly/-/tangly-1.0.0-beta.tgz","fileCount":12,"unpackedSize":50324,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEM+lbPmciyPs4Bfu40Q2t2MeaYPR9Yb+w2X+id7exNlAiEA2je8pTVKzquqccv4DReVSTiMc3xU3WbWrku866JbKzk="}]},"maintainers":[{"name":"ewbutterfield","email":"ewbutterfield@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tangly_1.0.0-beta_1522120507218_0.61501615650066"},"_hasShrinkwrap":false}},"time":{"created":"2018-03-27T03:15:07.135Z","1.0.0-beta":"2018-03-27T03:15:07.442Z","modified":"2022-04-04T18:58:04.037Z"},"maintainers":[{"email":"hello@tcasey.me","name":"tcasey"},{"email":"stetsmando@gmail.com","name":"stetsmando"},{"email":"ewbutterfield@gmail.com","name":"ewbutterfield"}],"description":"A library for storing and querying identity related data on the IOTA Tangle","homepage":"https://github.com/BitBounti/tangly#readme","keywords":["iota","tangle","library","javascript","nodejs","API"],"repository":{"type":"git","url":"git+https://github.com/BitBounti/tangly.git"},"author":{"name":"Eric Butterfield"},"bugs":{"url":"https://github.com/BitBounti/tangly/issues"},"license":"ISC","readme":"# Tangly: Identity library for the IOTA Tangle\nTangly (tangle + identity) interfaces with the IOTA Tangle; allowing for storing and retrieving data based on a seed. Instead of a user registering and sending sensitive data to a centralized data store, user data is encrypted based off of the user's seed that only the user knows and stored in the decentralized Tangle. The Tangle has the unique property of having free transactions which allows for data to be stored through Tangly one field at a time. Data is then retrieved and decrypted based off of a user's seed. No sensitive data needs to touch a centralized database, not even a username and password.\n\nIt is sometimes necessary to store meta data like user reputation and stats. Tangly allows you to add an \"anchor\" ID to the Tangle which can be stored in a centralized database. This anchor ID can be retrieved from the tangle to be used to send meta data to a database.\n## Quick Start\n### Installation\n```\nnpm install --save tangly\n```\n### Demo\n```\nnpm run demo\n```\n### Client-side usage\n```html\n<--! example.html -->\n<script src=\"./node_modules/iota.lib.js/dist/iota.js\"></script>\n<script src=\"./node_modules/crypto-js/crypto-js.js\"></script>\n<script src=\"./node_modules/tangly/dist/tangly.js\"></script>\n```\n```javascript\n// example.js\nconst tangly = new window.tangly({\n  seed: 'your_seed',\n  node: 'https://testnet140.tangle.works'  // testnet node. Can use testnet or mainnet\n})\n\ntangly.find({}).then(data => data)\n```\n### Server-side usage\n```javascript\n// server.js\nconst Tangly = require('tangly');\n\nconst tangly = new Tangly({\n  seed: 'your_seed',\n  node: 'https://testnet140.tangle.works'  // testnet node. Can use any testnet or mainnet node\n});\n\ntangly.insert({ firstName: \"Jane\" })\n  .then(data => data)\n```\n## API\n### `tangly.generateSeed()`\nGenerate a random seed.\n#### **Input**\n```javascript\ntangly.generateSeed()\n```\n##### Example\n```javascript\nconst seed = tangly.generateSeed()\n```\n#### **Return Value**\n- `String`: Generated seed\n##### Example\n```javascript\n'VOOGDWRRNECRXZTAASVMYZPONDFBAURNFPLFHKIBKXYCIKPISAIXIGCWVNERD9OUEIBZUZCVCRSFFJHGY'\n```\n-------\n### `tangly.insert()`\nInsert an object into the Tangle by attaching a zero-value transaction.\n#### **Input**\n```javascript\ntangly.insert(data, options)\n```\n- `data` (`Object`) `required`: Data you will be attaching to the tangle.\n- `options` (`Object`) `optional`: Tangle meta data.\n  - `tag` (`String`): Tryte-encoded tag. Maximum value is 27 trytes.\n##### Example\n```javascript\ntangly.insert(\n    {\n      firstName: \"Jane\",\n      lastName: \"Doe\"\n    },\n    {\n      tag: 'SuperDescriptiveTag'\n    }\n  ).then(data => data)\n```\n#### **Return Value**\n- `Object`\n  - `address` (`String`): Address that was used to insert data into the Tangle.\n  - `tag` (`String`): Tag that was assigned.\n##### Example\n```javascript\n{\n  address: 'W9AZFNWZZZNTAQIOOGYZHKYJHSVMALVTWJSSZDDRVEIXXWPNWEALONZLPQPTCDZRZLHNIHSUKZRSZAZ9W',\n  tag: 'SUPER9DESCRIPTIVE9TAG'\n}\n```\n-------\n### `tangly.find()`\nFind data that was inserted by the specified seed.\n#### **Input**\n```javascript\ntangly.find(field, options)\n```\n- `field` (`String`) `required`: The name of the field you are attempting to find. An empty string will return all fields.\n- `options` (`Object`) `optional`: Optional search parameters.\n  - `history` (`Boolean`) `default` `false`: Flag to return a field's history.\n##### Example\n###### Single field query\n```javascript\ntangly.find('firstName', { history: false }).then(data => data)\n```\n###### All fields query\n```javascript\ntangly.find('', { history: true }).then(data => data)\n```\n#### **Return Value**\n- `Object`\n  - `fieldName` (`Object`)\n    - `value` (`Any`)\n    - `timestamp` (`String`)\n##### Example\n###### Without history\n```javascript\n{\n  firstName: {\n    value: \"Jane\",\n    timestamp: '3534534234'\n  }\n  lastName: {\n    value: \"Doe\",\n    timestamp: '3534534234'\n  }\n}\n```\n###### With history\n```javascript\n{\n  firstName: {\n    value: 'Jane',\n    timestamp: '34567893233',\n    history: [\n      {\n        value: 'jaane'\n        timestamp: '3456789876'\n      }\n    ]\n  }\n}\n```\n----\nTODO: tangly.addAnchorId()\n\n----\nTODO: tangly.getAnchorId()","readmeFilename":"README.md"}