10 lines
376 B
TypeScript
10 lines
376 B
TypeScript
const MAX_ENCODED_ID_UTF8_BYTES = 64;
|
|
|
|
/** Transport guard only; Core retains its own field/profile structural rules. */
|
|
export function hasValidEncodedIdUtf8Length(value: unknown): value is string {
|
|
return typeof value === "string" && (() => {
|
|
const bytes = new TextEncoder().encode(value).length;
|
|
return bytes >= 1 && bytes <= MAX_ENCODED_ID_UTF8_BYTES;
|
|
})();
|
|
}
|