From d9ef706378aaece2273cf661f0b1c75f5d416296 Mon Sep 17 00:00:00 2001 From: Koen van der Veen Date: Fri, 27 Sep 2024 16:35:48 +0200 Subject: [PATCH] log signing key --- packages/syft/src/syft/server/credentials.py | 4 ++++ packages/syft/src/syft/server/server.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/packages/syft/src/syft/server/credentials.py b/packages/syft/src/syft/server/credentials.py index 4b811aa0db5..f4615f083e8 100644 --- a/packages/syft/src/syft/server/credentials.py +++ b/packages/syft/src/syft/server/credentials.py @@ -2,6 +2,7 @@ from __future__ import annotations # stdlib +import hashlib from typing import Any # third party @@ -58,6 +59,9 @@ class SyftSigningKey(SyftBaseModel): def make_signing_key(cls, v: Any) -> Any: return SigningKey(bytes.fromhex(v)) if isinstance(v, str) else v + def deterministic_hash(self) -> str: + return hashlib.sha256(self.signing_key._seed).hexdigest() + @property def verify_key(self) -> SyftVerifyKey: return SyftVerifyKey(verify_key=self.signing_key.verify_key) diff --git a/packages/syft/src/syft/server/server.py b/packages/syft/src/syft/server/server.py index 7ea7bed2b78..212ae3def3e 100644 --- a/packages/syft/src/syft/server/server.py +++ b/packages/syft/src/syft/server/server.py @@ -379,6 +379,10 @@ def __init__( skey = signing_key self.signing_key = skey or SyftSigningKey.generate() + logger.critical( + f"Hash of the signing key '{self.signing_key.deterministic_hash()[:5]}...'" + ) + self.association_request_auto_approval = association_request_auto_approval consumer_type = (