Skip to content

Commit

Permalink
fix iss v1.23.2
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelavoyan committed Jan 21, 2024
1 parent 37d5ff6 commit 33fc31d
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 23 deletions.
8 changes: 4 additions & 4 deletions VCL/VCL.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,7 @@
buildSettings = {
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 120;
CURRENT_PROJECT_VERSION = 121;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 7DDDGP43MJ;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -1905,7 +1905,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.23.1;
MARKETING_VERSION = 1.23.2;
PRODUCT_BUNDLE_IDENTIFIER = io.velocitycareerlabs.VCL;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1922,7 +1922,7 @@
buildSettings = {
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 120;
CURRENT_PROJECT_VERSION = 121;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 7DDDGP43MJ;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -1935,7 +1935,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.23.1;
MARKETING_VERSION = 1.23.2;
PRODUCT_BUNDLE_IDENTIFIER = io.velocitycareerlabs.VCL;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
5 changes: 3 additions & 2 deletions VCL/VCL/api/entities/VCLIdentificationSubmission.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ class VCLIdentificationSubmission: VCLSubmission {

init(
credentialManifest: VCLCredentialManifest,
verifiableCredentials: [VCLVerifiableCredential]? = nil
verifiableCredentials: [VCLVerifiableCredential]? = nil,
iss: String? = nil
) {
super.init(
submitUri: credentialManifest.submitPresentationUri,
iss: credentialManifest.iss,
iss: iss ?? "",
exchangeId: credentialManifest.exchangeId,
presentationDefinitionId: credentialManifest.presentationDefinitionId,
verifiableCredentials: verifiableCredentials,
Expand Down
5 changes: 3 additions & 2 deletions VCL/VCL/api/entities/VCLPresentationSubmission.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ public class VCLPresentationSubmission: VCLSubmission {

public init(
presentationRequest: VCLPresentationRequest,
verifiableCredentials: [VCLVerifiableCredential]
verifiableCredentials: [VCLVerifiableCredential],
iss: String? = nil
) {
self.progressUri = presentationRequest.progressUri

super.init(
submitUri: presentationRequest.submitPresentationUri,
iss: presentationRequest.iss,
iss: iss ?? "",
exchangeId: presentationRequest.exchangeId,
presentationDefinitionId: presentationRequest.presentationDefinitionId,
verifiableCredentials: verifiableCredentials,
Expand Down
1 change: 1 addition & 0 deletions VCL/VCL/api/entities/VCLSubmission.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class VCLSubmission {
private func generatePayload() -> [String: Any] {
var retVal = [String: Any]()
retVal[CodingKeys.KeyJti] = self.jti
retVal[CodingKeys.KeyIss] = self.iss
var vp = [String: Any]()
vp[CodingKeys.KeyType] = CodingKeys.ValueVerifiablePresentation
var presentationSubmissionDict = [String: Any]()
Expand Down
3 changes: 2 additions & 1 deletion VCL/VCL/impl/VCLImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ public class VCLImpl: VCL {
) {
let identificationSubmission = VCLIdentificationSubmission(
credentialManifest: generateOffersDescriptor.credentialManifest,
verifiableCredentials: generateOffersDescriptor.identificationVerifiableCredentials
verifiableCredentials: generateOffersDescriptor.identificationVerifiableCredentials,
iss: didJwk?.kid
)
identificationSubmissionUseCase.submit(
submission: identificationSubmission,
Expand Down
43 changes: 30 additions & 13 deletions VCL/VCLTests/entities/VCLSubmissionTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,53 @@ import XCTest
@testable import VCL

final class VCLSubmissionTest: XCTestCase {
private var subject: VCLSubmission!
private var subjectPresentationSubmission: VCLSubmission!
private var subjectIdentificationSubmission: VCLSubmission!

override func setUp() {
subject = VCLPresentationSubmission(
subjectPresentationSubmission = VCLPresentationSubmission(
presentationRequest: PresentationSubmissionMocks.PresentationRequest,
verifiableCredentials: PresentationSubmissionMocks.SelectionsList
verifiableCredentials: PresentationSubmissionMocks.SelectionsList,
iss: "inspection iss"
)

subjectIdentificationSubmission = VCLIdentificationSubmission(
credentialManifest: VCLCredentialManifest(
jwt: CommonMocks.JWT,
verifiedProfile: VCLVerifiedProfile(payload: VerifiedProfileMocks.VerifiedProfileIssuerJsonStr1.toDictionary()!)
),
verifiableCredentials: PresentationSubmissionMocks.SelectionsList,
iss: "issuing iss"
)
}

func testPayload() {
assert(subject.payload[VCLSubmission.CodingKeys.KeyJti] as! String == subject.jti)
let pl = subjectPresentationSubmission.payload
let iss = subjectPresentationSubmission.payload[VCLSubmission.CodingKeys.KeyIss] as? String
assert(subjectPresentationSubmission.payload[VCLSubmission.CodingKeys.KeyJti] as? String == subjectPresentationSubmission.jti)
assert(subjectPresentationSubmission.payload[VCLSubmission.CodingKeys.KeyIss] as? String == subjectPresentationSubmission.iss)

assert(subjectIdentificationSubmission.payload[VCLSubmission.CodingKeys.KeyJti] as? String == subjectIdentificationSubmission.jti)
assert(subjectIdentificationSubmission.payload[VCLSubmission.CodingKeys.KeyIss] as? String == subjectIdentificationSubmission.iss)
}

func testPushDelegate() {
assert(subject.pushDelegate!.pushUrl == PresentationSubmissionMocks.PushDelegate.pushUrl)
assert(subject.pushDelegate!.pushToken == PresentationSubmissionMocks.PushDelegate.pushToken)
assert(subjectPresentationSubmission.pushDelegate!.pushUrl == PresentationSubmissionMocks.PushDelegate.pushUrl)
assert(subjectPresentationSubmission.pushDelegate!.pushToken == PresentationSubmissionMocks.PushDelegate.pushToken)
}

func testRequestBody() {
let requestBodyJsonObj = subject.generateRequestBody(jwt: JwtServiceMocks.JWT)
assert(requestBodyJsonObj[VCLSubmission.CodingKeys.KeyExchangeId] as! String == subject.exchangeId)
assert(requestBodyJsonObj[VCLSubmission.CodingKeys.KeyContext] as! [String] == VCLSubmission.CodingKeys.ValueContextList)
let requestBodyJsonObj = subjectPresentationSubmission.generateRequestBody(jwt: JwtServiceMocks.JWT)
assert(requestBodyJsonObj[VCLSubmission.CodingKeys.KeyExchangeId] as? String == subjectPresentationSubmission.exchangeId)
assert(requestBodyJsonObj[VCLSubmission.CodingKeys.KeyContext] as? [String] == VCLSubmission.CodingKeys.ValueContextList)

let pushDelegateBodyJsonObj = requestBodyJsonObj[VCLSubmission.CodingKeys.KeyPushDelegate] as! [String: Any]

assert(pushDelegateBodyJsonObj[VCLPushDelegate.CodingKeys.KeyPushUrl] as! String == PresentationSubmissionMocks.PushDelegate.pushUrl)
assert(pushDelegateBodyJsonObj[VCLPushDelegate.CodingKeys.KeyPushToken] as! String == PresentationSubmissionMocks.PushDelegate.pushToken)
assert(pushDelegateBodyJsonObj[VCLPushDelegate.CodingKeys.KeyPushUrl] as? String == PresentationSubmissionMocks.PushDelegate.pushUrl)
assert(pushDelegateBodyJsonObj[VCLPushDelegate.CodingKeys.KeyPushToken] as? String == PresentationSubmissionMocks.PushDelegate.pushToken)

assert(pushDelegateBodyJsonObj[VCLPushDelegate.CodingKeys.KeyPushUrl] as! String == subject.pushDelegate!.pushUrl)
assert(pushDelegateBodyJsonObj[VCLPushDelegate.CodingKeys.KeyPushToken] as! String == subject.pushDelegate!.pushToken)
assert(pushDelegateBodyJsonObj[VCLPushDelegate.CodingKeys.KeyPushUrl] as? String == subjectPresentationSubmission.pushDelegate!.pushUrl)
assert(pushDelegateBodyJsonObj[VCLPushDelegate.CodingKeys.KeyPushToken] as? String == subjectPresentationSubmission.pushDelegate!.pushToken)
}

func testContext() {
Expand Down
3 changes: 2 additions & 1 deletion WalletIOS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ class ViewController: UIViewController {
private func submitPresentation(presentationRequest: VCLPresentationRequest) {
let presentationSubmission = VCLPresentationSubmission(
presentationRequest: presentationRequest,
verifiableCredentials: Constants.PresentationSelectionsList
verifiableCredentials: Constants.PresentationSelectionsList,
iss: didJwk?.did
)
submitPresentation(presentationSubmission: presentationSubmission)
}
Expand Down

0 comments on commit 33fc31d

Please sign in to comment.