Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | 5x 5x 90x 513x | import type { Issuer } from './Issuer';
import type { JsonLDContext } from './Blockcerts';
import type { CONTENT_MEDIA_TYPES } from './contentMediaTypes';
export interface VCProof {
type: string;
created: string;
proofValue?: string;
jws?: string;
proofPurpose: string;
domain?: string;
challenge?: string;
verificationMethod: string;
chainedProofType?: string;
previousProof?: any;
cryptosuite?: string; // DataIntegrityProof spec
}
export function getVCProofVerificationMethod (proof: VCProof | VCProof[]): string {
if (Array.isArray(proof)) {
const initialProof: VCProof = proof.find(p => p.type !== 'ChainedProof2021');
return initialProof.verificationMethod;
}
return proof.verificationMethod;
}
export function isVerifiablePresentation (credential: BlockcertsV3 | VerifiablePresentation): credential is VerifiablePresentation {
return credential.type.includes('VerifiablePresentation');
}
export interface MultilingualVcField {
'@value': string;
'@language': string;
'@direction'?: string;
}
export interface VerifiablePresentation {
'@context': JsonLDContext;
id?: string;
type: string[];
verifiableCredential?: BlockcertsV3[];
holder?: string;
}
export interface VCObject {
type: string;
id?: string;
}
export interface VerifiableCredential {
'@context': JsonLDContext;
id: string;
type: string[];
credentialStatus?: VCCredentialStatus | VCCredentialStatus[];
credentialSchema?: VCCredentialSchema | VCCredentialSchema[];
issuer: string | Issuer;
credentialSubject?: any | any[];
expirationDate?: string;
evidence?: VCObject | VCObject[];
holder?: {
type?: string;
id?: string;
};
issued?: string;
issuanceDate?: string;
refreshService?: VCObject | VCObject[];
termsOfUse?: VCObject | VCObject[];
proof: VCProof | VCProof[];
// VC V2
validFrom?: string; // expect dateTime
validUntil?: string; // expect dateTime
name?: string | MultilingualVcField[];
description?: string | MultilingualVcField[];
}
export interface BlockcertsV3Display {
contentMediaType: CONTENT_MEDIA_TYPES;
content: string;
contentEncoding?: string;
}
export interface VCCredentialStatus {
id: string;
type: string;
statusPurpose: string;
statusListIndex: string;
statusListCredential: string;
}
export interface VCCredentialSchema {
type: string;
id: string;
}
// CredentialSubject can technically be anything the issuer wants, but we define a basic structure
export interface BlockcertsV3BasicCredentialSubject {
id?: string;
publicKey?: string;
name?: string;
type?: string;
claim?: {
type?: string;
id?: string;
name?: string;
description?: string;
criteria?: string;
};
}
export interface BlockcertsV3 extends VerifiableCredential {
credentialSubject: BlockcertsV3BasicCredentialSubject | BlockcertsV3BasicCredentialSubject[];
metadata?: string;
display?: BlockcertsV3Display;
nonce?: string;
/**
* @deprecated v3 alpha only
*/
metadataJson?: string;
}
export type UnsignedBlockcertsV3 = Omit<BlockcertsV3, 'proof'>;
|