Skip to content

Commit

Permalink
fix Serder.Ilks
Browse files Browse the repository at this point in the history
  • Loading branch information
SmithSamuelM committed Mar 8, 2024
1 parent 0a28582 commit 59544a8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
17 changes: 10 additions & 7 deletions src/keri/core/serdering.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,19 @@ class Serder:
r='', rr='', q={}),
saids={Saids.d: DigDex.Blake3_256}),
Ilks.rpy: FieldDom(alls=dict(v='', t='',d='', i='', dt='',
r='',a=[]),
r='',a={}),
saids={Saids.d: DigDex.Blake3_256}),
Ilks.pro: FieldDom(alls=dict(v='', t='',d='', i='', dt='',
r='', rr='', q={}),
saids={Saids.d: DigDex.Blake3_256}),
Ilks.bar: FieldDom(alls=dict(v='', t='',d='', i='', dt='',
r='',a=[]),
r='',a={}),
saids={Saids.d: DigDex.Blake3_256}),
Ilks.exn: FieldDom(alls=dict(v='', t='', d='', i="", p="",
dt='', r='', q={}, a=[], e={}),
Ilks.xip: FieldDom(alls=dict(v='', t='', d='', i="", dt='',
r='', q={}, a={}),
saids={Saids.d: DigDex.Blake3_256}),
Ilks.exn: FieldDom(alls=dict(v='', t='', d='', i="", x="",
p="", dt='', r='', q={}, a={}),
saids={Saids.d: DigDex.Blake3_256}),
},
},
Expand All @@ -366,9 +369,9 @@ class Serder:


# default ilk for each protocol at default version is zeroth ilk in dict
Ilks = dict()
DefaultIlks = dict()
for key, val in Fields.items():
Ilks[key] = list(list(val.values())[0].keys())
DefaultIlks[key] = list(list(val.values())[0].keys())


def __init__(self, *, raw=b'', sad=None, strip=False, version=Version,
Expand Down Expand Up @@ -650,7 +653,7 @@ def makify(self, sad, *, version=None,
kind = skind if skind is not None else self.Kind

if ilk is None:
ilk = silk if silk is not None else self.Ilks[proto][0]
ilk = silk if silk is not None else self.DefaultIlks[proto][0]


if proto not in self.Fields:
Expand Down
6 changes: 4 additions & 2 deletions src/keri/kering.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,16 @@ def sniff(ims):
"""

# KERI protocol packet (message) types
Ilkage = namedtuple("Ilkage", ('icp rot ixn dip drt rct qry rpy exn '
Ilkage = namedtuple("Ilkage", ('icp rot ixn dip drt rct qry rpy xip exn '
'pro bar vcp vrt iss rev bis brv '))

Ilks = Ilkage(icp='icp', rot='rot', ixn='ixn', dip='dip', drt='drt',
rct='rct',
qry='qry', rpy='rpy', exn='exn', pro='pro', bar='bar',
qry='qry', rpy='rpy', xip='xip', exn='exn', pro='pro', bar='bar',
vcp='vcp', vrt='vrt', iss='iss', rev='rev', bis='bis', brv='brv')

# Ilks needs to be versioned for Protocol versions or else use Serder.Fields

# note ksn is not actual standalone message but is embedded in exn msg when sent
# over the wire. But keep ilk for legacy reasons.

Expand Down
3 changes: 2 additions & 1 deletion tests/core/test_serdering.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def test_serder():

assert Serder.Fields

assert Serder.Ilks == {'KERI': ['icp',
# Version 1.0 ilks
assert Serder.DefaultIlks == {'KERI': ['icp',
'rot',
'ixn',
'dip',
Expand Down

0 comments on commit 59544a8

Please sign in to comment.