diff --git a/encryption/codec.py b/encryption/codec.py index 94e69dfd..6aaa58be 100644 --- a/encryption/codec.py +++ b/encryption/codec.py @@ -6,8 +6,8 @@ from temporalio.api.common.v1 import Payload from temporalio.converter import PayloadCodec -default_key = base64.b64decode(b"MkUb3RVdHQuOTedqETZW7ra2GkZqpBRmYWRACUospMc=") -default_key_id = "my-key" +default_key = b"test-key-test-key-test-key-test!" +default_key_id = "test-key-id" class EncryptionCodec(PayloadCodec): @@ -43,7 +43,9 @@ async def decode(self, payloads: Iterable[Payload]) -> List[Payload]: # Confirm our key ID is the same key_id = p.metadata.get("encryption-key-id", b"").decode() if key_id != self.key_id: - raise ValueError(f"Unrecognized key ID {key_id}") + raise ValueError( + f"Unrecognized key ID {key_id}. Current key ID is {self.key_id}." + ) # Decrypt and append ret.append(Payload.FromString(self.decrypt(p.data))) return ret diff --git a/encryption/starter.py b/encryption/starter.py index 4c39f553..7a64060f 100644 --- a/encryption/starter.py +++ b/encryption/starter.py @@ -23,7 +23,7 @@ async def main(): GreetingWorkflow.run, "Temporal", id=f"encryption-workflow-id", - task_queue="encryption-task-queue", + task_queue="encryption", ) print(f"Workflow result: {result}") diff --git a/encryption/worker.py b/encryption/worker.py index 2c410ab7..b99a2eab 100644 --- a/encryption/worker.py +++ b/encryption/worker.py @@ -9,7 +9,7 @@ from encryption.codec import EncryptionCodec -@workflow.defn +@workflow.defn(name="Workflow") class GreetingWorkflow: @workflow.run async def run(self, name: str) -> str: