From 0ecde76b98491d7d52d4ec1521da71f711fc46cf Mon Sep 17 00:00:00 2001 From: Charles Lanahan Date: Thu, 25 Apr 2024 11:46:54 -0400 Subject: [PATCH 1/6] Adjusted log message to clarify which SAID errored as SADs may contain multiple SAIDs --- src/keri/core/serdering.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/keri/core/serdering.py b/src/keri/core/serdering.py index afe6686d..be9f035f 100644 --- a/src/keri/core/serdering.py +++ b/src/keri/core/serdering.py @@ -785,8 +785,8 @@ def _verify(self): dkwa.update(length=length) dig = Matter(raw=klas(raw, **ikwa).digest(**dkwa), code=code).qb64 if dig != self._sad[label]: # compare to original - raise ValidationError(f"Invalid said field '{label}' in sad" - f" = {self._sad}, should be {dig}.") + raise ValidationError(f"Invalid said field '{label}': '{self._sad[label]}'" + f" in sad = {self._sad}, should be {dig}.") sad[label] = dig raw = self.dumps(sad, kind=self.kind) # compute final raw From 0ddc90e8c2f6209f08a2e8ee257325d424053f15 Mon Sep 17 00:00:00 2001 From: Charles Lanahan Date: Thu, 25 Apr 2024 21:36:49 -0400 Subject: [PATCH 2/6] Adjusted workflow to get right image to run --- .github/workflows/python-app-ci.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python-app-ci.yml b/.github/workflows/python-app-ci.yml index d0ae68b2..4bfde642 100644 --- a/.github/workflows/python-app-ci.yml +++ b/.github/workflows/python-app-ci.yml @@ -7,6 +7,7 @@ on: push: branches: - 'main' + - 'development' pull_request: workflow_dispatch: @@ -20,10 +21,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.12.2 + - name: Set up Python 3.10.4 uses: actions/setup-python@v2 with: - python-version: 3.12.2 + python-version: 3.10.4 - name: Install dependencies run: | python -m pip install --upgrade pip @@ -46,10 +47,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python 3.12.2 + - name: Set up Python 3.10.4 uses: actions/setup-python@v2 with: - python-version: 3.12.2 + python-version: 3.10.4 - name: Install dependencies run: | python -m pip install --upgrade pip @@ -59,18 +60,18 @@ jobs: run: | pytest --cov=./ --cov-report=xml - name: Upload - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v3 with: - token: ${{ secrets.CODECOV_TOKEN }} + token: 5eb1c60e-8b43-45f1-a003-357b240061cd scripts: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python 3.12.2 + - name: Set up Python 3.10.4 uses: actions/setup-python@v2 with: - python-version: 3.12.2 + python-version: 3.10.4 - name: Install dependencies run: | python -m pip install --upgrade pip From 65c8c0afd3ec4e161fa8c89e276c50340adfa8a8 Mon Sep 17 00:00:00 2001 From: Charles Lanahan Date: Wed, 7 Aug 2024 21:45:24 +0900 Subject: [PATCH 3/6] Adjusted help descriptions to more accurately describe what that command does in keripy --- src/keri/app/cli/commands/escrow.py | 2 +- src/keri/app/cli/commands/kevers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/keri/app/cli/commands/escrow.py b/src/keri/app/cli/commands/escrow.py index 62546fa1..4602a678 100644 --- a/src/keri/app/cli/commands/escrow.py +++ b/src/keri/app/cli/commands/escrow.py @@ -18,7 +18,7 @@ logger = help.ogler.getLogger() -parser = argparse.ArgumentParser(description='Initialize a prefix') +parser = argparse.ArgumentParser(description='Views events in escrow state.') parser.set_defaults(handler=lambda args: handler(args), transferable=True) parser.add_argument('--name', '-n', help='keystore name and file location of KERI keystore', required=True) diff --git a/src/keri/app/cli/commands/kevers.py b/src/keri/app/cli/commands/kevers.py index 4509c476..a1badf24 100644 --- a/src/keri/app/cli/commands/kevers.py +++ b/src/keri/app/cli/commands/kevers.py @@ -18,7 +18,7 @@ logger = help.ogler.getLogger() -parser = argparse.ArgumentParser(description='Initialize a prefix') +parser = argparse.ArgumentParser(description='Poll events at controller for prefix') parser.set_defaults(handler=lambda args: handler(args), transferable=True) parser.add_argument('--name', '-n', help='keystore name and file location of KERI keystore', required=True) From ffe7ecab1b23c4d2546d93bbb1449f46abf6d1f6 Mon Sep 17 00:00:00 2001 From: Charles Lanahan Date: Wed, 7 Aug 2024 22:21:43 +0900 Subject: [PATCH 4/6] Restored these files to what they are in origin/main --- .github/workflows/python-app-ci.yml | 17 ++++++++--------- src/keri/core/serdering.py | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/python-app-ci.yml b/.github/workflows/python-app-ci.yml index 4bfde642..d0ae68b2 100644 --- a/.github/workflows/python-app-ci.yml +++ b/.github/workflows/python-app-ci.yml @@ -7,7 +7,6 @@ on: push: branches: - 'main' - - 'development' pull_request: workflow_dispatch: @@ -21,10 +20,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.10.4 + - name: Set up Python 3.12.2 uses: actions/setup-python@v2 with: - python-version: 3.10.4 + python-version: 3.12.2 - name: Install dependencies run: | python -m pip install --upgrade pip @@ -47,10 +46,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python 3.10.4 + - name: Set up Python 3.12.2 uses: actions/setup-python@v2 with: - python-version: 3.10.4 + python-version: 3.12.2 - name: Install dependencies run: | python -m pip install --upgrade pip @@ -60,18 +59,18 @@ jobs: run: | pytest --cov=./ --cov-report=xml - name: Upload - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: - token: 5eb1c60e-8b43-45f1-a003-357b240061cd + token: ${{ secrets.CODECOV_TOKEN }} scripts: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python 3.10.4 + - name: Set up Python 3.12.2 uses: actions/setup-python@v2 with: - python-version: 3.10.4 + python-version: 3.12.2 - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/src/keri/core/serdering.py b/src/keri/core/serdering.py index be9f035f..afe6686d 100644 --- a/src/keri/core/serdering.py +++ b/src/keri/core/serdering.py @@ -785,8 +785,8 @@ def _verify(self): dkwa.update(length=length) dig = Matter(raw=klas(raw, **ikwa).digest(**dkwa), code=code).qb64 if dig != self._sad[label]: # compare to original - raise ValidationError(f"Invalid said field '{label}': '{self._sad[label]}'" - f" in sad = {self._sad}, should be {dig}.") + raise ValidationError(f"Invalid said field '{label}' in sad" + f" = {self._sad}, should be {dig}.") sad[label] = dig raw = self.dumps(sad, kind=self.kind) # compute final raw From 465b60bc16f6ff513d02aad4f344d08a5634991d Mon Sep 17 00:00:00 2001 From: Charles Lanahan Date: Sat, 21 Sep 2024 23:31:48 +0200 Subject: [PATCH 5/6] Removed --prefix from verify command. Prefixes are 1-1 with aliases which are already required for this command and thus redundant. Removed for ease of use. --- scripts/demo/basic/demo-script.sh | 8 ++++---- src/keri/app/cli/commands/verify.py | 4 +--- tests/app/cli/test_kli_commands.py | 2 -- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/scripts/demo/basic/demo-script.sh b/scripts/demo/basic/demo-script.sh index 1cdbd619..dbb851a2 100755 --- a/scripts/demo/basic/demo-script.sh +++ b/scripts/demo/basic/demo-script.sh @@ -46,16 +46,16 @@ isSuccess kli sign --name test --base "${KERI_TEMP_DIR}" --alias trans --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json isSuccess -kli verify --name test --base "${KERI_TEMP_DIR}" --alias trans --prefix EIryzWYlZ9bQr7EhMAoBXk4r2h-OgaEqERid7-AHNp6o --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature AABuQervAG8QLyvho99362U8TScec_4zYDVF1pUMWfWfKbl5thR6QakpvSvVMdcPcGYxi0McgNtW-Z3EhpC01I4A +kli verify --name test --base "${KERI_TEMP_DIR}" --alias trans --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature AABuQervAG8QLyvho99362U8TScec_4zYDVF1pUMWfWfKbl5thR6QakpvSvVMdcPcGYxi0McgNtW-Z3EhpC01I4A isSuccess -kli verify --name test --base "${KERI_TEMP_DIR}" --alias trans --prefix EIryzWYlZ9bQr7EhMAoBXk4r2h-OgaEqERid7-AHNp6o --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature ABBJcS2ZbcHEdEEnaJE1CFUxdsKqkoU5TS34CImGh3s0cs-k3cNcy2PJxQ8WjIvAot1-cZ71o1E-WkqZ-tCTNZsJ +kli verify --name test --base "${KERI_TEMP_DIR}" --alias trans --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature ABBJcS2ZbcHEdEEnaJE1CFUxdsKqkoU5TS34CImGh3s0cs-k3cNcy2PJxQ8WjIvAot1-cZ71o1E-WkqZ-tCTNZsJ isSuccess -kli verify --name test --base "${KERI_TEMP_DIR}" --alias trans --prefix EIryzWYlZ9bQr7EhMAoBXk4r2h-OgaEqERid7-AHNp6o --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature ACBieMVQBXvIxeqQuHc4Db_-GUoFE9e37TW8t6DomwXdMcSxBiHJpDp3EJH1Dcz9lHKbFuCRqoNo4wywZGtUpOcB +kli verify --name test --base "${KERI_TEMP_DIR}" --alias trans --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature ACBieMVQBXvIxeqQuHc4Db_-GUoFE9e37TW8t6DomwXdMcSxBiHJpDp3EJH1Dcz9lHKbFuCRqoNo4wywZGtUpOcB isSuccess -kli verify --name test --base "${KERI_TEMP_DIR}" --alias trans --prefix EIryzWYlZ9bQr7EhMAoBXk4r2h-OgaEqERid7-AHNp6o --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature ACSHdal6kHAAjbW_frH83sDDCoBHw_nNKFysW5Dj8PSsnwVPePCNw-kFmF6Z8H87q7D3abw_5u2i4jmzdnWFsRDz +kli verify --name test --base "${KERI_TEMP_DIR}" --alias trans --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature ACSHdal6kHAAjbW_frH83sDDCoBHw_nNKFysW5Dj8PSsnwVPePCNw-kFmF6Z8H87q7D3abw_5u2i4jmzdnWFsRDz ret=$? if [ $ret -eq 0 ]; then echo "Testing invalid signature should fail $ret" diff --git a/src/keri/app/cli/commands/verify.py b/src/keri/app/cli/commands/verify.py index 17033bb2..79cb13d5 100644 --- a/src/keri/app/cli/commands/verify.py +++ b/src/keri/app/cli/commands/verify.py @@ -19,8 +19,6 @@ parser.add_argument('--alias', '-a', help='human readable alias for the new identifier prefix', required=True) parser.add_argument('--passcode', '-p', help='21 character encryption passcode for keystore (is not saved)', dest="bran", default=None) # passcode => bran - -parser.add_argument("--prefix", help="Identifier prefix of the signer", required=True) parser.add_argument('--text', '-t', help='Original signed text or file (starts with "@")', required=True) parser.add_argument('--signature', '-s', default=[], help='list of signatures to verify (can appear multiple times)', action="append", required=True) @@ -54,7 +52,7 @@ def verify(tymth, tock=0.0, **opts): try: with existing.existingHab(name=name, alias=alias, base=base, bran=bran) as (_, hab): - kever = hab.kevers[args.prefix] + kever = hab.kevers[hab.pre] txt = args.text if txt.startswith("@"): diff --git a/tests/app/cli/test_kli_commands.py b/tests/app/cli/test_kli_commands.py index 94d96042..ad175624 100644 --- a/tests/app/cli/test_kli_commands.py +++ b/tests/app/cli/test_kli_commands.py @@ -205,8 +205,6 @@ def test_standalone_kli_commands(helpers, capsys): 'ACCLl9pVv7OM4Y261GZkpPWQu__1mw8ffzcFY1lJ62CGjiEh3mvESu_N7a01YOCKqicqEe5TOXSf0j_8qBxPKxwO\n') args = parser.parse_args(["verify", "--name", "test", "--alias", "trans", - "--prefix", - 'EF0bnfg4smFm9Q_OKlKUYRRQctGhTBWUU3rXf7zuA9GU', "--text", "this is test data to sign", "--signature", From 47a9529b4a9a0afcb1c038fa8026f32baeee4ee5 Mon Sep 17 00:00:00 2001 From: Charles Lanahan Date: Mon, 4 Nov 2024 23:42:08 -0500 Subject: [PATCH 6/6] Reverted to remove alias rather than prefix from verify command --- scripts/demo/basic/demo-script.sh | 8 ++++---- src/keri/app/cli/commands/verify.py | 8 ++++---- tests/app/cli/test_kli_commands.py | 4 +++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/demo/basic/demo-script.sh b/scripts/demo/basic/demo-script.sh index dbb851a2..b5bb43ef 100755 --- a/scripts/demo/basic/demo-script.sh +++ b/scripts/demo/basic/demo-script.sh @@ -46,16 +46,16 @@ isSuccess kli sign --name test --base "${KERI_TEMP_DIR}" --alias trans --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json isSuccess -kli verify --name test --base "${KERI_TEMP_DIR}" --alias trans --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature AABuQervAG8QLyvho99362U8TScec_4zYDVF1pUMWfWfKbl5thR6QakpvSvVMdcPcGYxi0McgNtW-Z3EhpC01I4A +kli verify --name test --base "${KERI_TEMP_DIR}" --prefix EIryzWYlZ9bQr7EhMAoBXk4r2h-OgaEqERid7-AHNp6o --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature AABuQervAG8QLyvho99362U8TScec_4zYDVF1pUMWfWfKbl5thR6QakpvSvVMdcPcGYxi0McgNtW-Z3EhpC01I4A isSuccess -kli verify --name test --base "${KERI_TEMP_DIR}" --alias trans --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature ABBJcS2ZbcHEdEEnaJE1CFUxdsKqkoU5TS34CImGh3s0cs-k3cNcy2PJxQ8WjIvAot1-cZ71o1E-WkqZ-tCTNZsJ +kli verify --name test --base "${KERI_TEMP_DIR}" --prefix EIryzWYlZ9bQr7EhMAoBXk4r2h-OgaEqERid7-AHNp6o --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature ABBJcS2ZbcHEdEEnaJE1CFUxdsKqkoU5TS34CImGh3s0cs-k3cNcy2PJxQ8WjIvAot1-cZ71o1E-WkqZ-tCTNZsJ isSuccess -kli verify --name test --base "${KERI_TEMP_DIR}" --alias trans --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature ACBieMVQBXvIxeqQuHc4Db_-GUoFE9e37TW8t6DomwXdMcSxBiHJpDp3EJH1Dcz9lHKbFuCRqoNo4wywZGtUpOcB +kli verify --name test --base "${KERI_TEMP_DIR}" --prefix EIryzWYlZ9bQr7EhMAoBXk4r2h-OgaEqERid7-AHNp6o --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature ACBieMVQBXvIxeqQuHc4Db_-GUoFE9e37TW8t6DomwXdMcSxBiHJpDp3EJH1Dcz9lHKbFuCRqoNo4wywZGtUpOcB isSuccess -kli verify --name test --base "${KERI_TEMP_DIR}" --alias trans --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature ACSHdal6kHAAjbW_frH83sDDCoBHw_nNKFysW5Dj8PSsnwVPePCNw-kFmF6Z8H87q7D3abw_5u2i4jmzdnWFsRDz +kli verify --name test --base "${KERI_TEMP_DIR}" --prefix EIryzWYlZ9bQr7EhMAoBXk4r2h-OgaEqERid7-AHNp6o --text @${KERI_DEMO_SCRIPT_DIR}/data/anchor.json --signature ACSHdal6kHAAjbW_frH83sDDCoBHw_nNKFysW5Dj8PSsnwVPePCNw-kFmF6Z8H87q7D3abw_5u2i4jmzdnWFsRDz ret=$? if [ $ret -eq 0 ]; then echo "Testing invalid signature should fail $ret" diff --git a/src/keri/app/cli/commands/verify.py b/src/keri/app/cli/commands/verify.py index 79cb13d5..2df449e8 100644 --- a/src/keri/app/cli/commands/verify.py +++ b/src/keri/app/cli/commands/verify.py @@ -16,9 +16,10 @@ parser.add_argument('--name', '-n', help='keystore name and file location of KERI keystore', required=True) parser.add_argument('--base', '-b', help='additional optional prefix to file location of KERI keystore', required=False, default="") -parser.add_argument('--alias', '-a', help='human readable alias for the new identifier prefix', required=True) parser.add_argument('--passcode', '-p', help='21 character encryption passcode for keystore (is not saved)', dest="bran", default=None) # passcode => bran + +parser.add_argument("--prefix", help="Identifier prefix of the signer", required=True) parser.add_argument('--text', '-t', help='Original signed text or file (starts with "@")', required=True) parser.add_argument('--signature', '-s', default=[], help='list of signatures to verify (can appear multiple times)', action="append", required=True) @@ -43,16 +44,15 @@ def verify(tymth, tock=0.0, **opts): args = opts["args"] name = args.name - alias = args.alias base = args.base bran = args.bran sigers = [indexing.Siger(qb64=sig) for sig in args.signature] try: - with existing.existingHab(name=name, alias=alias, base=base, bran=bran) as (_, hab): + with existing.existingHby(name=name, base=base, bran=bran) as hby: - kever = hab.kevers[hab.pre] + kever = hby.kevers[args.prefix] txt = args.text if txt.startswith("@"): diff --git a/tests/app/cli/test_kli_commands.py b/tests/app/cli/test_kli_commands.py index 4aaca109..4db45e43 100644 --- a/tests/app/cli/test_kli_commands.py +++ b/tests/app/cli/test_kli_commands.py @@ -204,7 +204,9 @@ def test_standalone_kli_commands(helpers, capsys): '3. ' 'ACCLl9pVv7OM4Y261GZkpPWQu__1mw8ffzcFY1lJ62CGjiEh3mvESu_N7a01YOCKqicqEe5TOXSf0j_8qBxPKxwO\n') - args = parser.parse_args(["verify", "--name", "test", "--alias", "trans", + args = parser.parse_args(["verify", "--name", "test", + "--prefix", + 'EF0bnfg4smFm9Q_OKlKUYRRQctGhTBWUU3rXf7zuA9GU', "--text", "this is test data to sign", "--signature",