-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds escrow clearing, moves original escrow command to 'escrow list'
Signed-off-by: Kevin Griffin <[email protected]>
- Loading branch information
Showing
8 changed files
with
181 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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 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,3 @@ | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(description="A collection of escrow operations") |
This file contains 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,52 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
KERI | ||
keri.kli.commands.escrow module | ||
""" | ||
import argparse | ||
|
||
from hio import help | ||
from hio.base import doing | ||
from keri.app.cli.common import existing | ||
|
||
logger = help.ogler.getLogger() | ||
|
||
parser = argparse.ArgumentParser(description='Clear escrows') | ||
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('--passcode', '-p', help='21 character encryption passcode for keystore (is not saved)', | ||
dest="bran", default=None) # passcode => bran | ||
parser.add_argument('--force', action="store_true", required=False, | ||
help='True means perform clear without prompting the user') | ||
|
||
|
||
def handler(args): | ||
if not args.force: | ||
print() | ||
print("This command will clear all escrows and is not reversible.") | ||
print() | ||
yn = input("Are you sure you want to continue? [y|N]: ") | ||
|
||
if yn not in ("y", "Y"): | ||
print("...exiting") | ||
return [] | ||
|
||
kwa = dict(args=args) | ||
return [doing.doify(clear, **kwa)] | ||
|
||
|
||
def clear(tymth, tock=0.0, **opts): | ||
""" Command line clear handler | ||
""" | ||
_ = (yield tock) | ||
args = opts["args"] | ||
name = args.name | ||
base = args.base | ||
bran = args.bran | ||
|
||
with existing.existingHby(name=name, base=base, bran=bran) as hby: | ||
hby.db.clearEscrows() |
2 changes: 1 addition & 1 deletion
2
src/keri/app/cli/commands/escrow.py → src/keri/app/cli/commands/escrow/list.py
This file contains 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
KERI | ||
keri.kli.commands module | ||
keri.kli.commands.escrow module | ||
""" | ||
import argparse | ||
|
This file contains 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 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 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 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