import { Injectable } from '@nestjs/common' ; import { CoreService } from '@fc/core' ; import { CryptographyFcaService , IAgentIdentity } from '@fc/cryptography-fca' ; import { FeatureHandler , IFeatureHandler } from '@fc/feature-handler' ; import { LoggerService } from '@fc/logger' ; import { OidcClientSession } from '@fc/oidc-client' ; import { ISessionService } from '@fc/session' ; @ Injectable ( ) @ FeatureHandler ( 'core-fca-default-verify' ) export class CoreFcaDefaultVerifyHandler implements IFeatureHandler { constructor ( private readonly logger , private readonly core , private readonly cryptographyFca ) { this . logger . setContext ( this . constructor . name ) ; } see IVerifyFeatureHandlerHandleArgument todo author Hugues
     *  date param req async handle ( sessionOidc ) { this . logger . debug ( 'getConsent service: ##### core-fca-default-verify' ) ; const { idpId , idpIdentity , idpAcr , spId , spAcr } = await sessionOidc . get ( ) ; this . core . checkIfAcrIsValid ( idpAcr , spAcr ) ; todo const agentIdentity = idpIdentity as unknown as IAgentIdentity ; const agentHash = this . cryptographyFca . computeIdentityHash ( idpId , agentIdentity ) ; await this . core . checkIfAccountIsBlocked ( agentHash ) ; const subSp = this . cryptographyFca . computeSubV1 ( spId , agentHash ) ; const { sub : subIdp } = agentIdentity ; const accountId = await this . core . computeInteraction ( { spId , subSp , hashSp : agentHash , } , { idpId , subIdp , } ) ; const spIdentity = { ... idpIdentity , sub : subSp , idp_id : idpId , idp_acr : idpAcr , } ; const idpIdentityCleaned = { sub : idpIdentity . sub , } ; const session = { amr : [ 'fca' ] , idpIdentity : idpIdentityCleaned , spIdentity : spIdentity , accountId , } ; this . logger . trace ( { session } ) ; await sessionOidc . set ( session ) ; } }