1# generated by datamodel-codegen:
2# filename: hashedrekord_schema.json
3# version: 0.26.3
4
5from __future__ import annotations
6
7from enum import Enum
8from typing import Optional
9
10from pydantic import BaseModel, ConfigDict, Field, RootModel, StrictStr
11
12
13class PublicKey(BaseModel):
14 """The public key that can verify the signature; this can also be an X509 code signing certificate that contains the raw public key information"""
15
16 model_config = ConfigDict(
17 populate_by_name=True,
18 )
19 content: Optional[str] = Field(
20 default=None,
21 description="Specifies the content of the public key or code signing certificate inline within the document",
22 )
23
24
25class Signature(BaseModel):
26 """Information about the detached signature associated with the entry"""
27
28 model_config = ConfigDict(
29 populate_by_name=True,
30 )
31 content: Optional[str] = Field(
32 default=None,
33 description="Specifies the content of the signature inline within the document",
34 )
35 public_key: Optional[PublicKey] = Field(
36 default=None,
37 alias="publicKey",
38 description="The public key that can verify the signature; this can also be an X509 code signing certificate that contains the raw public key information",
39 )
40
41
42class Algorithm(str, Enum):
43 """The hashing function used to compute the hash value"""
44
45 SHA256 = "sha256"
46 SHA384 = "sha384"
47 SHA512 = "sha512"
48
49
50class Hash(BaseModel):
51 """Specifies the hash algorithm and value for the content"""
52
53 model_config = ConfigDict(
54 populate_by_name=True,
55 )
56 algorithm: Algorithm = Field(
57 ...,
58 description="The hashing function used to compute the hash value",
59 )
60 value: StrictStr = Field(
61 ...,
62 description="The hash value for the content, as represented by a lower case hexadecimal string",
63 )
64
65
66class Data(BaseModel):
67 """Information about the content associated with the entry"""
68
69 model_config = ConfigDict(
70 populate_by_name=True,
71 )
72 hash: Optional[Hash] = Field(
73 default=None,
74 description="Specifies the hash algorithm and value for the content",
75 )
76
77
78class HashedrekordV001Schema(BaseModel):
79 """Schema for Hashed Rekord object"""
80
81 model_config = ConfigDict(
82 populate_by_name=True,
83 )
84 signature: Signature = Field(
85 ...,
86 description="Information about the detached signature associated with the entry",
87 )
88 data: Data = Field(..., description="Information about the content associated with the entry")
89
90
91class HashedrekordSchema(RootModel[HashedrekordV001Schema]):
92 model_config = ConfigDict(
93 populate_by_name=True,
94 )
95 root: HashedrekordV001Schema = Field(
96 ...,
97 description="Schema for Hashedrekord objects",
98 title="Hashedrekord Schema",
99 )