Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

did-jwt-vc

Package Overview
Dependencies
Maintainers
7
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

did-jwt-vc - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [1.0.6](https://github.com/decentralized-identity/did-jwt-vc/compare/1.0.5...1.0.6) (2020-08-18)
### Bug Fixes
* **deps:** update dependency did-resolver@2.1.0 & did-jwt@4.4.2 ([#48](https://github.com/decentralized-identity/did-jwt-vc/issues/48)) ([6a98103](https://github.com/decentralized-identity/did-jwt-vc/commit/6a981033f9a4aa5317a238af45022332cd57a306))
## [1.0.5](https://github.com/decentralized-identity/did-jwt-vc/compare/1.0.4...1.0.5) (2020-08-18)

@@ -2,0 +9,0 @@

5

lib/index.d.ts

@@ -0,8 +1,5 @@

import { Resolvable } from 'did-jwt';
import { JwtCredentialPayload, Issuer, JwtPresentationPayload, JWT, VerifiablePresentation, VerifiableCredential, CredentialPayload, PresentationPayload, Verifiable, W3CCredential, W3CPresentation, VerifiedCredential, VerifiedPresentation } from './types';
import { DIDDocument } from 'did-resolver';
import { transformCredentialInput, transformPresentationInput, normalizeCredential, normalizePresentation } from './converters';
export { Issuer, CredentialPayload, PresentationPayload, JwtCredentialPayload, JwtPresentationPayload, VerifiableCredential, VerifiablePresentation, VerifiedCredential, VerifiedPresentation, Verifiable, W3CCredential, W3CPresentation, transformCredentialInput, transformPresentationInput, normalizeCredential, normalizePresentation };
interface Resolvable {
resolve: (did: string) => Promise<DIDDocument>;
}
/**

@@ -9,0 +6,0 @@ * Creates a VerifiableCredential given a `CredentialPayload` or `JwtCredentialPayload` and an `Issuer`.

58

lib/types.d.ts

@@ -1,2 +0,2 @@

import { Signer, verifyJWT } from 'did-jwt';
import { Signer, JWTVerified } from 'did-jwt';
export interface JwtCredentialSubject {

@@ -9,5 +9,9 @@ [x: string]: any;

}
/**
* A JWT payload representation of a Credential
* @see https://www.w3.org/TR/vc-data-model/#jwt-encoding
*/
export interface JwtCredentialPayload {
iss?: string;
sub: string;
sub?: string;
vc: {

@@ -25,2 +29,6 @@ '@context': string[] | string;

}
/**
* A JWT payload representation of a Presentation
* @see https://www.w3.org/TR/vc-data-model/#jwt-encoding
*/
export interface JwtPresentationPayload {

@@ -61,2 +69,6 @@ vp: {

}
/**
* A more flexible representation of a {@link W3CCredential} that can be used as input to methods
* that expect it.
*/
export declare type CredentialPayload = Extensible<FixedCredentialPayload>;

@@ -104,2 +116,6 @@ /**

}
/**
* A more flexible representation of a {@link W3CPresentation} that can be used as input to methods
* that expect it.
*/
export declare type PresentationPayload = Extensible<FixedPresentationPayload>;

@@ -124,16 +140,46 @@ interface NarrowPresentationDefinitions {

}
/**
* Represents a readonly representation of a verifiable object, including the {@link Proof}
* property that can be used to verify it.
*/
export declare type Verifiable<T> = Readonly<T> & {
proof: Proof;
readonly proof: Proof;
};
export declare type JWT = string;
export declare type VerifiablePresentation = Verifiable<W3CPresentation> | JWT;
/**
* A union type for both possible representations of a Credential (JWT and W3C standard)
*
* @see https://www.w3.org/TR/vc-data-model/#proof-formats
*/
export declare type VerifiableCredential = JWT | Verifiable<W3CCredential>;
declare type UnpackedPromise<T> = T extends Promise<infer U> ? U : T;
export declare type VerifiedJWT = UnpackedPromise<ReturnType<typeof verifyJWT>>;
/**
* A union type for both possible representations of a Presentation (JWT and W3C standard)
*
* @see https://www.w3.org/TR/vc-data-model/#proof-formats
*/
export declare type VerifiablePresentation = JWT | Verifiable<W3CPresentation>;
export declare type VerifiedJWT = JWTVerified;
/**
* Represents the result of a Presentation verification.
* It includes the properties produced by `did-jwt` and a W3C compliant representation of
* the Presentation that was just verified.
*
* This is usually the result of a verification method and not meant to be created by generic code.
*/
export declare type VerifiedPresentation = VerifiedJWT & {
verifiablePresentation: Verifiable<W3CPresentation>;
};
/**
* Represents the result of a Credential verification.
* It includes the properties produced by `did-jwt` and a W3C compliant representation of
* the Credential that was just verified.
*
* This is usually the result of a verification method and not meant to be created by generic code.
*/
export declare type VerifiedCredential = VerifiedJWT & {
verifiableCredential: Verifiable<W3CCredential>;
};
/**
* Represents a tuple of a DID-URL with a `Signer` and associated algorithm.
*/
export interface Issuer {

@@ -140,0 +186,0 @@ did: string;

{
"name": "did-jwt-vc",
"version": "1.0.5",
"version": "1.0.6",
"description": "Create and verify W3C Verifiable Credentials and Presentations in JWT format",

@@ -28,3 +28,3 @@ "main": "lib/index.js",

"dependencies": {
"did-jwt": "^4.3.2"
"did-jwt": "^4.4.2"
},

@@ -61,3 +61,3 @@ "repository": {

"codecov": "3.7.2",
"did-resolver": "2.0.1",
"did-resolver": "2.1.0",
"ethr-did": "1.1.0",

@@ -64,0 +64,0 @@ "faker": "4.1.0",

@@ -8,3 +8,3 @@ import EthrDID from 'ethr-did'

} from '../index'
import { decodeJWT } from 'did-jwt'
import { decodeJWT, Resolvable } from 'did-jwt'
import { DEFAULT_VC_TYPE, DEFAULT_VP_TYPE, DEFAULT_CONTEXT } from '../constants'

@@ -71,3 +71,3 @@ import {

}
const resolver = {
const resolver: Resolvable = {
resolve: (did: string) =>

@@ -82,3 +82,3 @@ Promise.resolve({

ethereumAddress: `${did.substring(9)}`,
owner: did
controller: did
}

@@ -85,0 +85,0 @@ ]

@@ -1,2 +0,2 @@

import { createJWT, verifyJWT } from 'did-jwt'
import { createJWT, verifyJWT, Resolvable } from 'did-jwt'
import { JWT_ALG } from './constants'

@@ -27,3 +27,2 @@ import * as validators from './validators'

} from './converters'
export {

@@ -48,6 +47,2 @@ Issuer,

interface Resolvable {
resolve: (did: string) => Promise<DIDDocument>
}
/**

@@ -54,0 +49,0 @@ * Creates a VerifiableCredential given a `CredentialPayload` or `JwtCredentialPayload` and an `Issuer`.

@@ -1,2 +0,2 @@

import { Signer, verifyJWT } from 'did-jwt'
import { Signer, JWTVerified, JWTPayload } from 'did-jwt'

@@ -12,5 +12,9 @@ export interface JwtCredentialSubject {

/**
* A JWT payload representation of a Credential
* @see https://www.w3.org/TR/vc-data-model/#jwt-encoding
*/
export interface JwtCredentialPayload {
iss?: string
sub: string
sub?: string
vc: {

@@ -29,2 +33,6 @@ '@context': string[] | string

/**
* A JWT payload representation of a Presentation
* @see https://www.w3.org/TR/vc-data-model/#jwt-encoding
*/
export interface JwtPresentationPayload {

@@ -64,2 +72,6 @@ vp: {

/**
* A more flexible representation of a {@link W3CCredential} that can be used as input to methods
* that expect it.
*/
export type CredentialPayload = Extensible<FixedCredentialPayload>

@@ -110,2 +122,6 @@

/**
* A more flexible representation of a {@link W3CPresentation} that can be used as input to methods
* that expect it.
*/
export type PresentationPayload = Extensible<FixedPresentationPayload>

@@ -134,11 +150,32 @@

export type Verifiable<T> = Readonly<T> & { proof: Proof }
/**
* Represents a readonly representation of a verifiable object, including the {@link Proof}
* property that can be used to verify it.
*/
export type Verifiable<T> = Readonly<T> & { readonly proof: Proof }
export type JWT = string
export type VerifiablePresentation = Verifiable<W3CPresentation> | JWT
/**
* A union type for both possible representations of a Credential (JWT and W3C standard)
*
* @see https://www.w3.org/TR/vc-data-model/#proof-formats
*/
export type VerifiableCredential = JWT | Verifiable<W3CCredential>
type UnpackedPromise<T> = T extends Promise<infer U> ? U : T
export type VerifiedJWT = UnpackedPromise<ReturnType<typeof verifyJWT>>
/**
* A union type for both possible representations of a Presentation (JWT and W3C standard)
*
* @see https://www.w3.org/TR/vc-data-model/#proof-formats
*/
export type VerifiablePresentation = JWT | Verifiable<W3CPresentation>
export type VerifiedJWT = JWTVerified
/**
* Represents the result of a Presentation verification.
* It includes the properties produced by `did-jwt` and a W3C compliant representation of
* the Presentation that was just verified.
*
* This is usually the result of a verification method and not meant to be created by generic code.
*/
export type VerifiedPresentation = VerifiedJWT & {

@@ -148,2 +185,9 @@ verifiablePresentation: Verifiable<W3CPresentation>

/**
* Represents the result of a Credential verification.
* It includes the properties produced by `did-jwt` and a W3C compliant representation of
* the Credential that was just verified.
*
* This is usually the result of a verification method and not meant to be created by generic code.
*/
export type VerifiedCredential = VerifiedJWT & {

@@ -153,2 +197,5 @@ verifiableCredential: Verifiable<W3CCredential>

/**
* Represents a tuple of a DID-URL with a `Signer` and associated algorithm.
*/
export interface Issuer {

@@ -155,0 +202,0 @@ did: string

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc