import { RulesValidationError } from "../error_handling/RulesValidationError" ; /**
 * Defines the presentation protcol
 */ export enum AuthenticationScheme { /**
     * basic authentication in the authorization header aka RFC 7617
     */ basic = "basic" , /**
     * use a shared secret in a custom header
     */ sharedSecret = "sharedSecret" , /**
     * use did authentication
     */ did = "did" , /**
     * use did authentication with proof of possession
     */ didPop = "didPop" } /**
 * Data Model to describe external service authentication
 */ export class AuthenticationModel { param type param secret param header constructor ( public readonly type , public readonly secret , public readonly header ? ) { } param input static fromJSON ( input ) { const { header , secret , type } = input ; if ( ! secret ) { throw new RulesValidationError ( 'missing required "secret" property' ) ; } if ( ! type ) { throw new RulesValidationError ( 'missing required "type" property' ) ; } if ( ! Object . values ( AuthenticationScheme ) . includes ( type ) ) { throw new RulesValidationError ( `${ type } is not a valid AuthenticationScheme value` ) ; } return new AuthenticationModel ( type , secret , header ) ; } }