From dbf02010e75c2aa21b5e7400d01742d604ecbba8 Mon Sep 17 00:00:00 2001 From: sydneymorton Date: Tue, 17 Nov 2020 13:45:49 -0800 Subject: [PATCH] Fix nits --- VCEntities/VCEntities/ResponseContaining.swift | 1 - .../presentation/PresentationResponseContainer.swift | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/VCEntities/VCEntities/ResponseContaining.swift b/VCEntities/VCEntities/ResponseContaining.swift index 2aff862..76190c3 100644 --- a/VCEntities/VCEntities/ResponseContaining.swift +++ b/VCEntities/VCEntities/ResponseContaining.swift @@ -3,7 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ - public protocol ResponseContaining { var audienceUrl: String { get } var audienceDid: String { get } diff --git a/VCEntities/VCEntities/presentation/PresentationResponseContainer.swift b/VCEntities/VCEntities/presentation/PresentationResponseContainer.swift index e7fc837..889c388 100644 --- a/VCEntities/VCEntities/presentation/PresentationResponseContainer.swift +++ b/VCEntities/VCEntities/presentation/PresentationResponseContainer.swift @@ -18,8 +18,13 @@ public struct PresentationResponseContainer: ResponseContaining { public init(from presentationRequest: PresentationRequest, expiryInSeconds exp: Int = 3000) throws { - self.audienceUrl = presentationRequest.content.redirectURI ?? "" - self.audienceDid = presentationRequest.content.issuer ?? "" + guard let aud = presentationRequest.content.redirectURI, + let did = presentationRequest.content.issuer else { + throw PresentationResponseError.noAudienceSpecifiedInRequest + } + + self.audienceDid = did + self.audienceUrl = aud self.request = presentationRequest self.expiryInSeconds = exp }