mirror of
https://github.com/status-im/sourcecred.git
synced 2025-02-24 10:18:11 +00:00
Summary: A new utility module defines an opaque UUID type. Clients can generate random UUIDs and convert them to and from strings. We roll our own module here rather than using the `uuid` NPM module because that module only exposes the 32-character hyphen-separated string form of UUID, which takes up nearly 50% more space. The usual approach these days is to use fixed-length base64 strings without padding. For instance, [YouTube video IDs are of this form][yt]. This module takes care not to generate IDs that might confuse command-line argument parsers, and tries not to generate IDs that might contain English curse words. The implementation uses isomorphic libraries for RNG and base64 conversion because the relevant Node and browser APIs are not aligned. [yt]: https://webapps.stackexchange.com/a/101153 Test Plan: Unit tests included, with full coverage. wchargin-branch: util-uuid