@@ -32,15 +32,15 @@ public struct OfferCredential {
32
32
33
33
public let id : String
34
34
public let type : String
35
- public let body : Body
35
+ public let body : Body ?
36
36
public let attachments : [ AttachmentDescriptor ]
37
37
public let thid : String ?
38
38
public let from : DID
39
39
public let to : DID
40
40
41
41
public init (
42
42
id: String = UUID ( ) . uuidString,
43
- body: Body ,
43
+ body: Body ? ,
44
44
type: String ,
45
45
attachments: [ AttachmentDescriptor ] ,
46
46
thid: String ? ,
@@ -67,10 +67,10 @@ public struct OfferCredential {
67
67
shouldBe: [ ProtocolTypes . didcommOfferCredential. rawValue]
68
68
) }
69
69
70
- let body = try JSONDecoder . didComm ( ) . decode ( Body . self, from: fromMessage. body)
70
+ let body = try ? JSONDecoder . didComm ( ) . decode ( Body . self, from: fromMessage. body)
71
71
self . init (
72
72
id: fromMessage. id,
73
- body: . init ( credentialPreview : . init ( attributes : [ ] ) , formats : [ ] ) , // TODO: [Anoncreds] when they fix on the agent put this back
73
+ body: body ,
74
74
type: piuri. rawValue,
75
75
attachments: fromMessage. attachments,
76
76
thid: fromMessage. thid,
@@ -108,10 +108,10 @@ public struct OfferCredential {
108
108
109
109
return OfferCredential (
110
110
body: Body (
111
- goalCode: proposed. body. goalCode,
112
- comment: proposed. body. comment,
113
- credentialPreview: proposed. body. credentialPreview,
114
- formats: proposed. body. formats
111
+ goalCode: proposed. body? . goalCode,
112
+ comment: proposed. body? . comment,
113
+ credentialPreview: proposed. body? . credentialPreview ?? . init ( attributes : [ ] ) ,
114
+ formats: proposed. body? . formats ?? [ ]
115
115
) ,
116
116
type: type. rawValue,
117
117
attachments: proposed. attachments,
@@ -139,14 +139,14 @@ public struct OfferCredential3_0 {
139
139
public let comment : String ?
140
140
public let replacementId : String ?
141
141
public let multipleAvailable : String ?
142
- public let credentialPreview : CredentialPreview3_0
142
+ public let credentialPreview : CredentialPreview3_0 ?
143
143
144
144
public init (
145
145
goalCode: String ? = nil ,
146
146
comment: String ? = nil ,
147
147
replacementId: String ? = nil ,
148
148
multipleAvailable: String ? = nil ,
149
- credentialPreview: CredentialPreview3_0
149
+ credentialPreview: CredentialPreview3_0 ?
150
150
) {
151
151
self . goalCode = goalCode
152
152
self . comment = comment
@@ -158,15 +158,15 @@ public struct OfferCredential3_0 {
158
158
159
159
public let id : String
160
160
public let type : String
161
- public let body : Body
161
+ public let body : Body ?
162
162
public let attachments : [ AttachmentDescriptor ]
163
163
public let thid : String ?
164
164
public let from : DID
165
165
public let to : DID
166
166
167
167
public init (
168
168
id: String = UUID ( ) . uuidString,
169
- body: Body ,
169
+ body: Body ? ,
170
170
type: String ,
171
171
attachments: [ AttachmentDescriptor ] ,
172
172
thid: String ? ,
@@ -193,7 +193,7 @@ public struct OfferCredential3_0 {
193
193
shouldBe: [ ProtocolTypes . didcommOfferCredential. rawValue]
194
194
) }
195
195
196
- let body = try JSONDecoder . didComm ( ) . decode ( Body . self, from: fromMessage. body)
196
+ let body = try ? JSONDecoder . didComm ( ) . decode ( Body . self, from: fromMessage. body)
197
197
self . init (
198
198
id: fromMessage. id,
199
199
body: body,
@@ -236,9 +236,9 @@ public struct OfferCredential3_0 {
236
236
237
237
return OfferCredential3_0 (
238
238
body: Body (
239
- goalCode: proposed. body. goalCode,
240
- comment: proposed. body. comment,
241
- credentialPreview: proposed. body. credentialPreview
239
+ goalCode: proposed. body? . goalCode,
240
+ comment: proposed. body? . comment,
241
+ credentialPreview: proposed. body? . credentialPreview
242
242
) ,
243
243
type: type. rawValue,
244
244
attachments: proposed. attachments,
0 commit comments