x3dh/pre_key_pair.py
raw| 1 | from typing import NamedTuple |
| 2 | |
| 3 | import xeddsa |
| 4 | |
| 5 | |
| 6 | __all__ = [ |
| 7 | "PreKeyPair" |
| 8 | ] |
| 9 | |
| 10 | |
| 11 | class PreKeyPair(NamedTuple): |
| 12 | """ |
| 13 | A pre key. |
| 14 | """ |
| 15 | |
| 16 | priv: bytes |
| 17 | |
| 18 | @property |
| 19 | def pub(self) -> bytes: |
| 20 | """ |
| 21 | Returns: |
| 22 | The public key of this pre key. |
| 23 | """ |
| 24 | |
| 25 | return xeddsa.priv_to_curve25519_pub(self.priv) |