import { injectable } from 'tsyringe' ; import { ArianeeTokenId } from '../../../../models/ArianeeTokenId' ; import { ConsolidatedCertificateRequest } from '../../certificateSummary/certificateSummary' ; import { CertificateDetails } from '../certificateDetailsService/certificatesDetailsService' ; import { ContractService } from '../contractService/contractsService' ; import { IdentityService } from '../identityService/identityService' ; import { WalletService } from '../walletService/walletService' ; @ injectable ( ) export class CertificateAuthorizationService { constructor ( private contractService , private identityService , private certificateDetailsService , private walletService ) { } param certificateId public getMessageSenders = async ( parameters ) : Promise < { [ key ] : boolean ; } > => { const { address } = await this . certificateDetailsService . fetchCertificateIssuer ( parameters ) ; const { certificateId } = parameters ; const currentAddress = this . walletService . address ; const isIssuerAuthorized = await this . contractService . whitelistContract . methods . isAuthorized ( certificateId , address , currentAddress ) . call ( ) ; return { [ address ] : isIssuerAuthorized } ; } ; public setMessageAuthorizationFor = async ( certificateId , senderAddress , isAuthorized ) : Promise < any > => { return this . contractService . whitelistContract . methods . addBlacklistedAddress ( senderAddress , certificateId , ! isAuthorized ) . send ( ) ; } ; }