diff --git a/apps/ssi-abstraction/src/agent/dids/dids.service.ts b/apps/ssi-abstraction/src/agent/dids/dids.service.ts index 2aad3dd5cd8e08239e465d8b554d84cdfdad82ef..ef2d8e837c15c21bed59393ab33eda7a73ef7c01 100644 --- a/apps/ssi-abstraction/src/agent/dids/dids.service.ts +++ b/apps/ssi-abstraction/src/agent/dids/dids.service.ts @@ -24,7 +24,7 @@ import { KeyType, TypedArrayEncoder, } from '@credo-ts/core'; -import { Injectable } from '@nestjs/common'; +import { Injectable, Logger } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { LEDGERS } from '../../config/ledger.js'; @@ -34,6 +34,8 @@ import { WithTenantService } from '../withTenantService.js'; @Injectable() export class DidsService { + private readonly logger = new Logger(this.constructor.name); + public constructor( private agentService: AgentService, private withTenantService: WithTenantService, @@ -138,9 +140,14 @@ export class DidsService { }; try { + this.logger.log('Registering wallet key for endorser dids'); await this.agentService.agent.wallet.createKey(privKey); - } catch { - // Key already exists, but we don't care + } catch (e) { + if (e instanceof Error && e.constructor.name === 'WalletKeyExistsError') { + this.logger.log('Wallet key already exists'); + } else { + throw e; + } } for (const indyDid of indyDids) { diff --git a/apps/ssi-abstraction/src/application.ts b/apps/ssi-abstraction/src/application.ts index 271d8cb5ef5ab477ef70b194304db46f4dc7482b..d56a9ad6481b9bdc04ad4eac3c4f59a24c69f88b 100644 --- a/apps/ssi-abstraction/src/application.ts +++ b/apps/ssi-abstraction/src/application.ts @@ -93,12 +93,8 @@ export class Application implements OnApplicationBootstrap { public async onApplicationBootstrap() { await this.natsClient.connect(); - try { - await firstValueFrom( - this.natsClient.send(EventDidsRegisterEndorserDid.token, {}), - ); - } catch { - // If there was an error, we don't want to crash the application - } + await firstValueFrom( + this.natsClient.send(EventDidsRegisterEndorserDid.token, {}), + ); } }