Skip to content

isJwsShaped

function isJwsShaped(token): boolean;

Defined in: src/token-identity.ts:379

Whether token is a JWS – three dot-separated base64url segments.

Tested against the whitespace-trimmed credential, and that is the whole portability story. This port’s unflagged $ anchors at end-of-string, so "a.b.c\n" is not JWS-shaped to it and would be routed straight to a resolver – the one outcome this guard exists to prevent. Python’s $ happened to match before a single trailing newline and refused it, but not before two, so it was neither strict nor consistent; seven regex dialects disagree about anchors and always will. Trimming first depends on none of them, and can only ever add refusals.

Parameter Type
token string

boolean