New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@trace4eu/verifiable-presentation

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trace4eu/verifiable-presentation

Verifiable Presentation validator library

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
2
Created
Source

verifiable-presentation library

It is a library designed to provide validation functionality for JSON Web Tokens (JWTs) verifiable presentations. It exposes a method to validate verifiable presentations. This library supports did:ebsi method and it makes use of the EBSI library https://www.npmjs.com/package/@cef-ebsi/verifiable-presentation

Features

  • Designed for validating DID:key presentations containing EBSI issued credentials.
  • Validate presentation submission and presentation definition.
  • Extract the vp_token data.

Installation

You can install @trace4eu/verifiable-presentation via npm:

npm install @trace4eu/verifiable-presentation

Usage

Importing the library

import {
  validateJwtVP,
} from '@trace4eu/verifiable-presentation';

Validating JSON Web Token (JWT) Verifiable Presentations (VPs)

const validationResult = await validateJwtVP(jwtPresentation, audience, options);

Optional option parameters

interface PresentationValidationOptions {
  presentationSubmission?: PresentationSubmission;
  presentationDefinition?: PresentationDefinition;
  didRegistry?: string;
  ebsiAuthority?: string;
}

Validation Response

The response object will follow the interface:

interface ValidationResult {
  valid: boolean;
  messages?: string[];
  vpData?: VPTokenData;
}
  • If the valid property is false, the messages array will include reasons why the credential is not valid.
  • vpData contains the decoded Verifiable Presentation with the following data:
{
    "decodedVerifiablePresentation": {
        ...
    },
    "descriptorMapIds": [
        "urn:did:123456"
    ],
    "verifiableCredentials": [
        {
            "format": "jwt",
            "verifiableCredential": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpX..."
        }
    ],
    "verifiableCredentialsDecoded": [
        {
            ...
        }
    ],
    "vpToken": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImRpZ...",
    "vpTokenIssuer": "did:key:z2dmzD81cgPx..."
}

FAQs

Package last updated on 21 Aug 2024

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