diff --git a/.env.example b/.env.example index 7553fff1fc5aed12927489f7562b5956c297c0e5..7ff990004c75f3e5d50d4d3ed48fbefa033288e3 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,7 @@ LEDGERS="BCOVRIN_TEST" IDUNION_KEY=#add if you are using IDUNION as a ledger +IDUNION_BASIC_USER= +IDUNION_BASIC_PASS= AGENT_PEER_URL=http://localhost:8001,ws://localhost:8002 AGENT_NAME=EXAMPTTLE_AGENT_45 diff --git a/compose/env/holder.env b/compose/env/holder.env index 2d6baefb409488da9c470b0b7345fa907b62b151..0966044f9b5444002983d0a74d73bb16ea093a54 100644 --- a/compose/env/holder.env +++ b/compose/env/holder.env @@ -1,5 +1,7 @@ -LEDGERS="BCOVRIN_TEST" +LEDGERS=IDUNION IDUNION_KEY= +IDUNION_BASIC_USER= +IDUNION_BASIC_PASS= AGENT_PEER_URL=http://new.didgram.pro:6001,ws://new.didgram.pro:6002 AGENT_NAME=DEV_AGENT_HOLDER_OCM_4 # this should be changed to company name diff --git a/compose/env/holder.simple.env b/compose/env/holder.simple.env index 6d8e0ac8947cb05f622f709a4ed5388195e85bdf..f04aa0a9d8a3799cac048c7591b0e224463314ce 100644 --- a/compose/env/holder.simple.env +++ b/compose/env/holder.simple.env @@ -1,5 +1,7 @@ -LEDGERS="BCOVRIN_TEST" +LEDGERS=IDUNION IDUNION_KEY= +IDUNION_BASIC_USER= +IDUNION_BASIC_PASS= AGENT_PEER_URL=http://agent-holder:6001,ws://agent-holder:6002 AGENT_NAME=DEV_SIMPLE_AGENT_HOLDER_OCM # this should be changed to company name diff --git a/compose/env/issuer.env b/compose/env/issuer.env index 5ddf0c87110bf4b9352a420596d8b29dae7b85e7..92b9df2bc66a9bb7e29ba140ea7cf456e970e560 100644 --- a/compose/env/issuer.env +++ b/compose/env/issuer.env @@ -1,5 +1,7 @@ -LEDGERS="BCOVRIN_TEST" +LEDGERS=IDUNION IDUNION_KEY= +IDUNION_BASIC_USER= +IDUNION_BASIC_PASS= AGENT_PEER_URL=http://new.didgram.pro:8001,ws://new.didgram.pro:8002 AGENT_NAME=DEV_AGENT_ISSUER_OCM_4 # this should be changed to company name diff --git a/compose/env/issuer.simple.env b/compose/env/issuer.simple.env index a974ad464fe7b01cf6451c025250231adafcc8b9..02e4a0bd1a7fcfbf1ae7c21e5280df7b99129ad0 100644 --- a/compose/env/issuer.simple.env +++ b/compose/env/issuer.simple.env @@ -1,5 +1,7 @@ -LEDGERS="BCOVRIN_TEST" +LEDGERS=IDUNION IDUNION_KEY= +IDUNION_BASIC_USER= +IDUNION_BASIC_PASS= AGENT_PEER_URL=http://agent-issuer:8001,ws://agent-issuer:8002 AGENT_NAME=DEV_SIMPLE_AGENT_ISSUER_OCM # this should be changed to company name diff --git a/libs/config/src/config/ledgers.config.ts b/libs/config/src/config/ledgers.config.ts index de79f8a9af7f5173ada50f3bb31f16f2e2f9efe6..8d7c3c672df77b960758aed40014c243e0a94eeb 100644 --- a/libs/config/src/config/ledgers.config.ts +++ b/libs/config/src/config/ledgers.config.ts @@ -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"]!, }), ); diff --git a/libs/config/src/interfaces/ledgers.config.interface.ts b/libs/config/src/interfaces/ledgers.config.interface.ts index a49c9850e94d8f14581774d5fc9694dd75c1d685..c7af9b9afcf1690d455e151a55e4f4001a2ea997 100644 --- a/libs/config/src/interfaces/ledgers.config.interface.ts +++ b/libs/config/src/interfaces/ledgers.config.interface.ts @@ -1,4 +1,6 @@ export interface ILedgers { ledgers: Array<string>; idUnionApiKey: string; + idUnionApiBasicUser: string; + idUnionApiBasicPass: string; } diff --git a/libs/config/src/schemas/ledgers.schema.ts b/libs/config/src/schemas/ledgers.schema.ts index d305f72862825e6b7f89dd6dccc1972fcd9e2637..67a2cf3fc798828230d762d621e29ae4d55b3702 100644 --- a/libs/config/src/schemas/ledgers.schema.ts +++ b/libs/config/src/schemas/ledgers.schema.ts @@ -3,4 +3,6 @@ import Joi from "joi"; export const ledgersSchema = Joi.object({ LEDGERS: Joi.string().required(), IDUNION_KEY: Joi.string(), + IDUNION_BASIC_USER: Joi.string(), + IDUNION_BASIC_PASS: Joi.string(), }); diff --git a/libs/ledgers/src/idunion/idunion.provider.ts b/libs/ledgers/src/idunion/idunion.provider.ts index 5c6dcf4654797c7f773a59b9c9e9f318773441f5..0a5fa67caeef847c65e774d904dd090b86129133 100644 --- a/libs/ledgers/src/idunion/idunion.provider.ts +++ b/libs/ledgers/src/idunion/idunion.provider.ts @@ -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;