{"_id":"@synonymdev/slashtags-docid","_rev":"34-7de05f02e818babb9662cba1d973dc02","name":"@synonymdev/slashtags-docid","dist-tags":{"canary":"0.0.2-alpha.1","latest":"0.1.0"},"versions":{"0.0.1-alpha.0":{"name":"@synonymdev/slashtags-docid","version":"0.0.1-alpha.0","keywords":["slashtags","identifiers","cid","feed"],"author":{"name":"Ar Nazeh","email":"ar.nazeh@gmail.com"},"_id":"@synonymdev/slashtags-docid@0.0.1-alpha.0","maintainers":[{"name":"bitcoinerrorlog","email":"john@synonym.to"},{"name":"jayvdb","email":"jayvdb1@gmail.com"},{"name":"coreyphillips","email":"corey.lyle.phillips@gmail.com"},{"name":"gr0kchain","email":"gr0kchain@protonmail.com"},{"name":"nzh","email":"ar.nazeh@gmail.com"}],"dist":{"shasum":"46786d807af06ce3b86c40fe29b32b6fb6d680df","tarball":"https://registry.npmjs.org/@synonymdev/slashtags-docid/-/slashtags-docid-0.0.1-alpha.0.tgz","fileCount":31,"integrity":"sha512-JdQzO7l3eiq4Bh3vyj/lf6twPdThFpK6S+SWgKl/8vTGfqU8clN0hzWr3quyJrnDFAsomPCgcch2XpW38BIDYg==","signatures":[{"sig":"MEUCIQDwHGN8jaPZ+94U1/qzVzGS4rGBkSocZUl17rP1b/O92QIgSCF9/tohy5KI/JmiUtrtJ7zXDw8Lrgpt32UiuDPctB0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":21501,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhN4xNCRA9TVsSAnZWagAA68YQAJ4iV8d12GrXKLbfBV+i\nqz1F5y4o/xc6vSpNqo1rdk9IAB+Acsase9ZIi+mQil0PaYjC+wnYDre+a3zx\nM4BpH0btLQS4I21cgudS+wBCUn/6bfl7VjP8nSFGq57Dks6fXdGlhTRYM0hs\n/j290Ou+N9qdiz6UojdcsRU3BEjfJGi64S+L9ThxNHyqs679Z8WS22P61G1S\n4a+CAJL6qLOKZR/dNhKDQTY/pthZ7m338MmUZKK7VE4+5dQVkbNkRU+/NOWL\npSTztQ0YyshVkigNLTcFrYhbUcQz9ZihjlyHltyD+HjPiW6iyugXHlMzIPB0\nWTPo2qSBpijKbAmObl7c603Pk+4S9PEm7gni7EWEQLy9kYdEoB+Lmq9qxnFp\nRBWioKT57LwJjz2eqr9N5zC/LEtaGPlOopanU1MK9I482/rTps1GDKkdzjbN\nFd3ZyEwWYJaksK0W17mRyuouhYI1i+7g9oZKCTP9zBveYFCJX1QZbYsAuuSV\nCjU48ScMlcZGTniCPtJdAnv6RnC8JbNCWrp7ulivOWO+2dNkpvhGGzzmx37v\ndvRqLhZ9VxQ2mO53BBJvwGtZvCy5PJ/DyORkWZHi7N9pXEU1hW/UcqLR3GN6\nqBAVPvyIzE9K3kK62S6qv5y1AjRejD0cr/Lg6pFjc3BUV3mWWZobEkUi36K3\njZs0\r\n=vV0p\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./src/index.js","type":"module","types":"./types/index.d.ts","exports":{".":{"import":"./src/index.js"},"./DocID":{"import":"./src/DocID.js"},"./constants":{"import":"./src/constants.js"},"./docTypes/CID":{"import":"./src/docTypes/CID.js"}},"gitHead":"f1154958d866385c25503422d0a9255a28f0bc8e","scripts":{"lint":"standard  --fix ./src","test":"hundreds mocha test --recursive","build":"npm run build:js && npm run build:types","build:js":"ipjs build --tests --main","test:all":"npm run lint && npm run test && npm run test:cjs && npm run test:cjs:browser","test:cjs":"npm run build && mocha dist/cjs/node-test/*.spec.js","build:types":"tsc -p tsconfig.json","prepublishOnly":"npm run test:all && rm -rf dist/**/*test","test:cjs:browser":"cd ../../ && polendina --page --worker --serviceworker --cleanup packages/docid/dist/cjs/browser-test/*.spec.js"},"_npmUser":{"name":"nzh","email":"ar.nazeh@gmail.com"},"standard":{"env":["mocha"],"ignore":["dist/"]},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","_npmVersion":"lerna/4.0.0/node@v14.15.0+x64 (linux)","description":"Slashtags Dcoument IDs","directories":{},"_nodeVersion":"14.15.0","dependencies":{"multiformats":"^9.4.6"},"typesVersions":{"*":{"*":["types/*"],"types/*":["types/*"]}},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/slashtags-docid_0.0.1-alpha.0_1631030349328_0.45627397336757824","host":"s3://npm-registry-packages"}},"0.0.1-alpha.1":{"name":"@synonymdev/slashtags-docid","version":"0.0.1-alpha.1","keywords":["slashtags","identifiers","cid","feed"],"author":{"name":"Ar Nazeh","email":"ar.nazeh@gmail.com"},"_id":"@synonymdev/slashtags-docid@0.0.1-alpha.1","maintainers":[{"name":"bitcoinerrorlog","email":"john@synonym.to"},{"name":"jayvdb","email":"jayvdb1@gmail.com"},{"name":"coreyphillips","email":"corey.lyle.phillips@gmail.com"},{"name":"gr0kchain","email":"gr0kchain@protonmail.com"},{"name":"nzh","email":"ar.nazeh@gmail.com"}],"dist":{"shasum":"ca57f050e97b6ceaa6c4d8bc83c2b93f23f520c0","tarball":"https://registry.npmjs.org/@synonymdev/slashtags-docid/-/slashtags-docid-0.0.1-alpha.1.tgz","fileCount":29,"integrity":"sha512-EzzoaLCqJdxFv4KXh2tMUmSU9d0xFaDktj79+DV4WNJM5gqjDehYuSRrm6xWqNTJ1Jh5OjODza0XsAgFhGDbMA==","signatures":[{"sig":"MEUCIQC9Hy41kozUOP1hYLeJhBSuz3GiNqr3yyJIJqBz7elIYgIgHn3WNXR2PxdhmonBFggEtO0F5IC4w1lpg6SHl1yT4JQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16286,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhN7F5CRA9TVsSAnZWagAACagQAJ3brH7MDrMWtHjj/pL2\nJEvCdRCAlAJz77+8yUbFYOmpls1QBSP8MZxHeJkG1439f2aXEjtGnLICijS7\nOr2avl3g6T/C1eDEEJnyaYKDLmlFOvtEpPbv4bchQALGSpHpChzCRxKU/z/2\n54LHV8Atcp8I6XCDIoQaJHd5UJbEHGPb1FiO/5joqxUNK508KqALMaQXLgp2\nGa8yRZ97k5UgADTYr5c+DF38OIJva/pMWhCGD4KpEwiwV/E8rg0syQ3amkEi\nr8cQ001tu8P4IM7CXcmjAzyo1Kb3aOgow3GIs+eVc+0Bi5G37xKE+26J7ruY\nqmWyacfdue1ylfg1l85OjNj3QNFT22zTqA75p1vTfu2B8T+jLRZipnM45ICv\nN8d6e9l4Pv21BKGndW3Lwtwn4/ygUkJVOLZWS7hGN0lhq9BFIxrxLScp4gId\nGUE6hoi1H7nPsex/21ibLbxh2UVTxST+zHbvJXO4NnOZHzleM8eFgJPtHFgB\nfu4TkDmIzP18PPg69AL22AHK1Rr+bqiPOB0D4MlRJEf4S0KeqgaT1KsLu/Bv\nuA5DyPPPclTFuviFSWWRK5thJ4TMI7eixtIU5BptZZ7bKdglWTMDk6xsd4yC\nidrOaFJdXLvyjPVtj5W79bbWvf2PUK4QUN4Hg+UQAm6C3MhYBH7HBAk4Uo25\nzB3c\r\n=qHcB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./cjs/src/index.js","types":"./types/index.d.ts","browser":{".":"./cjs/src/index.js","./DocID":"./cjs/src/DocID.js","./constants":"./cjs/src/constants.js","./docTypes/CID":"./cjs/src/docTypes/CID.js"},"exports":{".":{"import":"./esm/src/index.js","browser":"./esm/src/index.js","require":"./cjs/src/index.js"},"./DocID":{"import":"./esm/src/DocID.js","browser":"./esm/src/DocID.js","require":"./cjs/src/DocID.js"},"./constants":{"import":"./esm/src/constants.js","browser":"./esm/src/constants.js","require":"./cjs/src/constants.js"},"./docTypes/CID":{"import":"./esm/src/docTypes/CID.js","browser":"./esm/src/docTypes/CID.js","require":"./cjs/src/docTypes/CID.js"}},"gitHead":"fdf818784c26def3e33471d12a015970d1b143c0","scripts":{"lint":"standard  --fix ./src","test":"hundreds mocha test --recursive","build":"npm run build:js && npm run build:types","build:js":"ipjs build --tests --main","test:all":"npm run lint && npm run test && npm run test:cjs && npm run test:cjs:browser","test:cjs":"npm run build && mocha dist/cjs/node-test/*.spec.js","build:types":"tsc -p tsconfig.json","prepublishOnly":"npm run test:all && rm -rf dist/**/*test","test:cjs:browser":"cd ../../ && polendina --page --worker --serviceworker --cleanup packages/docid/dist/cjs/browser-test/*.spec.js"},"_npmUser":{"name":"nzh","email":"ar.nazeh@gmail.com"},"standard":{"env":["mocha"],"ignore":["dist/"]},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","_npmVersion":"lerna/4.0.0/node@v14.15.0+x64 (linux)","description":"Slashtags Dcoument IDs","directories":{},"_nodeVersion":"14.15.0","dependencies":{"multiformats":"^9.4.6"},"typesVersions":{"*":{"*":["types/*"],"types/*":["types/*"]}},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/slashtags-docid_0.0.1-alpha.1_1631039865492_0.23640717249733179","host":"s3://npm-registry-packages"}},"0.0.2-alpha.0":{"name":"@synonymdev/slashtags-docid","version":"0.0.2-alpha.0","keywords":["slashtags","identifiers","cid","feed"],"author":{"name":"Ar Nazeh","email":"ar.nazeh@gmail.com"},"_id":"@synonymdev/slashtags-docid@0.0.2-alpha.0","maintainers":[{"name":"kaloudis","email":"npm@nyxmail.com"},{"name":"shashank.shinde","email":"shashank.shinde@live.com"},{"name":"bitcoinerrorlog","email":"john@synonym.to"},{"name":"jayvdb","email":"jayvdb1@gmail.com"},{"name":"coreyphillips","email":"corey.lyle.phillips@gmail.com"},{"name":"gr0kchain","email":"gr0kchain@protonmail.com"},{"name":"nzh","email":"ar.nazeh@gmail.com"}],"dist":{"shasum":"95a8798d66fa5b41e32be95f364c688465807df8","tarball":"https://registry.npmjs.org/@synonymdev/slashtags-docid/-/slashtags-docid-0.0.2-alpha.0.tgz","fileCount":12,"integrity":"sha512-UCdQZHCrPH+adwy0ve7y5y0GIVOPQ8dc5syJTESl2lYMnEBB3B0HBHhcsYcYgEcLxfqv/WUIZGB034c6PYE4lA==","signatures":[{"sig":"MEYCIQD7bhfjZkSbzb1LEnkkgtMNT+lXYOAaxvH08OEWT0NBJgIhALz1IoYClCdvEwyJ1vIfM7QESAU6ghR1soVwkHj4/1Lc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9580,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhOQpZCRA9TVsSAnZWagAAqk4P/3G06bMrNT3t+y3drjaC\nm8Ic8YqW29qaq6qThxw394EuQSIy2gBPNDqfG0gTC19OfNJ1RubzFuVuYuI1\nQROAFExIyNFyHT8dMASxe5Y2dOBMTigom+PpQhpb0QN+FdzBCl1Z6y6IymhH\n99iVzi12B/0UkA8m4uw2omescgiW4twowX4Rus72gvzDSIkuO8uADPmBdsSW\nn2i75o+t/RfcW+e221UPiX0n3t8Hr+Gw8gdgyjX5RjXSpRCrOqeXijv7/x5x\nXcM4byBi8LhYv1eTDKkplPmant3RyKLhW3PXhhmXi48SoJERv6qr+r3AwM4w\n3OiiLEmauOxMsLIXkHA6KATEk5bBP6DgVPG66QGoyg7Ab6riGAXxmi5Rw5Lu\n/UnvN9DLZsycFE8i1ntKN2PYSSbHSNml5Jfg6hDWbyLv0fsa76Nv9128h1gh\nR3mpp0c9h377aKPPbK6wogB6VfW3CyApZ9Bhz4lO1XJfWVdVRrU/VHou/0X4\nx/cRx25c0XD2a2Dbcrcp3WMLbtsLiLj6O4GNUW8q5EIru1bB+HwKx9OySk5o\neU0RaHmnqU8K41xtshG97Da07XkyJMH8BwVHa97iSh+FO5njoSh4rluoEZ9I\nVopgaAjN7CvkIfcLSlzgSN27/KhMyxg7sK6OTV4ArGxzO0Ly4N7IMudEFfqw\nApzC\r\n=Ysu6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","type":"module","readme":"# Slashtags Document IDs\n\n> Contains Slashtags Document IDs ceration, serializing, and parsing\n\n## Abstract\n\nDocIDs are composed of a `multicodec-slashtags-docid`, and `type-code` varint, followed by identifying bytes.\n\n## Motivation\n\nA specific encoding for Slashtags' DocIDs allows us to distinguish them from other forms of identifiers as well distinguishing the type of data and how to parse the identifying bytes.\n\n## Specification\n\n```js\n<slashtags-docid> ::= <mb><mc-docid><type-code><idx>\n// or, expanded:\n<slashtags-docid> ::= <multibase-prefix><multicodec-slashtags-docid><type-code><index-bytes>\n```\n\nWhere\n\n- `<multibase-prefix>` is a [multibase](https://github.com/multiformats/multibase) code (1 or 2 bytes), to ease encoding CIDs into various bases. **NOTE:** _Binary_ (not text-based) protocols and formats may omit the multibase prefix when the encoding is unambiguous.\n\n- `<multicodec-slashtags-docid>`: `0xd2` indicates that this is a Slashtags identifier and representing.\n- `<type-code>` Distinguish types data (static / stream) and how to parse the indentfiying bytes.\n- `<index-bytes>` are used to index the document and address it according to its corrisponding `type-code`.\n\n### SlashtagsID multicodec\n\n// TODO: add slashtags Document ID `<multicodec-slashtags-docid>` to [multicodec](https://github.com/multiformats/multicodec)\n\n### DocID type\n\nUsed to encode multiple attributes about the ID and the document it represents:\n\n- **Mutability**: Static content or updatable Streams.\n- **Index bytes format**: How to interpret the index bytes.\n- **More**: Any future special kinds of documents with their own rules for verification ..etc\n\n| name   | code | mutability | identifying bytes  |\n| ------ | ---- | ---------- | ------------------ |\n| CID    | 0    | static     | CID                |\n| FeedID | 1    | stream     | Hypercore feed key |\n\n### Static vs Stream documents\n\nStatic documents are immutable and relatively small piece of data, mainly used in Slashtags for [schemas]() and labeling predefined [Actions]().\n\nUnlike streams, static documents are not assumed to be stored as `append only log` nor any other format, so they require less overhaed.\n\n## Types\n\n### CID\n\nA Slashtags DocID of type `CID` has four parts:\n\n```js\n<docid> ::= <mb><mc-docid><type-code=0><cid>\n// or, expanded:\n<docid> ::= <multibase-prefix><multicodec-slashtags-docid><type-code=0><multicodec-cid><multicodec-content-type><multihash-content-address>\n```\n\nWhere\n\n- `<multibase-prefix>`: defaults to `base32`\n- `<type-code>` is `0`\n- `<identifying-bytes>` is a [CID](https://github.com/multiformats/cid)\n\n#### Usage\n\nCreate a CID typed DocID from json\n\n```js\nimport { DocID } from '@slashtags/ids';\nconst docID = DocID.CID.fromJSON({ foo: 'bar' });\n```\n\nOr create it by passing a CID bytes\n\n```js\nimport { DocID } from '@slashtags/ids';\nimport { CID } from 'multiformats/cid';\nimport * as json from 'multiformats/codecs/json';\nimport { sha256 } from 'multiformats/hashes/sha2';\n\nconst bytes = json.encode({ hello: 'world' });\nconst hash = await sha256.digest(bytes);\nconst cid = CID.create(1, json.code, hash);\n\nconst docID = DocID.create(0, cid.bytes);\n```\n\n### FeedID\n\nA Slashtags DocID of type `FeedID` has four parts:\n\n```js\n<docid> ::= <mb><mc-docid><type-code=0><feed-key>\n// or, expanded:\n<docid> ::= <multibase-prefix><multicodec-slashtags-docid><type-code=1><hypercore-feed-key>\n```\n\n#### Usage\n\n```js\nimport hypercore from 'hypercore';\n\nvar feed = new Hypercore('./my-first-dataset');\n\n// You can pass the type name instead of the type code\nconst docID = DocID.create('FeedID', feed.key);\n```\n","gitHead":"6352726fff6fd9a3ff30ec8e9c33067d010baabf","scripts":{"lint":"standard  --fix","test":"hundreds ava ./test/**/*.js","build":"tsc -p tsconfig.json","prepublishOnly":"npm run lint && npm run build && npm run test"},"_npmUser":{"name":"nzh","email":"ar.nazeh@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","_npmVersion":"lerna/4.0.0/node@v14.15.0+x64 (linux)","description":"Slashtags Dcoument IDs","directories":{},"_nodeVersion":"14.15.0","dependencies":{"multiformats":"^9.4.6","@synonymdev/slashtags-common":"^0.0.2-alpha.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/slashtags-docid_0.0.2-alpha.0_1631128153285_0.5992069652579954","host":"s3://npm-registry-packages"}},"0.0.2-alpha.1":{"name":"@synonymdev/slashtags-docid","version":"0.0.2-alpha.1","keywords":["slashtags","identifiers","cid","feed"],"author":{"name":"Nazeh","email":"ar.nazeh@gmail.com"},"_id":"@synonymdev/slashtags-docid@0.0.2-alpha.1","maintainers":[{"name":"shashank.shinde","email":"shashank.shinde@live.com"},{"name":"kaloudis","email":"npm@nyxmail.com"},{"name":"bitcoinerrorlog","email":"john@synonym.to"},{"name":"jayvdb","email":"jayvdb1@gmail.com"},{"name":"coreyphillips","email":"corey.lyle.phillips@gmail.com"},{"name":"gr0kchain","email":"gr0kchain@protonmail.com"},{"name":"nzh","email":"ar.nazeh@gmail.com"}],"homepage":"https://github.com/synonymdev/slashtags/tree/master/packages/docid/#readme","bugs":{"url":"https://github.com/synonymdev/slashtags/issues"},"dist":{"shasum":"81c11a4cb39bd10292e341e67b176cfa7d4e691b","tarball":"https://registry.npmjs.org/@synonymdev/slashtags-docid/-/slashtags-docid-0.0.2-alpha.1.tgz","fileCount":12,"integrity":"sha512-0qNfRX12ykiNOTQO6V2BPphFAL9kX8apHYXliT0v3U63boBNv4OGLlRyAp28/wSJygDNegsIFAlXJgzgeoxoYg==","signatures":[{"sig":"MEQCIGdrOE3KKBEWhBFZXYIg3gcDyomWv1VVJYhO9FBTlp7gAiA2feJmJ1cKK5YKvoHHtUAYRbM4WWifl7yzVJdE0IlKww==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9684,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhObn/CRA9TVsSAnZWagAABKMQAIeMNlCi2l79Iv6k34tX\nwbWWM3o9fz7nNf5Qf9X31O1+N/50sa1ffo2cncSbL4U9eq1zj4673rW0UJoE\nl4bupwWosGKbfCBWsz1jY3kk+D11TAc3Hadi1fcnx/zslJk3A+ZvXy1ig6uB\nKR8v9prc1t+dD4CvUWoPAt3V2lSYd+QxKP+xM6t7XVin+rJHRfndD9RZ/wv5\nyLHQxAYtgC2NmVqpKA0Ai/0oHHKQQSCbfLpZK+cWEE/XmaVZwe1JsL7wCYPx\nb9v78Nah5ohG0ai0bUNPBkGXc1pswep5Jgl1q1BQlsgbnDSCXwUaVIc6/06R\nsnaRKeQ/AqzED6kZaHiFZXKfyGDz/H6jghEsIXpcn/IbxSHb6kqrQth2a7Qf\neawPEuVUKbx0JgGpY1lmTGt5wIU2Swkk48LbBYFrIyTnuf26S+qArmHOSSQZ\nCK8kBvJkE6Isss+MTqX7GMZsN+bfbs7Tb+H+gxKz2XajS8lM730KyNctUBrp\n1Ym7SkdNMobQtwbo3YrIx+1AIILdbB/L+BKHGKPPKj+mckJZsBId/cxOsaFE\nWzv+ja8E6Dx2h3IsMXDLDDjJc4IDmtZ5F0pqEjhIgLgwDr30h6IDbukFh3Uo\nn9J9pUYGQoH0wAEHvgo2iSAhXBIFhjcp9zQxaTdBsSTWB89rHcf3sjjcYo+j\nomBD\r\n=o5Yr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","readme":"# Slashtags Document IDs\n\n> Contains Slashtags Document IDs ceration, serializing, and parsing\n\n## Usage\n\n### FeedID\n\nCreate a FeedID typed DocID from hypercore feed key\n\n```js\nimport * as DocID from '@slashtags/ids';\nimport hypercore from 'hypercore';\n\nvar feed = new Hypercore('./my-first-dataset');\n\n// You can pass the type name instead of the type code\nconst docID = DocID.create('FeedID', feed.key);\n```\n\n### CID\n\nCreate a CID typed DocID from json with sha256\n\n```js\nimport * as DocID from '@slashtags/ids';\nconst docID = DocID.CID.fromJSON({ foo: 'bar' });\n```\n\nOr by passing CID bytes\n\n```js\nimport * as DocID from '@slashtags/ids';\nimport { CID } from 'multiformats/cid';\nimport * as json from 'multiformats/codecs/json';\nimport { sha256 } from 'multiformats/hashes/sha2';\n\nconst bytes = json.encode({ hello: 'world' });\nconst hash = await sha256.digest(bytes);\nconst cid = CID.create(1, json.code, hash);\n\nconst docID = DocID.create(0, cid.bytes);\n```\n\n## Abstract\n\nDocIDs are composed of a `multicodec-slashtags-docid`, and `type-code` varint, followed by identifying bytes.\n\n## Motivation\n\nA specific encoding for Slashtags' DocIDs allows us to distinguish them from other forms of identifiers as well distinguishing the type of data and how to parse the identifying bytes.\n\n## Specification\n\n```js\n<slashtags-docid> ::= <mb><mc-docid><type-code><idx>\n// or, expanded:\n<slashtags-docid> ::= <multibase-prefix><multicodec-slashtags-docid><type-code><index-bytes>\n```\n\nWhere\n\n- `<multibase-prefix>` is a [multibase](https://github.com/multiformats/multibase) code (1 or 2 bytes), to ease encoding CIDs into various bases. **NOTE:** _Binary_ (not text-based) protocols and formats may omit the multibase prefix when the encoding is unambiguous.\n\n- `<multicodec-slashtags-docid>`: `0xd2` indicates that this is a Slashtags identifier and representing.\n- `<type-code>` Distinguish types data (static / stream) and how to parse the indentfiying bytes.\n- `<index-bytes>` are used to index the document and address it according to its corrisponding `type-code`.\n\n### SlashtagsID multicodec\n\n// TODO: add slashtags Document ID `<multicodec-slashtags-docid>` to [multicodec](https://github.com/multiformats/multicodec)\n\n### DocID type\n\nUsed to encode multiple attributes about the ID and the document it represents:\n\n- **Mutability**: Static content or updatable Streams.\n- **Index bytes format**: How to interpret the index bytes.\n- **More**: Any future special kinds of documents with their own rules for verification ..etc\n\n| name   | code | mutability | identifying bytes  |\n| ------ | ---- | ---------- | ------------------ |\n| CID    | 0    | static     | CID                |\n| FeedID | 1    | stream     | Hypercore feed key |\n\n### Static vs Stream documents\n\nStatic documents are immutable and relatively small piece of data, mainly used in Slashtags for [schemas]() and labeling predefined [Actions]().\n\nUnlike streams, static documents are not assumed to be stored as `append only log` nor any other format, so they require less overhaed.\n\n## Types\n\n### CID\n\nA Slashtags DocID of type `CID` has four parts:\n\n```js\n<docid> ::= <mb><mc-docid><type-code=0><cid>\n// or, expanded:\n<docid> ::= <multibase-prefix><multicodec-slashtags-docid><type-code=0><multicodec-cid><multicodec-content-type><multihash-content-address>\n```\n\nWhere\n\n- `<multibase-prefix>`: defaults to `base32`\n- `<type-code>` is `0`\n- `<identifying-bytes>` is a [CID](https://github.com/multiformats/cid)\n\n### FeedID\n\nA Slashtags DocID of type `FeedID` has four parts:\n\n```js\n<docid> ::= <mb><mc-docid><type-code=0><feed-key>\n// or, expanded:\n<docid> ::= <multibase-prefix><multicodec-slashtags-docid><type-code=1><hypercore-feed-key>\n```\n","gitHead":"1d206985c9af2089401bec7dac9e265484dea8f3","scripts":{"lint":"standard  --fix","test":"hundreds ava ./test/**/*.js","build":"rm -rf ./lib && tsc -p tsconfig.json","prepublishOnly":"npm run lint && npm run build && npm run test"},"_npmUser":{"name":"nzh","email":"ar.nazeh@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/synonymdev/slashtags.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v14.15.0+x64 (linux)","description":"Slashtags Dcoument IDs","directories":{},"_nodeVersion":"14.15.0","dependencies":{"multiformats":"^9.4.6","@synonymdev/slashtags-common":"^0.0.2-alpha.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/slashtags-docid_0.0.2-alpha.1_1631173119435_0.4248211170302971","host":"s3://npm-registry-packages"}},"0.0.3-alpha.0":{"name":"@synonymdev/slashtags-docid","version":"0.0.3-alpha.0","keywords":["slashtags","identifiers","cid","feed"],"author":{"name":"Nazeh","email":"ar.nazeh@gmail.com"},"_id":"@synonymdev/slashtags-docid@0.0.3-alpha.0","maintainers":[{"name":"shashank.shinde","email":"shashank.shinde@live.com"},{"name":"kaloudis","email":"npm@nyxmail.com"},{"name":"bitcoinerrorlog","email":"john@synonym.to"},{"name":"jayvdb","email":"jayvdb1@gmail.com"},{"name":"coreyphillips","email":"corey.lyle.phillips@gmail.com"},{"name":"gr0kchain","email":"gr0kchain@protonmail.com"},{"name":"nzh","email":"ar.nazeh@gmail.com"}],"homepage":"https://github.com/synonymdev/slashtags/tree/master/packages/docid/#readme","bugs":{"url":"https://github.com/synonymdev/slashtags/issues"},"dist":{"shasum":"2e997d6e562cf56959ec573179a9ddd02649998b","tarball":"https://registry.npmjs.org/@synonymdev/slashtags-docid/-/slashtags-docid-0.0.3-alpha.0.tgz","fileCount":12,"integrity":"sha512-J8mQGRy+W+Ua538DV4eb3n3+kcn3vdK4Pv1XyYbPp6gP/y7umSELj1hotsDT3+6vH92aM8RT13J3l3r+F/WqcA==","signatures":[{"sig":"MEUCIBoPBDL/AcWQgsEFNDNBsANLieAFUX1HyY5KgB86Fb1xAiEAqvlU53RegRdzWWHckAKiexrsBWs6kc6ZPwWmwBetI/Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9676,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhOcDaCRA9TVsSAnZWagAAINsP/0SRbRML2KYFCNJ6tgWd\n2LmXmCc5jCCngso7ksvhxgowTp9cnUKK4zi1oU5PvsG4iERFGI42LPOqdb6z\n0Qg2YTpUQRBYkPb4JfsRbyyjYshsF9QiNQC0MI5ePABMoMsnZ8f8VB8igNe/\nCTk6iqbixIczPtR+NvhoWCp2/GpD9BFT/GlqD65UDLQogLMtPCdM0tSdlRYA\nzyN+yz30k7eefX8hyTSWz9RcxHA3sos/39LIrzY7aY8ViysuT3MNN2W1BKDB\nCJFC4wUTGvTaYHeizOqqI5xy6SpNUVAMWE2nk3jf//u/xji5zB05qsYObApS\ntB/T9AZA5lmqnUz1dYof07kfMHHljHdkGML7I65GxyMNJtz04k/LxQIPfeN4\nB9Z8s/nQOEKJGOhQoK58stheG/YBpgXBG0HyY02hC+WexSRag1oW/6QrpmNC\ntcMyKq0I+s1QAi0YmhcW4NwzLM3a0XlcrgAg94peCaBXeZf4O9mlOpM/gBgv\n3gu0pAjyT+iw7m65oWXmUA+xVuILs/SE9MkLZcgAz4OOrhXVgoVvT/9KfVJa\nG53DymiBCCI4GipkQ6+4D3QKjEc1qAPmORNYDUgx/R3RRE2uwTB0HIQ30Gwf\nuWa/EyyjZ1zHH/UHy5z/p4nMeISrTJBMJmQIrjZ0poMDcJiW8+OA8Ne8yRXy\na6I3\r\n=t08K\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","gitHead":"6b2912067dcd4934cd5f8b4f540276f3dd787d98","scripts":{"lint":"standard  --fix","test":"hundreds ava ./test/**/*.js","build":"rm -rf ./lib && tsc -p tsconfig.json","prepublishOnly":"npm run lint && npm run build && npm run test"},"_npmUser":{"name":"nzh","email":"ar.nazeh@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/synonymdev/slashtags.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v14.15.0+x64 (linux)","description":"Slashtags Dcoument IDs","directories":{},"_nodeVersion":"14.15.0","dependencies":{"multiformats":"^9.4.6","@synonymdev/slashtags-common":"^0.0.1-alpha.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/slashtags-docid_0.0.3-alpha.0_1631174874843_0.71400123278318","host":"s3://npm-registry-packages"}},"0.0.3-alpha.1":{"name":"@synonymdev/slashtags-docid","version":"0.0.3-alpha.1","keywords":["slashtags","identifiers","cid","feed"],"author":{"name":"Nazeh","email":"ar.nazeh@gmail.com"},"_id":"@synonymdev/slashtags-docid@0.0.3-alpha.1","maintainers":[{"name":"shashank.shinde","email":"shashank.shinde@live.com"},{"name":"kaloudis","email":"npm@nyxmail.com"},{"name":"bitcoinerrorlog","email":"john@synonym.to"},{"name":"jayvdb","email":"jayvdb1@gmail.com"},{"name":"coreyphillips","email":"corey.lyle.phillips@gmail.com"},{"name":"gr0kchain","email":"gr0kchain@protonmail.com"},{"name":"nzh","email":"ar.nazeh@gmail.com"}],"homepage":"https://github.com/synonymdev/slashtags/tree/master/packages/docid/#readme","bugs":{"url":"https://github.com/synonymdev/slashtags/issues"},"dist":{"shasum":"d1301ae5722c0a593319c0217ba70b66b1508317","tarball":"https://registry.npmjs.org/@synonymdev/slashtags-docid/-/slashtags-docid-0.0.3-alpha.1.tgz","fileCount":14,"integrity":"sha512-5keFp/vZ13dx8M+EJwySRslbsw0LQnD46frcJS7T3+zDfhnwrJ/kNU2mQmQN3M9pPCyzO3Q+bckQBYDY4kJV8w==","signatures":[{"sig":"MEYCIQD7pvNIsgypbYy/HqkPLK+COuTdocy7+VZqDaMV6J4W/wIhAKwTYDm/QuArnx/aPnUqU8ukd8GwqLeEFxJVo7BSvcjQ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9949,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhPHfTCRA9TVsSAnZWagAAsjUP/R9v0hyA7jKmItALPRJU\nuJft2SX+P089/bhhdsfrQBePd+nWT0XTf5G10o1c5WDh1fSMuH+1Tlg9QkAE\ngQVK0LIFrrbTgewSBe9u4B/qImRllzRp67UPdptdmAb0RNTCbLVeMVyE7wGa\nDDXDkWNA5ZEGbRYw+1b/S8CVQ02LU+I6lBjvC16xbL92xa3fh3I9shLMKCZX\neIKAc36aALrM/5DdK6Y2nfVQloFgktho/0so5srMXjhlzbm8Ca+CaQhrUzA0\nqTbwWGH8zy1373rMC1e908QTICMbUCvLjH0ICLUBBTrOrOSMfiNusFpZlKjo\nMPqFGZ+9iQRbMC0WNL0+DkCkC/UGvFujevAGeoVXumiVN3QHfhl/oLqd+201\n5dp9O1WziCF39anWTepEi3REm4fo0GdzyEOsfGQvbvGzO2h4V0jOezAs1A3x\nxuqHhmv0DMDUFuWEnReMrISJIbw2sXAfHDR8cF2Stos76/LuxWbV7o1vSh9R\nJc2IUdZmzZmSpiPQ28xQCtGeBJ3hRNieZiCaBlBbiQNVDtGnZDcRJQkcRLJV\nRrQsAlhnhl3SdPMXJzmeNrzg9nlE3gio3DJhH6LYpIP+OxzPANx1Vf6LGvXU\nAi7Pyk4OtJF+pkJYOiaHmMQrUcy7x7g1JEcsF6GTfmz2VDo38/TRo2GuDQRr\nAVuq\r\n=4mvk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","gitHead":"856e008f60e9d6406c067e86cc804d136640a3b5","scripts":{"lint":"standard  --fix","test":"hundreds ava ./test/**/*.js","build":"rm -rf ./lib && tsc -p tsconfig.json","prepublishOnly":"npm run lint && npm run build && npm run test"},"_npmUser":{"name":"nzh","email":"ar.nazeh@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/synonymdev/slashtags.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v14.15.0+x64 (linux)","description":"Slashtags Dcoument IDs","directories":{},"_nodeVersion":"14.15.0","dependencies":{"multiformats":"^9.4.6","@synonymdev/slashtags-common":"^0.0.1-alpha.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/slashtags-docid_0.0.3-alpha.1_1631352787004_0.35282202442599186","host":"s3://npm-registry-packages"}},"0.0.3-alpha.2":{"name":"@synonymdev/slashtags-docid","version":"0.0.3-alpha.2","keywords":["slashtags","identifiers","cid","feed"],"author":{"name":"Nazeh","email":"ar.nazeh@gmail.com"},"_id":"@synonymdev/slashtags-docid@0.0.3-alpha.2","maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},{"name":"shashank.shinde","email":"shashank.shinde@live.com"},{"name":"kaloudis","email":"npm@nyxmail.com"},{"name":"bitcoinerrorlog","email":"john@synonym.to"},{"name":"jayvdb","email":"jayvdb1@gmail.com"},{"name":"coreyphillips","email":"corey.lyle.phillips@gmail.com"},{"name":"gr0kchain","email":"gr0kchain@protonmail.com"},{"name":"nzh","email":"ar.nazeh@gmail.com"}],"homepage":"https://github.com/synonymdev/slashtags/tree/master/packages/docid/#readme","bugs":{"url":"https://github.com/synonymdev/slashtags/issues"},"dist":{"shasum":"5db598c6813669798fca7c76947b39c5ca129bca","tarball":"https://registry.npmjs.org/@synonymdev/slashtags-docid/-/slashtags-docid-0.0.3-alpha.2.tgz","fileCount":14,"integrity":"sha512-Dlsgl0DVkTNoRGeGx0iZ7XtuqnEpRrKzm2tL6wqFnMeDycFdLcxZnuS0InHUBiLEwzodMGUE/HjxvPrJg+XKVQ==","signatures":[{"sig":"MEQCIGlHMk3Iu+MdSNAyZhYl6gvVydh4/VWAbeOV0vHSfeu6AiA/fAAR7O1Yv1PzUMMf50mTDsXY8oRcmKSA2iG/6JHKIQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9949,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQKBLCRA9TVsSAnZWagAAmBIQAIuMjcahm1rCAaVCTbOm\nw0lNLvjcoferC4u0Ox8060+V/k8YZwwAiCEokp0iAos1BYPK8CiT05eea9Sp\ngxQJFLMc3YUt7pjNbyPSwPO1lpP5pNJ60yyXaBiIgWUo1tfblDyIr8M5JCKw\nwbkiK5cS5ltqfQel7hBVRFJplsFGOE2hBGsw+4bXsOvmsy/mAg5J1XnnqZGr\nG77ZsIGPLhEWguPC64TareosLYXzgqB4uiOQWLQULhS9amNdWBmbp79pzlhG\nzmSPnRoRqHT3zeT3Y4znvE6NXh2tEZOhiG9Hr671nwJSWhD3ggfMNYqkd1JS\nF1AvHPnMhHAsAtbDQVKOoEskjOgKWG/yJIRGv9QARa08Ymhck4t9Ua9mxGby\nH7vmF5Cz+AzDu35/HrgjDmGaPY2kr2cxzuJQRrk/gcbQtm8VuEL8wXt5mxdX\nZHCjWolr/YkRSefUOBFla338rlt21Kt/9M1cHZ4AVzV4RDo7wowDws1buiUK\nPORND7pEydmJrR5qRP0LGm2Yx/WH/McRR+MlN4ZsZ4otEYsQ043geV4jn5XW\nrUEIJSIx8d/xiz4JOCUWnsTuBypxzmVvDOEatfGeKPGhe3HtulI4ljjS4nFM\nbrgOz78LZ9JUqH1esCBuBjotPLCBl69pwA4zyOz1Pv8A/y9H5jroNLIHqLCD\ncWob\r\n=Npoa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","type":"module","gitHead":"b30c817a7d82870c4ae89075f80c6b50a763e426","scripts":{"lint":"standard  --fix","test":"hundreds ava ./test/**/*.js","build":"rm -rf ./lib && tsc -p tsconfig.json","prepublishOnly":"npm run lint && npm run build && npm run test"},"_npmUser":{"name":"nzh","email":"ar.nazeh@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/synonymdev/slashtags.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v14.15.0+x64 (linux)","description":"Slashtags Dcoument IDs","directories":{},"_nodeVersion":"14.15.0","dependencies":{"multiformats":"^9.4.6","@synonymdev/slashtags-common":"^0.0.1-alpha.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/slashtags-docid_0.0.3-alpha.2_1631625291625_0.8690581905494892","host":"s3://npm-registry-packages"}},"0.0.3-alpha.4":{"name":"@synonymdev/slashtags-docid","version":"0.0.3-alpha.4","keywords":["slashtags","identifiers","cid","feed"],"author":{"name":"Nazeh","email":"ar.nazeh@gmail.com"},"_id":"@synonymdev/slashtags-docid@0.0.3-alpha.4","maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},{"name":"shashank.shinde","email":"shashank.shinde@live.com"},{"name":"kaloudis","email":"npm@nyxmail.com"},{"name":"bitcoinerrorlog","email":"john@synonym.to"},{"name":"jayvdb","email":"jayvdb1@gmail.com"},{"name":"coreyphillips","email":"corey.lyle.phillips@gmail.com"},{"name":"gr0kchain","email":"gr0kchain@protonmail.com"},{"name":"nzh","email":"ar.nazeh@gmail.com"}],"homepage":"https://github.com/synonymdev/slashtags/tree/master/packages/docid/#readme","bugs":{"url":"https://github.com/synonymdev/slashtags/issues"},"dist":{"shasum":"780959055ee81803f7886714a528514277260ea8","tarball":"https://registry.npmjs.org/@synonymdev/slashtags-docid/-/slashtags-docid-0.0.3-alpha.4.tgz","fileCount":20,"integrity":"sha512-sUiwuLn53u4qkYH1uBzySXF+qnmQ0CD0H5tQJ79omH9WD4o2j9HuzlbAwUv5G6OaJ8VOUZPIzYbHHPjMP4cSNQ==","signatures":[{"sig":"MEUCIFlLYvht+fSKcr0kLZD+oVcAnfiwMKdvT/OxiWBr+SvcAiEAlsksdHCtAXNQ1o5PbVSl/E7JMxvMQdB0Blj19GRU6MM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13070,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQeOtCRA9TVsSAnZWagAAkZMQAJmmGPgCJmItgYS1AsBC\nklvV5v//WJWQW9axl20MpjxqEtYG8auUwYkC095pFCbRccW6tU27nrmjakq+\ns+4aITPG+fjp4p8ScnGPNzk1wNQLOvfy82R9OBqKYFSO8brF1D2eFKXS8yEd\nDWmMar0LCW3lCzUNGHgPi5MdFSMC+dslxwfEap1TfPDYzdlSw8wPZ8Rtoi2M\nAz8eQczbV+KYRFsQ64nj26Yu7e5RJVV2L9pggxac+QglxycsHcaOhaXXOkuS\n9CPk1NyL3lUyjaxBI4eAIjPwOiF83xlLpE7Og2GpCr9XTUBTPUBjVdpB1pio\nLGTFw90lDIIP2qKM3zbX/ovppW3c+eluajV7k0ON89gRY9TxC3lE8DWy79ji\nMciihqWfry5BTr2m+aLd6WQGwPWd0m1ZHpa8VNSzJ4zn32jceNa/x86hXjCO\nneW0wHoVzS9mroP8XjSRAitU7SmKedl0QTiFOSyVebmDyUzKakXRqH/S41VE\n7MGi5KiPCpYT/3hB8X76qYTdhaJGFhYvkb634qKeHIB4ck7J2bNxDZ1F9FqQ\nTt1u5ozvYoYwnCDIJ0/j0qFtAL+KYRvWRqSCAhRjxNMFEufGGkaFeyzgBXKt\nLuKcmGtZ9CVbfV1USlSwaXSOGn1YNvAA7+ee/z45RezFoTclPUyMNo/Bhinm\n6FvS\r\n=LJzv\r\n-----END PGP SIGNATURE-----\r\n"},"types":"./types/index.d.ts","browser":{".":"./cjs/src/index.js"},"exports":{".":{"import":"./esm/src/index.js","browser":"./esm/src/index.js","require":"./cjs/src/index.js"}},"gitHead":"44f3a82548896120119d0a7f6beaa47e3d0d0eed","scripts":{"lint":"rm -rf dist && standard --fix","test":"hundreds ava ./test/**/*.js","build":"rm -rf dist types && ipjs build && tsc && mv types/src dist/types","prepublishOnly":"npm run lint && npm run build && npm run test"},"_npmUser":{"name":"nzh","email":"ar.nazeh@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/synonymdev/slashtags.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v14.15.0+x64 (linux)","description":"Slashtags Dcoument IDs","directories":{},"_nodeVersion":"14.15.0","dependencies":{"multiformats":"^9.4.6","@synonymdev/slashtags-common":"^0.0.1-alpha.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/slashtags-docid_0.0.3-alpha.4_1631708077322_0.3746009273877666","host":"s3://npm-registry-packages"}},"0.0.3":{"name":"@synonymdev/slashtags-docid","version":"0.0.3","keywords":["slashtags","identifiers","cid","feed"],"author":{"name":"Nazeh","email":"ar.nazeh@gmail.com"},"_id":"@synonymdev/slashtags-docid@0.0.3","maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},{"name":"shashank.shinde","email":"shashank.shinde@live.com"},{"name":"kaloudis","email":"npm@nyxmail.com"},{"name":"bitcoinerrorlog","email":"john@synonym.to"},{"name":"jayvdb","email":"jayvdb1@gmail.com"},{"name":"coreyphillips","email":"corey.lyle.phillips@gmail.com"},{"name":"gr0kchain","email":"gr0kchain@protonmail.com"},{"name":"nzh","email":"ar.nazeh@gmail.com"}],"homepage":"https://github.com/synonymdev/slashtags/tree/master/packages/docid/#readme","bugs":{"url":"https://github.com/synonymdev/slashtags/issues"},"dist":{"shasum":"61c77253df1378623309ed74a254a32d97bb6028","tarball":"https://registry.npmjs.org/@synonymdev/slashtags-docid/-/slashtags-docid-0.0.3.tgz","fileCount":20,"integrity":"sha512-sAnc7LyVQCNYnrOEurMYKpnetXv/kOsNF4wkFFQnJEzJ1qp7DDunGDnrJ3bgSHnATIQdkDDwfnzFbnbkQSAnFQ==","signatures":[{"sig":"MEQCICQDJ4JHQ1t7QO7JfbcQocZCI+62ayzInT9fo6Yn3tSSAiByJAjOsJHnHgLCZFKpD8rQQ52jH863WoOZcyBg36oyJQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13093},"types":"./types/index.d.ts","browser":{".":"./cjs/src/index.js"},"exports":{".":{"import":"./esm/src/index.js","browser":"./esm/src/index.js","require":"./cjs/src/index.js"}},"gitHead":"47dd5197cecf75ee4b17f854ddbc26eba31b56df","scripts":{"lint":"rm -rf dist && standard --fix","test":"hundreds ava ./test/**/*.js","build":"rm -rf dist types && ipjs build && tsc && mv types/src dist/types","prepublishOnly":"npm run lint && npm run build && npm run test"},"_npmUser":{"name":"nzh","email":"ar.nazeh@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/synonymdev/slashtags.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v14.15.0+x64 (linux)","description":"Slashtags Dcoument IDs","directories":{},"_nodeVersion":"14.15.0","dependencies":{"multiformats":"^9.4.6","@synonymdev/slashtags-common":"^0.0.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/slashtags-docid_0.0.3_1631874643731_0.6165158845049179","host":"s3://npm-registry-packages"}},"0.1.0":{"name":"@synonymdev/slashtags-docid","version":"0.1.0","keywords":["slashtags","identifiers","cid","feed"],"author":{"name":"Nazeh","email":"ar.nazeh@gmail.com"},"_id":"@synonymdev/slashtags-docid@0.1.0","maintainers":[{"name":"chm-diederichs","email":"christophe.diederichs@googlemail.com"},{"name":"shashank.shinde","email":"shashank.shinde@live.com"},{"name":"kaloudis","email":"npm@nyxmail.com"},{"name":"bitcoinerrorlog","email":"john@synonym.to"},{"name":"jayvdb","email":"jayvdb1@gmail.com"},{"name":"coreyphillips","email":"corey.lyle.phillips@gmail.com"},{"name":"gr0kchain","email":"gr0kchain@protonmail.com"},{"name":"nzh","email":"ar.nazeh@gmail.com"}],"homepage":"https://github.com/synonymdev/slashtags/tree/master/packages/docid/#readme","bugs":{"url":"https://github.com/synonymdev/slashtags/issues"},"dist":{"shasum":"ed3d72167531733f68250adf441a60ba9e963c7c","tarball":"https://registry.npmjs.org/@synonymdev/slashtags-docid/-/slashtags-docid-0.1.0.tgz","fileCount":20,"integrity":"sha512-pyd2ZpKMlH0ntj7+hsUJ8x4BnuDYZWWOKFRP10jH/8QwTzjOyqjmIh8u6Ec4KI0o5nuWPC8pK2FOpSHZhXlg+g==","signatures":[{"sig":"MEUCIFpcRg9s3bJQ7fvsbV857rW8zoH1xDH9u/XLLX8FtfItAiEAtB4gRJCWbX4ZSXJqEp/oQZw6duKeRcQatbyuj/0/ogA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13093},"types":"./types/index.d.ts","browser":{".":"./cjs/src/index.js"},"exports":{".":{"import":"./esm/src/index.js","browser":"./esm/src/index.js","require":"./cjs/src/index.js"}},"gitHead":"f2d2763ce547de8763b88c75aa46bb942b498bda","scripts":{"lint":"rm -rf dist && standard --fix","test":"hundreds ava ./test/**/*.js","build":"rm -rf dist types && ipjs build && tsc && mv types/src dist/types","prepublishOnly":"npm run lint && npm run build && npm run test"},"_npmUser":{"name":"nzh","email":"ar.nazeh@gmail.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/synonymdev/slashtags.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v14.15.0+x64 (linux)","description":"Slashtags Dcoument IDs","directories":{},"_nodeVersion":"14.15.0","dependencies":{"multiformats":"^9.4.6","@synonymdev/slashtags-common":"^0.1.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/slashtags-docid_0.1.0_1631875651561_0.7251588125673321","host":"s3://npm-registry-packages"}}},"time":{"created":"2021-09-07T15:59:09.327Z","modified":"2025-08-18T08:22:52.072Z","0.0.1-alpha.0":"2021-09-07T15:59:09.482Z","0.0.1-alpha.1":"2021-09-07T18:37:45.648Z","0.0.2-alpha.0":"2021-09-08T19:09:13.439Z","0.0.2-alpha.1":"2021-09-09T07:38:39.568Z","0.0.3-alpha.0":"2021-09-09T08:07:54.972Z","0.0.3-alpha.1":"2021-09-11T09:33:07.137Z","0.0.3-alpha.2":"2021-09-14T13:14:51.781Z","0.0.3-alpha.4":"2021-09-15T12:14:37.439Z","0.0.3":"2021-09-17T10:30:43.856Z","0.1.0":"2021-09-17T10:47:31.694Z"},"bugs":{"url":"https://github.com/synonymdev/slashtags/issues"},"author":{"name":"Nazeh","email":"ar.nazeh@gmail.com"},"homepage":"https://github.com/synonymdev/slashtags/tree/master/packages/docid/#readme","keywords":["slashtags","identifiers","cid","feed"],"repository":{"url":"git+https://github.com/synonymdev/slashtags.git","type":"git"},"description":"Slashtags Dcoument IDs","maintainers":[],"readme":"# Slashtags Document IDs\n\n> Contains Slashtags Document IDs ceration, serializing, and parsing\n\n## Usage\n\n### FeedID\n\nCreate a FeedID typed DocID from hypercore feed key\n\n```js\nimport * as DocID from '@slashtags/ids';\nimport hypercore from 'hypercore';\n\nvar feed = new Hypercore('./my-first-dataset');\n\n// You can pass the type name instead of the type code\nconst docID = DocID.create('FeedID', feed.key);\n```\n\n### CID\n\nCreate a CID typed DocID from json with sha256\n\n```js\nimport * as DocID from '@slashtags/ids';\nconst docID = DocID.CID.fromJSON({ foo: 'bar' });\n```\n\nOr by passing CID bytes\n\n```js\nimport * as DocID from '@slashtags/ids';\nimport { CID } from 'multiformats/cid';\nimport * as json from 'multiformats/codecs/json';\nimport { sha256 } from 'multiformats/hashes/sha2';\n\nconst bytes = json.encode({ hello: 'world' });\nconst hash = await sha256.digest(bytes);\nconst cid = CID.create(1, json.code, hash);\n\nconst docID = DocID.create(0, cid.bytes);\n```\n\n## Abstract\n\nDocIDs are composed of a `multicodec-slashtags-docid`, and `type` varint, followed by identifying bytes.\n\n## Motivation\n\nA specific encoding for Slashtags' DocIDs allows us to distinguish them from other forms of identifiers as well distinguishing the type of data and how to parse the identifying bytes.\n\n## Specification\n\n```js\n<slashtags-docid> ::= <mb><mc-docid><type><key>\n// or, expanded:\n<slashtags-docid> ::= <multibase-prefix><multicodec-slashtags-docid><type><key>\n```\n\nWhere\n\n- `<multibase-prefix>` is a [multibase](https://github.com/multiformats/multibase) code (1 or 2 bytes), to ease encoding CIDs into various bases. **NOTE:** _Binary_ (not text-based) protocols and formats may omit the multibase prefix when the encoding is unambiguous.\n\n- `<multicodec-slashtags-docid>`: `0xd2` indicates that this is a Slashtags identifier.\n- `<type>` describes mutability (static / stream), how to read and use the `key`, and any idiosyncratic rules.\n- `<key>` is used for document's storage, addressing, and discovery according to the `type`.\n\n### SlashtagsID multicodec\n\n// TODO: add slashtags Document ID `<multicodec-slashtags-docid>` to [multicodec](https://github.com/multiformats/multicodec)\n\n### DocID type\n\nUsed to encode multiple attributes about the ID and the document it represents:\n\n- **Mutability**: Static content or updatable Streams.\n- **key format**: How to parse the key bytes if needed.\n- **Data storage** How to use the key to store and query for the document.\n- **More**: Any future special kinds of documents with their own rules for verification ..etc\n\n| name   | code | mutability | key                |\n| ------ | ---- | ---------- | ------------------ |\n| CID    | 0    | static     | CID                |\n| FeedID | 1    | stream     | Hypercore feed key |\n\n### Static vs Stream documents\n\nStatic documents are immutable and relatively small piece of data, mainly used in Slashtags for [schemas]() and labeling predefined [Actions]().\n\nUnlike streams, static documents are not assumed to be stored as `append only log` nor any other format, so they require less overhaed.\n\n## Types\n\n### CID\n\nA Slashtags DocID of type `CID` has four parts:\n\n```js\n<docid> ::= <mb><mc-docid><type=0><key=cid>\n// or, expanded:\n<docid> ::= <multibase-prefix><multicodec-slashtags-docid><type-code=0><multicodec-cid><multicodec-content-type><multihash-content-address>\n```\n\nWhere\n\n- `<multibase-prefix>`: defaults to `base32`\n- `<type-code>` is `0`\n- `<identifying-bytes>` is a [CID](https://github.com/multiformats/cid)\n\n### FeedID\n\nA Slashtags DocID of type `FeedID` has four parts:\n\n```js\n<docid> ::= <mb><mc-docid><type-code=0><key=feed-key>\n// or, expanded:\n<docid> ::= <multibase-prefix><multicodec-slashtags-docid><type=1><hypercore-feed-key>\n```\n","readmeFilename":"README.md"}