Skip to content

Commit

Permalink
merge: qa to prod 30 august 2024 (#199)
Browse files Browse the repository at this point in the history
* Added proof and credential record Id in oob offer output

Signed-off-by: ankita_patidar <[email protected]>

* Remove unnecessary details

Signed-off-by: ankita_patidar <[email protected]>

* fix prettier

Signed-off-by: ankita_patidar <[email protected]>

* add record threadId in output

Signed-off-by: Ankita Patidar <[email protected]>

* chore: package update (#124)

* added taskdef

Signed-off-by: KambleSahil3 <[email protected]>

* Added credo taskdef.json file for ECS

Signed-off-by: KambleSahil3 <[email protected]>

* Delete taskdef/credo-ecs-credo-taskdef.json-taskdef.json

Signed-off-by: KambleSahil3 <[email protected]>

* Update credo-ecs-taskdef.json

Signed-off-by: KambleSahil3 <[email protected]>

* Update credo-ecs-taskdef.json

Signed-off-by: KambleSahil3 <[email protected]>

* Update credo-ecs-taskdef.json

Signed-off-by: KambleSahil3 <[email protected]>

* Update credo-ecs-taskdef.json

Signed-off-by: KambleSahil3 <[email protected]>

* Update credo-ecs-taskdef.json

Signed-off-by: KambleSahil3 <[email protected]>

* Update credo-ecs-taskdef.json

Signed-off-by: KambleSahil3 <[email protected]>

* chore: updated contract address and packages for major package release (#126)

* fix: TAA versioning for indicio testnet (#127)

* chore: fix naming

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix naming

Signed-off-by: Krishna Waske <[email protected]>

* fix: add prestart

Signed-off-by: Krishna Waske <[email protected]>

* fix: update packages

Signed-off-by: Krishna Waske <[email protected]>

* fix: patch for conflicts in model Extensible

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix DCO

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix DCO

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix DCO

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix DCO

Signed-off-by: Krishna Waske <[email protected]>

* fix: error handling for Agent controller

Signed-off-by: Krishna Waske <[email protected]>

* fix: error handling for Basic Message controller

Signed-off-by: Krishna Waske <[email protected]>

* fix: error handling for Connection Controller

Signed-off-by: Krishna Waske <[email protected]>

* fix: spacing

Signed-off-by: Krishna Waske <[email protected]>

* fix: error handling for Credential Controller

Signed-off-by: Krishna Waske <[email protected]>

* fix: error handling for CredentialDEfinition Controller

Signed-off-by: Krishna Waske <[email protected]>

* fix: error handling for Schema Controller

Signed-off-by: Krishna Waske <[email protected]>

* fix: error handling for Did Controller

Signed-off-by: Krishna Waske <[email protected]>

* fix: error handling for Endorse Transaction Controller

Signed-off-by: Krishna Waske <[email protected]>

* fix: add examples

Signed-off-by: Krishna Waske <[email protected]>

* fix: error handling for Question Answer Controller

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix DCO

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix DCO

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix DCO

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix DCO

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix DCO

Signed-off-by: Krishna Waske <[email protected]>

* fix: redirection

Signed-off-by: Krishna Waske <[email protected]>

* fix: error handling

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix DCO

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix DCO

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix DCO

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix DCO

Signed-off-by: Krishna Waske <[email protected]>

* refactor:added condition for insufficient balance

Signed-off-by: tipusinghaw <[email protected]>

* fix: removed string type for the create schema

Signed-off-by: tipusinghaw <[email protected]>

* fix: matching return type according to previous implementation

Signed-off-by: Krishna Waske <[email protected]>

* fix: matching return type according to previous implementation for Schema Controller

Signed-off-by: Krishna Waske <[email protected]>

* fix: remove commented code

Signed-off-by: Krishna Waske <[email protected]>

* fix: remove commented code

Signed-off-by: Krishna Waske <[email protected]>

* chore: add TODOs

Signed-off-by: Krishna Waske <[email protected]>

* refactor: improve typing

Signed-off-by: Krishna Waske <[email protected]>

* fix: error handling for Credential controller

Signed-off-by: Krishna Waske <[email protected]>

* chore: update auto generated files

Signed-off-by: Krishna Waske <[email protected]>

* refactor: updated docker file

Signed-off-by: [email protected] <[email protected]>

* refactor: error handling for proof controller (#139)

* refactor: error handling oob controller (#137)

Co-authored-by: Sai Ranjit Tummalapalli <[email protected]>

* refactor: error handling of polygon controller (#143)

Signed-off-by: pranalidhanavade <[email protected]>

* refactor: error handling for endorser controller (#141)

* refactor: error handling of endorser controller

Signed-off-by: pranalidhanavade <[email protected]>

* resolved: comments on pull request

Signed-off-by: pranalidhanavade <[email protected]>

---------

Signed-off-by: pranalidhanavade <[email protected]>

* Refactor/error handling for multi-tenancy controller (#144)

* refactor: error handling of polygon controller

Signed-off-by: pranalidhanavade <[email protected]>

* refactor: error handling of multi-tenancy-question-answer APIs

Signed-off-by: pranalidhanavade <[email protected]>

* refactor: error handling for did-key and did-web APIs of multi-tenancy controller

Signed-off-by: pranalidhanavade <[email protected]>

* resolved: comments on pull request

Signed-off-by: pranalidhanavade <[email protected]>

* resolved: fixed comments on pull request

Signed-off-by: pranalidhanavade <[email protected]>

---------

Signed-off-by: pranalidhanavade <[email protected]>

* Refactor/error handling for multi tenancy controller (#145)

* refactor: error handling of polygon controller

Signed-off-by: pranalidhanavade <[email protected]>

* refactor: error handling of multi-tenancy-question-answer APIs

Signed-off-by: pranalidhanavade <[email protected]>

* refactor: error handling for did-key and did-web APIs of multi-tenancy controller

Signed-off-by: pranalidhanavade <[email protected]>

* resolved: comments on pull request

Signed-off-by: pranalidhanavade <[email protected]>

* resolved: fixed comments on pull request

Signed-off-by: pranalidhanavade <[email protected]>

* refactor: error handling for proof APIs in multi-tenancy controller

Signed-off-by: pranalidhanavade <[email protected]>

---------

Signed-off-by: pranalidhanavade <[email protected]>

* wip: refactor exception handling for multi-tenancy controller (#142)

* wip: applied validations for network type

Signed-off-by: bhavanakarwade <[email protected]>

* refactor: added swagger and route file

Signed-off-by: bhavanakarwade <[email protected]>

* wip: exception-handling-multi-tenancy

Signed-off-by: bhavanakarwade <[email protected]>

* wip: added routes and json file

Signed-off-by: bhavanakarwade <[email protected]>

* refactor: added routes and json files

Signed-off-by: bhavanakarwade <[email protected]>

* wip: error handling for multitenancy controller

Signed-off-by: bhavanakarwade <[email protected]>

* fix: resolved conflicts

Signed-off-by: bhavanakarwade <[email protected]>

---------

Signed-off-by: bhavanakarwade <[email protected]>

* fix:schema file server url

Signed-off-by: tipusinghaw <[email protected]>

* feat: created new event for reuse connection (#148)

Signed-off-by: tipusinghaw <[email protected]>

* removed yarn.lock file to solve frozen-lockfile error

Signed-off-by: [email protected] <[email protected]>

* resolved frozen-lockfile error

Signed-off-by: [email protected] <[email protected]>

* deleted config.json

Signed-off-by: [email protected] <[email protected]>

* changes in taskdef.json for fargate

Signed-off-by: [email protected] <[email protected]>

* changes family name in taskdef.json

Signed-off-by: [email protected] <[email protected]>

* fix: externalise env

Signed-off-by: Krishna Waske <[email protected]>

* fix: externalise env

Signed-off-by: Krishna Waske <[email protected]>

* fix: number conversion

Signed-off-by: Krishna Waske <[email protected]>

* fix: remove logs

Signed-off-by: Krishna Waske <[email protected]>

* fix: sample env variable

Signed-off-by: Krishna Waske <[email protected]>

* fix: remove comments

Signed-off-by: Krishna Waske <[email protected]>

* fix: remove comments

Signed-off-by: Krishna Waske <[email protected]>

* chore: github warnings

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix preetier

Signed-off-by: Krishna Waske <[email protected]>

* chore: fix preetier

Signed-off-by: Krishna Waske <[email protected]>

* feat: multi-tenancy basic message

Signed-off-by: KulkarniShashank <[email protected]>

* feat: added formData in credential webhook

Signed-off-by: pallavicoder <[email protected]>

* fix:added-patch

Signed-off-by: pallavicoder <[email protected]>

* wip: added json limit configurations

Signed-off-by: bhavanakarwade <[email protected]>

* fix:added patch for prettyVc

Signed-off-by: pallavicoder <[email protected]>

* fix:added patch for prettyVc

Signed-off-by: pallavicoder <[email protected]>

* fix: provision to default to 'Infinity' if required

Signed-off-by: Krishna Waske <[email protected]>

* fix: yarn lock

Signed-off-by: Krishna Waske <[email protected]>

* Update .env.sample file

Signed-off-by: KulkarniShashank <[email protected]>

* fix: added assertion method in did web

Signed-off-by: tipusinghaw <[email protected]>

* merge: DEV to QA (#196)

* fix:added-reuse-connection-event

Signed-off-by: pallavicoder <[email protected]>

* fix: added patch for avoiding  proof abandoned issue (#177)

* fix:added cache tenant record patch

Signed-off-by: pallavicoder <[email protected]>

* fix: w3c issuance without holderDID (#179)

* updated Taskdef.json

Signed-off-by: [email protected] <[email protected]>

* updated Taskdef.json

Signed-off-by: [email protected] <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>

* fix:added-reuse-connection-event

Signed-off-by: pallavicoder <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>

* fix: added patch for avoiding  proof abandoned issue (#177)

Signed-off-by: Krishna Waske <[email protected]>

* fix:added cache tenant record patch

Signed-off-by: pallavicoder <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>

* fix: w3c issuance without holderDID (#179)

Signed-off-by: Krishna Waske <[email protected]>

* Update .env.sample file

Signed-off-by: KulkarniShashank <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>

* refactor: Implemented white labeling in taskdef.json file

Signed-off-by: [email protected] <[email protected]>

* fix: sign off develop (#190)

Co-authored-by: [email protected] <[email protected]>
Co-authored-by: bhavanakarwade <[email protected]>
Co-authored-by: pallavicoder <[email protected]>
Co-authored-by: tipusinghaw <[email protected]>
Co-authored-by: pallavighule <[email protected]>
Co-authored-by: KulkarniShashank <[email protected]>
fix: added patch for avoiding  proof abandoned issue (#177)
fix: w3c issuance without holderDID (#179)

* refactor: Updated taskdef.josn file

Signed-off-by: [email protected] <[email protected]>

* feat: added reuse connection for dedicated agent (#193)

* feat: added reuse connection for dedicated agent

Signed-off-by: bhavanakarwade <[email protected]>

* fix: remove goalcode from oob issuance

Signed-off-by: bhavanakarwade <[email protected]>

---------

Signed-off-by: bhavanakarwade <[email protected]>

* refactor: replace the bcovrin network url

Signed-off-by: KulkarniShashank <[email protected]>

---------

Signed-off-by: pallavicoder <[email protected]>
Signed-off-by: [email protected] <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>
Signed-off-by: KulkarniShashank <[email protected]>
Signed-off-by: bhavanakarwade <[email protected]>
Co-authored-by: pallavicoder <[email protected]>
Co-authored-by: pallavighule <[email protected]>
Co-authored-by: Krishna <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: KambleSahil3 <[email protected]>
Co-authored-by: KulkarniShashank <[email protected]>
Co-authored-by: tipusinghaw <[email protected]>
Co-authored-by: Sai Ranjit Tummalapalli <[email protected]>
Co-authored-by: Shashank Kulkarni <[email protected]>

---------

Signed-off-by: ankita_patidar <[email protected]>
Signed-off-by: Ankita Patidar <[email protected]>
Signed-off-by: KambleSahil3 <[email protected]>
Signed-off-by: KambleSahil3 <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>
Signed-off-by: tipusinghaw <[email protected]>
Signed-off-by: [email protected] <[email protected]>
Signed-off-by: pranalidhanavade <[email protected]>
Signed-off-by: bhavanakarwade <[email protected]>
Signed-off-by: KulkarniShashank <[email protected]>
Signed-off-by: pallavicoder <[email protected]>
Co-authored-by: ankita_patidar <[email protected]>
Co-authored-by: KambleSahil3 <[email protected]>
Co-authored-by: KambleSahil3 <[email protected]>
Co-authored-by: Sheetal-ayanworks <[email protected]>
Co-authored-by: tipusinghaw <[email protected]>
Co-authored-by: tipusinghaw <[email protected]>
Co-authored-by: Sai Ranjit Tummalapalli <[email protected]>
Co-authored-by: pranalidhanavade <[email protected]>
Co-authored-by: bhavanakarwade <[email protected]>
Co-authored-by: KulkarniShashank <[email protected]>
Co-authored-by: pallavicoder <[email protected]>
Co-authored-by: pallavighule <[email protected]>
Co-authored-by: bhavanakarwade <[email protected]>
Co-authored-by: Shashank Kulkarni <[email protected]>
Signed-off-by: KulkarniShashank <[email protected]>
  • Loading branch information
15 people committed Sep 13, 2024
1 parent b1a867b commit bb0200f
Show file tree
Hide file tree
Showing 44 changed files with 5,440 additions and 6,091 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ windowMs=
maxRateLimit=
# Specify Did contract address
DID_CONTRACT_ADDRESS=

# Specify Bcovrin test genesis
BCOVRIN_TEST_GENESIS=`{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node1","blskey":"4N8aUNHSgjQVgkpm8nhNEfDf6txHznoYREg9kirmJrkivgL4oSEimFF6nsQ6M41QvhM2Z33nves5vfSn9n1UwNFJBYtWVnHYMATn76vLuL3zU88KyeAYcHfsih3He6UHcXDxcaecHVz6jhCYz1P2UZn2bDVruL5wXpehgBfBaLKm3Ba","blskey_pop":"RahHYiCvoNCtPTrVtP7nMC5eTYrsUA8WjXbdhNc8debh1agE9bGiJxWBXYNFbnJXoXhWFMvyqhqhRoq737YQemH5ik9oL7R4NTTCz2LEZhkgLJzB3QRQqJyBNyv7acbdHrAT8nQ9UkLbaVL9NBpnWXBTw4LEMePaSHEw66RzPNdAX1","client_ip":"138.197.138.255","client_port":9702,"node_ip":"138.197.138.255","node_port":9701,"services":["VALIDATOR"]},"dest":"Gw6pDLhcBcoQesN72qfotTgFa7cbuqZpkX3Xo6pLhPhv"},"metadata":{"from":"Th7MpTaRZVRYnPiabds81Y"},"type":"0"},"txnMetadata":{"seqNo":1,"txnId":"fea82e10e894419fe2bea7d96296a6d46f50f93f9eeda954ec461b2ed2950b62"},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node2","blskey":"37rAPpXVoxzKhz7d9gkUe52XuXryuLXoM6P6LbWDB7LSbG62Lsb33sfG7zqS8TK1MXwuCHj1FKNzVpsnafmqLG1vXN88rt38mNFs9TENzm4QHdBzsvCuoBnPH7rpYYDo9DZNJePaDvRvqJKByCabubJz3XXKbEeshzpz4Ma5QYpJqjk","blskey_pop":"Qr658mWZ2YC8JXGXwMDQTzuZCWF7NK9EwxphGmcBvCh6ybUuLxbG65nsX4JvD4SPNtkJ2w9ug1yLTj6fgmuDg41TgECXjLCij3RMsV8CwewBVgVN67wsA45DFWvqvLtu4rjNnE9JbdFTc1Z4WCPA3Xan44K1HoHAq9EVeaRYs8zoF5","client_ip":"138.197.138.255","client_port":9704,"node_ip":"138.197.138.255","node_port":9703,"services":["VALIDATOR"]},"dest":"8ECVSk179mjsjKRLWiQtssMLgp6EPhWXtaYyStWPSGAb"},"metadata":{"from":"EbP4aYNeTHL6q385GuVpRV"},"type":"0"},"txnMetadata":{"seqNo":2,"txnId":"1ac8aece2a18ced660fef8694b61aac3af08ba875ce3026a160acbc3a3af35fc"},"ver":"1"}
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ WORKDIR /app
# Copy package.json and yarn.lock files
COPY package.json yarn.lock ./

# Install dependencies
RUN yarn install --frozen-lockfile

# Copy the rest of the application code
COPY . .

# Install dependencies
RUN yarn install --frozen-lockfile

RUN yarn global add patch-package

# Build the application
Expand Down
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import base from './jest.config.base'

const config: Config.InitialOptions = {
...base,
name: 'afj-controller',
displayName: 'afj-controller',
name: 'credo-controller',
displayName: 'credo-controller',
testTimeout: 120000,
}

Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@aries-framework/rest",
"name": "credo-controller",
"main": "build/index",
"types": "build/index",
"version": "0.9.4",
Expand Down Expand Up @@ -28,6 +28,8 @@
"tsoa": "tsoa spec-and-routes",
"dev": "tsoa spec-and-routes && tsnd --respawn samples/sampleWithApp.ts",
"build": "yarn run clean && yarn run compile",
"prestart:dev": "yarn run clean && yarn run compile",
"start:dev": "./bin/afj-rest.js --config ./samples/cliConfig.json",
"clean": "rimraf -rf ./build",
"compile": "tsoa spec-and-routes && tsc -p tsconfig.build.json",
"prepublishOnly": "yarn run build",
Expand All @@ -37,7 +39,7 @@
"validate": "yarn lint && yarn check-types && yarn check-format"
},
"dependencies": {
"@ayanworks/credo-polygon-w3c-module": "0.0.2-alpha.10",
"@ayanworks/credo-polygon-w3c-module": "1.0.0",
"@credo-ts/anoncreds": "0.5.3",
"@credo-ts/askar": "0.5.3",
"@credo-ts/core": "0.5.3",
Expand Down Expand Up @@ -92,15 +94,15 @@
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^27.3.1",
"jest": "^29.7.0",
"ngrok": "^4.3.1",
"prettier": "^2.8.8",
"supertest": "^6.2.3",
"ts-jest": "^27.0.7",
"ts-jest": "^29.1.2",
"ts-node-dev": "^2.0.0",
"typescript": "^5.3.3"
},
"engines": {
"node": ">=18"
"node": "18.19.0"
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/@credo-ts/core/build/modules/credentials/formats/jsonld/JsonLdCredentialFormat.d.ts b/node_modules/@credo-ts/core/build/modules/credentials/formats/jsonld/JsonLdCredentialFormat.d.ts
index d12468b..ae70f36 100644
--- a/node_modules/@credo-ts/core/build/modules/credentials/formats/jsonld/JsonLdCredentialFormat.d.ts
+++ b/node_modules/@credo-ts/core/build/modules/credentials/formats/jsonld/JsonLdCredentialFormat.d.ts
@@ -10,6 +10,8 @@ export interface JsonCredential {
issuanceDate: string;
expirationDate?: string;
credentialSubject: SingleOrArray<JsonObject>;
+ //TODO change type
+ prettyVc?: any;
[key: string]: unknown;
}
/**
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js b/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js
index 006d870..da56801 100644
--- a/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js
+++ b/node_modules/@credo-ts/core/build/modules/proofs/formats/dif-presentation-exchange/DifPresentationExchangeProofFormatService.js
@@ -170,7 +170,8 @@ class DifPresentationExchangeProofFormatService {
try {
ps.validatePresentationDefinition(request.presentation_definition);
ps.validatePresentationSubmission(jsonPresentation.presentation_submission);
- ps.validatePresentation(request.presentation_definition, parsedPresentation);
+ // FIXME: Commenting validatePresentation() for now due to intermittent abandoned issue
+ //ps.validatePresentation(request.presentation_definition, parsedPresentation);
let verificationResult;
// FIXME: for some reason it won't accept the input if it doesn't know
// whether it's a JWT or JSON-LD VP even though the input is the same.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/node_modules/@credo-ts/core/build/modules/credentials/protocol/v2/V2CredentialProtocol.js b/node_modules/@credo-ts/core/build/modules/credentials/protocol/v2/V2CredentialProtocol.js
index fb1fb9d..b519694 100644
--- a/node_modules/@credo-ts/core/build/modules/credentials/protocol/v2/V2CredentialProtocol.js
+++ b/node_modules/@credo-ts/core/build/modules/credentials/protocol/v2/V2CredentialProtocol.js
@@ -97,7 +97,6 @@ class V2CredentialProtocol extends BaseCredentialProtocol_1.BaseCredentialProtoc
let credentialRecord = await this.findByProperties(messageContext.agentContext, {
threadId: proposalMessage.threadId,
role: models_1.CredentialRole.Issuer,
- connectionId: connection === null || connection === void 0 ? void 0 : connection.id,
});
const formatServices = this.getFormatServicesFromMessage(proposalMessage.formats);
if (formatServices.length === 0) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
diff --git a/node_modules/@credo-ts/tenants/build/context/TenantAgentContextProvider.d.ts b/node_modules/@credo-ts/tenants/build/context/TenantAgentContextProvider.d.ts
index 91bb8f4..b4dae61 100644
--- a/node_modules/@credo-ts/tenants/build/context/TenantAgentContextProvider.d.ts
+++ b/node_modules/@credo-ts/tenants/build/context/TenantAgentContextProvider.d.ts
@@ -1,5 +1,5 @@
import type { TenantRecord } from '../repository';
-import type { AgentContextProvider, UpdateAssistantUpdateOptions } from '@credo-ts/core';
+import type { AgentContextProvider, UpdateAssistantUpdateOptions , CacheModule, InMemoryLruCache } from '@credo-ts/core';
import { AgentContext, EventEmitter, Logger } from '@credo-ts/core';
import { TenantRecordService } from '../services';
import { TenantSessionCoordinator } from './TenantSessionCoordinator';
@@ -9,7 +9,9 @@ export declare class TenantAgentContextProvider implements AgentContextProvider
private eventEmitter;
private logger;
private tenantSessionCoordinator;
- constructor(tenantRecordService: TenantRecordService, rootAgentContext: AgentContext, eventEmitter: EventEmitter, tenantSessionCoordinator: TenantSessionCoordinator, logger: Logger);
+ private cacheModule;
+ private inMemoryLruCache;
+ constructor(tenantRecordService: TenantRecordService, rootAgentContext: AgentContext, eventEmitter: EventEmitter, tenantSessionCoordinator: TenantSessionCoordinator, logger: Logger, cache: InMemoryLruCache);
getAgentContextForContextCorrelationId(contextCorrelationId: string): Promise<AgentContext>;
getContextForInboundMessage(inboundMessage: unknown, options?: {
contextCorrelationId?: string;
diff --git a/node_modules/@credo-ts/tenants/build/context/TenantAgentContextProvider.js b/node_modules/@credo-ts/tenants/build/context/TenantAgentContextProvider.js
index d491d4e..d60ec79 100644
--- a/node_modules/@credo-ts/tenants/build/context/TenantAgentContextProvider.js
+++ b/node_modules/@credo-ts/tenants/build/context/TenantAgentContextProvider.js
@@ -24,16 +24,28 @@ let TenantAgentContextProvider = class TenantAgentContextProvider {
this.eventEmitter = eventEmitter;
this.tenantSessionCoordinator = tenantSessionCoordinator;
this.logger = logger;
+ this.cache = new core_1.CacheModule({
+ cache: new core_1.InMemoryLruCache({ limit: 100 }),
+ });
// Start listener for newly created routing keys, so we can register a mapping for each new key for the tenant
this.listenForRoutingKeyCreatedEvents();
}
async getAgentContextForContextCorrelationId(contextCorrelationId) {
+ this.logger.debug('debug ========= Inside getAgentContextForContextCorrelationId')
// It could be that the root agent context is requested, in that case we return the root agent context
if (contextCorrelationId === this.rootAgentContext.contextCorrelationId) {
return this.rootAgentContext;
}
// TODO: maybe we can look at not having to retrieve the tenant record if there's already a context available.
- const tenantRecord = await this.tenantRecordService.getTenantById(this.rootAgentContext, contextCorrelationId);
+ this.logger.debug('debug ========= Get tenantRecord from cache')
+ let tenantRecord = await this.cache.config.cache.get(this.rootAgentContext, `contextCorrelationId-${contextCorrelationId}`)
+ if(!tenantRecord) {
+ // TODO: maybe we can look at not having to retrieve the tenant record if there's already a context available.
+ this.logger.debug('debug ========= TenantRecord not found in cache')
+ tenantRecord = await this.tenantRecordService.getTenantById(this.rootAgentContext, contextCorrelationId)
+ await this.cache.config.cache.set(this.rootAgentContext,`contextCorrelationId-${contextCorrelationId}`,tenantRecord)
+ this.logger.debug(`debug ========= Cached tenant agent context for tenant '${contextCorrelationId}'`)
+ }
const shouldUpdate = !(0, core_1.isStorageUpToDate)(tenantRecord.storageVersion);
// If the tenant storage is not up to date, and autoUpdate is disabled we throw an error
if (shouldUpdate && !this.rootAgentContext.config.autoUpdateStorageOnStartup) {
19 changes: 9 additions & 10 deletions samples/cliConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"walletPassword": "postgres",
"walletAdminAccount": "postgres",
"walletAdminPassword": "postgres",
"walletScheme": "DatabasePerWallet",
"walletScheme": "ProfilePerWallet",
"indyLedger": [
{
"genesisTransactions": "https://raw.githubusercontent.com/Indicio-tech/indicio-network/main/genesis_files/pool_transactions_testnet_genesis",
Expand All @@ -19,29 +19,28 @@
"indyNamespace": "indicio:demonet"
},
{
"genesisTransactions": "http://test.bcovrin.vonx.io/genesis",
"genesisTransactions": "https://raw.githubusercontent.com/bcgov/von-network/main/BCovrin/genesis_test",
"indyNamespace": "bcovrin:testnet"
}
],
"endpoint": ["http://localhost:4002"],
"autoAcceptConnections": true,
"autoAcceptCredentials": "contentApproved",
"autoAcceptCredentials": "always",
"autoAcceptProofs": "contentApproved",
"useLegacyDidSovPrefix": true,
"logLevel": 5,
"logLevel": 2,
"inboundTransport": [
{
"transport": "http",
"port": 4002
}
],
"outboundTransport": ["http"],
"autoAcceptMediationRequests": false,
"adminPort": 4001,
"tenancy": true,
"didRegistryContractAddress": "0x1adeA199dCf07E17232415Cb232442BE52517Add",
"schemaManagerContractAddress": "0x289c7Bd4C7d38cC54bff370d6f9f01b74Df51b11",
"schemaFileServerURL": "https://schema.credebl.id/schemas/",
"didRegistryContractAddress": "0xcB80F37eDD2bE3570c6C9D5B0888614E04E1e49E",
"schemaManagerContractAddress": "0x4742d43C2dFCa5a1d4238240Afa8547Daf87Ee7a",
"rpcUrl": "https://rpc-amoy.polygon.technology",
"fileServerUrl": "https://schema.credebl.id/",
"fileServerUrl": "https://schema.credebl.id",
"fileServerToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBeWFuV29ya3MiLCJpZCI6ImNhZDI3ZjhjLTMyNWYtNDRmZC04ZmZkLWExNGNhZTY3NTMyMSJ9.I3IR7abjWbfStnxzn1BhxhV0OEzt1x3mULjDdUcgWHk"
}
}
66 changes: 66 additions & 0 deletions scripts/taskdef/credo-ecs-taskdef.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"family": "${FAMILY}",
"containerDefinitions": [
{
"name": "Platform-admin",
"image": "%REPOSITORY_URI%:CREDO_v_%BUILD_NUMBER%",
"cpu": 154,
"memory": 307,
"portMappings": [
{
"containerPort": 8001,
"hostPort": 8001,
"protocol": "tcp"
},
{
"containerPort": 9001,
"hostPort": 9001,
"protocol": "tcp"
}
],
"essential": true,
"command": [
"--auto-accept-connections",
"--config",
"/config.json"
],
"environment": [
{
"name": "AFJ_REST_LOG_LEVEL",
"value": "1"
}
],
"environmentFiles": [
{
"value": "${S3_ARN}",
"type": "s3"
}
],
"mountPoints": [
{
"sourceVolume": "config",
"containerPath": "/config.json",
"readOnly": true
}
],
"volumesFrom": [],
"ulimits": []
}

],
"executionRoleArn": "arn:aws:iam::${ACCOUNT_ID}:role/ecsTaskExecutionRole",
"placementConstraints": [],
"requiresCompatibilities": [
"EC2"
],
"cpu": "154",
"memory": "307",
"volumes": [
{
"name": "config",
"host": {
"sourcePath": "${SourcePath}"
}
}
]
}
76 changes: 76 additions & 0 deletions scripts/taskdef/credo-fargate-taskdef.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"family": "${FAMILY}",
"containerDefinitions": [
{
"name": "Platform-admin",
"image": "%REPOSITORY_URI%:CREDO_v_%BUILD_NUMBER%",
"cpu": 0,
"portMappings": [
{
"containerPort": 8004,
"hostPort": 8004,
"protocol": "tcp"
},
{
"containerPort": 9004,
"hostPort": 9004,
"protocol": "tcp"
}
],
"essential": true,
"command": [
"--auto-accept-connections",
"--config",
"/config/${CONFIG_FILE}"
],
"environment": [
{
"name": "AFJ_REST_LOG_LEVEL",
"value": "1"
}
],
"environmentFiles": [
{
"value": "${S3_ARN}",
"type": "s3"
}
],
"mountPoints": [
{
"sourceVolume": "config",
"containerPath": "/config",
"readOnly": false
}
],
"volumesFrom": [],
"ulimits": [],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/${FAMILY}",
"awslogs-create-group": "true",
"awslogs-region": "ap-south-1",
"awslogs-stream-prefix": "ecs"
}
}
}

],
"executionRoleArn": "arn:aws:iam::${ACCOUNT_ID}:role/ecsTaskExecutionRole",
"networkMode": "awsvpc",
"placementConstraints": [],
"requiresCompatibilities": [
"FARGATE"
],
"cpu": "1024",
"memory": "2048",
"volumes": [
{
"name": "config",
"efsVolumeConfiguration": {
"fileSystemId": "${EFS}",
"rootDirectory": "/"
}
}
]
}
Loading

0 comments on commit bb0200f

Please sign in to comment.