Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/rekor_types/_internal/jar.py: 97%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

34 statements  

1# generated by datamodel-codegen: 

2# filename: jar_schema.json 

3# version: 0.26.3 

4 

5from __future__ import annotations 

6 

7from enum import Enum 

8from typing import Optional, Union 

9 

10from pydantic import BaseModel, ConfigDict, Field, RootModel, StrictStr 

11 

12 

13class PublicKey(BaseModel): 

14 """The X509 certificate containing the public key JAR which verifies the signature of the JAR""" 

15 

16 model_config = ConfigDict( 

17 populate_by_name=True, 

18 ) 

19 content: str = Field( 

20 ..., 

21 description="Specifies the content of the X509 certificate containing the public key used to verify the signature", 

22 ) 

23 

24 

25class Signature(BaseModel): 

26 """Information about the included signature in the JAR file""" 

27 

28 model_config = ConfigDict( 

29 populate_by_name=True, 

30 ) 

31 content: str = Field( 

32 ..., 

33 description="Specifies the PKCS7 signature embedded within the JAR file ", 

34 ) 

35 public_key: PublicKey = Field( 

36 ..., 

37 alias="publicKey", 

38 description="The X509 certificate containing the public key JAR which verifies the signature of the JAR", 

39 ) 

40 

41 

42class Algorithm(str, Enum): 

43 """The hashing function used to compute the hash value""" 

44 

45 SHA256 = "sha256" 

46 

47 

48class Hash(BaseModel): 

49 """Specifies the hash algorithm and value encompassing the entire signed archive""" 

50 

51 model_config = ConfigDict( 

52 populate_by_name=True, 

53 ) 

54 algorithm: Algorithm = Field( 

55 ..., 

56 description="The hashing function used to compute the hash value", 

57 ) 

58 value: StrictStr = Field(..., description="The hash value for the archive") 

59 

60 

61class Archive(BaseModel): 

62 """Information about the archive associated with the entry""" 

63 

64 model_config = ConfigDict( 

65 populate_by_name=True, 

66 ) 

67 hash: Hash = Field( 

68 ..., 

69 description="Specifies the hash algorithm and value encompassing the entire signed archive", 

70 ) 

71 content: Optional[str] = Field( 

72 default=None, 

73 description="Specifies the archive inline within the document", 

74 ) 

75 

76 

77class Hash1(Hash): 

78 """Specifies the hash algorithm and value encompassing the entire signed archive""" 

79 

80 

81class Archive1(BaseModel): 

82 """Information about the archive associated with the entry""" 

83 

84 model_config = ConfigDict( 

85 populate_by_name=True, 

86 ) 

87 hash: Optional[Hash1] = Field( 

88 default=None, 

89 description="Specifies the hash algorithm and value encompassing the entire signed archive", 

90 ) 

91 content: str = Field(..., description="Specifies the archive inline within the document") 

92 

93 

94class JarV001Schema(BaseModel): 

95 """Schema for JAR entries""" 

96 

97 model_config = ConfigDict( 

98 populate_by_name=True, 

99 ) 

100 signature: Optional[Signature] = Field( 

101 default=None, 

102 description="Information about the included signature in the JAR file", 

103 ) 

104 archive: Union[Archive, Archive1] = Field( 

105 ..., 

106 description="Information about the archive associated with the entry", 

107 ) 

108 

109 

110class JarSchema(RootModel[JarV001Schema]): 

111 model_config = ConfigDict( 

112 populate_by_name=True, 

113 ) 

114 root: JarV001Schema = Field(..., description="Schema for JAR objects", title="JAR Schema")