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

URL Token Encoder

A small utility that turns text or binary payloads into URL-safe tokens using base64url encoding.

Capabilities

Encodes text payloads

  • Given the UTF-8 string "hello world", it returns the base64url string "aGVsbG8gd29ybGQ". @test

Encodes binary buffers

  • Given a Buffer containing the bytes de ad be ef (hex), it returns the base64url string "3q2-7w". @test

Honors explicit input encoding

  • When provided a string built from the bytes [0x00, 0xff, 0x10] and an encoding option set to "binary", it returns the base64url string "AP8Q". @test

Implementation

@generates

API

export interface TokenOptions {
  encoding?: BufferEncoding;
}

/**
 * Creates a URL-safe base64 token from text or binary input.
 */
export function createUrlToken(
  input: string | Buffer,
  options?: TokenOptions
): string;

Dependencies { .dependencies }

base64url { .dependency }

Provides base64url transformations for text and binary data.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-base64url

tile.json