From 53ef5837eae05343b60091b6463c5c211ff4a28b Mon Sep 17 00:00:00 2001 From: "leo.do" Date: Wed, 17 Jul 2024 10:36:15 +0700 Subject: [PATCH 1/4] DTIS-982: update the cnfg and data for incept event message --- examples/integration-scripts/witness.test.ts | 2 ++ src/keri/app/aiding.ts | 6 ++++-- src/keri/app/habery.ts | 1 + src/keri/core/eventing.ts | 5 +++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/integration-scripts/witness.test.ts b/examples/integration-scripts/witness.test.ts index b7b39a3e..7313aad9 100644 --- a/examples/integration-scripts/witness.test.ts +++ b/examples/integration-scripts/witness.test.ts @@ -35,6 +35,8 @@ test('test witness', async () => { let icpResult1 = await client1.identifiers().create('aid1', { toad: 1, wits: [WITNESS_AID], + cnfg: ["RB"], + data: {"ledger": "CARDANO_PREVIEW"} }); await waitOperation(client1, await icpResult1.op()); let aid1 = await client1.identifiers().get('aid1'); diff --git a/src/keri/app/aiding.ts b/src/keri/app/aiding.ts index f508f182..3081ed1a 100644 --- a/src/keri/app/aiding.ts +++ b/src/keri/app/aiding.ts @@ -19,6 +19,7 @@ export interface CreateIdentiferArgs { delpre?: string; dcode?: string; data?: any; + cnfg?: any[]; algo?: Algos; pre?: string; states?: any[]; @@ -141,6 +142,7 @@ export class Identifier { const proxy = kargs.proxy; const delpre = kargs.delpre; const data = kargs.data != undefined ? [kargs.data] : []; + const cnfg = kargs.cnfg != undefined ? kargs.cnfg : []; const pre = kargs.pre; const states = kargs.states; const rstates = kargs.rstates; @@ -195,7 +197,7 @@ export class Identifier { nsith: nsith, toad: toad, wits: wits, - cnfg: [], + cnfg: cnfg, data: data, version: Versionage, kind: Serials.JSON, @@ -210,7 +212,7 @@ export class Identifier { nsith: nsith, toad: toad, wits: wits, - cnfg: [], + cnfg: cnfg, data: data, version: Versionage, kind: Serials.JSON, diff --git a/src/keri/app/habery.ts b/src/keri/app/habery.ts index 3339a27b..12b769fe 100644 --- a/src/keri/app/habery.ts +++ b/src/keri/app/habery.ts @@ -10,6 +10,7 @@ export class TraitCodex { EstOnly: string = 'EO'; // Only allow establishment events DoNotDelegate: string = 'DND'; // Dot not allow delegated identifiers NoBackers: string = 'NB'; // Do not allow backers + RegistrarBackers: string = 'RB'; // Registrar backers } export const TraitDex = new TraitCodex(); diff --git a/src/keri/core/eventing.ts b/src/keri/core/eventing.ts index d03e4473..3c025b11 100644 --- a/src/keri/core/eventing.ts +++ b/src/keri/core/eventing.ts @@ -9,6 +9,7 @@ import { Version, Versionage, } from './core'; +import { TraitDex } from '../app/habery'; import { Tholder } from './tholder'; import { CesrNumber } from './number'; import { Prefixer } from './prefixer'; @@ -403,6 +404,10 @@ export function incept({ [, ked] = Saider.saidify(ked); } + if (cnfg.includes(TraitDex.RegistrarBackers)) { + ked['a'] = [ked['d']] + } + return new Serder(ked); } From 89782a817711915514fca47f98182e86dc6dfc58 Mon Sep 17 00:00:00 2001 From: "leo.do" Date: Wed, 17 Jul 2024 14:31:42 +0700 Subject: [PATCH 2/4] update: the value for data key --- src/keri/core/eventing.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/keri/core/eventing.ts b/src/keri/core/eventing.ts index 3c025b11..7bfe8532 100644 --- a/src/keri/core/eventing.ts +++ b/src/keri/core/eventing.ts @@ -405,7 +405,7 @@ export function incept({ } if (cnfg.includes(TraitDex.RegistrarBackers)) { - ked['a'] = [ked['d']] + ked['a'] = { d: ked['d'] } } return new Serder(ked); From 30403c85550ff1a36d7524a4b78a86026fc20d58 Mon Sep 17 00:00:00 2001 From: "leo.do" Date: Thu, 18 Jul 2024 20:07:12 +0700 Subject: [PATCH 3/4] DTIS-982: Modify data for ths SAID --- src/keri/core/eventing.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/keri/core/eventing.ts b/src/keri/core/eventing.ts index 7bfe8532..8ad341b1 100644 --- a/src/keri/core/eventing.ts +++ b/src/keri/core/eventing.ts @@ -405,9 +405,10 @@ export function incept({ } if (cnfg.includes(TraitDex.RegistrarBackers)) { - ked['a'] = { d: ked['d'] } + let new_data = {}; + [, new_data] = Saider.saidify(ked["a"][0]); + ked['a'] = [new_data] } - return new Serder(ked); } From 3a0df1eb23c3df0fbb023b4064ffe3639133f394 Mon Sep 17 00:00:00 2001 From: "leo.do" Date: Thu, 18 Jul 2024 20:09:07 +0700 Subject: [PATCH 4/4] DTIS-982: Update the test --- examples/integration-scripts/witness.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/integration-scripts/witness.test.ts b/examples/integration-scripts/witness.test.ts index 7313aad9..12755b84 100644 --- a/examples/integration-scripts/witness.test.ts +++ b/examples/integration-scripts/witness.test.ts @@ -36,7 +36,7 @@ test('test witness', async () => { toad: 1, wits: [WITNESS_AID], cnfg: ["RB"], - data: {"ledger": "CARDANO_PREVIEW"} + data: {"ledger": "CARDANO_PREVIEW", "d": ""} }); await waitOperation(client1, await icpResult1.op()); let aid1 = await client1.identifiers().get('aid1');