Skip to content

Commit

Permalink
wrap flatMap write operation in Future
Browse files Browse the repository at this point in the history
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
  • Loading branch information
coveloper committed Feb 11, 2025
1 parent a7efde5 commit 833b522
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 100 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,15 @@ env:
jobs:
lint:
name: build
runs-on: macos-13
runs-on: macos-15

steps:
- name: Checkout Code
uses: actions/checkout@v3

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0.1'

- name: Install SSH Key
uses: shimataro/[email protected]
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: github.com

- name: Adding Known Hosts
run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts
xcode-version: '16.2'

# - name: Install lcov
# run: brew install [email protected] && brew link --overwrite --force [email protected]
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ jobs:
with:
xcode-version: '15.0.1'

- name: Install SSH Key
uses: shimataro/[email protected]
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: github.com

- name: Adding Known Hosts
run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts
# - name: Install SSH Key
# uses: shimataro/[email protected]
# with:
# key: ${{ secrets.SSH_PRIVATE_KEY }}
# known_hosts: github.com
#
# - name: Adding Known Hosts
# run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts

- name: Create properties file
working-directory: E2E/e2eTests/Resources
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/releaseDocumentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v3

- name: Install SSH Key
uses: shimataro/[email protected]
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: github.com

- name: Adding Known Hosts
run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts

- name: Build Docs
uses: nick-fields/retry@v2
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ public extension DIDCommAgent {

let requestCredential = RequestCredential3_0(
body: .init(
goalCode: offer.body.goalCode,
comment: offer.body.comment
goalCode: offer.body?.goalCode,
comment: offer.body?.comment
),
type: type.rawValue,
attachments: [.init(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public struct IssueCredential {

public let id: String
public let type: String
public let body: Body
public let body: Body?
public let attachments: [AttachmentDescriptor]
public let thid: String?
public let from: DID
public let to: DID

init(
id: String = UUID().uuidString,
body: Body,
body: Body?,
type: String,
attachments: [AttachmentDescriptor],
thid: String?,
Expand Down Expand Up @@ -65,7 +65,7 @@ public struct IssueCredential {
shouldBe: [ProtocolTypes.didcommIssueCredential.rawValue]
) }

let body = try JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
let body = try? JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
self.init(
id: fromMessage.id,
body: body,
Expand Down Expand Up @@ -111,9 +111,9 @@ public struct IssueCredential {

return IssueCredential(
body: Body(
goalCode: request.body.goalCode,
comment: request.body.comment,
formats: request.body.formats
goalCode: request.body?.goalCode,
comment: request.body?.comment,
formats: request.body?.formats ?? []
),
type: type.rawValue,
attachments: request.attachments,
Expand Down Expand Up @@ -169,15 +169,15 @@ public struct IssueCredential3_0 {

public let id: String
public let type: String
public let body: Body
public let body: Body?
public let attachments: [AttachmentDescriptor]
public let thid: String?
public let from: DID
public let to: DID

init(
id: String = UUID().uuidString,
body: Body,
body: Body?,
type: String,
attachments: [AttachmentDescriptor],
thid: String?,
Expand All @@ -204,7 +204,7 @@ public struct IssueCredential3_0 {
shouldBe: [ProtocolTypes.didcommIssueCredential3_0.rawValue]
) }

let body = try JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
let body = try? JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
self.init(
id: fromMessage.id,
body: body,
Expand Down Expand Up @@ -247,8 +247,8 @@ public struct IssueCredential3_0 {

return IssueCredential3_0(
body: Body(
goalCode: request.body.goalCode,
comment: request.body.comment
goalCode: request.body?.goalCode,
comment: request.body?.comment
),
type: type.rawValue,
attachments: request.attachments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ public struct OfferCredential {

public let id: String
public let type: String
public let body: Body
public let body: Body?
public let attachments: [AttachmentDescriptor]
public let thid: String?
public let from: DID
public let to: DID

public init(
id: String = UUID().uuidString,
body: Body,
body: Body?,
type: String,
attachments: [AttachmentDescriptor],
thid: String?,
Expand All @@ -67,10 +67,10 @@ public struct OfferCredential {
shouldBe: [ProtocolTypes.didcommOfferCredential.rawValue]
) }

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

return OfferCredential(
body: Body(
goalCode: proposed.body.goalCode,
comment: proposed.body.comment,
credentialPreview: proposed.body.credentialPreview,
formats: proposed.body.formats
goalCode: proposed.body?.goalCode,
comment: proposed.body?.comment,
credentialPreview: proposed.body?.credentialPreview ?? .init(attributes: []),
formats: proposed.body?.formats ?? []
),
type: type.rawValue,
attachments: proposed.attachments,
Expand Down Expand Up @@ -139,14 +139,14 @@ public struct OfferCredential3_0 {
public let comment: String?
public let replacementId: String?
public let multipleAvailable: String?
public let credentialPreview: CredentialPreview3_0
public let credentialPreview: CredentialPreview3_0?

public init(
goalCode: String? = nil,
comment: String? = nil,
replacementId: String? = nil,
multipleAvailable: String? = nil,
credentialPreview: CredentialPreview3_0
credentialPreview: CredentialPreview3_0?
) {
self.goalCode = goalCode
self.comment = comment
Expand All @@ -158,15 +158,15 @@ public struct OfferCredential3_0 {

public let id: String
public let type: String
public let body: Body
public let body: Body?
public let attachments: [AttachmentDescriptor]
public let thid: String?
public let from: DID
public let to: DID

public init(
id: String = UUID().uuidString,
body: Body,
body: Body?,
type: String,
attachments: [AttachmentDescriptor],
thid: String?,
Expand All @@ -193,7 +193,7 @@ public struct OfferCredential3_0 {
shouldBe: [ProtocolTypes.didcommOfferCredential.rawValue]
) }

let body = try JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
let body = try? JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
self.init(
id: fromMessage.id,
body: body,
Expand Down Expand Up @@ -236,9 +236,9 @@ public struct OfferCredential3_0 {

return OfferCredential3_0(
body: Body(
goalCode: proposed.body.goalCode,
comment: proposed.body.comment,
credentialPreview: proposed.body.credentialPreview
goalCode: proposed.body?.goalCode,
comment: proposed.body?.comment,
credentialPreview: proposed.body?.credentialPreview
),
type: type.rawValue,
attachments: proposed.attachments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import Foundation
// ALL parameterS are DIDCOMMV2 format and naming conventions and follows the protocol
// https://github.com/hyperledger/aries-rfcs/tree/main/features/0453-issue-credential-v2
public struct ProposeCredential {
struct Body: Codable, Equatable {
let goalCode: String?
let comment: String?
let credentialPreview: CredentialPreview
let formats: [CredentialFormat]
public struct Body: Codable, Equatable {
public let goalCode: String?
public let comment: String?
public let credentialPreview: CredentialPreview
public let formats: [CredentialFormat]

init(
public init(
goalCode: String? = nil,
comment: String? = nil,
credentialPreview: CredentialPreview,
Expand All @@ -26,15 +26,15 @@ public struct ProposeCredential {

public let id: String
public let type = ProtocolTypes.didcommProposeCredential.rawValue
let body: Body
let attachments: [AttachmentDescriptor]
public let body: Body?
public let attachments: [AttachmentDescriptor]
public let thid: String?
public let from: DID
public let to: DID

init(
id: String = UUID().uuidString,
body: Body,
body: Body?,
attachments: [AttachmentDescriptor],
thid: String?,
from: DID,
Expand All @@ -57,7 +57,7 @@ public struct ProposeCredential {
type: fromMessage.piuri,
shouldBe: [ProtocolTypes.didcommProposeCredential.rawValue]
) }
let body = try JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
let body = try? JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
self.init(
id: fromMessage.id,
body: body,
Expand Down Expand Up @@ -119,15 +119,15 @@ extension ProposeCredential: Equatable {
// ALL parameterS are DIDCOMMV2 format and naming conventions and follows the protocol
// https://github.com/hyperledger/aries-rfcs/tree/main/features/0453-issue-credential-v2
public struct ProposeCredential3_0 {
struct Body: Codable, Equatable {
let goalCode: String?
let comment: String?
let credentialPreview: CredentialPreview3_0
public struct Body: Codable, Equatable {
public let goalCode: String?
public let comment: String?
public let credentialPreview: CredentialPreview3_0?

init(
public init(
goalCode: String? = nil,
comment: String? = nil,
credentialPreview: CredentialPreview3_0
credentialPreview: CredentialPreview3_0?
) {
self.goalCode = goalCode
self.comment = comment
Expand All @@ -137,15 +137,15 @@ public struct ProposeCredential3_0 {

public let id: String
public let type = ProtocolTypes.didcommProposeCredential3_0.rawValue
let body: Body
let attachments: [AttachmentDescriptor]
public let body: Body?
public let attachments: [AttachmentDescriptor]
public let thid: String?
public let from: DID
public let to: DID

init(
id: String = UUID().uuidString,
body: Body,
body: Body?,
attachments: [AttachmentDescriptor],
thid: String?,
from: DID,
Expand All @@ -168,7 +168,7 @@ public struct ProposeCredential3_0 {
type: fromMessage.piuri,
shouldBe: [ProtocolTypes.didcommProposeCredential3_0.rawValue]
) }
let body = try JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
let body = try? JSONDecoder.didComm().decode(Body.self, from: fromMessage.body)
self.init(
id: fromMessage.id,
body: body,
Expand Down
Loading

0 comments on commit 833b522

Please sign in to comment.