Sign In

@aauth/interaction-code

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aauth/interaction-code

AAuth interaction code generation and canonicalization (Crockford base32, spec §2.6)

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
2
Created
Source

@aauth/interaction-code

AAuth interaction code generation and canonicalization, implementing the Crockford base32 format specified in draft-hardt-oauth-aauth-protocol §2.6.

Install

npm install @aauth/interaction-code

API

generateCode(): string

Generates an 8-symbol Crockford base32 interaction code (40 bits of entropy) in canonical XXXX-XXXX form. The returned value is ready to use as a storage key.

import { generateCode } from '@aauth/interaction-code'

const code = generateCode()  // e.g. "A1B2-C3D4"
store.set(code, pendingData)

canonicalizeCode(input: string): string

Canonicalizes user-presented input to XXXX-XXXX form for storage lookup. Handles:

  • Hyphens in any position (stripped, then reinserted at position 4)
  • Lowercase input (uppercased)
  • Crockford decode aliases: I/L1, O0
import { canonicalizeCode } from '@aauth/interaction-code'

// All of these look up the same stored record:
store.get(canonicalizeCode('a1b2c3d4'))    // → 'A1B2-C3D4'
store.get(canonicalizeCode('A1B2-C3D4'))  // → 'A1B2-C3D4'
store.get(canonicalizeCode('a1b2-c3d4'))  // → 'A1B2-C3D4'

CROCKFORD32: string

The Crockford base32 alphabet: 0123456789ABCDEFGHJKMNPQRSTVWXYZ (omits I, L, O, U).

Code format

  • Alphabet: Crockford base32 (32 symbols, no visually ambiguous characters)
  • Entropy: 40 bits (5 random bytes → 8 × 5-bit symbols)
  • Display: XXXX-XXXX — hyphen at position 4 for human readability only
  • Storage: XXXX-XXXX — canonical form includes hyphen
  • Lookup: call canonicalizeCode(userInput) before comparing

Keywords

aauth

FAQs

Package last updated on 15 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts