{"id":19122927,"url":"https://github.com/digitalbazaar/base58-universal","last_synced_at":"2025-05-05T18:25:52.109Z","repository":{"id":40339541,"uuid":"235668409","full_name":"digitalbazaar/base58-universal","owner":"digitalbazaar","description":"Encode/decode using \"The Base58 Encoding Scheme\".","archived":false,"fork":false,"pushed_at":"2022-08-25T18:52:56.000Z","size":67,"stargazers_count":5,"open_issues_count":4,"forks_count":4,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-10-28T13:58:58.761Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitalbazaar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-22T21:15:41.000Z","updated_at":"2024-04-15T12:26:23.000Z","dependencies_parsed_at":"2022-07-20T11:47:35.675Z","dependency_job_id":null,"html_url":"https://github.com/digitalbazaar/base58-universal","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fbase58-universal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fbase58-universal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fbase58-universal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fbase58-universal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalbazaar","download_url":"https://codeload.github.com/digitalbazaar/base58-universal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223788232,"owners_count":17202935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T05:23:38.572Z","updated_at":"2024-11-09T05:23:39.080Z","avatar_url":"https://github.com/digitalbazaar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Base58 Universal Encoder/Decoder _(base58-universal)_\n\n\u003e Encoder/decoder for [The Base58 Encoding Scheme][] for [Node.js][] and Web browsers\n\n## Table of Contents\n\n- [Security](#security)\n- [Background](#background)\n- [Install](#install)\n- [Usage](#usage)\n- [Contribute](#contribute)\n- [Commercial Support](#commercial-support)\n- [License](#license)\n\n## Security\n\nTBD\n\n## Background\n\nThis library provides an encoder and decoder for [The Base58 Encoding Scheme][]\nusing an alphabet popularized by Bitcoin. It works in both [Node.js][] and in\nWeb browsers with no dependencies.\n\n## Install\n\n- Node.js \u003e=14 required.\n\nTo install for [Node.js][] or in a Web project using npm:\n\n```\nnpm install base58-universal\n```\n\nTo install locally or for development:\n\n```\ngit clone https://github.com/digitalbazaar/base58-universal.git\ncd base58-universal\nnpm install\n```\n\n## Usage\n\n```js\nimport {encode, decode} from 'base58-universal';\n```\n\n### Encoding\n\n* `encode(input[, maxline])`\n  * **`input`**: `Uint8Array` - bytes to encode\n  * **`maxline`**: `Number` - maximum number of encoded characters per line to\n    use, defaults to infinite.\n  * Returns a base58 encoded string.\n\n```js\nimport {encode} from 'base58-universal';\n\nconst input1 = Uint8Array([1, 2, 3, 4]);\nconst encoded1 = encode(input1);\n// \u003e 2VfUX\n\nconst input2 = Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);\nconst encoded2 = encode(input2, 8);\n// \u003e 4HUtbHhN\\r\\n2TkpR\n```\n\n### Decoding\n\n* `decode(input)`\n  * **`input`**: `String` - string to decode\n  * Returns a `Uint8Array` with the decoded bytes.\n\n```js\nimport {decode} from 'base58-universal';\n\nconst input3 = '2VfUX';\nconst decoded3 = decode(input3);\n// \u003e Uint8Array [ 1, 2, 3, 4 ]\n\nconst input4 = '4HUtbHhN\\r\\n2TkpR';\nconst decoded4 = decode(input4);\n// \u003e Uint8Array [\n//   1, 2, 3, 4,  5,\n//   6, 7, 8, 9, 10\n// ]\n```\n\n### String Handling\n\nThis library uses [Uint8Array][] for encoder input and decoder output.\nConversion to and from strings can be done with a variety of tools.\n\n#### Browser\n\n- [TextEncoder][] and [TextDecoder][] using the [Encoding][] standard.\n\n```js\nconst input5 = new TextEncoder().encode('abc');\nconst encoded5 = encode(input5);\n// \u003e ZiCa\n\nconst decoded6 = decode(encoded5);\nconst output6 = new TextDecoder().decode(decoded6);\n// \u003e abc\n```\n\n#### Node.js\n\n- [util.TextEncoder][] and [util.TextDecoder][] globals using the [Encoding][]\n  standard.\n- [Buffer][] `from` and `toString` with encoding options.\n\n```js\nconst input7 = new TextEncoder().encode('abc');\nconst encoded7 = encode(input7);\n// \u003e ZiCa\n\nconst decoded8 = decode(encoded7);\nconst output8 = new TextDecoder().decode(decoded8);\n// \u003e abc\n\n// Using Buffer (which is a Uint8Array)\nconst input9 = Buffer.from('616263', 'hex');\nconst encoded9 = encode(input9);\nconst decoded9 = decode(encoded9);\nBuffer.from(decoded9).toString();\n// \u003e abc\nBuffer.from(decoded9).toString('hex');\n// \u003e 616263\n```\n\n## Contribute\n\nPlease follow the [Bedrock contributing\nguidelines](https://github.com/digitalbazaar/bedrock/blob/master/CONTRIBUTING.md).\n\nPRs accepted.\n\nIf editing the README, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme)\nspecification.\n\n## Commercial Support\n\nCommercial support for this library is available upon request from\nDigital Bazaar: support@digitalbazaar.com\n\n## License\n\n[New BSD License (3-clause)](LICENSE) © Digital Bazaar\n\nEncoder/decoder original implementation from\n[base-x](https://github.com/cryptocoinjs/base-x) under the MIT License.\n\n[Buffer]: https://nodejs.org/api/buffer.html\n[Encoding]: https://encoding.spec.whatwg.org/\n[Node.js]: https://nodejs.org/\n[TextDecoder]: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder\n[TextEncoder]: https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder\n[The Base58 Encoding Scheme]: https://github.com/digitalbazaar/base58-spec\n[Uint8Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array\n[util.TextDecoder]: https://nodejs.org/api/util.html#util_class_util_textdecoder\n[util.TextEncoder]: https://nodejs.org/api/util.html#util_class_util_textencoder\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalbazaar%2Fbase58-universal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalbazaar%2Fbase58-universal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalbazaar%2Fbase58-universal/lists"}