Skip to content

Commit

Permalink
Update docstring and func return params
Browse files Browse the repository at this point in the history
  • Loading branch information
ross-spencer committed May 15, 2024
1 parent 4db0652 commit 841618e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/simple_sign/sign.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
"""Python template repository.
Baseline template for future Python code related to this project.
Replace this docstring and code below with your own code as required.
"""
"""Orcfax simple sign."""

import argparse
import logging
Expand Down Expand Up @@ -59,20 +54,20 @@ def signature_in_constitution_config():
raise NotImplementedError("reading from config is not yet implemented")


def sign_with_key(data: str, signing_key: str):
def sign_with_key(data: str, signing_key: str) -> str:
"""Sign with an signing key."""
skey = pyc.SigningKey.from_json(signing_key)
vkey = pyc.VerificationKey.from_signing_key(skey)
logger.info("signing with addr: %s", pyc.Address(vkey.hash()))
return pyc.sign(data, skey)


def signing_handler(data: str, signing_key: str):
def signing_handler(data: str, signing_key: str) -> str:
"""Handle signing functions."""
return sign_with_key(data, signing_key)


def verify_signature(data: str):
def verify_signature(data: str) -> dict:
"""Verify a signature with an address."""
try:
status = pyc.verify(data)
Expand All @@ -93,7 +88,7 @@ def verify_signature(data: str):
}


def verify_handler(data: str):
def verify_handler(data: str) -> dict:
"""Verify input data."""
return verify_signature(data)

Expand Down

0 comments on commit 841618e

Please sign in to comment.