21 lines
410 B
Python
21 lines
410 B
Python
import time
|
|
import hmac
|
|
import hashlib
|
|
from dataclasses import dataclass
|
|
from typing import Any
|
|
|
|
|
|
@dataclass
|
|
class AuditLogEntry:
|
|
timestamp: float
|
|
action: str
|
|
details: str
|
|
|
|
|
|
class Signer:
|
|
def __init__(self, key: str) -> None:
|
|
self.key = key.encode("utf-8")
|
|
|
|
def sign(self, message: str) -> str:
|
|
return hmac.new(self.key, message.encode("utf-8"), hashlib.sha256).hexdigest()
|