Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DTIS-982] Confit traits #3

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/integration-scripts/witness.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", "d": ""}
});
await waitOperation(client1, await icpResult1.op());
let aid1 = await client1.identifiers().get('aid1');
Expand Down
6 changes: 4 additions & 2 deletions src/keri/app/aiding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface CreateIdentiferArgs {
delpre?: string;
dcode?: string;
data?: any;
cnfg?: any[];
algo?: Algos;
pre?: string;
states?: any[];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -195,7 +197,7 @@ export class Identifier {
nsith: nsith,
toad: toad,
wits: wits,
cnfg: [],
cnfg: cnfg,
data: data,
version: Versionage,
kind: Serials.JSON,
Expand All @@ -210,7 +212,7 @@ export class Identifier {
nsith: nsith,
toad: toad,
wits: wits,
cnfg: [],
cnfg: cnfg,
data: data,
version: Versionage,
kind: Serials.JSON,
Expand Down
1 change: 1 addition & 0 deletions src/keri/app/habery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions src/keri/core/eventing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -403,6 +404,11 @@ export function incept({
[, ked] = Saider.saidify(ked);
}

if (cnfg.includes(TraitDex.RegistrarBackers)) {
let new_data = {};
[, new_data] = Saider.saidify(ked["a"][0]);
ked['a'] = [new_data]
}
return new Serder(ked);
}

Expand Down
Loading