Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[typeid] Enforce that the first suffix character is in the 0-7 range #75

Merged
merged 3 commits into from
Jul 6, 2023

Conversation

loreto
Copy link
Contributor

@loreto loreto commented Jul 5, 2023

Change spec and implementations to enforce that the first suffix character should be in the 0-7 range. This is because
26 characters in base32 encode 130-bits, but UUIDs are only 128-bits. In order to guarantee that there are no
overflow errors and that the typeid <-> uuid mapping is a bijective function, the maximum possible suffix is 7zzzzzzzzzzzzzzzzzzzzzzzzz.

This was first reported by @fxlae in jetify-com/typeid#20

This PR:

  1. Updates the spec
  2. Updates the test data files provided by the spec
  3. Updates our go and typescript implementations

@loreto loreto merged commit d6786d1 into main Jul 6, 2023
@loreto loreto deleted the daniel/typeid-overflow branch July 6, 2023 12:34
- name: suffix-overflow
# This is the first suffix that overflows into 129 bits
typeid: "prefix_8zzzzzzzzzzzzzzzzzzzzzzzzz"
description: "The should encode at most 128-bits"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: "The should encode at most 128-bits"
description: "The suffix should encode at most 128-bits"

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants