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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@verana-labs/verre

v0.2.5

Published

The **Verana Trust Resolver** library provides a set of functions to resolve Decentralized Identifiers (DIDs), validate their associated documents, process Verifiable Credentials, and check their trust status according to the [**Verifiable Trust** specifi

Readme

Verana Trust Resolver (VerRe)

The Verana Trust Resolver library provides a set of functions to resolve Decentralized Identifiers (DIDs), validate their associated documents, process Verifiable Credentials, and check their trust status according to the Verifiable Trust specifications of the Verana blockchain.

The main entry point for using the resolver is the resolve function, which allows users to retrieve and validate a DID document, process its credentials, and check its trust status against the Verana Trust Registry.


Table of Contents

  1. Getting Started
  2. Overview
  3. Importing the Method
  4. Method Signature
  5. Parameters
  6. Return Value
  7. Usage Example
  8. Notes

Getting Started

To use the Verana Trust Resolver, install the library and import the necessary modules:

npm install @verana-labs/verre

or

yarn add @verana-labs/verre

Overview

The Verre resolver provides two primary resolution methods:

  • resolveDID: Resolves a Decentralized Identifier (DID), retrieves its DID Document, validates its services, and performs trust evaluation using configured registries.
  • resolveCredential: Validates a W3C Verifiable Credential by extracting its issuer and evaluating it against trust registries.

Both methods return an object describing the trust evaluation outcome.

Import

import { resolveDID, resolveCredential, verifyPermissions } from '@verana-labs/verre';

Method Signatures

async function resolveDID(did: string, options?: ResolverConfig): Promise<TrustResolution>
async function resolveCredential(credential: W3cVerifiableCredential, options?: ResolverConfig): Promise<TrustResolution>
async function verifyPermissions(options: VerifyPermissionsOptions): Promise<{ verified: boolean }>

Parameters

Common (options shared across methods)

  • verifiablePublicRegistries (VerifiablePublicRegistry[]): Trusted registry definitions for validation.
  • didResolver (Resolver, optional): Custom universal resolver instance.
  • cache (TrustResolutionCache<string, Promise, optional): Cache store for trust resolution results. When provided, a successful resolution is stored keyed by DID and returned directly on subsequent calls. Any object implementing the TrustResolutionCache interface is accepted, the library provides InMemoryCache as a built-in implementation.
  • skipDigestSRICheck (boolean, optional): When true, skips verification of the credential integrity (digestSRI). Defaults to false.
  • logger (IVerreLogger, optional): Logger instance for the resolution process. Accepts any object that implements the IVerreLogger interface.

Method Details

resolveDID

Parameters

  • did (string, required): DID to resolve.
  • options (ResolverConfig): Resolver configuration.

Return Value

Resolves to a TrustResolution containing:

  • didDocument (DIDDocument, optional): Resolved DID Document.
  • verified (boolean): Whether the DID and its services passed trust checks.
  • outcome (TrustResolutionOutcome): Final trust evaluation status.
  • metadata (TrustResolutionMetadata, optional): Error or diagnostic information.
  • service (IService, optional): Verified DID service.
  • serviceProvider (ICredential, optional): Credential representing the trust provider.

resolveCredential

Parameters

  • credential (W3cVerifiableCredential, required): Credential to resolve.
  • options (ResolverConfig): Resolver configuration.

Return Value

Resolves to a TrustResolution containing:

  • issuer (string): Identifier of the credential issuer.
  • verified (boolean): Whether the issuer passed trust validation.
  • outcome (TrustResolutionOutcome): Final trust evaluation status.

verifyPermissions

Parameters

  • did (string): The DID of the entity to validate permissions for.
  • jsonSchemaCredentialId (string): URL or reference to the JSON schema defining the credential structure.
  • issuanceDate (string): Date when the credential was issued.
  • verifiablePublicRegistries (VerifiablePublicRegistry[]): Trusted registries used to validate permission rules.
  • permissionType (PermissionType): The type of permission to verify.
  • logger (IVerreLogger, optional): Logger used for debugging

Usage Example

import { resolve } from '@verana-labs/verre';

(async () => {
  const did = 'did:example:123456';
  const verifiablePublicRegistries = [
    {
      name: 'vpr:hostname:main',
      baseurls: ['http://testTrust.com'],
      production: true,
    },
  ];

  const resolution = await resolveDID(did, { verifiablePublicRegistries, agentContext });
  console.log('Resolved DID Document:', resolution.resolvedDidDocument);
  console.log('Trust Metadata:', resolution.metadata);
})();

Using Credo-TS with a Default DID Resolver

import { Resolver } from 'did-resolver'
import { AgentContext } from '@credo-ts/core'

// Set up the agent
const agent = await setupAgent({ name: 'Default DID Resolver Test with Credo' })
const agentContext = agent.dependencyManager.resolve(AgentContext)

// By default, if no resolver is provided, the Credo-TS resolver will be used
await resolveDID('did:web:example.com', {
  trustRegistryUrl: 'https://registry.example.com',
  agentContext,
})

Using Credo-TS to Provide a Custom DID Resolver

import { Resolver } from 'did-resolver'
import { DidResolverService, AgentContext } from '@credo-ts/core'

// Set up the agent
const agent = await setupAgent({ name: 'DID Service Test' })
const didResolverService = agent.dependencyManager.resolve(DidResolverService)
const agentContext = agent.dependencyManager.resolve(AgentContext)

// Create a custom resolver using Credo-TS resolution strategies
const didResolver = new Resolver({
  web: async (did: string) => didResolverService.resolve(agentContext, did),
  key: async (did: string) => didResolverService.resolve(agentContext, did),
  peer: async (did: string) => didResolverService.resolve(agentContext, did),
  jwk: async (did: string) => didResolverService.resolve(agentContext, did),
})
const verifiablePublicRegistries = [
  {
    name: 'https://vpr-hostname/vpr',
    baseurls: ['http://testTrust.com'],
    production: true,
  },
];

// Use the custom resolver in the call to `resolve`
await resolveDID('did:web:example.com', {
  verifiablePublicRegistries,
  didResolver,
  agentContext,
})

Example: Agent with In-Memory Askar Wallet and DID Resolver (Generic)

import { Agent, AgentContext, InitConfig } from '@credo-ts/core'
import { AskarModule } from '@credo-ts/askar'
import { agentDependencies } from '@credo-ts/node'
import { ariesAskar } from '@hyperledger/aries-askar-nodejs'
import { Resolver } from 'did-resolver'
import * as didWeb from 'web-did-resolver'

import { getAskarStoreConfig } from '../src/helpers'

// Create the in-memory wallet config
const walletConfig = getAskarStoreConfig('InMemoryTestAgent', { inMemory: true })
const didResolver = new Resolver(didWeb.getResolver())

// Agent initialization config
const config: InitConfig = {
  label: 'InMemoryTestAgent',
  walletConfig,
}

// Create and initialize the agent
const agent = new Agent({
  config,
  dependencies: agentDependencies,
  modules: {
    askar: new AskarModule({ ariesAskar }),
  },
})

await agent.initialize()

// Resolve dependencies
const agentContext = agent.dependencyManager.resolve(didResolver, AgentContext)

// Example usage of the DID Resolver
const result = await resolveDID('did:web:example.com', {
  agentContext,
})
console.log('Resolved DID Document:', result)

Notes

  • The method supports ECS (Entity Credential Schema) identifiers such as ORG, PERSON, USER-AGENT, and SERVICE.
  • The function exits early if both issuerCredential and verifiableService are found during credential processing.

This method is essential for resolving and validating DIDs in a trusted ecosystem.