Skip to content

Commit

Permalink
Refactor deprecated randomNonce() with Salter().qb64 (WebOfTrust#241)
Browse files Browse the repository at this point in the history
Co-authored-by: Rubel Hassan Mollik <[email protected]>
  • Loading branch information
rubelhassan and Rubel Hassan Mollik authored May 9, 2024
1 parent 44cc2d8 commit f833f73
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/keria/app/agenting.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
from keri.app.grouping import Counselor
from keri.app.keeping import Algos
from keri.core import coring, parsing, eventing, routing, serdering
from keri.core.coring import Ilks, randomNonce
from keri.core.coring import Ilks
from keri.core.signing import Salter
from keri.db import dbing
from keri.db.basing import OobiRecord
from keri.vc import protocoling
Expand Down Expand Up @@ -1049,7 +1050,7 @@ def on_post(req, rep):
else:
raise falcon.HTTPBadRequest(description="invalid OOBI request body, either 'rpy' or 'url' is required")

oid = randomNonce()
oid = Salter().qb64
op = agent.monitor.submit(oid, longrunning.OpTypes.oobi, metadata=dict(oobi=oobi))

rep.status = falcon.HTTP_202
Expand Down
3 changes: 2 additions & 1 deletion src/keria/testing/testing_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from keri.core import coring, eventing, parsing, routing, scheming, serdering
from keri.core.coring import MtrDex
from keri.core.eventing import SealEvent
from keri.core.signing import Salter
from keri.help import helping
from keri.kering import TraitCodex
from keri.vc import proving
Expand Down Expand Up @@ -473,7 +474,7 @@ def createRegistry(client, agent, salt, doist, deeds):
pre = aid['i']
assert pre == "EHgwVwQT15OJvilVvW57HE4w0-GPs_Stj2OFoAHZSysY"

nonce = coring.randomNonce()
nonce = Salter().qb64
regser = veventing.incept(pre,
baks=[],
toad="0",
Expand Down
3 changes: 2 additions & 1 deletion tests/app/test_credentialing.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from keri.app import habbing
from keri.core import scheming, coring, parsing, serdering
from keri.core.eventing import SealEvent
from keri.core.signing import Salter
from keri.kering import TraitCodex
from keri.vc import proving
from keri.vdr import eventing
Expand Down Expand Up @@ -116,7 +117,7 @@ def test_registry_end(helpers, seeder):
result = client.simulate_post(path="/identifiers/test123/registries", body=b'{"name": "test"}')
assert result.status == falcon.HTTP_400 # Bad Request, invalid aid name

nonce = coring.randomNonce()
nonce = Salter().qb64
regser = eventing.incept(pre,
baks=[],
toad="0",
Expand Down
5 changes: 3 additions & 2 deletions tests/app/test_indirecting.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from keri import core
from keri.app import habbing, httping
from keri.core import coring, serdering
from keri.core.coring import randomNonce, MtrDex
from keri.core.coring import MtrDex
from keri.core.signing import Salter
from keri.vdr import eventing
from keria.end import ending

Expand Down Expand Up @@ -105,7 +106,7 @@ def test_indirecting(helpers):
regser = eventing.incept(hab.pre,
baks=[],
toad="0",
nonce=randomNonce(),
nonce=Salter().qb64,
cnfg=[],
code=MtrDex.Blake3_256)
headers = Hict([
Expand Down
3 changes: 2 additions & 1 deletion tests/app/test_ipexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from keri import core
from keri.app import habbing, signing
from keri.core import eventing, coring, serdering
from keri.core.signing import Salter
from keri.help import helping
from keri.kering import Roles, TraitCodex
from keri.peer import exchanging
Expand Down Expand Up @@ -601,7 +602,7 @@ def test_multisig_grant_admit(seeder, helpers):
assert holderHab.pre in agent1.hby.kevers

# Create credential registry
nonce = coring.randomNonce()
nonce = Salter().qb64
regser = veventing.incept(issuerPre,
baks=[],
toad="0",
Expand Down
4 changes: 2 additions & 2 deletions tests/app/test_notifying.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
from builtins import isinstance

from keri.core.coring import randomNonce
from keri.core.signing import Salter

from keria.app import notifying, grouping

Expand Down Expand Up @@ -63,7 +63,7 @@ def test_notifications(helpers):
assert notes[1]['a'] == dict(a=2)

# Load with a non-existance last
last = randomNonce()
last = Salter().qb64
# Not found for deleting or marking as read a non-existent note
res = client.simulate_delete(path=f"/notifications/{last}")
assert res.status_code == 404
Expand Down

0 comments on commit f833f73

Please sign in to comment.