abc.py 629 B

1234567891011121314151617181920212223242526272829303132333435
  1. from abc import (
  2. ABC,
  3. abstractmethod,
  4. )
  5. from typing import (
  6. Union,
  7. )
  8. class PreImageAPI(ABC):
  9. @abstractmethod
  10. def __init__(self, value: bytes) -> None:
  11. ...
  12. @abstractmethod
  13. def update(self, value: bytes) -> None:
  14. ...
  15. @abstractmethod
  16. def digest(self) -> bytes:
  17. ...
  18. @abstractmethod
  19. def copy(self) -> "PreImageAPI":
  20. ...
  21. class BackendAPI(ABC):
  22. @abstractmethod
  23. def keccak256(self, in_data: Union[bytearray, bytes]) -> bytes:
  24. ...
  25. @abstractmethod
  26. def preimage(self, in_data: Union[bytearray, bytes]) -> PreImageAPI:
  27. ...