Skip to content

Commit 5e8ad07

Browse files
committed
wrap flatMap write operation in Future
Signed-off-by: Jon Bauer <[email protected]> ci: update and remove breaking steps Signed-off-by: goncalo-frade-iohk <[email protected]> update build.yml for xcode16 Signed-off-by: Jon Bauer <[email protected]> feat(agent): the body on issue credential protocol messages can be null hyperledger-identus/identus#115 Signed-off-by: goncalo-frade-iohk <[email protected]> commits squashed
1 parent a7efde5 commit 5e8ad07

12 files changed

+84
-100
lines changed

.github/workflows/build.yml

+2-11
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,15 @@ env:
1919
jobs:
2020
lint:
2121
name: build
22-
runs-on: macos-13
22+
runs-on: macos-15
2323

2424
steps:
2525
- name: Checkout Code
2626
uses: actions/checkout@v3
2727

2828
- uses: maxim-lobanov/setup-xcode@v1
2929
with:
30-
xcode-version: '15.0.1'
31-
32-
- name: Install SSH Key
33-
uses: shimataro/[email protected]
34-
with:
35-
key: ${{ secrets.SSH_PRIVATE_KEY }}
36-
known_hosts: github.com
37-
38-
- name: Adding Known Hosts
39-
run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts
30+
xcode-version: '16.2'
4031

4132
# - name: Install lcov
4233
# run: brew install [email protected] && brew link --overwrite --force [email protected]

.github/workflows/e2e.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ jobs:
3131
with:
3232
xcode-version: '15.0.1'
3333

34-
- name: Install SSH Key
35-
uses: shimataro/[email protected]
36-
with:
37-
key: ${{ secrets.SSH_PRIVATE_KEY }}
38-
known_hosts: github.com
39-
40-
- name: Adding Known Hosts
41-
run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts
34+
# - name: Install SSH Key
35+
# uses: shimataro/[email protected]
36+
# with:
37+
# key: ${{ secrets.SSH_PRIVATE_KEY }}
38+
# known_hosts: github.com
39+
#
40+
# - name: Adding Known Hosts
41+
# run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts
4242

4343
- name: Create properties file
4444
working-directory: E2E/e2eTests/Resources

.github/workflows/releaseDocumentation.yml

-9
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ jobs:
2828
- name: Checkout Code
2929
uses: actions/checkout@v3
3030

31-
- name: Install SSH Key
32-
uses: shimataro/[email protected]
33-
with:
34-
key: ${{ secrets.SSH_PRIVATE_KEY }}
35-
known_hosts: github.com
36-
37-
- name: Adding Known Hosts
38-
run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts
39-
4031
- name: Build Docs
4132
uses: nick-fields/retry@v2
4233
with:

EdgeAgentSDK/EdgeAgent/Sources/DIDCommAgent/DIDCommAgent+Credentials.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ public extension DIDCommAgent {
265265

266266
let requestCredential = RequestCredential3_0(
267267
body: .init(
268-
goalCode: offer.body.goalCode,
269-
comment: offer.body.comment
268+
goalCode: offer.body?.goalCode,
269+
comment: offer.body?.comment
270270
),
271271
type: type.rawValue,
272272
attachments: [.init(

EdgeAgentSDK/EdgeAgent/Sources/Protocols/IssueCredential/IssueCredential.swift

+11-11
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ public struct IssueCredential {
2929

3030
public let id: String
3131
public let type: String
32-
public let body: Body
32+
public let body: Body?
3333
public let attachments: [AttachmentDescriptor]
3434
public let thid: String?
3535
public let from: DID
3636
public let to: DID
3737

3838
init(
3939
id: String = UUID().uuidString,
40-
body: Body,
40+
body: Body?,
4141
type: String,
4242
attachments: [AttachmentDescriptor],
4343
thid: String?,
@@ -65,7 +65,7 @@ public struct IssueCredential {
6565
shouldBe: [ProtocolTypes.didcommIssueCredential.rawValue]
6666
) }
6767

68-
let body = try JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
68+
let body = try? JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
6969
self.init(
7070
id: fromMessage.id,
7171
body: body,
@@ -111,9 +111,9 @@ public struct IssueCredential {
111111

112112
return IssueCredential(
113113
body: Body(
114-
goalCode: request.body.goalCode,
115-
comment: request.body.comment,
116-
formats: request.body.formats
114+
goalCode: request.body?.goalCode,
115+
comment: request.body?.comment,
116+
formats: request.body?.formats ?? []
117117
),
118118
type: type.rawValue,
119119
attachments: request.attachments,
@@ -169,15 +169,15 @@ public struct IssueCredential3_0 {
169169

170170
public let id: String
171171
public let type: String
172-
public let body: Body
172+
public let body: Body?
173173
public let attachments: [AttachmentDescriptor]
174174
public let thid: String?
175175
public let from: DID
176176
public let to: DID
177177

178178
init(
179179
id: String = UUID().uuidString,
180-
body: Body,
180+
body: Body?,
181181
type: String,
182182
attachments: [AttachmentDescriptor],
183183
thid: String?,
@@ -204,7 +204,7 @@ public struct IssueCredential3_0 {
204204
shouldBe: [ProtocolTypes.didcommIssueCredential3_0.rawValue]
205205
) }
206206

207-
let body = try JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
207+
let body = try? JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
208208
self.init(
209209
id: fromMessage.id,
210210
body: body,
@@ -247,8 +247,8 @@ public struct IssueCredential3_0 {
247247

248248
return IssueCredential3_0(
249249
body: Body(
250-
goalCode: request.body.goalCode,
251-
comment: request.body.comment
250+
goalCode: request.body?.goalCode,
251+
comment: request.body?.comment
252252
),
253253
type: type.rawValue,
254254
attachments: request.attachments,

EdgeAgentSDK/EdgeAgent/Sources/Protocols/IssueCredential/OfferCredential.swift

+16-16
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ public struct OfferCredential {
3232

3333
public let id: String
3434
public let type: String
35-
public let body: Body
35+
public let body: Body?
3636
public let attachments: [AttachmentDescriptor]
3737
public let thid: String?
3838
public let from: DID
3939
public let to: DID
4040

4141
public init(
4242
id: String = UUID().uuidString,
43-
body: Body,
43+
body: Body?,
4444
type: String,
4545
attachments: [AttachmentDescriptor],
4646
thid: String?,
@@ -67,10 +67,10 @@ public struct OfferCredential {
6767
shouldBe: [ProtocolTypes.didcommOfferCredential.rawValue]
6868
) }
6969

70-
let body = try JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
70+
let body = try? JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
7171
self.init(
7272
id: fromMessage.id,
73-
body: .init(credentialPreview: .init(attributes: []), formats: []), // TODO: [Anoncreds] when they fix on the agent put this back
73+
body: body,
7474
type: piuri.rawValue,
7575
attachments: fromMessage.attachments,
7676
thid: fromMessage.thid,
@@ -108,10 +108,10 @@ public struct OfferCredential {
108108

109109
return OfferCredential(
110110
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 ?? []
115115
),
116116
type: type.rawValue,
117117
attachments: proposed.attachments,
@@ -139,14 +139,14 @@ public struct OfferCredential3_0 {
139139
public let comment: String?
140140
public let replacementId: String?
141141
public let multipleAvailable: String?
142-
public let credentialPreview: CredentialPreview3_0
142+
public let credentialPreview: CredentialPreview3_0?
143143

144144
public init(
145145
goalCode: String? = nil,
146146
comment: String? = nil,
147147
replacementId: String? = nil,
148148
multipleAvailable: String? = nil,
149-
credentialPreview: CredentialPreview3_0
149+
credentialPreview: CredentialPreview3_0?
150150
) {
151151
self.goalCode = goalCode
152152
self.comment = comment
@@ -158,15 +158,15 @@ public struct OfferCredential3_0 {
158158

159159
public let id: String
160160
public let type: String
161-
public let body: Body
161+
public let body: Body?
162162
public let attachments: [AttachmentDescriptor]
163163
public let thid: String?
164164
public let from: DID
165165
public let to: DID
166166

167167
public init(
168168
id: String = UUID().uuidString,
169-
body: Body,
169+
body: Body?,
170170
type: String,
171171
attachments: [AttachmentDescriptor],
172172
thid: String?,
@@ -193,7 +193,7 @@ public struct OfferCredential3_0 {
193193
shouldBe: [ProtocolTypes.didcommOfferCredential.rawValue]
194194
) }
195195

196-
let body = try JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
196+
let body = try? JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
197197
self.init(
198198
id: fromMessage.id,
199199
body: body,
@@ -236,9 +236,9 @@ public struct OfferCredential3_0 {
236236

237237
return OfferCredential3_0(
238238
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
242242
),
243243
type: type.rawValue,
244244
attachments: proposed.attachments,

EdgeAgentSDK/EdgeAgent/Sources/Protocols/IssueCredential/ProposeCredential.swift

+20-20
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import Foundation
55
// ALL parameterS are DIDCOMMV2 format and naming conventions and follows the protocol
66
// https://github.com/hyperledger/aries-rfcs/tree/main/features/0453-issue-credential-v2
77
public struct ProposeCredential {
8-
struct Body: Codable, Equatable {
9-
let goalCode: String?
10-
let comment: String?
11-
let credentialPreview: CredentialPreview
12-
let formats: [CredentialFormat]
8+
public struct Body: Codable, Equatable {
9+
public let goalCode: String?
10+
public let comment: String?
11+
public let credentialPreview: CredentialPreview
12+
public let formats: [CredentialFormat]
1313

14-
init(
14+
public init(
1515
goalCode: String? = nil,
1616
comment: String? = nil,
1717
credentialPreview: CredentialPreview,
@@ -26,15 +26,15 @@ public struct ProposeCredential {
2626

2727
public let id: String
2828
public let type = ProtocolTypes.didcommProposeCredential.rawValue
29-
let body: Body
30-
let attachments: [AttachmentDescriptor]
29+
public let body: Body?
30+
public let attachments: [AttachmentDescriptor]
3131
public let thid: String?
3232
public let from: DID
3333
public let to: DID
3434

3535
init(
3636
id: String = UUID().uuidString,
37-
body: Body,
37+
body: Body?,
3838
attachments: [AttachmentDescriptor],
3939
thid: String?,
4040
from: DID,
@@ -57,7 +57,7 @@ public struct ProposeCredential {
5757
type: fromMessage.piuri,
5858
shouldBe: [ProtocolTypes.didcommProposeCredential.rawValue]
5959
) }
60-
let body = try JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
60+
let body = try? JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
6161
self.init(
6262
id: fromMessage.id,
6363
body: body,
@@ -119,15 +119,15 @@ extension ProposeCredential: Equatable {
119119
// ALL parameterS are DIDCOMMV2 format and naming conventions and follows the protocol
120120
// https://github.com/hyperledger/aries-rfcs/tree/main/features/0453-issue-credential-v2
121121
public struct ProposeCredential3_0 {
122-
struct Body: Codable, Equatable {
123-
let goalCode: String?
124-
let comment: String?
125-
let credentialPreview: CredentialPreview3_0
122+
public struct Body: Codable, Equatable {
123+
public let goalCode: String?
124+
public let comment: String?
125+
public let credentialPreview: CredentialPreview3_0?
126126

127-
init(
127+
public init(
128128
goalCode: String? = nil,
129129
comment: String? = nil,
130-
credentialPreview: CredentialPreview3_0
130+
credentialPreview: CredentialPreview3_0?
131131
) {
132132
self.goalCode = goalCode
133133
self.comment = comment
@@ -137,15 +137,15 @@ public struct ProposeCredential3_0 {
137137

138138
public let id: String
139139
public let type = ProtocolTypes.didcommProposeCredential3_0.rawValue
140-
let body: Body
141-
let attachments: [AttachmentDescriptor]
140+
public let body: Body?
141+
public let attachments: [AttachmentDescriptor]
142142
public let thid: String?
143143
public let from: DID
144144
public let to: DID
145145

146146
init(
147147
id: String = UUID().uuidString,
148-
body: Body,
148+
body: Body?,
149149
attachments: [AttachmentDescriptor],
150150
thid: String?,
151151
from: DID,
@@ -168,7 +168,7 @@ public struct ProposeCredential3_0 {
168168
type: fromMessage.piuri,
169169
shouldBe: [ProtocolTypes.didcommProposeCredential3_0.rawValue]
170170
) }
171-
let body = try JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
171+
let body = try? JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
172172
self.init(
173173
id: fromMessage.id,
174174
body: body,

0 commit comments

Comments
 (0)