Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions charon/pkgs/radas_signature_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import os
import asyncio
import sys
from typing import List, Any, Tuple, Callable, Dict
from typing import List, Any, Tuple, Callable, Dict, Optional
from charon.config import get_config, RadasConfig
from charon.pkgs.oras_client import OrasClient
from proton import Event
Expand All @@ -33,14 +33,23 @@ class RadasReceiver(MessagingHandler):
This receiver will listen to UMB message queue to receive signing message for
signing result.
Attributes:
sign_result_loc (str): Local save path (e.g. “/tmp/sign”) for oras pull result,
this value transfers from the cmd flag, should register UmbListener when the client starts
sign_result_loc (str):
Local save path (e.g. “/tmp/sign”) for oras pull result, this value transfers
from the cmd flag,should register UmbListener when the client starts
request_id (str):
Identifier of the request for the signing result
sign_result_status (str):
Result of the signing(success/failed)
sign_result_errors (list):
Any errors encountered if signing fails, this will be empty list if successful
"""

def __init__(self, sign_result_loc: str, request_id: str) -> None:
super().__init__()
self.sign_result_loc = sign_result_loc
self.request_id = request_id
self.sign_result_status: Optional[str] = None
self.sign_result_errors: List[str] = []

def on_start(self, event: Event) -> None:
"""
Expand Down Expand Up @@ -95,6 +104,8 @@ def _process_message(self, msg: Any) -> None:
logger.info(
"Start to process the sign event message, request_id %s is matched", msg_request_id
)
self.sign_result_status = msg_dict.get("signing_status")
self.sign_result_errors = msg_dict.get("errors", [])
result_reference_url = msg_dict.get("result_reference")
if not result_reference_url:
logger.warning("Not found result_reference in message,ignore.")
Expand Down