import { Injectable } from '@nestjs/common' ; import { ConfigService } from '@fc/config' ; import { CryptographyService } from '@fc/cryptography' ; import { CryptographyEidasConfig } from './dto/cryptography-eidas-config' ; import { IPivotIdentity } from './interfaces/pivot-identity.interface' ; @ Injectable ( ) export class CryptographyEidasService { constructor ( private readonly crypto , private readonly config ) { } param pivotIdentity returns computeIdentityHash ( { sub } ) { return this . crypto . hash ( sub , 'binary' , 'sha256' , 'base64' ) ; } param providerRef param identityHash returns computeSubV1 ( providerRef , identityHash ) { const { subSecretKey } = this . config . get < CryptographyEidasConfig > ( 'CryptographyEidas' ) ; const data = [ providerRef , identityHash , subSecretKey ] ; return `${ this . crypto . hash ( data . join ( '' ) ) }v1` ; } }