Skip to content

Replace jose dependency with Web Crypto API #5

Description

@melvincarvalho

Summary

Replace the jose npm dependency with the native Web Crypto API to achieve a truly zero-dependency library.

Motivation

  • The library advertises itself as "minimal, zero-build" but still pulls in jose (~45kb)
  • Modern browsers ship Web Crypto API with full support for JWT signing, verification, and key generation
  • Removing jose means zero dependencies, smaller bundle, no supply chain risk

Web Crypto equivalents

jose function Web Crypto replacement
generateKeyPair crypto.subtle.generateKey
SignJWT crypto.subtle.sign + manual JWT construction
jwtVerify crypto.subtle.verify
exportJWK crypto.subtle.exportKey('jwk', ...)
calculateJwkThumbprint crypto.subtle.digest('SHA-256', ...)
createRemoteJWKSet fetch + crypto.subtle.importKey
decodeJwt JSON.parse(atob(token.split('.')[1]))

Acceptance criteria

  • All jose imports replaced with Web Crypto API calls
  • jose removed from package.json dependencies
  • Zero npm dependencies
  • Existing tests still pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions