From 0feb81635069755d3873d55055fad849d77ccf3e Mon Sep 17 00:00:00 2001 From: Zdravko Iliev <zdravko.iliev@vereign.com> Date: Mon, 18 Mar 2024 12:23:02 +0000 Subject: [PATCH] feat: double invitation links --- .../deployment/ci-cd/helm/templates/deployment.yaml | 6 ++++++ apps/agent/deployment/ci-cd/helm/values.yaml | 11 ++++++++--- libs/askar/src/askar/agent.service.ts | 12 +++++++++++- libs/config/src/config/agent.config.ts | 1 + libs/config/src/interfaces/agent.config.interface.ts | 1 + 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/apps/agent/deployment/ci-cd/helm/templates/deployment.yaml b/apps/agent/deployment/ci-cd/helm/templates/deployment.yaml index cf60387d..cb3c1943 100644 --- a/apps/agent/deployment/ci-cd/helm/templates/deployment.yaml +++ b/apps/agent/deployment/ci-cd/helm/templates/deployment.yaml @@ -75,6 +75,8 @@ spec: value: {{ .Values.ocm.agent.api.basic.pass | quote }} - name: AUTH_JWT_PUBLIC_KEY value: {{ .Values.ocm.agent.api.jwt.publicKey | quote }} + - name: AGENT_OOB_URL + value: {{ .Values.ocm.agent.oob.url | quote }} {{- else if eq .Release.Namespace "ocm-test" }} - name: LEDGERS value: {{ .Values.ocmtest.agent.ledgers | quote }} @@ -114,6 +116,8 @@ spec: value: {{ .Values.ocmtest.agent.api.basic.pass | quote }} - name: AUTH_JWT_PUBLIC_KEY value: {{ .Values.ocmtest.agent.api.jwt.publicKey | quote }} + - name: AGENT_OOB_URL + value: {{ .Values.ocmtest.agent.oob.url | quote }} {{- else if eq .Release.Namespace "hin" }} - name: LEDGERS value: {{ .Values.hin.agent.ledgers | quote }} @@ -157,6 +161,8 @@ spec: value: {{ .Values.hin.agent.api.basic.pass | quote }} - name: AUTH_JWT_PUBLIC_KEY value: {{ .Values.hin.agent.api.jwt.publicKey | quote }} + - name: AGENT_OOB_URL + value: {{ .Values.hin.agent.oob.url | quote }} {{- else if eq .Release.Namespace "cloud-auth" }} - name: LEDGERS value: {{ .Values.ca.agent.ledgers | quote }} diff --git a/apps/agent/deployment/ci-cd/helm/values.yaml b/apps/agent/deployment/ci-cd/helm/values.yaml index da661557..866e2100 100644 --- a/apps/agent/deployment/ci-cd/helm/values.yaml +++ b/apps/agent/deployment/ci-cd/helm/values.yaml @@ -87,7 +87,8 @@ ocm: basic: user: "ocm-admin" pass: "" - + oob: + url: "https://issuer-dev.vereign.com" # nats: # server: "nats.ocm:4222" # name: "ssi_issuer_stream" @@ -131,7 +132,9 @@ ocmtest: publicKey: "" basic: user: "ocmtest-admin" - pass: "" + pass: "" + oob: + url: "https://holder-dev.vereign.com" # nats: @@ -182,7 +185,9 @@ hin: publicKey: "" basic: user: "ocmhin-admin" - pass: "" + pass: "" + oob: + url: "https://hin-dev.vereign.com" ca: agent: diff --git a/libs/askar/src/askar/agent.service.ts b/libs/askar/src/askar/agent.service.ts index 3fb35aa7..186bb188 100644 --- a/libs/askar/src/askar/agent.service.ts +++ b/libs/askar/src/askar/agent.service.ts @@ -74,15 +74,25 @@ export class AgentService { const response = new CreateInvitationResponseDto(); - response.invitationUrl = outOfBoundRecord.outOfBandInvitation.toUrl({ + let longUrl = outOfBoundRecord.outOfBandInvitation.toUrl({ domain: this.askar.agentConfig.agentPeerAddress, }); + + if (this.askar.agentConfig.agentOobUrl) { + longUrl = longUrl.replace( + this.askar.agentConfig.agentPeerAddress, + this.askar.agentConfig.agentOobUrl, + ); + } + + //TODO: should we replace the short url with agentOobUrl if we do this we should have a redirect in ingress response.shortInvitationUrl = `${this.askar.agentConfig.agentPeerAddress}/invitations/${outOfBoundRecord.outOfBandInvitation.id}`; response.outOfBandId = outOfBoundRecord.id; response.createdAt = outOfBoundRecord.createdAt; response.updatedAt = outOfBoundRecord.updatedAt; response.role = outOfBoundRecord.role; response.state = outOfBoundRecord.state; + response.invitationUrl = longUrl; return response; }; diff --git a/libs/config/src/config/agent.config.ts b/libs/config/src/config/agent.config.ts index 02edc5bb..c0d12384 100644 --- a/libs/config/src/config/agent.config.ts +++ b/libs/config/src/config/agent.config.ts @@ -37,5 +37,6 @@ export const agentConfig = registerAs( agentAuthJwtPublicKey: process.env["AUTH_JWT_PUBLIC_KEY"]!, logLevel: parseInt(process.env["LOG_LEVEL"]!) ?? LogLevel.error, agentWebHook: process.env["AGENT_WEBHOOK_URL"]!, + agentOobUrl: process.env["AGENT_OOB_URL"] || undefined, }), ); diff --git a/libs/config/src/interfaces/agent.config.interface.ts b/libs/config/src/interfaces/agent.config.interface.ts index d5fed1a5..eeabad51 100644 --- a/libs/config/src/interfaces/agent.config.interface.ts +++ b/libs/config/src/interfaces/agent.config.interface.ts @@ -27,4 +27,5 @@ export interface IConfAgent { logLevel: number; agentWebHook: string; + agentOobUrl: string | undefined; } -- GitLab