|
41 | 41 | from typing import Self
|
42 | 42 | from typing_extensions import override
|
43 | 43 |
|
| 44 | +from model_signing.hashing import hashing |
| 45 | + |
44 | 46 |
|
45 | 47 | class ManifestItem(metaclass=ABCMeta):
|
46 | 48 | """An item that can be included in the manifest.
|
@@ -114,28 +116,21 @@ def from_str(as_str: str) -> Self:
|
114 | 116 | return ManifestFileChunkItem(file, start, end)
|
115 | 117 |
|
116 | 118 |
|
117 |
| -@dataclass(frozen=True) |
118 |
| -class ManifestDigest: |
119 |
| - """A computed digest (algorithm and hash) for a `ManifestItem`.""" |
120 |
| - algorithm: str |
121 |
| - digest: bytes |
122 |
| - |
123 |
| - |
124 | 119 | class Manifest(metaclass=ABCMeta):
|
125 | 120 | """Generic manifest file to represent a model."""
|
126 |
| - objects: dict[ManifestItem, ManifestDigest] = {} |
| 121 | + objects: dict[ManifestItem, hashing.Digest] = {} |
127 | 122 | constraints: list[set[ManifestItem]] = set()
|
128 | 123 |
|
129 |
| - def prepare_manifest_for_signing(self) -> Any: |
130 |
| - """Computes the final form of the manifest for signing in memory. |
| 124 | + #def prepare_manifest_for_signing(self) -> Any: |
| 125 | + # """Computes the final form of the manifest for signing in memory. |
131 | 126 |
|
132 |
| - Implementations decide the output type, as this can be from an |
133 |
| - external dependency. |
| 127 | + # Implementations decide the output type, as this can be from an |
| 128 | + # external dependency. |
134 | 129 |
|
135 |
| - This method is optional, but implementations must define at least one |
136 |
| - of `prepare_manifest_for_signing` and `write_manifest`. |
137 |
| - """ |
138 |
| - pass |
| 130 | + # This method is optional, but implementations must define at least one |
| 131 | + # of `prepare_manifest_for_signing` and `write_manifest`. |
| 132 | + # """ |
| 133 | + # pass |
139 | 134 |
|
140 | 135 | def write_manifest(self, path: pathlib.Path) -> None:
|
141 | 136 | """Writes the manifest to a file to be signed afterwards.
|
@@ -171,7 +166,7 @@ def verify(self, only_for_objects: list[ManifestItem]) -> bool:
|
171 | 166 | @abstractmethod
|
172 | 167 | def update(
|
173 | 168 | self,
|
174 |
| - objects: dict[ManifestItem, ManifestDigest], |
| 169 | + objects: dict[ManifestItem, hashing.Digest], |
175 | 170 | constraints: list[set[ManifestItem]],
|
176 | 171 | ) -> None:
|
177 | 172 | """Updates the manifest with new integrity data."""
|
|
0 commit comments