engine/share_code library
Share codes and deep links (research theme-engine.md §11, Recommendation 13).
50 bits = family (5) + engineVersion (6) + seed (32) + CRC-7 (7), as 10
Crockford base32 symbols shown XXXXX-XXXXX. CRC polynomial
x⁷ + x³ + 1 (0x09) is primitive, so every single-symbol substitution and
every transposition of two different symbols is detected. Decoding is
case-insensitive, maps O → 0 and I/L → 1, and ignores hyphens and
spaces. Deep link: calsee://t/CODE (lowercase scheme and host,
because Android matches them case-sensitively); web form
https://calsee.tech/t/CODE (parsed only; App Links / Universal Links
verification is pending, docs/release/README.md).
Classes
- Decoded share-code payload.
Constants
- crockfordAlphabet → const String
- Crockford base32 alphabet (no I, L, O, U).
- deepLinkScheme → const String
- Deep-link scheme (lowercase).
- deepLinkThemeHost → const String
- Deep-link host for themes (lowercase).
-
deepLinkWebHosts
→ const Set<
String> -
Web hosts whose
https://<host>/t/CODElinks are theme links. - legacyDeepLinkScheme → const String
- Pre-release placeholder scheme, still accepted when parsing so links made by development builds keep working.
- Family field value for hero themes (seed = hero id).
- Reserved family field value.
Functions
-
crc7(
List< int> bits) → int -
CRC-7, polynomial x⁷ + x³ + 1 (0x09), MSB-first, init 0, over
bits(each 0 or 1). -
Decodes a share code, or null when it is malformed or fails the CRC.
Callers must still check the family id and that
SharePayload. engineVersionis not newer than the app's ("update the app to open this theme"). -
encodePayload(
SharePayload payload) → String -
Encodes
payload(see encodeShareCode). -
Encodes a payload as
XXXXX-XXXXX.familyId0–31,engineVersion0–63;seedis taken modulo 2^32. -
formatThemeDeepLink(
String code) → String -
Formats the deep link for
code:calsee://t/XXXXX-XXXXX. -
formatThemeWebLink(
String code) → String -
Formats the web form of the link for
code:https://calsee.tech/t/XXXXX-XXXXX. -
Normalises user input to the 10 canonical symbols (upper case,
O → 0,I/L → 1, hyphens and whitespace dropped), or null if it contains a character outside the alphabet or has the wrong length. -
parseThemeDeepLink(
String link) → SharePayload? -
Parses a theme deep link (
calsee://t/CODE, or the pre-releaseinfinitecalc://t/CODE; scheme and host lowercase, the code may be any case) or a web link (https://calsee.tech/t/CODE). Returns null for anything else or a bad code.