CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-base64url

For encoding to/from base64urls implementing RFC 4648 base64url standard

89

1.28x
Overview
Eval results
Files

task.mdevals/scenario-5/

Base64url Normalization

Create a small module that turns base64url-encoded tokens into standard base64 strings with required = padding so legacy services that expect padded base64 accept the values.

Capabilities

Normalize single token

  • Converting "SGVsbG8td29ybGQ" returns "SGVsbG8td29ybGQ=" with padding restored @test
  • Converting "_w" returns "/w==" while preserving the original bytes @test

Normalize collections

  • Normalizing ["-w", " c3VtX3VzZXI "] returns ["+w==", "c3VtX3VzZXI="], trimming surrounding whitespace but keeping order @test

Reject invalid tokens

  • Passing a token such as "bad*token" (contains characters outside the base64url alphabet) results in an error that identifies the invalid token @test

Implementation

@generates

API

export function normalizeToken(base64urlToken: string): string;
export function normalizeCollection(tokens: Array<string>): string[];

Dependencies { .dependencies }

base64url { .dependency }

Provides base64url to base64 conversion utilities.

Install with Tessl CLI

npx tessl i tessl/npm-base64url

tile.json