Skip to content
Snippets Groups Projects

Revocation: remove dry-run and display options from save and verify cmds, drop default revocation file path (#435)

Merged Moul requested to merge 435_revocation into main
2 files
+ 59
186
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 3
26
@@ -32,16 +32,10 @@ from silkaj.public_key import gen_pubkey_checksum
from silkaj.wot import idty_tools
from silkaj.wot import tools as w_tools
REVOCATION_LOCAL_PATH = Path("revocation.txt")
@click.command(
"create",
help="Create and save a revocation document. Optionnaly takes the document filename.",
)
@click.command("create", help="Create and save a revocation document")
@click.argument(
"file",
default=REVOCATION_LOCAL_PATH,
type=click.Path(dir_okay=False, writable=True, path_type=Path),
)
@click.pass_context
@@ -54,14 +48,8 @@ def create(ctx: click.Context, file: Path) -> None:
rev_doc = create_revocation_doc(_id, key.pubkey, currency)
rev_doc.sign(key)
if ctx.obj["DRY_RUN"]:
click.echo(rev_doc.signed_raw())
return
idty_table = idty_tools.display_identity(rev_doc.identity)
click.echo(idty_table.draw())
if ctx.obj["DISPLAY_DOCUMENT"]:
click.echo(rev_doc.signed_raw())
confirm_message = "Do you want to save the revocation document for this identity?"
if click.confirm(confirm_message):
@@ -102,37 +90,26 @@ def revoke_now(ctx: click.Context) -> None:
@click.command(
"verify",
help="Verifies that a revocation document is correctly formatted and matches an \
existing identity.\nOptionnaly takes the document filename.",
existing identity",
)
@click.argument(
"file",
default=REVOCATION_LOCAL_PATH,
type=click.Path(exists=True, dir_okay=False, readable=True, path_type=Path),
)
@click.pass_context
def verify(ctx: click.Context, file: Path) -> None:
rev_doc = verify_document(file)
if ctx.obj["DRY_RUN"]:
click.echo(rev_doc.signed_raw())
return
idty_table = idty_tools.display_identity(rev_doc.identity)
click.echo(idty_table.draw())
if ctx.obj["DISPLAY_DOCUMENT"]:
click.echo(rev_doc.signed_raw())
click.echo("Revocation document is valid.")
@click.command(
"publish",
help="Publish revocation document. Identity will be revoked immediately.\n\
Optionnaly takes the document filename.",
help="Publish revocation document. Identity will be revoked immediately",
)
@click.argument(
"file",
default=REVOCATION_LOCAL_PATH,
type=click.Path(exists=True, dir_okay=False, readable=True, path_type=Path),
)
@click.pass_context
Loading