Skip to content

Commit

Permalink
feat: flip the order of sign methods
Browse files Browse the repository at this point in the history
  • Loading branch information
johnson2427 committed May 1, 2024
1 parent 494fdac commit a77b083
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ape_aws/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ def address(self) -> AddressType:
keccak(self.public_key[-64:])[-20:].hex().lower()
)

def sign_raw_msghash(self, msghash: HexBytes) -> Optional[MessageSignature]:
if len(msghash) != 32:
return None

if signature := self.sign_raw_hash(msghash):
return MessageSignature(**_convert_der_to_rsv(signature, 27))

return None

def sign_raw_hash(self, msghash: HexBytes) -> Optional[bytes]:
response = self.kms_client.sign(
KeyId=self.key_id,
Expand All @@ -89,6 +80,15 @@ def sign_raw_hash(self, msghash: HexBytes) -> Optional[bytes]:
)
return response.get('Signature')

def sign_raw_msghash(self, msghash: HexBytes) -> Optional[MessageSignature]:
if len(msghash) != 32:
return None

if signature := self.sign_raw_hash(msghash):
return MessageSignature(**_convert_der_to_rsv(signature, 27))

return None

def sign_message(
self, msg: Any, **signer_options
) -> Optional[MessageSignature]:
Expand Down

0 comments on commit a77b083

Please sign in to comment.