-
Notifications
You must be signed in to change notification settings - Fork 72
Two new kli utilities and a minor improvement to IPEX grant messages #1141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pfeairheller
merged 3 commits into
WebOfTrust:v1.3.2
from
pfeairheller:feat-credential-improvements
Jan 21, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
7aca457
A new credential schema kli utility to import schema from a file.
pfeairheller 889a5b6
Pin multicommand version to 1.0.0 to avoid bug discovered in 2.0.0.
pfeairheller c089ff8
Upgrade github workflow to latest macos runner. Pulled in from main.
pfeairheller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # -*- encoding: utf-8 -*- | ||
| """ | ||
| KERI | ||
| keri.kli.commands module | ||
|
|
||
| """ | ||
| import argparse | ||
|
|
||
| from hio.base import doing | ||
|
|
||
| from keri import help | ||
| from keri.app.cli.common import existing | ||
| from keri.db.dbing import dgKey, snKey | ||
|
|
||
| logger = help.ogler.getLogger() | ||
|
|
||
| parser = argparse.ArgumentParser(description='Remove an AID from the database') | ||
| 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) | ||
| parser.add_argument('--base', '-b', help='additional optional prefix to file location of KERI keystore', | ||
| required=False, default="") | ||
| parser.add_argument('--prefix', help='qb64 identifier prefix to display', required=True) | ||
| parser.add_argument('--passcode', '-p', help='21 character encryption passcode for keystore (is not saved)', | ||
| dest="bran", default=None) # passcode => bran | ||
|
|
||
|
|
||
| def handler(args): | ||
| kever = DeleteDoer(name=args.name, base=args.base, bran=args.bran, prefix=args.prefix) | ||
| return [kever] | ||
|
|
||
|
|
||
| class DeleteDoer(doing.Doer): | ||
|
|
||
| def __init__(self, name, base, bran, prefix, poll=False, verbose=False): | ||
| self.prefix = prefix | ||
| self.poll = poll | ||
| self.verbose = verbose | ||
| self.hby = existing.setupHby(name=name, base=base, bran=bran) | ||
| super(DeleteDoer, self).__init__() | ||
|
|
||
| def recur(self, tyme): | ||
| """ Command line status handler | ||
|
|
||
| """ | ||
| preb = self.prefix.encode("utf-8") | ||
|
|
||
| if self.prefix not in self.hby.kevers: | ||
| print(f"Identifier prefix {self.prefix} is not known locally") | ||
| return True | ||
|
|
||
| count = 0 | ||
| for _, fn, dig in self.hby.db.getFelItemPreIter(self.prefix): | ||
| dgkeys = (self.prefix, dig) | ||
| dgkey = dgKey(preb, dig) | ||
|
|
||
| self.hby.db.delEvt(dgkey) | ||
| self.hby.db.delWigs(dgkey) | ||
| self.hby.db.delSigs(dgkey) | ||
| self.hby.db.delDts(dgkey) | ||
| self.hby.db.wits.rem(keys=dgkeys) | ||
| self.hby.db.delKes(dgkey) | ||
| self.hby.db.delAes(dgkey) | ||
| self.hby.db.esrs.rem(dgkeys) | ||
| self.hby.db.fons.rem(dgkey) | ||
| count += 1 | ||
|
|
||
| for sn in range(count): | ||
| self.hby.db.delKes(snKey(preb, sn)) | ||
| self.hby.db.delFe(snKey(preb, sn)) | ||
|
|
||
| self.hby.db.states.rem(keys=self.prefix) | ||
|
|
||
| return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # -*- encoding: utf-8 -*- | ||
| """ | ||
| KERI | ||
| keri.kli.commands.vc.schema module | ||
|
|
||
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # -*- encoding: utf-8 -*- | ||
| """ | ||
| KERI | ||
| keri.kli.commands.vc.schema module | ||
|
|
||
| """ | ||
| import argparse | ||
| import json | ||
|
|
||
| from hio.base import doing | ||
|
|
||
| from keri import help, kering | ||
| from keri.app.cli.common import existing | ||
| from keri.core import scheming | ||
|
|
||
| logger = help.ogler.getLogger() | ||
|
|
||
| parser = argparse.ArgumentParser(description='Import ACDC JSON schema file into the schema database') | ||
| parser.set_defaults(handler=lambda args: import_schema(args)) | ||
| 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('--passcode', '-p', help='21 character encryption passcode for keystore (is not saved)', | ||
| dest="bran", default=None) # passcode => bran | ||
| parser.add_argument('--schema', '-s', help='path to ACDC JSON schema file to import', required=True) | ||
|
|
||
|
|
||
| def import_schema(args): | ||
| """ Command line handler for importing ACDC JSON schema files | ||
|
|
||
| """ | ||
| idoer = ImportDoer(name=args.name, | ||
| base=args.base, | ||
| bran=args.bran, | ||
| schema=args.schema) | ||
| return [idoer] | ||
|
|
||
|
|
||
| class ImportDoer(doing.DoDoer): | ||
|
|
||
| def __init__(self, name, base, bran, schema): | ||
| self.schemaPath = schema | ||
| self.hby = existing.setupHby(name=name, base=base, bran=bran) | ||
|
|
||
| doers = [doing.doify(self.importDo)] | ||
|
|
||
| super(ImportDoer, self).__init__(doers=doers) | ||
|
|
||
| def importDo(self, tymth, tock=0.0, **kwa): | ||
| """ Import ACDC JSON schema file into the schema database | ||
|
|
||
| Parameters: | ||
| tymth (function): injected function wrapper closure returned by .tymen() of | ||
| Tymist instance. Calling tymth() returns associated Tymist .tyme. | ||
| tock (float): injected initial tock value | ||
|
|
||
| Returns: doifiable Doist compatible generator method | ||
|
|
||
| """ | ||
| # enter context | ||
| self.wind(tymth) | ||
| self.tock = tock | ||
| _ = (yield self.tock) | ||
|
|
||
| try: | ||
| # Read the schema file | ||
| with open(self.schemaPath, 'rb') as f: | ||
| raw = f.read() | ||
|
|
||
| # Create Schemer instance which validates the schema | ||
| schemer = scheming.Schemer(raw=raw) | ||
|
|
||
| # Store the schema in the database | ||
| self.hby.db.schema.pin(keys=(schemer.said,), val=schemer) | ||
|
|
||
| print(f"Schema successfully imported with SAID: {schemer.said}") | ||
|
|
||
| except FileNotFoundError: | ||
| raise kering.ConfigurationError(f"Schema file not found: {self.schemaPath}") | ||
| except json.JSONDecodeError as e: | ||
| raise kering.ConfigurationError(f"Invalid JSON in schema file: {e}") | ||
| except kering.ValidationError as e: | ||
| raise kering.ConfigurationError(f"Schema validation failed: {e}") | ||
| except Exception as e: | ||
| raise kering.ConfigurationError(f"Error importing schema: {e}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for leaving the campsite cleaner than you found it