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-4/

Base64url Payload Decoder

Utilities for turning base64url-encoded strings into binary payloads and assembling them when split across multiple tokens.

Capabilities

Decode URL-safe tokens

  • Decodes the base64url string Zm9vLWJhcg into a Buffer containing the ASCII bytes for foo-bar. @test
  • Rejects input containing characters outside the base64/base64url alphabet (for example token!) with an error. @test

Normalize standard base64

  • Accepts the standard base64 string +vv8 and returns a Buffer whose hex representation is fafbfc. @test

Merge decoded segments

  • Given ["Zm9vX2Jhcg", "+vv8"], decodes each token (treating either base64 or base64url) and concatenates them; the resulting Buffer should have hex 666f6f5f626172fafbfc. @test

Implementation

@generates

API

export function decodeUrlToken(token: string): Buffer;
export function decodeBase64Token(token: string): Buffer;
export function mergeDecoded(tokens: string[]): Buffer;

Dependencies { .dependencies }

base64url { .dependency }

Provides helpers for translating between standard and URL-safe base64 and decoding into Buffers.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-base64url

tile.json