Skip to content

Commit

Permalink
Merge pull request #617 from WebOfTrust/serder
Browse files Browse the repository at this point in the history
CESR 1.1 Updates from Sam
  • Loading branch information
SmithSamuelM authored Dec 1, 2023
2 parents 024b7fd + 3f64fba commit 2747d24
Show file tree
Hide file tree
Showing 80 changed files with 2,482 additions and 1,928 deletions.
275 changes: 126 additions & 149 deletions docs/naming.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/demo/basic/challenge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
kli init --name cha1 --nopasscode --config-dir "${KERI_SCRIPT_DIR}" --config-file demo-witness-oobis
kli incept --name cha1 --alias cha1 --file ${KERI_DEMO_SCRIPT_DIR}/data/challenge-sample.json
kli ends add --name cha1 --alias cha1 --eid BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM --role mailbox

exit 0
kli init --name cha2 --nopasscode --config-dir "${KERI_SCRIPT_DIR}" --config-file pool2-witness-oobis
kli incept --name cha2 --alias cha2 --file ${KERI_DEMO_SCRIPT_DIR}/data/challenge-sample-pool2.json
kli ends add --name cha2 --alias cha2 --eid BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM --role mailbox
Expand Down
14 changes: 7 additions & 7 deletions src/keri/app/agenting.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from . import httping, forwarding
from .. import help
from .. import kering
from ..core import eventing, parsing, coring
from ..core import eventing, parsing, coring, serdering
from ..core.coring import CtrDex
from ..db import dbing
from ..kering import Roles
Expand All @@ -39,9 +39,9 @@ def __init__(self, hby, msgs=None, gets=None, cues=None):

def receipt(self, pre, sn=None):
""" Returns a generator for witness receipting
The returns a generator that will submit the designated event to witnesses for receipts using
the synchronous witness API, the propogate the receipts to each of the other witnesses.
The returns a generator that will submit the designated event to witnesses for receipts using
the synchronous witness API, the propogate the receipts to each of the other witnesses.
Parameters:
Expand All @@ -63,7 +63,7 @@ def receipt(self, pre, sn=None):
return

msg = hab.makeOwnEvent(sn=sn)
ser = coring.Serder(raw=msg)
ser = serdering.SerderKERI(raw=msg)

# If we are a rotation event, may need to catch new witnesses up to current key state
if ser.ked['t'] in (coring.Ilks.rot,):
Expand All @@ -89,7 +89,7 @@ def receipt(self, pre, sn=None):
if rep.status == 200:
rct = bytearray(rep.body)
hab.psr.parseOne(bytearray(rct))
rserder = coring.Serder(raw=rct)
rserder = serdering.SerderKERI(raw=rct)
del rct[:rserder.size]

# pull off the count code
Expand Down Expand Up @@ -315,7 +315,7 @@ def receiptDo(self, tymth=None, tock=0.0):
continue

msg = hab.makeOwnEvent(sn=sn)
ser = coring.Serder(raw=msg)
ser = serdering.SerderKERI(raw=msg)

dgkey = dbing.dgKey(ser.preb, ser.saidb)

Expand Down
12 changes: 6 additions & 6 deletions src/keri/app/cli/commands/delegate/confirm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from keri.app import habbing, indirecting, agenting, grouping, forwarding, delegating, notifying
from keri.app.cli.common import existing
from keri.app.habbing import GroupHab
from keri.core import coring
from keri.core import coring, serdering
from keri.db import dbing
from keri.peer import exchanging

Expand Down Expand Up @@ -101,12 +101,12 @@ def confirmDo(self, tymth, tock=0.0):
eraw = self.hby.db.getEvt(dgkey)
if eraw is None:
continue
eserder = coring.Serder(raw=bytes(eraw)) # escrowed event
eserder = serdering.SerderKERI(raw=bytes(eraw)) # escrowed event

ilk = eserder.ked["t"]
ilk = eserder.sad["t"]
if ilk in (coring.Ilks.dip,):
typ = "inception"
delpre = eserder.ked["di"]
delpre = eserder.sad["di"]

elif ilk in (coring.Ilks.drt,):
typ = "rotation"
Expand Down Expand Up @@ -138,7 +138,7 @@ def confirmDo(self, tymth, tock=0.0):
print("Confirm does not support rotation for delegation approval with group multisig")
continue

serder = coring.Serder(raw=msg)
serder = serdering.SerderKERI(raw=msg)
exn, atc = grouping.multisigInteractExn(ghab=hab, aids=aids, ixn=bytearray(msg))
others = list(oset(hab.smids + (hab.rmids or [])))
others.remove(hab.mhab.pre)
Expand Down Expand Up @@ -187,7 +187,7 @@ def confirmDo(self, tymth, tock=0.0):
print(f'\tDelegate {eserder.pre} {typ} Anchored at Seq. No. {hab.kever.sner.num}')

# wait for confirmation of fully commited event
wits = [werfer.qb64 for werfer in eserder.werfers]
wits = [werfer.qb64 for werfer in eserder.berfers]
self.witq.query(src=hab.pre, pre=eserder.pre, sn=eserder.sn, wits=wits)

while eserder.pre not in self.hby.kevers:
Expand Down
2 changes: 1 addition & 1 deletion src/keri/app/cli/commands/delegate/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from keri.app import habbing, indirecting, agenting, grouping, forwarding, delegating
from keri.app.cli.common import existing
from keri.app.habbing import GroupHab
from keri.core import coring
from keri.core import coring, serdering
from keri.db import dbing

logger = help.ogler.getLogger()
Expand Down
6 changes: 3 additions & 3 deletions src/keri/app/cli/commands/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from hio.base import doing

from keri.app.cli.common import existing
from keri.core import coring
from keri.core import coring, serdering

logger = help.ogler.getLogger()

Expand Down Expand Up @@ -92,7 +92,7 @@ def outputKEL(self, pre):
if f is not None:
f.write(msg.decode("utf-8"))
else:
serder = coring.Serder(raw=msg)
serder = serdering.SerderKERI(raw=msg)
atc = msg[serder.size:]
sys.stdout.write(serder.raw.decode("utf-8"))
sys.stdout.write(atc.decode("utf-8"))
Expand All @@ -110,7 +110,7 @@ def outputEnds(self, pre):
if f is not None:
f.write(msg.decode("utf-8"))
else:
serder = coring.Serder(raw=msg)
serder = serdering.SerderKERI(raw=msg)
atc = msg[serder.size:]
sys.stdout.write(serder.raw.decode("utf-8"))
sys.stdout.write(atc.decode("utf-8"))
4 changes: 2 additions & 2 deletions src/keri/app/cli/commands/kevers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from keri.app import indirecting
from keri.app.cli.common import displaying, existing
from keri.core import coring
from keri.core import coring, serdering
from keri.help import helping

logger = help.ogler.getLogger()
Expand Down Expand Up @@ -84,7 +84,7 @@ def kevers(self, tymth, tock=0.0, **opts):

cloner = self.hby.db.clonePreIter(pre=self.prefix, fn=0) # create iterator at 0
for msg in cloner:
srdr = coring.Serder(raw=msg)
srdr = serdering.SerderKERI(raw=msg)
print(srdr.pretty())
print()

Expand Down
2 changes: 1 addition & 1 deletion src/keri/app/cli/commands/multisig/incept.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from keri.app import indirecting, grouping, habbing, forwarding
from keri.app.cli.common import existing, displaying
from keri.app.notifying import Notifier
from keri.core import coring
from keri.core import coring, serdering
from keri.peer import exchanging

logger = help.ogler.getLogger()
Expand Down
4 changes: 2 additions & 2 deletions src/keri/app/cli/commands/multisig/interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from keri.app import grouping, indirecting, habbing, forwarding
from keri.app.cli.common import existing, displaying, config
from keri.app.notifying import Notifier
from keri.core import coring
from keri.core import coring, serdering
from keri.peer import exchanging

logger = help.ogler.getLogger()
Expand Down Expand Up @@ -113,7 +113,7 @@ def interactDo(self, tymth, tock=0.0):
aids = self.aids if self.aids is not None else ghab.smids

ixn = ghab.interact(data=self.data)
serder = coring.Serder(raw=ixn)
serder = serdering.SerderKERI(raw=ixn)

exn, ims = grouping.multisigInteractExn(ghab=ghab, aids=aids, ixn=ixn)
others = list(oset(ghab.smids + (ghab.rmids or [])))
Expand Down
10 changes: 5 additions & 5 deletions src/keri/app/cli/commands/multisig/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from keri import help, kering
from keri.app import habbing, indirecting, agenting, notifying, grouping, connecting, forwarding
from keri.app.cli.common import existing, displaying
from keri.core import coring, eventing, scheming, parsing, routing
from keri.core import coring, eventing, scheming, parsing, routing, serdering
from keri.peer import exchanging
from keri.vc import proving
from keri.vdr import verifying, credentialing
Expand Down Expand Up @@ -233,7 +233,7 @@ def interact(self, attrs):

if approve:
ixn = ghab.interact(data=data)
serder = coring.Serder(raw=ixn)
serder = serdering.SerderKERI(raw=ixn)
prefixer = coring.Prefixer(qb64=ghab.pre)
seqner = coring.Seqner(sn=serder.sn)
saider = coring.Saider(qb64b=serder.saidb)
Expand Down Expand Up @@ -324,12 +324,12 @@ def rotate(self, attrs):
ghab = self.hby.joinGroupHab(pre, group=alias, mhab=mhab, smids=smids, rmids=rmids)

try:
serder = coring.Serder(ked=ked)
serder = serdering.SerderKERI(sad=ked)
rot = ghab.rotate(serder=serder)
except ValueError as e:
return False

serder = coring.Serder(raw=rot)
serder = serdering.SerderKERI(raw=rot)
prefixer = coring.Prefixer(qb64=ghab.pre)
seqner = coring.Seqner(sn=serder.sn)

Expand Down Expand Up @@ -623,7 +623,7 @@ def iss(self, attrs):
pass

acdc = embeds["acdc"]
creder = proving.Creder(ked=acdc)
creder = serdering.SerderACDC(sad=acdc)
acdc = bytearray(creder.raw) + pathed["acdc"]
self.psr.parseOne(ims=bytes(acdc))

Expand Down
16 changes: 8 additions & 8 deletions src/keri/app/cli/commands/multisig/rotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from keri.app import grouping, indirecting, habbing, forwarding
from keri.app.cli.common import rotating, existing, displaying, config
from keri.app.notifying import Notifier
from keri.core import coring
from keri.core import coring, serdering
from keri.db import dbing
from keri.peer import exchanging

Expand Down Expand Up @@ -84,7 +84,7 @@ def __init__(self, name, base, bran, alias, smids=None, rmids=None, isith=None,
self.wits = wits if wits is not None else []
self.cuts = cuts if cuts is not None else []
self.adds = adds if adds is not None else []

self.hby = existing.setupHby(name=name, base=base, bran=bran)
self.hbyDoer = habbing.HaberyDoer(habery=self.hby) # setup doer
notifier = Notifier(self.hby)
Expand Down Expand Up @@ -123,7 +123,7 @@ def rotateDo(self, tymth, tock=0.0, **opts):

if self.smids is None:
self.smids = ghab.smids

if self.rmids is None:
self.rmids = self.smids

Expand Down Expand Up @@ -157,8 +157,8 @@ def rotateDo(self, tymth, tock=0.0, **opts):
raise kering.ConfigurationError(f"non-existant event {sn} for signing member {mid}")

evt = self.hby.db.getEvt(dbing.dgKey(mid, bytes(dig)))
serder = coring.Serder(raw=bytes(evt))
if not serder.est:
serder = serdering.SerderKERI(raw=bytes(evt))
if not serder.estive:
raise kering.ConfigurationError(f"invalid event {sn} for signing member {mid}")

merfers.append(serder.verfers[0])
Expand Down Expand Up @@ -188,8 +188,8 @@ def rotateDo(self, tymth, tock=0.0, **opts):
raise kering.ConfigurationError(f"non-existant event {sn} for rotation member {mid}")

evt = self.hby.db.getEvt(dbing.dgKey(mid, bytes(dig)))
serder = coring.Serder(raw=bytes(evt))
if not serder.est:
serder = serdering.SerderKERI(raw=bytes(evt))
if not serder.estive:
raise kering.ConfigurationError(f"invalid event {sn} for rotation member {mid}")

migers.append(serder.digers[0])
Expand All @@ -207,7 +207,7 @@ def rotateDo(self, tymth, tock=0.0, **opts):
toad=self.toad, cuts=list(self.cuts), adds=list(self.adds), data=self.data,
verfers=merfers, digers=migers)

rserder = coring.Serder(raw=rot)
rserder = serdering.SerderKERI(raw=rot)
# Create a notification EXN message to send to the other agents
exn, ims = grouping.multisigRotateExn(ghab=ghab,
smids=smids,
Expand Down
4 changes: 2 additions & 2 deletions src/keri/app/cli/commands/rollback.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from keri import kering
from keri.app.cli.common import displaying, existing
from keri.core import coring
from keri.core import coring, serdering
from keri.db import dbing, basing
from keri.help import helping
from keri.kering import ConfigurationError
Expand Down Expand Up @@ -69,7 +69,7 @@ def rollback(tymth, tock=0.0, **opts):

pDgKey = dbing.dgKey(serder.preb, bytes(pdig)) # get message
raw = hby.db.getEvt(key=pDgKey)
pserder = coring.Serder(raw=bytes(raw))
pserder = serdering.SerderKERI(raw=bytes(raw))

dgkey = dbing.dgKey(serder.preb, serder.saidb)
hby.db.delEvt(dgkey)
Expand Down
3 changes: 2 additions & 1 deletion src/keri/app/cli/commands/vc/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from hio.base import doing

from keri import kering
from keri.core import serdering
from keri.app import indirecting, habbing, grouping, connecting, forwarding, signing, notifying
from keri.app.cli.common import existing
from keri.core import coring, eventing
Expand Down Expand Up @@ -176,7 +177,7 @@ def __init__(self, name, alias, base, bran, registryName=None, schema=None, edge
data=data,
private=private)
else:
self.creder = proving.Creder(ked=credential)
self.creder = serdering.SerderACDC(sad=credential) # proving.Creder(ked=credential)
self.credentialer.validate(creder=self.creder)

except kering.ConfigurationError as e:
Expand Down
14 changes: 7 additions & 7 deletions src/keri/app/cli/commands/vc/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from hio.base import doing

from keri.app.cli.common import existing
from keri.core import coring
from keri.core import coring, serdering
from keri.vdr import credentialing

logger = help.ogler.getLogger()
Expand Down Expand Up @@ -43,7 +43,7 @@ def export_credentials(args):
"""
tels = args.tels
kels = args.kels
chains = args.chains
chains = args.edge

if args.full:
tels = kels = chains = True
Expand Down Expand Up @@ -103,12 +103,12 @@ def outputCred(self, said):
self.outputKEL(issr)

if self.tels:
if creder.status is not None:
self.outputTEL(creder.status)
if creder.regi is not None:
self.outputTEL(creder.regi)
self.outputTEL(creder.said)

if self.chains:
chains = creder.chains
chains = creder.edge
saids = []
for key, source in chains.items():
if key == 'd':
Expand Down Expand Up @@ -139,7 +139,7 @@ def outputTEL(self, regk):
if f is not None:
f.write(msg.decode("utf-8"))
else:
serder = coring.Serder(raw=msg)
serder = serdering.SerderKERI(raw=msg)
atc = msg[serder.size:]
sys.stdout.write(serder.raw.decode("utf-8"))
sys.stdout.write(atc.decode("utf-8"))
Expand All @@ -156,7 +156,7 @@ def outputKEL(self, pre):
if f is not None:
f.write(msg.decode("utf-8"))
else:
serder = coring.Serder(raw=msg)
serder = serdering.SerderKERI(raw=msg)
atc = msg[serder.size:]
sys.stdout.write(serder.raw.decode("utf-8"))
sys.stdout.write(atc.decode("utf-8"))
Expand Down
6 changes: 3 additions & 3 deletions src/keri/app/cli/commands/vc/revoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def revokeDo(self, tymth, tock=0.0):
hab = registry.hab

state = registry.tever.vcState(vci=creder.said)
if state is None or state.ked["et"] not in (coring.Ilks.iss, coring.Ilks.rev):
if state is None or state.et not in (coring.Ilks.iss, coring.Ilks.rev):
raise kering.ValidationError(f"credential {creder.said} not is correct state for revocation")

rserder = registry.revoke(said=creder.said, **kwargs)
Expand Down Expand Up @@ -139,8 +139,8 @@ def revokeDo(self, tymth, tock=0.0):
while not self.registrar.complete(creder.said, sn=1):
yield self.tock

if self.hab.witnesser() and 'i' in creder.subject:
recp = creder.subject['i']
if self.hab.witnesser() and 'i' in creder.attrib:
recp = creder.attrib['i']
msgs = []
for msg in self.hby.db.clonePreIter(pre=creder.issuer):
serder = coring.Serder(raw=msg)
Expand Down
4 changes: 3 additions & 1 deletion src/keri/app/cli/common/existing.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def setupHby(name, base="", bran=None, cf=None):
retries += 1
hby = habbing.Habery(name=name, base=base, bran=bran, cf=cf, free=True)
break
except (kering.AuthError, ValueError):
except (kering.AuthError, ValueError) as e:
raise e

if retries >= 3:
raise kering.AuthError("too many attempts")
print("Valid passcode required, try again...")
Expand Down
Loading

0 comments on commit 2747d24

Please sign in to comment.