From 19265cc957c43fb47030bea8be1c57868c8939ad Mon Sep 17 00:00:00 2001 From: Alex Weil Date: Tue, 14 Apr 2026 11:56:08 -0700 Subject: [PATCH] Update RemoteSigningWebhookEventHandler __repr__ --- lightspark/__tests__/test_remote_signing.py | 19 +++++++++++++++++++ lightspark/remote_signing.py | 19 ++++++------------- 2 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 lightspark/__tests__/test_remote_signing.py diff --git a/lightspark/__tests__/test_remote_signing.py b/lightspark/__tests__/test_remote_signing.py new file mode 100644 index 0000000..46b93f3 --- /dev/null +++ b/lightspark/__tests__/test_remote_signing.py @@ -0,0 +1,19 @@ +# Copyright ©, 2026-present, Lightspark Group, Inc. - All Rights Reserved + +from lightspark import ( + LightsparkSyncClient, + PositiveValidator, + RemoteSigningWebhookEventHandler, +) + + +class TestRemoteSigning: + def test_master_seed_not_in_repr(self) -> None: + client = LightsparkSyncClient("", "") + handler = RemoteSigningWebhookEventHandler( + client=client, + master_seed=b"1234", + validator=PositiveValidator(), + ) + + assert "1234" not in repr(handler) diff --git a/lightspark/remote_signing.py b/lightspark/remote_signing.py index 46f78f3..7de2225 100644 --- a/lightspark/remote_signing.py +++ b/lightspark/remote_signing.py @@ -1,5 +1,5 @@ from typing import Any -from dataclasses import dataclass +from dataclasses import dataclass, field import json import lightspark_crypto as lsc import lightspark @@ -14,21 +14,14 @@ def should_sign(webhook: Any) -> bool: # ty:ignore[invalid-method-override] @dataclass class RemoteSigningWebhookEventHandler: client: lightspark.LightsparkSyncClient - master_seed: bytes + master_seed: bytes = field(repr=False) validator: lsc.Validation - def __init__( - self, - client: lightspark.LightsparkSyncClient, - master_seed: bytes, - validator: lsc.Validation, - ): - self.client = client - self.master_seed = master_seed - self.validator = validator - def handle_remote_signing_webhook_request( - self, data: bytes, hexdigest: str, webhook_secret: str + self, + data: bytes, + hexdigest: str, + webhook_secret: str, ): response = lsc.handle_remote_signing_webhook_event( data, hexdigest, webhook_secret, self.master_seed, self.validator