@@ -13,24 +13,30 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
See the License for the specific language governing permissions and
14
14
limitations under the License.
15
15
*/
16
- import { Bundle as ProtoBundle } from '@sigstore/protobuf-specs' ;
16
+ import { Envelope , Bundle as ProtoBundle } from '@sigstore/protobuf-specs' ;
17
17
import { assertBundle } from './validate' ;
18
18
19
19
import type { Bundle } from './bundle' ;
20
20
import type { OneOf } from './utility' ;
21
21
22
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
- export const bundleFromJSON = ( obj : any ) : Bundle => {
22
+ export const bundleFromJSON = ( obj : unknown ) : Bundle => {
24
23
const bundle = ProtoBundle . fromJSON ( obj ) ;
25
24
assertBundle ( bundle ) ;
26
25
return bundle ;
27
26
} ;
28
27
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
28
export const bundleToJSON = ( bundle : Bundle ) : SerializedBundle => {
31
29
return ProtoBundle . toJSON ( bundle ) as SerializedBundle ;
32
30
} ;
33
31
32
+ export const envelopeFromJSON = ( obj : unknown ) : Envelope => {
33
+ return Envelope . fromJSON ( obj ) ;
34
+ } ;
35
+
36
+ export const envelopeToJSON = ( envelope : Envelope ) : SerializedEnvelope => {
37
+ return Envelope . toJSON ( envelope ) as SerializedEnvelope ;
38
+ } ;
39
+
34
40
type SerializedTLogEntry = {
35
41
logIndex : string ;
36
42
logId : {
@@ -76,7 +82,7 @@ type SerializedMessageSignature = {
76
82
} ;
77
83
78
84
// Serialized form of the dsseEnvelope option in the Sigstore Bundle
79
- type SerializedDSSEEnvelope = {
85
+ export type SerializedEnvelope = {
80
86
payload : string ;
81
87
payloadType : string ;
82
88
signatures : {
@@ -85,9 +91,6 @@ type SerializedDSSEEnvelope = {
85
91
} [ ] ;
86
92
} ;
87
93
88
- // Serialized form of the DSSE Envelope
89
- export type { SerializedDSSEEnvelope as SerializedEnvelope } ;
90
-
91
94
// Serialized form of the Sigstore Bundle union type with all possible options
92
95
// represented
93
96
export type SerializedBundle = {
@@ -103,6 +106,6 @@ export type SerializedBundle = {
103
106
timestampVerificationData : SerializedTimestampVerificationData | undefined ;
104
107
} ;
105
108
} & OneOf < {
106
- dsseEnvelope : SerializedDSSEEnvelope ;
109
+ dsseEnvelope : SerializedEnvelope ;
107
110
messageSignature : SerializedMessageSignature ;
108
111
} > ;
0 commit comments