{"_id":"hypercore-id-encoding","_rev":"946011","name":"hypercore-id-encoding","description":"Convert Hypercore keys to/from z-base32 or hex","dist-tags":{"latest":"1.3.0"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"andrewosh","email":"andrewosh@gmail.com"}],"time":{"modified":"2024-08-21T05:52:24.000Z","created":"2022-06-18T18:20:56.168Z","1.3.0":"2024-03-26T10:55:08.207Z","1.2.0":"2023-07-25T13:28:30.448Z","1.1.0":"2023-06-07T19:20:55.953Z","1.0.2":"2022-11-07T20:54:58.142Z","1.0.1":"2022-11-02T12:32:57.593Z","1.0.0":"2022-06-18T18:20:56.168Z"},"users":{},"author":"","repository":{"type":"git","url":"git+https://github.com/holepunchto/hypercore-id-encoding.git"},"versions":{"1.3.0":{"name":"hypercore-id-encoding","version":"1.3.0","description":"Convert Hypercore keys to/from z-base32 or hex","main":"index.js","scripts":{"test":"standard && brittle test.js"},"dependencies":{"b4a":"^1.5.3","z32":"^1.0.0"},"devDependencies":{"brittle":"^3.1.1","hypercore":"^10.0.0","random-access-memory":"^6.0.0","standard":"^17.1.0"},"license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/holepunchto/hypercore-id-encoding.git"},"keywords":[],"author":"","bugs":{"url":"https://github.com/holepunchto/hypercore-id-encoding/issues"},"homepage":"https://github.com/holepunchto/hypercore-id-encoding#readme","_id":"hypercore-id-encoding@1.3.0","gitHead":"5607a0e308d0badebf25f32e94d3615a4c9f22ed","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-W6sHdGo5h7LXEsoWfKf/KfuROZmZRQDlGqJF2EPHW+noCK66Vvr0+zE6cL0vqQi18s0kQPeN7Sq3QyR0Ytc2VQ==","shasum":"b3822eb97bee89ac134ffea2b8b67230ca166f55","tarball":"http://registry-npm.ywwl.com/hypercore-id-encoding/download/hypercore-id-encoding-1.3.0.tgz","fileCount":4,"unpackedSize":14342,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICZ3btKklakN2aWgwzMaw3sA+TucsxxBSXgy1QN1aYzWAiEAvfNo5jg0ji1ccgow8xzG9WRgZEJ/0NLMyQ/DIRzY68g="}],"size":5248,"noattachment":false,"key":"/hypercore-id-encoding/-/hypercore-id-encoding-1.3.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"andrewosh","email":"andrewosh@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hypercore-id-encoding_1.3.0_1711450508067_0.8006855341535568"},"_hasShrinkwrap":false,"publish_time":1711450508207,"_cnpm_publish_time":1711450508207},"1.2.0":{"name":"hypercore-id-encoding","version":"1.2.0","description":"Convert Hypercore keys to/from z-base32 or hex","main":"index.js","scripts":{"test":"standard && brittle test.js"},"dependencies":{"b4a":"^1.5.3","z32":"^1.0.0"},"devDependencies":{"brittle":"^3.1.1","hypercore":"^10.0.0","random-access-memory":"^6.0.0","standard":"^17.1.0"},"license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/holepunchto/hypercore-id-encoding.git"},"keywords":[],"author":"","bugs":{"url":"https://github.com/holepunchto/hypercore-id-encoding/issues"},"homepage":"https://github.com/holepunchto/hypercore-id-encoding#readme","gitHead":"b46135618edca4dde522de3223510a5bdc855e81","_id":"hypercore-id-encoding@1.2.0","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-WqPBJ/HZ/sifoo9jYw/ZUr1Z1l4kll8hQwVdDhVqsDyYPj0c/Tl0ALLXbDxb9vcpKBV+WLgLqf8kVB0GcZU0Mg==","shasum":"b801540fbd2575977e2f92e60421e51ded1b45dc","tarball":"http://registry-npm.ywwl.com/hypercore-id-encoding/download/hypercore-id-encoding-1.2.0.tgz","fileCount":4,"unpackedSize":14264,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC4+zvAcptiBGcM8G6vSkZTSkifvG0POjtr39vtX6KHewIgOE9wllpS4g4p4qG1wef4TEtTdve3bwuAyn2+FGwAO4E="}],"size":5209,"noattachment":false,"key":"/hypercore-id-encoding/-/hypercore-id-encoding-1.2.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"andrewosh","email":"andrewosh@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hypercore-id-encoding_1.2.0_1690291710272_0.3605565394443664"},"_hasShrinkwrap":false,"publish_time":1690291710448,"_cnpm_publish_time":1690291710448},"1.1.0":{"name":"hypercore-id-encoding","version":"1.1.0","description":"Convert Hypercore keys to/from z-base32 or hex","main":"index.js","scripts":{"test":"brittle test.js"},"dependencies":{"b4a":"^1.5.3","z32":"^1.0.0"},"devDependencies":{"brittle":"^3.1.1","hypercore":"^10.0.0","random-access-memory":"^6.0.0"},"license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/holepunchto/hypercore-id-encoding.git"},"keywords":[],"author":"","bugs":{"url":"https://github.com/holepunchto/hypercore-id-encoding/issues"},"homepage":"https://github.com/holepunchto/hypercore-id-encoding#readme","gitHead":"5cebe1f59a417e38b2202659481c9aba63bb1bea","_id":"hypercore-id-encoding@1.1.0","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-5Rg5y3dRs/UcClFniGOr0zrDINNOID3zEDmAmXx632jn0Zui8W8yE0mSXFa2/b7EaVB6bGxjK4G7yDYy1U0b6w==","shasum":"c92c6b469fcfa43a865ed497b2e326c872f96efc","tarball":"http://registry-npm.ywwl.com/hypercore-id-encoding/download/hypercore-id-encoding-1.1.0.tgz","fileCount":7,"unpackedSize":16370,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCU5jwj/3or40dRn7AbcIyhAAHzc6RhLn3k2qz6/7WKcwIgJh2xLqOBmCmMhhcg5W1VpPUeQFbtwzqE1IsxkRxoF5s="}],"size":5736,"noattachment":false,"key":"/hypercore-id-encoding/-/hypercore-id-encoding-1.1.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"andrewosh","email":"andrewosh@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hypercore-id-encoding_1.1.0_1686165655689_0.4096822145943968"},"_hasShrinkwrap":false,"publish_time":1686165655953,"_cnpm_publish_time":1686165655953},"1.0.2":{"name":"hypercore-id-encoding","version":"1.0.2","description":"Convert Hypercore keys to/from z-base32 or hex","main":"index.js","scripts":{"test":"brittle test.js"},"dependencies":{"b4a":"^1.5.3","z32":"^1.0.0"},"devDependencies":{"brittle":"^3.1.1","hypercore":"^10.0.0","random-access-memory":"^6.0.0"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/hypercore-protocol/hypercore-id-encoding.git"},"keywords":[],"author":"","bugs":{"url":"https://github.com/hypercore-protocol/hypercore-id-encoding/issues"},"homepage":"https://github.com/hypercore-protocol/hypercore-id-encoding#readme","gitHead":"98ab701305e50929f7aad9c646a7b53a78b90694","_id":"hypercore-id-encoding@1.0.2","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-ypj37Y2pWo8F6yr+PC3W/FYkAiZCTESOzdMVHZWBWuMOUWaeC1TQooAZbbmISZQuF/qvUuNDhhONL1xhtcc0Jg==","shasum":"93b0db384680747489ad0a6d26bd70540b9bf8bf","tarball":"http://registry-npm.ywwl.com/hypercore-id-encoding/download/hypercore-id-encoding-1.0.2.tgz","fileCount":5,"unpackedSize":4538,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0jaJ362bnSCXFO3rcIqk24FA6b8H+RWg4H87o6biz5QIgLbz+gidecqeIgVW8s3KE6dZH22zLZTBEsV11yQQc+KI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjaXCiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo6cA/8CaeIj/l4RjI3vbEvmBjd1DjcQIWODOr3vuCnozYcvVIcK/QD\r\nonNvEGbdLe64bEKZFfV+MkHvParEwg8fK0z4vsnE7wvGHYsIfzHzfN7dln7v\r\nDHs2WkBgnHhTSVT0v2mbPIwgbstAVaGGUlSLkqWaYelgGBF9ReujblsVY8oH\r\nsHn5L8d3vvRvuaqRDT6f9MTeh8CFrt3G0dAzLeqzsnv01tA9ArpOhpAMCIQO\r\n8WtGbgvclQG66ue7Ey9q8/+m9DeRod+HQmTG9xmm0wRoO1ckLAqRyhXcVUd2\r\nGTiwKycoSZzuQCw5Z0EQjgfdpzb3mwh+Xze2lOt/IMiG8CVN1wY+uLQpyXTx\r\n4zjIIIvkzkfIByQEgZvYhOJTf0s02ufvh0sxCZ0h3OzdyFs+5OSyoP3QCRtP\r\nCxz4kJ4lNRBFtUJvaFJr9LvSWBHygeN5H6U+l5eL0k99qcnn9uFjlfNy7UtV\r\n04o68HCv8xbJ4jZLHqRmvGvbE/nmxOCdvXXFLv+WG4qQcMXOcuVXWsh7xL8z\r\nAZMUqH4nKfNqHrusVfibiSsL4EDapr0poJyxf1oinim3nVLP9t1wUhlETKn6\r\nEs4KWOZ8XhnNOrIGX4tBhOkfCzXM6NTjPe6PJ1ItDkYomLfyOj2xlsv2TRL1\r\nCDG4T0Yi/vGHj0ip+vTRE6dtxHSmTtMOkrk=\r\n=f8wP\r\n-----END PGP SIGNATURE-----\r\n","size":2043,"noattachment":false,"key":"/hypercore-id-encoding/-/hypercore-id-encoding-1.0.2.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"andrewosh","email":"andrewosh@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hypercore-id-encoding_1.0.2_1667854497997_0.6750666229778173"},"_hasShrinkwrap":false,"publish_time":1667854498142,"_cnpm_publish_time":1667854498142},"1.0.1":{"name":"hypercore-id-encoding","version":"1.0.1","description":"Convert Hypercore keys to/from z-base32 or hex","main":"index.js","scripts":{"test":"brittle test.js"},"dependencies":{"b4a":"^1.5.3","z32":"^1.0.0"},"devDependencies":{"brittle":"^2.3.1","hypercore":"next","random-access-memory":"^4.1.0"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/hypercore-protocol/hypercore-id-encoding.git"},"keywords":[],"author":"","bugs":{"url":"https://github.com/hypercore-protocol/hypercore-id-encoding/issues"},"homepage":"https://github.com/hypercore-protocol/hypercore-id-encoding#readme","gitHead":"0a519b94e73020c3584adcba68d19dbe3da1a7c2","_id":"hypercore-id-encoding@1.0.1","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-qTZIKbHRmYwHhRnT+eInmf4c2SDPXe1D+FotXQpBL3wvGZTVKqiENoSg+K4xYhw5EP/SUBACvpoL4fXXEFz9bw==","shasum":"217bb793da791a6019850b576d3cee361f896e22","tarball":"http://registry-npm.ywwl.com/hypercore-id-encoding/download/hypercore-id-encoding-1.0.1.tgz","fileCount":6,"unpackedSize":761022,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICvGo7rUwmmbaeU2Gdi7Gzkz7q+VfqtmnKT7Tki6ci9CAiACGCXJb++EpcvnvcWFtCGgC2nPGCcqKyON+6NHpoSjnw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjYmN5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpTFA//QVpjuD/KLE8r4Wxbf8NeW8kURozOxNw5X60uEiHGxmiy1jjp\r\nITjMrf7ySgigP5z/dQA2SpZJpTOlM3Hlhrg1UPEB3j3cPhCvZ51ekRp/Sh7y\r\nIQ50WcCgmzrFr2nBL64Y7+eHyhUXXQfk8ddkJhrizst2u85bLQTV+pqKR8W+\r\nKJDXWoiMaKtH7B4CZBWaHbvCaYc0oh22rvHSlp1AEF1S1KGcZL+JF/PYnrQF\r\nTOqjsmPzHKleIENSJcOSNFD1/DIAbkTg/DOUS3jumsgX35H2d7Nzg7AisSve\r\njfGzCgmeUUO+o30SGPclQ0oznpS2i1hXtZ+tm5kaIqWDVk8/bm1kvgtQ+Moz\r\nQ0k8JmjarWSw8doktlZxMJEdX0mgCM00Z0i5bFkcEOLrlHEDZzFIGLBMvox3\r\n6q/oxuqzp8CnbN3pExiNud1eHQiAzkEtnXuQKCUNX8cI1G2KWLLKfF2TUIpQ\r\niwVY4Og3EwUIs8zKGSs8ZrinY2rtXj9Kj0UF56Ntcc1N4XaUK5FoZw/3U/wE\r\ngZgYwifs665HrMtC74c1MdsZmwUHIhje89NsgC7DQaWc1PTjCwH2BO6beVxF\r\nnr054u4StiHJxKCKs5X4+mt3s6y2iqfj2UKXIRr8n7DabMqglrihaX+jcG3K\r\n7brmtwxNZc8nhVVPLIpzPp/xhPx4PhcG0+E=\r\n=bjrp\r\n-----END PGP SIGNATURE-----\r\n","size":86517,"noattachment":false,"key":"/hypercore-id-encoding/-/hypercore-id-encoding-1.0.1.tgz"},"_npmUser":{"name":"andrewosh","email":"andrewosh@gmail.com"},"directories":{},"maintainers":[{"name":"andrewosh","email":"andrewosh@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hypercore-id-encoding_1.0.1_1667392377409_0.27084505589498664"},"_hasShrinkwrap":false,"publish_time":1667392377593,"_cnpm_publish_time":1667392377593},"1.0.0":{"name":"hypercore-id-encoding","version":"1.0.0","description":"Convert Hypercore keys to/from z-base32 or hex","main":"index.js","scripts":{"test":"brittle test.js"},"dependencies":{"b4a":"^1.5.3","z32":"^1.0.0"},"devDependencies":{"brittle":"^2.3.1","hypercore":"next","random-access-memory":"^4.1.0"},"license":"MIT","gitHead":"0f048cf27534e28bd6edf5a72cf25978addf1b97","_id":"hypercore-id-encoding@1.0.0","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-9JjQopswSSzS+lc6XPD/yd/BTSZvIXH4abgvaxP44z8mnpkl/10uhcrnUKoF5nKQ/SVcg3ILITiE28fgtzI32A==","shasum":"19d2048705c222bf54535b533592a8cfe033b5a6","tarball":"http://registry-npm.ywwl.com/hypercore-id-encoding/download/hypercore-id-encoding-1.0.0.tgz","fileCount":6,"unpackedSize":749095,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDSrgsN1bmbHosPCdFzjcsQnR8+W1BPemNJ8NnuRvGQ1gIhANYlIAyM30pb2MT6Sk7MyHV7BiuvjSP3bg0JxACNNOXW"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJirheIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmppTQ//UwwQuGgj52yaMP0wJeb/wNDH5O9WT8drvTsVrV8YqDW6/Jpz\r\nGIF6lib7/oVHChMSQeo40KGliol4Owg8Fle6gebftOuzixg5JWbFdW2JS9VN\r\newz6KBdQA7MYBWv0d7QytTb0EcFafE8/68UVdfyaWE45hyl5do9iAECQq0ol\r\nfkt7TVKB4seBDk/ipFZiYSUvDxCiEflQfy99Sx1+AY/ztvemcYs998JNBv3z\r\nl/ARvEIVNdw3svBG00LsYLm5LG2dpUtUWgmpBgF/vuwSemBEIL3wsGmspIh6\r\nQkCJwhtMjl2AbDJJefvP5VduwTxo8Euf5cjPPXOwfFxfDo1iJgH0yhaHRVHS\r\nTkCxQGhD3mF4RXoc2CdSYPUoxQ5Je7pHVjkxxHCuk8ugr/Fm6jTXpzLYmLcm\r\nNdc03KbVzIopq10/9xBai6Di4iTKNo6bwVdeSA++RCrt3SamvFQ5ftyTJXNU\r\n6nxdtFA0utQI05G9LkoeMYBmfKuSXU1M+sNF81GgIuIfkIEjbjCTlimVjhy6\r\nQFyFg/hxT0919qMvwtkw6uOuO0bnMVgzcC+SgIihZS3KNkM/poinwDAb0HRK\r\nA7k3nX+sGC42gfANrRNYBa6JzGYAn+6DAEkjjOfuqAZhBhQx+viPhyhzHLeo\r\ndBaUs2nV0sr84Fxc+EV5M85qD8eIeBjiwwQ=\r\n=Fn2L\r\n-----END PGP SIGNATURE-----\r\n","size":85297,"noattachment":false,"key":"/hypercore-id-encoding/-/hypercore-id-encoding-1.0.0.tgz"},"_npmUser":{"name":"andrewosh","email":"andrewosh@gmail.com"},"directories":{},"maintainers":[{"name":"andrewosh","email":"andrewosh@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hypercore-id-encoding_1.0.0_1655576455974_0.46053807814822356"},"_hasShrinkwrap":false,"publish_time":1655576456168,"_cnpm_publish_time":1655576456168}},"readme":"# hypercore-id-encoding\n\nEncodes Hypercore keys into z-base32 ids, and decodes both hex/z-base32 strings.\n\n```\nnpm install hypercore-id-encoding\n```\n\n## Usage\n\n```js\nconst { encode, decode, normalize } = require('hypercore-id-encoding')\n\nconst id = encode(core.key) // (z-base32 String)\nconst hexEncoded = core.key.toString('hex')\n\nconst core = new Hypercore(ram, decode(id)) \nconst core2 = new Hypercore(ram, decode(hexEncoded)) // Will also work with hex\n\nconst id2 = normalize(id)\nconst id3 = normalize(hexEncoded)\n```\n\n## API\n\n#### `const id = encode(hypercoreKey)`\n\nEncodes a 32-byte Hypercore key into a z-base32 id.\n\n`hypercoreKey` must be a Buffer or an ArrayBuffer.\n\n#### `const buf = decode(hypercoreId)`\n\nDecodes an id or pear link into a Hypercore key.\n\nIf `hypercoreId` is a 52-character String, it will be decoded as z-base32.\n\nIf `hypercoreId` is a 64-character String, it will be decoded as hex.\n\nIf `hypercoreId` is already a Buffer and is a valid id, it will be returned as-is.\n\n#### `const id = normalize(any)`\n\nDecodes and encodes the input `any` to always return a z-base32 id.\n\n#### `isValid(any)`\n\nReturns a boolean indicating whether the key is a valid hypercore key (meaning that it can be decoded/normalised).\n\n## License\n\nApache-2.0\n\n\n\n","_attachments":{},"homepage":"https://github.com/holepunchto/hypercore-id-encoding#readme","bugs":{"url":"https://github.com/holepunchto/hypercore-id-encoding/issues"},"license":"Apache-2.0"}