Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix problem with agent initialize [DEV-3146] #346

Merged
merged 3 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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