import { IPayloadProtectionSigning } from 'verifiablecredentials-crypto-sdk-typescript'; import { IValidationOptions } from '../options/IValidationOptions'; import IValidatorOptions from '../options/IValidatorOptions'; import ClaimToken, { TokenType } from '../verifiable_credential/ClaimToken'; import { IValidationResponse } from './IValidationResponse'; import { IExpectedVerifiablePresentation, IExpectedVerifiableCredential, IExpectedSiop, IExpectedAudience } from '../options/IExpected'; /** * Helper Class for validation */ export declare class ValidationHelpers { private validatorOptions; private validationOptions; private tokenType; /** * Create new instance of * @param validatorOptions The validator options * @param validationOptions Issuance validationOptions containing delegates * @param tokenType Describe the type of token for error messages */ constructor(validatorOptions: IValidatorOptions, validationOptions: IValidationOptions, tokenType: TokenType); /** * Get the token object from the token * @param validationResponse The response for the requestor * @param token The token to parse * @returns validationResponse.result, validationResponse.status, validationResponse.detailedError * @returns validationResponse.didSignature The deserialized token * @returns validationResponse.didKid The kid used to sign the token * @returns validationResponse.did The DID used to sign the token * @returns validationResponse.payloadObject The parsed payload * @returns validationResponse.issuer The issuer of the token */ getTokenObject(validationResponse: IValidationResponse, token: string | object): Promise; /** * Resolve the DID and retrieve the public keys * @param validatorOptions The validator options * @param validationOptions Issuance validationOptions containing delegates * @param validationResponse The response for the requestor * @returns validationResponse.result, validationResponse.status, validationResponse.detailedError * @returns validationResponse.didDocument The DID document * @returns validationResponse.didSigningPublicKey The public key to validate the token signature */ resolveDidAndGetKeys(validationResponse: IValidationResponse): Promise; /** * Retireve public key from did document * @param validationResponse The response for the requestor */ static getPublicKeyFromDidDocument(didDocument: any, kid: string, did: string): any; /** * Check the time validity of the token * @param validationResponse The response for the requestor * @param clockSkewToleranceSeconds Drift used to extend time checks in seconds. Covers for clock drifts * @returns validationResponse.result, validationResponse.status, validationResponse.detailedError */ checkTimeValidityOnToken(validationResponse: IValidationResponse, clockSkewToleranceSeconds?: number): IValidationResponse; /** * Check the scope validity of the token such as iss and aud * @param validationResponse The response for the requestor * @returns validationResponse.result, validationResponse.status, validationResponse.detailedError */ checkScopeValidityOnIdToken(validationResponse: IValidationResponse, expected: IExpectedAudience): IValidationResponse; /** * Check the scope validity of the verifiable presentation token such as iss and aud * @param validationResponse The response for the requestor * @param expected Expected output of the verifiable credential * @param siopDid The DID which has been extablished during the SIOP validation * @returns validationResponse.result, validationResponse.status, validationResponse.detailedError */ checkScopeValidityOnVpToken(validationResponse: IValidationResponse, expected: IExpectedVerifiablePresentation, siopDid: string): IValidationResponse; /** * Check the scope validity of the verifiable credential token such as iss and aud * @param validationResponse The response for the requestor * @param expected Expected output of the verifiable credential * @param siopDid The DID which has been extablished during the SIOP validation * @returns validationResponse.result, validationResponse.status, validationResponse.detailedError */ checkScopeValidityOnVcToken(validationResponse: IValidationResponse, _expected: IExpectedVerifiableCredential, siopDid: string): IValidationResponse; /** * Check the scope validity of the token such as iss and aud * @param validationResponse The response for the requestor * @param expected Expected output of the verifiable credential * @returns validationResponse.result, validationResponse.status, validationResponse.detailedError */ checkScopeValidityOnSiopToken(validationResponse: IValidationResponse, expected: IExpectedSiop): IValidationResponse; /** * Validate the DID signature on the token * @param validationResponse The response for the requestor * @param token Token to validate * @returns validationResponse.result, validationResponse.status, validationResponse.detailedError */ validateDidSignature(validationResponse: IValidationResponse, token: IPayloadProtectionSigning): Promise; /** * fetch the public keys for an open id token * @param validationResponse The response for the requestor * @param token ClaimToken instance */ fetchOpenIdTokenPublicKeys(validationResponse: IValidationResponse, token: ClaimToken): Promise; /** * Validate the signature on a token. Fetch validation key * @param validationResponse The response for the requestor * @returns validationResponse.result, validationResponse.status, validationResponse.detailedError * @returns validationResponse.issuer The issuer found in the configuration. Should match the issuer in the token. */ fetchKeyAndValidateSignatureOnIdToken(validationResponse: IValidationResponse, token: ClaimToken): Promise; /** * Validation a signed token * @param validationResponse The response for the requestor * @param token Token to validate * @param key used to validate token */ validateSignatureOnToken(validationResponse: IValidationResponse, token: ClaimToken, key: any): Promise; }