Skip to content

Commit

Permalink
fix: update scripts to add serdering as import, update credential lis…
Browse files Browse the repository at this point in the history
…t method call (#102)

- add serdering as import
- use ipex.submitAdmit method to admit credential for a multisig holder
- update credential list method call

Signed-off-by: arshdeep singh <arsh.binny@gmail.com>
  • Loading branch information
Arsh-Sandhu authored Jan 12, 2024
1 parent dd0cf79 commit cbe57d4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion scripts/join_new_quadlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from time import sleep

from keri.core import eventing, coring
from keri.core import eventing, coring, serdering
from keri.core.coring import Tiers
from signify.app.clienting import SignifyClient

Expand Down
4 changes: 2 additions & 2 deletions scripts/multisig-create-credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from keri import kering
from keri.app import signing
from keri.app.keeping import Algos
from keri.core import coring, eventing
from keri.core import coring, eventing, serdering
from keri.core.coring import Tiers
from signify.app.clienting import SignifyClient

Expand Down Expand Up @@ -164,7 +164,7 @@ def create_credential():

prefixer = coring.Prefixer(qb64=iserder.pre)
seqner = coring.Seqner(sn=iserder.sn)
acdc = signing.serialize(creder, prefixer, seqner, iserder.saider)
acdc = signing.serialize(creder, prefixer, seqner, coring.Saider(qb64=iserder.said))
iss = registries.serialize(iserder, anc)

embeds = dict(
Expand Down
19 changes: 15 additions & 4 deletions scripts/multisig-holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from keri import kering
from keri.app import signing
from keri.app.keeping import Algos
from keri.core import coring, eventing
from keri.core import coring, eventing, serdering
from keri.core.coring import Tiers
from keri.help import helping

Expand Down Expand Up @@ -136,8 +136,19 @@ def multisig_holder():
sleep(1)
notes = notificatons.list()

print(f"\nissuer notifications..")
print(notes)

print(f"\nChecking credentials for holder1...")
credentials = client1.credentials().list()
while len(credentials) < 1:
print(' No credentials yet...')
sleep(1)
credentials = client1.credentials().list()

print('holder1 recieved credential: ')
creder = serdering.SerderACDC(sad=credentials[0]['sad'])
print(creder.pretty(size=5000))

def create_agent(bran, controller, agent):
url = "http://localhost:3901"
Expand Down Expand Up @@ -224,7 +235,7 @@ def create_admit(client, participant, group, said, recp):
ghab = get_aid(client, group)
mhab = get_aid(client, participant)

admit, sigs, end = ipex.admit(ghab, "", grant, dt=TIME)
admit, sigs, end = ipex.admit(ghab, "", said, dt=TIME)

mstate = ghab["state"]
seal = eventing.SealEvent(i=ghab["prefix"], s=mstate["ee"]["s"], d=mstate["ee"]["d"])
Expand All @@ -239,7 +250,7 @@ def create_admit(client, participant, group, said, recp):
payload=dict(gid=ghab["prefix"]),
embeds=embeds, recipients=recp)

exchanges.sendFromEvents(group, "credential", admit, sigs, atc.decode("utf-8"), [grant.ked['i']])
ipex.submitAdmit(ghab['name'], exn=admit, sigs=sigs, atc=end, recp=grant.ked['i'])


def get_aid(client, name):
Expand Down Expand Up @@ -323,7 +334,7 @@ def create_credential(client, holder):

prefixer = coring.Prefixer(qb64=iserder.pre)
seqner = coring.Seqner(sn=iserder.sn)
acdc = signing.serialize(creder, prefixer, seqner, iserder.saider)
acdc = signing.serialize(creder, prefixer, seqner, coring.Saider(qb64=iserder.said))
iss = registries.serialize(iserder, anc)

grant, sigs, end = ipex.grant(issuer, recp=holder['i'], acdc=acdc,
Expand Down
6 changes: 3 additions & 3 deletions scripts/single-issuer-holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def issue_credential(client: SignifyClient, name: str, registry_name: str, schem

prefixer = coring.Prefixer(qb64=iserder.pre)
seqner = coring.Seqner(sn=iserder.sn)
acdc = signing.serialize(creder, prefixer, seqner, iserder.saider)
acdc = signing.serialize(creder, prefixer, seqner, coring.Saider(qb64=iserder.said))
iss = client.registries().serialize(iserder, anc)

grant, sigs, end = client.ipex().grant(hab, recp=recipient, acdc=acdc,
Expand Down Expand Up @@ -176,11 +176,11 @@ def run():

print(f"Listing credentials...")

credentials = holder_client.credentials().list('holder', filtr={})
credentials = holder_client.credentials().list(filtr={'-a-i': holder_prefix})
while len(credentials) < 1:
print('No credentials yet...')
sleep(1)
credentials = holder_client.credentials().list('holder', filtr={})
credentials = holder_client.credentials().list(filtr={'-a-i': holder_prefix})

print('Succeeded')
creder = serdering.SerderACDC(sad=credentials[0]['sad'])
Expand Down

0 comments on commit cbe57d4

Please sign in to comment.