Skip to content

Commit

Permalink
fix: Fix problem with agent initialize [DEV-3146] (#346)
Browse files Browse the repository at this point in the history
* Fix problem with initialization of agent.

* Add semicolon.

* Add constructor for unauthorized class

---------

Co-authored-by: Andrew Nikitin <andrew.nikitin@cheqd.io>
  • Loading branch information
abdulla-ashurov and Andrew Nikitin committed Aug 21, 2023
1 parent 4075314 commit 45e1074
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/services/identity/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import type { StatusCheckResult } from "@cheqd/did-provider-cheqd";
import { Veramo } from "./agent.js";

export class DefaultIdentityService extends AbstractIdentityService {
constructor() {
super();
this.agent = this.initAgent()
}

async resolveDid(did: string, agentId?: string): Promise<DIDResolutionResult> {
return Veramo.instance.resolveDid(this.initAgent(), did)
}
Expand Down
5 changes: 5 additions & 0 deletions src/services/identity/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ const {
} = process.env

export class LocalIdentityService extends DefaultIdentityService {
constructor() {
super();
this.agent = this.initAgent();
}

initAgent() {
if (!DEFAULT_FEE_PAYER_MNEMONIC) {
throw new Error(`No fee payer found`)
Expand Down
5 changes: 5 additions & 0 deletions src/services/identity/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ const {
export class PostgresIdentityService extends DefaultIdentityService {
privateStore?: AbstractPrivateKeyStore

constructor() {
super();
this.agent = this.initAgent();
}

initAgent() {
if (this.agent) return this.agent
const dbConnection = Connection.instance.dbConnection
Expand Down
5 changes: 5 additions & 0 deletions src/services/identity/unauthorized.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const {
} = process.env

export class Unauthorized extends DefaultIdentityService {
constructor() {
super();
this.agent = this.initAgent();
}

initAgent() {
if (this.agent) {
return this.agent
Expand Down

0 comments on commit 45e1074

Please sign in to comment.