{"_id":"hypercore-id-encoding","_rev":"8-03e9ba92e2b2ad359506bae1db87ce56","name":"hypercore-id-encoding","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.0":{"name":"hypercore-id-encoding","version":"1.0.0","license":"MIT","_id":"hypercore-id-encoding@1.0.0","maintainers":[{"name":"andrewosh","email":"andrewosh@gmail.com"}],"dist":{"shasum":"19d2048705c222bf54535b533592a8cfe033b5a6","tarball":"https://registry.npmjs.org/hypercore-id-encoding/-/hypercore-id-encoding-1.0.0.tgz","fileCount":6,"integrity":"sha512-9JjQopswSSzS+lc6XPD/yd/BTSZvIXH4abgvaxP44z8mnpkl/10uhcrnUKoF5nKQ/SVcg3ILITiE28fgtzI32A==","signatures":[{"sig":"MEYCIQDSrgsN1bmbHosPCdFzjcsQnR8+W1BPemNJ8NnuRvGQ1gIhANYlIAyM30pb2MT6Sk7MyHV7BiuvjSP3bg0JxACNNOXW","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":749095,"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"},"main":"index.js","gitHead":"0f048cf27534e28bd6edf5a72cf25978addf1b97","scripts":{"test":"brittle test.js"},"_npmUser":{"name":"andrewosh","email":"andrewosh@gmail.com"},"_npmVersion":"8.1.2","description":"Convert Hypercore keys to/from z-base32 or hex","directories":{},"_nodeVersion":"16.13.2","dependencies":{"b4a":"^1.5.3","z32":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"brittle":"^2.3.1","hypercore":"next","random-access-memory":"^4.1.0"},"_npmOperationalInternal":{"tmp":"tmp/hypercore-id-encoding_1.0.0_1655576455974_0.46053807814822356","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"hypercore-id-encoding","version":"1.0.1","keywords":[],"author":"","license":"MIT","_id":"hypercore-id-encoding@1.0.1","maintainers":[{"name":"andrewosh","email":"andrewosh@gmail.com"}],"homepage":"https://github.com/hypercore-protocol/hypercore-id-encoding#readme","bugs":{"url":"https://github.com/hypercore-protocol/hypercore-id-encoding/issues"},"dist":{"shasum":"217bb793da791a6019850b576d3cee361f896e22","tarball":"https://registry.npmjs.org/hypercore-id-encoding/-/hypercore-id-encoding-1.0.1.tgz","fileCount":6,"integrity":"sha512-qTZIKbHRmYwHhRnT+eInmf4c2SDPXe1D+FotXQpBL3wvGZTVKqiENoSg+K4xYhw5EP/SUBACvpoL4fXXEFz9bw==","signatures":[{"sig":"MEQCICvGo7rUwmmbaeU2Gdi7Gzkz7q+VfqtmnKT7Tki6ci9CAiACGCXJb++EpcvnvcWFtCGgC2nPGCcqKyON+6NHpoSjnw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":761022,"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"},"main":"index.js","gitHead":"0a519b94e73020c3584adcba68d19dbe3da1a7c2","scripts":{"test":"brittle test.js"},"_npmUser":{"name":"andrewosh","email":"andrewosh@gmail.com"},"repository":{"url":"git+https://github.com/hypercore-protocol/hypercore-id-encoding.git","type":"git"},"_npmVersion":"8.1.2","description":"Convert Hypercore keys to/from z-base32 or hex","directories":{},"_nodeVersion":"16.13.2","dependencies":{"b4a":"^1.5.3","z32":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"brittle":"^2.3.1","hypercore":"next","random-access-memory":"^4.1.0"},"_npmOperationalInternal":{"tmp":"tmp/hypercore-id-encoding_1.0.1_1667392377409_0.27084505589498664","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"hypercore-id-encoding","version":"1.0.2","keywords":[],"author":"","license":"MIT","_id":"hypercore-id-encoding@1.0.2","maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"andrewosh","email":"andrewosh@gmail.com"}],"homepage":"https://github.com/hypercore-protocol/hypercore-id-encoding#readme","bugs":{"url":"https://github.com/hypercore-protocol/hypercore-id-encoding/issues"},"dist":{"shasum":"93b0db384680747489ad0a6d26bd70540b9bf8bf","tarball":"https://registry.npmjs.org/hypercore-id-encoding/-/hypercore-id-encoding-1.0.2.tgz","fileCount":5,"integrity":"sha512-ypj37Y2pWo8F6yr+PC3W/FYkAiZCTESOzdMVHZWBWuMOUWaeC1TQooAZbbmISZQuF/qvUuNDhhONL1xhtcc0Jg==","signatures":[{"sig":"MEUCIQD0jaJ362bnSCXFO3rcIqk24FA6b8H+RWg4H87o6biz5QIgLbz+gidecqeIgVW8s3KE6dZH22zLZTBEsV11yQQc+KI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4538,"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"},"main":"index.js","gitHead":"98ab701305e50929f7aad9c646a7b53a78b90694","scripts":{"test":"brittle test.js"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"repository":{"url":"git+https://github.com/hypercore-protocol/hypercore-id-encoding.git","type":"git"},"_npmVersion":"8.5.5","description":"Convert Hypercore keys to/from z-base32 or hex","directories":{},"_nodeVersion":"16.15.0","dependencies":{"b4a":"^1.5.3","z32":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"brittle":"^3.1.1","hypercore":"^10.0.0","random-access-memory":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hypercore-id-encoding_1.0.2_1667854497997_0.6750666229778173","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"hypercore-id-encoding","version":"1.1.0","keywords":[],"author":"","license":"Apache-2.0","_id":"hypercore-id-encoding@1.1.0","maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"andrewosh","email":"andrewosh@gmail.com"}],"homepage":"https://github.com/holepunchto/hypercore-id-encoding#readme","bugs":{"url":"https://github.com/holepunchto/hypercore-id-encoding/issues"},"dist":{"shasum":"c92c6b469fcfa43a865ed497b2e326c872f96efc","tarball":"https://registry.npmjs.org/hypercore-id-encoding/-/hypercore-id-encoding-1.1.0.tgz","fileCount":7,"integrity":"sha512-5Rg5y3dRs/UcClFniGOr0zrDINNOID3zEDmAmXx632jn0Zui8W8yE0mSXFa2/b7EaVB6bGxjK4G7yDYy1U0b6w==","signatures":[{"sig":"MEUCIQCU5jwj/3or40dRn7AbcIyhAAHzc6RhLn3k2qz6/7WKcwIgJh2xLqOBmCmMhhcg5W1VpPUeQFbtwzqE1IsxkRxoF5s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16370},"main":"index.js","gitHead":"5cebe1f59a417e38b2202659481c9aba63bb1bea","scripts":{"test":"brittle test.js"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"repository":{"url":"git+https://github.com/holepunchto/hypercore-id-encoding.git","type":"git"},"_npmVersion":"9.5.1","description":"Convert Hypercore keys to/from z-base32 or hex","directories":{},"_nodeVersion":"18.16.0","dependencies":{"b4a":"^1.5.3","z32":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"brittle":"^3.1.1","hypercore":"^10.0.0","random-access-memory":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hypercore-id-encoding_1.1.0_1686165655689_0.4096822145943968","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"hypercore-id-encoding","version":"1.2.0","keywords":[],"author":"","license":"Apache-2.0","_id":"hypercore-id-encoding@1.2.0","maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"andrewosh","email":"andrewosh@gmail.com"}],"homepage":"https://github.com/holepunchto/hypercore-id-encoding#readme","bugs":{"url":"https://github.com/holepunchto/hypercore-id-encoding/issues"},"dist":{"shasum":"b801540fbd2575977e2f92e60421e51ded1b45dc","tarball":"https://registry.npmjs.org/hypercore-id-encoding/-/hypercore-id-encoding-1.2.0.tgz","fileCount":4,"integrity":"sha512-WqPBJ/HZ/sifoo9jYw/ZUr1Z1l4kll8hQwVdDhVqsDyYPj0c/Tl0ALLXbDxb9vcpKBV+WLgLqf8kVB0GcZU0Mg==","signatures":[{"sig":"MEUCIQC4+zvAcptiBGcM8G6vSkZTSkifvG0POjtr39vtX6KHewIgOE9wllpS4g4p4qG1wef4TEtTdve3bwuAyn2+FGwAO4E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14264},"main":"index.js","gitHead":"b46135618edca4dde522de3223510a5bdc855e81","scripts":{"test":"standard && brittle test.js"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"repository":{"url":"git+https://github.com/holepunchto/hypercore-id-encoding.git","type":"git"},"_npmVersion":"9.5.1","description":"Convert Hypercore keys to/from z-base32 or hex","directories":{},"_nodeVersion":"18.16.0","dependencies":{"b4a":"^1.5.3","z32":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"brittle":"^3.1.1","standard":"^17.1.0","hypercore":"^10.0.0","random-access-memory":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hypercore-id-encoding_1.2.0_1690291710272_0.3605565394443664","host":"s3://npm-registry-packages"}},"1.3.0":{"name":"hypercore-id-encoding","version":"1.3.0","keywords":[],"author":"","license":"Apache-2.0","_id":"hypercore-id-encoding@1.3.0","maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"andrewosh","email":"andrewosh@gmail.com"}],"homepage":"https://github.com/holepunchto/hypercore-id-encoding#readme","bugs":{"url":"https://github.com/holepunchto/hypercore-id-encoding/issues"},"dist":{"shasum":"b3822eb97bee89ac134ffea2b8b67230ca166f55","tarball":"https://registry.npmjs.org/hypercore-id-encoding/-/hypercore-id-encoding-1.3.0.tgz","fileCount":4,"integrity":"sha512-W6sHdGo5h7LXEsoWfKf/KfuROZmZRQDlGqJF2EPHW+noCK66Vvr0+zE6cL0vqQi18s0kQPeN7Sq3QyR0Ytc2VQ==","signatures":[{"sig":"MEUCICZ3btKklakN2aWgwzMaw3sA+TucsxxBSXgy1QN1aYzWAiEAvfNo5jg0ji1ccgow8xzG9WRgZEJ/0NLMyQ/DIRzY68g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14342},"main":"index.js","gitHead":"5607a0e308d0badebf25f32e94d3615a4c9f22ed","scripts":{"test":"standard && brittle test.js"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"repository":{"url":"git+https://github.com/holepunchto/hypercore-id-encoding.git","type":"git"},"_npmVersion":"10.2.4","description":"Convert Hypercore keys to/from z-base32 or hex","directories":{},"_nodeVersion":"20.11.1","dependencies":{"b4a":"^1.5.3","z32":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"brittle":"^3.1.1","standard":"^17.1.0","hypercore":"^10.0.0","random-access-memory":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hypercore-id-encoding_1.3.0_1711450508067_0.8006855341535568","host":"s3://npm-registry-packages"}}},"time":{"created":"2022-06-18T18:20:55.973Z","modified":"2026-05-06T20:49:02.712Z","1.0.0":"2022-06-18T18:20:56.168Z","1.0.1":"2022-11-02T12:32:57.593Z","1.0.2":"2022-11-07T20:54:58.142Z","1.1.0":"2023-06-07T19:20:55.953Z","1.2.0":"2023-07-25T13:28:30.448Z","1.3.0":"2024-03-26T10:55:08.207Z"},"bugs":{"url":"https://github.com/holepunchto/hypercore-id-encoding/issues"},"license":"Apache-2.0","homepage":"https://github.com/holepunchto/hypercore-id-encoding#readme","keywords":[],"repository":{"url":"git+https://github.com/holepunchto/hypercore-id-encoding.git","type":"git"},"description":"Convert Hypercore keys to/from z-base32 or hex","maintainers":[{"email":"mathiasbuus@gmail.com","name":"mafintosh"}],"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","readmeFilename":"README.md"}