Flesh out the email implementation

This commit is contained in:
Campbell Alden 2026-08-01 01:07:58 +09:00
parent c1a61730d5
commit cee708f4d8
4 changed files with 29 additions and 10 deletions

View file

@ -1,3 +1,4 @@
from src.utils.secret import SecretBox
from src.config.parse import assert_key_of_type
from typing import Any
from dataclasses import dataclass
@ -8,11 +9,11 @@ EmailAddress = str
@dataclass
class Email:
bird_api_key: str
bird_api_key: SecretBox[str]
sender: EmailAddress
@classmethod
def from_dict(cls, config: dict[str, Any]) -> 'Email':
assert_key_of_type(config, 'bird_api_key', str)
assert_key_of_type(config, 'sender', str)
return Email(bird_api_key=config['bird_api_key'], sender=config['sender'])
return Email(bird_api_key=SecretBox(config['bird_api_key']), sender=config['sender'])