irctest/irctest/authentication.py

24 lines
533 B
Python
Raw Permalink Normal View History

import dataclasses
2021-02-22 18:04:23 +00:00
import enum
from typing import Optional, Tuple
2015-12-19 17:08:34 +00:00
2021-02-22 18:02:13 +00:00
2015-12-19 17:08:34 +00:00
@enum.unique
class Mechanisms(enum.Enum):
2015-12-20 12:47:30 +00:00
"""Enumeration for representing possible mechanisms."""
2021-02-22 18:02:13 +00:00
def to_string(self) -> str:
return self.name.upper().replace("_", "-")
2021-02-22 18:02:13 +00:00
2015-12-19 17:08:34 +00:00
plain = 1
ecdsa_nist256p_challenge = 2
2017-01-10 23:07:25 +00:00
scram_sha_256 = 3
2015-12-19 17:08:34 +00:00
2021-02-22 18:02:13 +00:00
@dataclasses.dataclass
class Authentication:
mechanisms: Tuple[Mechanisms] = (Mechanisms.plain,)
username: Optional[str] = None
password: Optional[str] = None
ecdsa_key: Optional[str] = None