Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • svdh/ocm-engine
1 result
Show changes
Commits on Source (3)
Showing
with 182 additions and 2438 deletions
......@@ -145,6 +145,14 @@ helm-gateway:
extends: .helm-gateway
stage: helm
deploy agent hin:
extends: .deploy-agent-hin-main
stage: deploy-test
deploy agent hin tagged:
extends: .deploy-agent-hin-tag
stage: deploy-test
deploy agent ocm:
extends: .deploy-agent-ocm-main
stage: deploy-test
......
......@@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file. See
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.11.0](https://code.vereign.com/gaiax/ocm/ocm-engine/compare/v1.10.0...v1.11.0) (2023-10-09)
### Features
* implement basic auth for id union ([9e15ff4](https://code.vereign.com/gaiax/ocm/ocm-engine/commit/9e15ff4ba8528d3bc71b52f243580dc16e1d0aa8))
## [1.10.0](https://code.vereign.com/gaiax/ocm/ocm-engine/compare/v1.9.0...v1.10.0) (2023-09-25)
......
This diff is collapsed.
{"openapi":"3.0.0","paths":{"/api/v1/invitation":{"post":{"operationId":"RestController_createInvitation","parameters":[],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInvitationResponseDto"}}}}}}},"/api/v1/invitation/accept":{"post":{"operationId":"RestController_acceptInvitation","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInvitationResponseDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptInvitationResponseDto"}}}}}}},"/api/v1/connections":{"get":{"operationId":"RestController_connections","parameters":[],"responses":{"200":{"description":""}}}},"/api/v1/schema":{"post":{"operationId":"RestController_createSchema","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSchemaRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSchemaResponseDto"}}}}}}},"/api/v1/credential/definition":{"post":{"operationId":"RestController_createCredentialDefinition","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCredentialDefinitionRequsetDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCredentialDefinitionResponseDto"}}}}}}},"/api/v1/credential/issue":{"post":{"operationId":"RestController_issueCredential","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueCredentialRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueCredentialResponseDto"}}}}}}},"/api/v1/credentials":{"get":{"operationId":"RestController_credentials","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/IssueCredentialResponseDto"}}}}}}}},"/api/v1/credential/offers":{"get":{"operationId":"RestController_getCredentialOffers","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/IssueCredentialResponseDto"}}}}}}}},"/api/v1/credential/{credential_record_id}/accept":{"post":{"operationId":"RestController_acceptCredential","parameters":[{"name":"credential_record_id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueCredentialResponseDto"}}}}}}},"/api/v1/credential/proof":{"get":{"operationId":"RestController_proofs","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/IssueProofResponseDto"}}}}}}}},"/api/v1/credential/proof/issue":{"post":{"operationId":"RestController_issueProof","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueProofRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueProofResponseDto"}}}}}}},"/api/v1/credential/proof/{proof_record_id}/accept":{"post":{"operationId":"RestController_acceptProof","parameters":[{"name":"proof_record_id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueProofResponseDto"}}}}}}},"/api/v1/resolve":{"post":{"operationId":"RestController_resolve","parameters":[],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/v1/messages":{"post":{"operationId":"RestController_sendMeesage","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MakeBasicMessageRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MakeBasicMessageResponseDto"}}}}}}}},"info":{"title":"Agent","description":"Agent API","version":"1.0","contact":{}},"tags":[],"servers":[],"components":{"schemas":{"CreateInvitationResponseDto":{"type":"object","properties":{"invitationUrl":{"type":"string","description":"A list of user's roles","example":"http://0.0.0.0:8001?oob=eyJAdHlwZSI6Imh0dHBzOi8vZGlkY29tbS5vcmcvb3V0LW9mLWJhbmQvMS4xL2ludml0YXRpb24iLCJAaWQiOiIzYWExNGIzNC04YTk5LTQxY2UtYTY3NC1jODUxYmVhMTIxMWEiLCJsYWJlbCI6IkRFeGNWYXNkX0FHRU5UXzQ1IiwiYWNjZXB0IjpbImRpZGNvbW0vYWlwMSIsImRpZGNvbW0vYWlwMjtlbnY9cmZjMTkiXSwiaGFuZHNoYWtlX3Byb3RvY29scyI6WyJodHRwczovL2RpZGNvbW0ub3JnL2RpZGV4Y2hhbmdlLzEuMCIsImh0dHBzOi8vZGlkY29tbS5vcmcvY29ubmVjdGlvbnMvMS4wIl0sInNlcnZpY2VzIjpbeyJpZCI6IiNpbmxpbmUtMCIsInNlcnZpY2VFbmRwb2ludCI6Imh0dHA6Ly8wLjAuMC4wOjgwMDEiLCJ0eXBlIjoiZGlkLWNvbW11bmljYXRpb24iLCJyZWNpcGllbnRLZXlzIjpbImRpZDprZXk6ejZNa3VFcHllc1pNa3k0a1BpQzhEOEplZERlcm55YTFuaTREMUF3ZmdnWWt6YmR4Il0sInJvdXRpbmdLZXlzIjpbXX1dfQ"}},"required":["invitationUrl"]},"AcceptInvitationResponseDto":{"type":"object","properties":{"connectionId":{"type":"string"},"connectionName":{"type":"string"},"did":{"type":"string"},"invitationDid":{"type":"string"},"outOfBandId":{"type":"string"},"createdAt":{"format":"date-time","type":"string"}},"required":["connectionId","createdAt"]},"CreateSchemaRequestDto":{"type":"object","properties":{"name":{"type":"string","example":"my test schema"},"attributes":{"example":["first_name, last_name"],"type":"array","items":{"type":"string"}},"version":{"type":"string","example":"1.0.2","pattern":"/^(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)$/"}},"required":["name","attributes","version"]},"CreateSchemaResponseDto":{"type":"object","properties":{"schemaId":{"type":"string"},"issuerId":{"type":"string"},"name":{"type":"string"},"version":{"type":"string"},"attributes":{"type":"array","items":{"type":"string"}}},"required":["schemaId","issuerId","name","version","attributes"]},"CreateCredentialDefinitionRequsetDto":{"type":"object","properties":{"schemaId":{"type":"string"},"tag":{"type":"string"}},"required":["schemaId","tag"]},"CreateCredentialDefinitionResponseDto":{"type":"object","properties":{"credentialDefinitionId":{"type":"string"},"schemaId":{"type":"string"},"isserId":{"type":"string"},"tag":{"type":"string"}},"required":["credentialDefinitionId","schemaId","isserId","tag"]},"IssueCredentialAttributes":{"type":"object","properties":{"name":{"type":"string"},"value":{"type":"string"}},"required":["name","value"]},"IssueCredentialRequestDto":{"type":"object","properties":{"connectionId":{"type":"string","example":"6464b521-005a-4379-91e0-a3692b31cafd"},"credentialDefinitionId":{"type":"string"},"attributes":{"type":"array","items":{"$ref":"#/components/schemas/IssueCredentialAttributes"}}},"required":["connectionId","credentialDefinitionId","attributes"]},"Credential":{"type":"object","properties":{"credentialRecordType":{"type":"string"},"credentialRecordId":{"type":"string"}},"required":["credentialRecordType","credentialRecordId"]},"IssueCredentialResponseDto":{"type":"object","properties":{"credentials":{"type":"array","items":{"$ref":"#/components/schemas/Credential"}},"credentialId":{"type":"string"},"connectionId":{"type":"string"},"attributes":{"type":"array","items":{"$ref":"#/components/schemas/IssueCredentialAttributes"}},"createdAt":{"format":"date-time","type":"string"}},"required":["credentialId","createdAt"]},"IssueProofResponseDto":{"type":"object","properties":{"proofId":{"type":"string"},"connectionId":{"type":"string","example":"6464b521-005a-4379-91e0-a3692b31cafd"},"state":{"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"createdAt":{"format":"date-time","type":"string"}},"required":["proofId","state","createdAt"]},"IssueProofAttribute":{"type":"object","properties":{"attributeName":{"type":"string"},"credentialDefinitionId":{"type":"string"},"schemaId":{"type":"string"}},"required":["attributeName","credentialDefinitionId","schemaId"]},"IssueProofRequestDto":{"type":"object","properties":{"connectionId":{"type":"string","example":"6464b521-005a-4379-91e0-a3692b31cafd"},"attributes":{"type":"array","items":{"$ref":"#/components/schemas/IssueProofAttribute"}}},"required":["attributes"]},"MakeBasicMessageRequestDto":{"type":"object","properties":{"connectionId":{"type":"string","example":"6464b521-005a-4379-91e0-a3692b31cafd"},"message":{"type":"string","example":"hello world"}},"required":["connectionId","message"]},"MakeBasicMessageResponseDto":{"type":"object","properties":{"id":{"type":"string"},"connectionId":{"type":"string","example":"6464b521-005a-4379-91e0-a3692b31cafd"},"from":{"type":"string","example":"example-ocm-name"},"to":{"type":"string","example":"example-ocm-name"},"message":{"type":"string","example":"hello world"}},"required":["id","connectionId","message"]}}}}
\ No newline at end of file
......@@ -41,6 +41,10 @@ spec:
value: {{ .Values.ocm.agent.ledgers | quote }}
- name: IDUNION_KEY
value: {{ .Values.ocm.agent.idunion.key | quote }}
- name: IDUNION_BASIC_USER
value: {{ .Values.ocm.agent.idunion.user | quote }}
- name: IDUNION_BASIC_PASS
value: {{ .Values.ocm.agent.idunion.pass | quote }}
- name : AGENT_PEER_URL
value: {{ .Values.ocm.agent.peer.url | quote }}
- name: AGENT_NAME
......@@ -86,6 +90,10 @@ spec:
value: {{ .Values.ocmtest.agent.ledgers | quote }}
- name: IDUNION_KEY
value: {{ .Values.ocmtest.agent.idunion.key | quote }}
- name: IDUNION_BASIC_USER
value: {{ .Values.ocm.agent.idunion.user | quote }}
- name: IDUNION_BASIC_PASS
value: {{ .Values.ocm.agent.idunion.pass | quote }}
- name : AGENT_PEER_URL
value: {{ .Values.ocmtest.agent.peer.url | quote }}
- name: AGENT_NAME
......@@ -126,6 +134,44 @@ spec:
value: {{ .Values.ocmtest.gateway.messagePattern | quote }}
- name: GATEWAY_HOST
value: {{ .Values.ocmtest.gateway.host | quote }}
{{- else if eq .Release.Namespace "hin" }}
- name: LEDGERS
value: {{ .Values.hin.agent.ledgers | quote }}
- name : AGENT_PEER_URL
value: {{ .Values.hin.agent.peer.url | quote }}
- name: AGENT_NAME
value: {{ .Values.hin.agent.name | quote }}
- name: AGENT_KEY
value: {{ .Values.hin.agent.key | quote }}
- name: AGENT_DID_SEED
value: {{ .Values.hin.agent.did.seed | quote }}
- name: AGENT_DB_HOST
value: {{ .Values.hin.agent.db.host | quote }}
- name: AGENT_DB_USER
value: {{ .Values.hin.agent.db.user | quote }}
- name: AGENT_DB_PASS
value: {{ .Values.hin.agent.db.pass | quote }}
- name: AGENT_PORT
value: {{ .Values.hin.agent.port | quote }}
- name: AGENT_IS_REST
value: {{ .Values.hin.agent.is.rest | quote }}
- name: AGENT_IS_SVDX
value: {{ .Values.hin.agent.is.svdx | quote }}
- name: AGENT_SVDX_SCHEMA_ID
value: {{ .Values.hin.agent.svdx.schema.id | quote }}
- name: AGENT_SVDX_CRED_DEF_ID
value: {{ .Values.hin.agent.svdx.cred.def.id | quote }}
- name: AGENT_SVDX_WEBHOOK_URL
value: {{ .Values.hin.agent.svdx.webhook.url | quote }}
- name: AGENT_SVDX_BASIC_USER
value: {{ .Values.hin.agent.svdx.basic.user | quote }}
- name: AGENT_SVDX_BASIC_PASS
value: {{ .Values.hin.agent.svdx.basic.pass | quote }}
- name: AGENT_MAX_MESSAGES
value: {{ .Values.hin.agent.max.messages | quote }}
- name: AGENT_RETE_LIMIT
value: {{ .Values.hin.agent.rete.limit | quote }}
{{- end }}
{{- if .Values.extraVars }}
{{ toYaml .Values.extraVars | indent 8 }}
......
......@@ -38,5 +38,23 @@ spec:
name: {{ template "app.name" . }}
port:
number: {{ .Values.service.port1 }}
{{- else if eq .Release.Namespace "hin" }}
- host: {{ .Values.ingress.frontendDomain }}
http:
paths:
- path: /hin-agent(/|$)(.*)
pathType: Prefix
backend:
service:
name: {{ template "app.name" . }}
port:
number: {{ .Values.service.port1 }}
- path: /api-hin-agent(/|$)(.*)
pathType: Prefix
backend:
service:
name: {{ template "app.name" . }}
port:
number: {{ .Values.hin.agent.port }}
{{- end }}
{{- end }}
# -- Default number of instances to start ...
# -- Default number of instances to start .....
replicaCount: 1
# -- Application name ...
name: agent
# -- Ovverwrites application name ..
# -- Ovverwrites application name ...
nameOverride: ""
image:
repository: eu.gcr.io/vrgn-infra-prj
# -- Image name .
# -- Image name ..
name: gaiax/ocm/ocm-engine/agent
# -- Image tag .
# -- Image tag ..
# Uses .Chart.AppVersion if empty .
tag: ""
# -- Image sha, usually generated by the CI .
......@@ -62,12 +62,14 @@ ocm:
ledgers: "BCOVRIN_TEST"
idunion:
key: ""
user: ""
pass: ""
peer:
url: "https://ssi-dev.vereign.com/issuer"
issuer:
name: "AGENT_ISSUER_OCM"
key: "CwNJroKHTSSj3XvE7ZAnuKiTn2C1uhuy7234FDCQkFvxEqfm5rzhNri"
did: "000000000000003451230000000000TCuste1232289234"
name: "AGENT_ISSUER_OCM_BCOVRIN"
key: "CwNJroKHTSSj3XvE7ZAnuKiTn2Copxk11uhuy7234FDCQkFvxEqfm5rzhNri"
did: "0000000000000034512300000ikajcuak1dpsaSDKJF00000TCuste1232odjxu289234"
db:
host: ""
user: ""
......@@ -98,12 +100,14 @@ ocmtest:
ledgers: "BCOVRIN_TEST"
idunion:
key: ""
user: ""
pass: ""
peer:
url: "https://ssi-dev.vereign.com/holder"
holder:
name: "HOLDER_AGENT_OCM"
key: "CwNJroKHTSSj3XvE7ZAnuKiTn3C4QkFvxEqfm5rsdNri"
did: "2000000000000000CCA120000000TCuste21jsjs"
name: "HOLDER_AGENT_OCM_BCOVRIN_TEST"
key: "CwNJroKHTSSj3XvE7ZAnuKiTbbscsn3udm1238cklawsliC4QkFvxEqfm5rsdNri"
did: "2000000000043431s0000ok1329ck1p12dpp0CCA120000000TCuste21jsjs"
db:
host: ""
user: ""
......@@ -128,6 +132,39 @@ ocmtest:
name: "message"
messagePattern: "webhook"
host: "gateway.ocm-test"
hin:
agent:
ledgers: "BCOVRIN_TEST"
peer:
url: "https://ssi-dev.vereign.com/hin-agent"
name: "hin-agent"
key: "Fpvsvz0seqevq7RRiPbRT6AcrMXcaY8d"
did:
seed: "8rQuMQ6YeVF1CVyKp4KZTwM4irGl26Ds"
port: 8080
is:
rest: "true"
svdx: "true"
svdx:
basic:
user: ""
pass: ""
schema:
id: "did:indy:bcovrin:test:Qtays75Zq3NbMRMGbw9JKM/anoncreds/v0/SCHEMA/demo-hin-schema/0.0.1"
cred:
def:
id: "did:indy:bcovrin:test:Qtays75Zq3NbMRMGbw9JKM/anoncreds/v0/CLAIM_DEF/66375/demo-hin-cred-def"
webhook:
url: "https://did.svdx.pro/ocm/connection"
max:
messages: 10
rete:
limit: 5
db:
host: ""
user: ""
pass: ""
service:
port: 8080
......
FROM node:18.16.0-buster-slim
RUN apt update -y && apt install python3 git make cmake build-essential -y
WORKDIR /app
COPY . .
RUN yarn install
RUN yarn build:agent
EXPOSE 8080
EXPOSE 8001
CMD ["node", "./dist/apps/agent/main.js"]
......@@ -8,6 +8,7 @@ import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app/app.module";
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
import * as fs from "fs";
async function bootstrap() {
const app = await NestFactory.create(AppModule);
......@@ -23,6 +24,7 @@ async function bootstrap() {
.build();
const document = SwaggerModule.createDocument(app, config);
fs.writeFileSync("./agent-swagger.json", JSON.stringify(document));
SwaggerModule.setup("api", app, document);
await app.listen(port, "0.0.0.0");
......
......@@ -242,6 +242,9 @@ export const svdxProofStateChangeHandler = async (
}
try {
console.log(
`sending data to svdx ${email}, ${ev.payload.proofRecord.connectionId}`,
);
await axios.post(
config?.agentSVDXWebHook,
{
......
......@@ -15,8 +15,9 @@ export const agentConfig = registerAs(
agentDbPass: process.env["AGENT_DB_PASS"]!,
agentIsRest: process.env["AGENT_IS_REST"] === "true",
agentConsumerName: process.env["AGENT_CONSUMER_NAME"]!,
agentConsumerMaxMessagess: parseInt(process.env["AGENT_MAX_MESSAGES"]!),
agentConsumerRateLimit: parseInt(process.env["AGENT_RETE_LIMIT"]!),
agentConsumerMaxMessagess:
parseInt(process.env["AGENT_MAX_MESSAGES"]!) || 10,
agentConsumerRateLimit: parseInt(process.env["AGENT_RETE_LIMIT"]!) || 5,
agentPort: parseInt(process.env["AGENT_PORT"]!),
agentIsSVDX: process.env["AGENT_IS_SVDX"] === "true",
agentSVDXSchemaId: process.env["AGENT_SVDX_SCHEMA_ID"]!,
......
......@@ -8,6 +8,6 @@ export const gatewayConfig = registerAs(
httpPort: parseInt(process.env["GATEWAY_HTTP_PORT"]!),
tcpPort: parseInt(process.env["GATEWAY_TCP_PORT"]!),
messagePattern: process.env["GATEWAY_MESSAGE_PATTERN"]!,
host: process.env["GATEWAY_HOST"]!,
host: process.env["GATEWAY_HOST"],
}),
);
......@@ -7,5 +7,7 @@ export const ledgersConfig = registerAs(
(): ILedgers => ({
ledgers: process.env["LEDGERS"]!.split(","),
idUnionApiKey: process.env["IDUNION_KEY"]!,
idUnionApiBasicUser: process.env["IDUNION_BASIC_USER"]!,
idUnionApiBasicPass: process.env["IDUNION_BASIC_PASS"]!,
}),
);
......@@ -5,8 +5,14 @@ import { IConfNats } from "../interfaces/nats.config.interface";
export const natsConfig = registerAs(
"nats",
(): IConfNats => ({
servers: process.env["NATS_SERVERS"]!.split(","),
streamName: process.env["NATS_STREAM_NAME"]!,
subjects: process.env["NATS_SUBJECTS"]!.split(","),
servers:
(process.env["NATS_SERVERS"] &&
process.env["NATS_SERVERS"]!.split(",")) ||
[],
streamName: process.env["NATS_STREAM_NAME"]! || "default-stream",
subjects:
(process.env["NATS_SUBJECTS"] &&
process.env["NATS_SUBJECTS"]!.split(",")) ||
[],
}),
);
......@@ -2,5 +2,5 @@ export interface IGateway {
httpPort: number;
tcpPort: number;
messagePattern: string;
host: string;
host?: string;
}
export interface ILedgers {
ledgers: Array<string>;
idUnionApiKey: string;
idUnionApiBasicUser: string;
idUnionApiBasicPass: string;
}
import Joi from "joi";
export const natsSchema = Joi.object({
NATS_SERVERS: Joi.string().required(),
NATS_STREAM_NAME: Joi.string().required(),
NATS_SUBJECTS: Joi.string().required(),
NATS_SERVERS: Joi.string(),
NATS_STREAM_NAME: Joi.string(),
NATS_SUBJECTS: Joi.string(),
});
......@@ -30,11 +30,20 @@ export class IdunionProvider implements IRegistrator {
this.logger.log(`Trying to register ${did} to idunion`);
try {
await axios.post(`${URL}?apiKey=${this.config.idUnionApiKey}`, {
role: "ENDORSER",
did: unqualifiedIndyDid,
verkey,
});
await axios.post(
`${URL}?apiKey=${this.config.idUnionApiKey}`,
{
role: "ENDORSER",
did: unqualifiedIndyDid,
verkey,
},
{
auth: {
username: this.config.idUnionApiBasicUser,
password: this.config.idUnionApiBasicPass,
},
},
);
this.logger.log("Registration successful");
return did;
......