Skip to content

Commit

Permalink
Merge branch 'feat/DTIS-855-reduce-usage-of-basic-storage' into feat/…
Browse files Browse the repository at this point in the history
…DTIS-682-full-ipex-flow-in-idw-credential-server
  • Loading branch information
bao-sotatek committed May 7, 2024
2 parents b315cdc + 1796db2 commit c8a30eb
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions src/core/agent/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class Agent {
"https://dev.keria-boot.cf-keripy.metadata.dev.cf-deployments.org";

private static instance: Agent;
private agentServicesProps!: AgentServicesProps;

private storageSession!: SqliteSession | IonicSession;

private basicStorageService!: BasicStorage;
Expand All @@ -66,11 +68,6 @@ class Agent {
private credentialService!: CredentialService;
private signifyNotificationService!: SignifyNotificationService;

private agentServicesProps: AgentServicesProps = {
signifyClient: this.signifyClient,
eventService: new EventService(),
};

get identifiers() {
if (!this.identifierService) {
this.identifierService = new IdentifierService(
Expand Down Expand Up @@ -157,21 +154,6 @@ class Agent {
async start(): Promise<void> {
if (!Agent.ready) {
await this.storageSession.open(walletId);
await signifyReady();
const bran = await this.getBran();
// @TODO - foconnor: Review of Tier level.
this.signifyClient = new SignifyClient(
Agent.LOCAL_KERIA_ENDPOINT,
bran,
Tier.low,
Agent.LOCAL_KERIA_BOOT_ENDPOINT
);
try {
await this.signifyClient.connect();
} catch (err) {
await this.signifyClient.boot();
await this.signifyClient.connect();
}
this.basicStorageService = new BasicStorage(
this.getStorageService<BasicRecord>(this.storageSession)
);
Expand All @@ -190,6 +172,28 @@ class Agent {
this.notificationStorage = new NotificationStorage(
this.getStorageService<NotificationRecord>(this.storageSession)
);

await signifyReady();
const bran = await this.getBran();
// @TODO - foconnor: Review of Tier level.
this.signifyClient = new SignifyClient(
Agent.LOCAL_KERIA_ENDPOINT,
bran,
Tier.low,
Agent.LOCAL_KERIA_BOOT_ENDPOINT
);
try {
await this.signifyClient.connect();
} catch (err) {
await this.signifyClient.boot();
await this.signifyClient.connect();
}

this.agentServicesProps = {
signifyClient: this.signifyClient,
eventService: new EventService(),
};

Agent.ready = true;
}
}
Expand Down

0 comments on commit c8a30eb

Please sign in to comment.