@credo-ts/core
Version:
<p align="center"> <br /> <img alt="Credo Logo" src="https://github.com/openwallet-foundation/credo-ts/blob/c7886cb8377ceb8ee4efe8d264211e561a75072d/images/credo-logo.png" height="250px" /> </p> <h1 align="center"><b>Credo - Core</b></h1
93 lines • 5.86 kB
text/typescript
import { Query, QueryOptions } from "../../storage/StorageService.mjs";
import { ClaimFormat } from "./models/ClaimFormat.mjs";
import { W3cV2VerifyCredentialResult, W3cV2VerifyPresentationResult } from "./models/W3cV2VerifyResult.mjs";
import "./models/index.mjs";
import { W3cV2CredentialRecord } from "./repository/W3cV2CredentialRecord.mjs";
import { W3cV2CredentialRepository } from "./repository/W3cV2CredentialRepository.mjs";
import "./repository/index.mjs";
import { W3cV2SdJwtCredentialService } from "./sd-jwt-vc/W3cV2SdJwtCredentialService.mjs";
import "./sd-jwt-vc/index.mjs";
import { W3cV2SignCredentialOptions, W3cV2SignPresentationOptions, W3cV2StoreCredentialOptions, W3cV2VerifyCredentialOptions, W3cV2VerifyPresentationOptions } from "./W3cV2CredentialServiceOptions.mjs";
import { W3cV2JwtCredentialService } from "./jwt-vc/W3cV2JwtCredentialService.mjs";
import { W3cV2VerifiableCredential } from "./models/credential/W3cV2VerifiableCredential.mjs";
import { W3cV2DataIntegrityCredentialService } from "./data-integrity/W3cV2DataIntegrityCredentialService.mjs";
import "./data-integrity/index.mjs";
import { W3cV2VerifiablePresentation } from "./models/presentation/W3cV2VerifiablePresentation.mjs";
import { AgentContext } from "../../agent/context/AgentContext.mjs";
import "../../agent/context/index.mjs";
//#region src/modules/vc/W3cV2CredentialService.d.ts
export declare class W3cV2CredentialService {
private w3cV2CredentialRepository;
private w3cV2SdJwtCredentialService;
private w3cV2JwtCredentialService;
private w3cV2DataIntegrityCredentialService;
constructor(w3cV2CredentialRepository: W3cV2CredentialRepository, w3cV2SdJwtCredentialService: W3cV2SdJwtCredentialService, w3cV2JwtCredentialService: W3cV2JwtCredentialService, w3cV2DataIntegrityCredentialService: W3cV2DataIntegrityCredentialService);
/**
* Signs a credential
*
* @param credential the credential to be signed
* @returns the signed credential
*/
signCredential<Format extends ClaimFormat.JwtW3cVc | ClaimFormat.SdJwtW3cVc | ClaimFormat.DiVc>(agentContext: AgentContext, options: W3cV2SignCredentialOptions<Format>): Promise<W3cV2VerifiableCredential<Format>>;
/**
* Verifies the signature(s) of a credential
*/
verifyCredential(agentContext: AgentContext, options: W3cV2VerifyCredentialOptions): Promise<W3cV2VerifyCredentialResult>;
/**
* Signs a presentation including the credentials it includes
*
* @param presentation the presentation to be signed
* @returns the signed presentation
*/
signPresentation<Format extends ClaimFormat.JwtW3cVp | ClaimFormat.SdJwtW3cVp | ClaimFormat.DiVp>(agentContext: AgentContext, options: W3cV2SignPresentationOptions<Format>): Promise<W3cV2VerifiablePresentation<Format>>;
/**
* Verifies a W3C V2 verifiable presentation and each enclosed credential entry.
*
* Flow:
* 1. Verifies the outer VP using the format-specific service (`vp+jwt` or `vp+sd-jwt`).
* 2. Derives the presenter identifier (holder id, or JWT verification method controller fallback).
* 3. Recursively walks enclosed entries and verifies each credential entry with the matching
* credential verifier (`vc+jwt` or `vc+sd-jwt`) based on the actual enclosed format.
* 4. Adds `credentialSubjectAuthentication` validation to each credential result by checking
* whether the authenticated presenter matches at least one credentialSubject id.
*
* Current support and constraints:
* - Compact string presentations are accepted for `vp+jwt` and `vp+sd-jwt` and normalized
* to typed presentation instances before routing.
* - `di_vp` routes through the DI credential service for outer-VP verification.
* - `di_vc` entries route through the DI credential service for entry verification.
* - Nested VP entries are treated as invalid. VC 2.0 verifiable presentations support VC entries,
* not VP-within-VP entries.
*
* Return semantics:
* - `presentation` contains the outer VP verification result.
* - `credentialEntries` contains one result per traversed credential entry, including unsupported
* entries as invalid results.
* - Top-level `isValid` is true only if the outer VP and all credential entry validations are valid.
*
* @param agentContext The framework agent context used for resolution and cryptographic checks.
* @param options Verification input containing the presentation to verify.
* @returns Aggregated presentation and credential-entry verification result.
*/
verifyPresentation(agentContext: AgentContext, options: W3cV2VerifyPresentationOptions): Promise<W3cV2VerifyPresentationResult>;
private verifyPresentationEntry;
private extractCredentialEntriesFromPresentation;
private extractCredentialEntriesFromResolvedPresentation;
private createInvalidCredentialEntryResult;
private getClaimFormat;
private mergeCredentialSubjectAuthenticationValidation;
/**
* Writes a credential to storage
*
* @param record the credential to be stored
* @returns the credential record that was written to storage
*/
storeCredential(agentContext: AgentContext, options: W3cV2StoreCredentialOptions): Promise<W3cV2CredentialRecord>;
removeCredentialRecord(agentContext: AgentContext, id: string): Promise<void>;
getAllCredentialRecords(agentContext: AgentContext): Promise<W3cV2CredentialRecord[]>;
getCredentialRecordById(agentContext: AgentContext, id: string): Promise<W3cV2CredentialRecord>;
findCredentialsByQuery(agentContext: AgentContext, query: Query<W3cV2CredentialRecord>, queryOptions?: QueryOptions): Promise<W3cV2VerifiableCredential[]>;
findCredentialRecordByQuery(agentContext: AgentContext, query: Query<W3cV2CredentialRecord>): Promise<W3cV2VerifiableCredential | undefined>;
}
//#endregion
//# sourceMappingURL=W3cV2CredentialService.d.mts.map