npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@vecrea/oid4vc-verifier-frontend-core

v0.1.0

Published

Frontend core library for OpenID for Verifiable Credentials (OID4VC) verifiers with hexagonal architecture

Readme

OID4VC Verifier Frontend Core

Overview

This project is a frontend core library for OpenID for Verifiable Credentials (OID4VC) verifiers. It adopts hexagonal architecture (ports and adapters pattern) and provides credential verification functionality based on the OID4VC protocol.

Key Features

  • Transaction Initialization: Start transactions for credential exchange with wallets
  • Wallet Response Processing: Receive and verify credential presentations from wallets
  • JARM Verification: Validation of JWT secured authorization response messages
  • MDOC Verification: Validation of ISO/IEC 18013-5 mobile driver's license formats
  • Session Management: Secure management of transaction states
  • Encryption Support: Secure communication through ephemeral ECDH key pairs

Architecture

This library is designed following hexagonal architecture and consists of the following main components:

Core Modules (/lib)

1. Domain Layer (/domain)

  • AuthorizationResponse: Domain model for authorization response
  • EphemeralECDHPrivateJwk / EphemeralECDHPublicJwk: Ephemeral ECDH key pairs
  • JarmOption: JARM (JWT secured authorization response) options
  • Nonce: Cryptographic nonce management
  • PresentationId: Presentation identifier

2. Services Layer (/services)

  • InitTransactionService: Transaction initialization service

    • User agent validation
    • Nonce generation
    • Ephemeral ECDH key pair generation
    • API communication
    • Session storage
    • Wallet redirect URI generation
  • GetWalletResponseService: Wallet response retrieval service

    • Session validation
    • API communication
    • JARM JWT verification
    • MDOC verification
    • Return verification results

3. Ports Layer (/ports)

  • Input Ports (/input): Application entry points

    • InitTransaction: Transaction initialization interface
    • GetWalletResponse: Wallet response retrieval interface
  • Output Ports (/out): Interfaces to external systems

    • HTTP communication
    • Session management
    • Encryption processing
    • Configuration management

4. Dependency Injection (/di)

  • PortsInput: Application entry point contracts
  • PortsOut: External system dependency contracts
  • Configuration: Application configuration contracts
  • AbstractPortsOut: Default implementation of output ports
  • AbstractConfiguration: Default implementation of configuration

5. Adapters Layer (/adapters)

  • Concrete integration implementations with external systems

Usage

Basic Usage Example

// 1. Create environment-specific configuration
class ProductionConfig extends AbstractConfiguration {
  apiBaseUrl() { return process.env.API_URL || 'https://api.prod.com'; }
  publicUrl() { return process.env.PUBLIC_URL || 'https://app.prod.com'; }
  walletUrl() { return process.env.WALLET_URL || 'https://wallet.prod.com'; }
  initTransactionApiPath() { return '/api/v1/init'; }
  walletResponseRedirectPath() { return '/callback'; }
}

// 2. Create port implementations
class ProductionPortsOut extends AbstractPortsOut {
  generatePresentationDefinition() {
    return createPresentationDefinitionService();
  }
  session() {
    return createRedisSession(this.config.redisUrl());
  }
}

// 3. Implement input ports
class DefaultPortsInput implements PortsInput {
  constructor(private portsOut: PortsOut) {}
  initTransaction() {
    return createInitTransactionService(this.portsOut);
  }
}

// 4. Wire everything together
const config = new ProductionConfig();
const portsOut = new ProductionPortsOut(config);
const portsInput = new DefaultPortsInput(portsOut);

// 5. Use in application
const app = createApp(portsInput);

Dependencies

Main Dependencies

  • cbor-x: CBOR (Concise Binary Object Representation) encoding
  • qrcode: QR code generation
  • ua-parser-js: User agent parsing
  • uuid: UUID generation
  • zod: Schema validation

Peer Dependencies

  • @vecrea/oid4vc-core: OID4VC core functionality
  • @vecrea/oid4vc-prex: Presentation exchange functionality

Development

Scripts

  • npm run build: Run type checking and build
  • npm test: Run tests
  • npm run test:coverage: Run tests with coverage
  • npm run typecheck: TypeScript type checking

Testing

The project provides a comprehensive test suite using Vitest:

  • Unit tests (for each module)
  • Integration tests (interactions between services)
  • Error handling tests

Architecture Benefits

  • Testability: Easy mocking and unit testing through interfaces
  • Flexibility: Interchangeable implementations for different environments
  • Separation of Concerns: Clear boundaries between business logic and infrastructure
  • Type Safety: Full TypeScript support with compile-time validation
  • Configuration Management: Centralized and type-safe configuration handling