From 41778287c2c71a41e54660cf82b4d946a8a32261 Mon Sep 17 00:00:00 2001 From: Michael Avoyan <64565419+michaelavoyan@users.noreply.github.com> Date: Sun, 1 Dec 2024 10:55:59 +0200 Subject: [PATCH 1/2] VL-8490 - support primary-source checks using root @context --- VCL/VCL.xcodeproj/project.pbxproj | 16 +-- VCL/VCL/api/VCL.swift | 90 +++++++-------- VCL/VCL/api/VCLCryptoServiceType.swift | 2 +- VCL/VCL/api/VCLEnvironment.swift | 2 +- VCL/VCL/api/VCLProvider.swift | 2 +- VCL/VCL/api/VCLSignatureAlgorithm.swift | 2 +- VCL/VCL/api/VCLXVnfProtocolVersion.swift | 2 +- VCL/VCL/api/entities/VCLClaims.swift | 8 +- VCL/VCL/api/entities/VCLCountries.swift | 2 +- VCL/VCL/api/entities/VCLCountry.swift | 6 +- .../api/entities/VCLCredentialManifest.swift | 14 +-- .../VCLCredentialManifestDescriptor.swift | 2 +- VCL/VCL/api/entities/VCLCredentialType.swift | 6 +- .../entities/VCLCredentialTypeSchema.swift | 6 +- .../entities/VCLCredentialTypeSchemas.swift | 2 +- VCL/VCL/api/entities/VCLCredentialTypes.swift | 2 +- .../VCLCredentialTypesUIFormSchema.swift | 6 +- ...redentialTypesUIFormSchemaDescriptor.swift | 2 +- VCL/VCL/api/entities/VCLDeepLink.swift | 2 +- VCL/VCL/api/entities/VCLDidJwk.swift | 2 +- .../api/entities/VCLDidJwkDescriptor.swift | 2 +- VCL/VCL/api/entities/VCLExchange.swift | 2 +- .../api/entities/VCLExchangeDescriptor.swift | 2 +- .../VCLFinalizeOffersDescriptor.swift | 6 +- .../VCLGenerateOffersDescriptor.swift | 8 +- VCL/VCL/api/entities/VCLIssuingType.swift | 2 +- VCL/VCL/api/entities/VCLJwt.swift | 16 +-- VCL/VCL/api/entities/VCLJwtDescriptor.swift | 6 +- .../VCLJwtVerifiableCredentials.swift | 2 +- VCL/VCL/api/entities/VCLOffer.swift | 8 +- VCL/VCL/api/entities/VCLOffers.swift | 10 +- VCL/VCL/api/entities/VCLOrganization.swift | 8 +- VCL/VCL/api/entities/VCLOrganizations.swift | 2 +- .../VCLOrganizationsSearchDescriptor.swift | 8 +- VCL/VCL/api/entities/VCLPlace.swift | 4 +- .../api/entities/VCLPresentationRequest.swift | 8 +- .../VCLPresentationRequestDescriptor.swift | 2 +- VCL/VCL/api/entities/VCLPublicJwk.swift | 8 +- VCL/VCL/api/entities/VCLPushDelegate.swift | 2 +- VCL/VCL/api/entities/VCLRegion.swift | 6 +- VCL/VCL/api/entities/VCLRegions.swift | 2 +- VCL/VCL/api/entities/VCLResult.swift | 2 +- VCL/VCL/api/entities/VCLService.swift | 6 +- VCL/VCL/api/entities/VCLServiceType.swift | 2 +- VCL/VCL/api/entities/VCLServiceTypes.swift | 2 +- VCL/VCL/api/entities/VCLSubmission.swift | 18 +-- .../api/entities/VCLSubmissionResult.swift | 2 +- VCL/VCL/api/entities/VCLToken.swift | 2 +- .../entities/VCLVerifiableCredential.swift | 2 +- VCL/VCL/api/entities/VCLVerifiedProfile.swift | 8 +- .../VCLVerifiedProfileDescriptor.swift | 2 +- VCL/VCL/api/entities/error/VCLError.swift | 4 +- .../VCLCryptoServicesDescriptor.swift | 2 +- .../VCLInitializationDescriptor.swift | 2 +- .../VCLInjectedCryptoServicesDescriptor.swift | 2 +- .../initialization/VCLJwtServiceUrls.swift | 2 +- .../initialization/VCLKeyServiceUrls.swift | 2 +- ...CLRemoteCryptoServicesUrlsDescriptor.swift | 2 +- VCL/VCL/api/jwt/VCLJwtSignService.swift | 6 +- VCL/VCL/api/jwt/VCLJwtVerifyService.swift | 4 +- VCL/VCL/api/keys/VCLKeyService.swift | 4 +- VCL/VCL/impl/VCLImpl.swift | 70 +++++------ .../infrastructure/db/CacheServiceImpl.swift | 2 +- .../executors/DsptchQueueImpl.swift | 4 +- .../executors/ExecutorImpl.swift | 4 +- .../network/NetworkServiceImpl.swift | 4 +- .../impl/data/models/CountriesModelImpl.swift | 4 +- .../CredentialTypeSchemasModelImpl.swift | 4 +- .../models/CredentialTypesModelImpl.swift | 4 +- .../CountriesRepositoryImpl.swift | 14 +-- .../CredentialManifestRepositoryImpl.swift | 2 +- .../CredentialTypeSchemaRepositoryImpl.swift | 4 +- .../CredentialTypesRepositoryImpl.swift | 10 +- ...ntialTypesUIFormSchemaRepositoryImpl.swift | 14 +-- .../ExchangeProgressRepositoryImpl.swift | 4 +- .../FinalizeOffersRepositoryImpl.swift | 2 +- .../GenerateOffersRepositoryImpl.swift | 2 +- .../JwtServiceRepositoryImpl.swift | 4 +- .../KeyServiceRepositoryImpl.swift | 2 +- .../OrganizationsRepositoryImpl.swift | 6 +- .../PresentationRequestRepositoryImpl.swift | 2 +- .../ResolveKidRepositoryImpl.swift | 2 +- .../SubmissionRepositoryImpl.swift | 8 +- .../VerifiedProfileRepositoryImpl.swift | 2 +- .../data/usecases/CountriesUseCaseImpl.swift | 2 +- .../CredentialManifestUseCaseImpl.swift | 12 +- .../CredentialTypeSchemasUseCaseImpl.swift | 4 +- ...edentialTypesUIFormSchemaUseCaseImpl.swift | 2 +- .../usecases/CredentialTypesUseCaseImpl.swift | 2 +- .../ExchangeProgressUseCaseImpl.swift | 2 +- .../usecases/FinalizeOffersUseCaseImpl.swift | 12 +- .../usecases/GenerateOffersUseCaseImpl.swift | 6 +- .../data/usecases/JwtServiceUseCaseImpl.swift | 4 +- .../data/usecases/KeyServiceUseCaseImpl.swift | 2 +- .../usecases/OrganizationsUseCaseImpl.swift | 2 +- .../PresentationRequestUseCaseImpl.swift | 10 +- .../data/usecases/SubmissionUseCaseImpl.swift | 2 +- .../usecases/VerifiedProfileUseCaseImpl.swift | 2 +- VCL/VCL/impl/data/utils/Utils.swift | 71 ------------ .../verifiers/CredentialDidVerifierImpl.swift | 2 +- .../CredentialIssuerVerifierEmptyImpl.swift | 2 +- .../CredentialIssuerVerifierImpl.swift | 51 ++++---- ...entialManifestByDeepLinkVerifierImpl.swift | 2 +- .../CredentialsByDeepLinkVerifierImpl.swift | 2 +- .../OffersByDeepLinkVerifierImpl.swift | 2 +- ...ntationRequestByDeepLinkVerifierImpl.swift | 2 +- .../data/verifiers/VerificationUtils.swift | 109 ++++++++++++++++++ .../infrastructure/db/CacheService.swift | 2 +- .../infrastructure/executors/Dispatcher.swift | 2 +- .../executors/DsptchQueue.swift | 4 +- .../infrastructure/executors/Executor.swift | 6 +- .../network/NetworkService.swift | 6 +- .../impl/domain/models/CountriesModel.swift | 2 +- .../models/CredentialTypeSchemasModel.swift | 2 +- .../domain/models/CredentialTypesModel.swift | 2 +- VCL/VCL/impl/domain/models/Model.swift | 6 +- .../repositories/CountriesRepository.swift | 4 +- .../CredentialManifestRepository.swift | 4 +- .../CredentialTypeSchemaRepository.swift | 4 +- .../CredentialTypesRepository.swift | 4 +- ...redentialTypesUIFormSchemaRepository.swift | 4 +- .../ExchangeProgressRepository.swift | 4 +- .../FinalizeOffersRepository.swift | 4 +- .../GenerateOffersRepository.swift | 4 +- .../repositories/JwtServiceRepository.swift | 8 +- .../repositories/KeyServiceRepository.swift | 4 +- .../OrganizationsRepository.swift | 4 +- .../PresentationRequestRepository.swift | 4 +- .../repositories/ResolveKidRepository.swift | 4 +- .../repositories/SubmissionRepository.swift | 4 +- .../VerifiedProfileRepository.swift | 4 +- .../domain/usecases/CountriesUseCase.swift | 4 +- .../usecases/CredentialManifestUseCase.swift | 4 +- .../CredentialTypeSchemasUseCase.swift | 4 +- .../CredentialTypesFormSchemaUseCase.swift | 4 +- .../usecases/CredentialTypesUseCase.swift | 4 +- .../usecases/ExchangeProgressUseCase.swift | 4 +- .../usecases/FinalizeOffersUseCase.swift | 4 +- .../usecases/GenerateOffersUseCase.swift | 4 +- .../domain/usecases/JwtServiceUseCase.swift | 8 +- .../domain/usecases/KeyServiceUserCase.swift | 4 +- .../usecases/OrganizationsUseCase.swift | 4 +- .../usecases/PresentationRequestUseCase.swift | 4 +- .../domain/usecases/SubmissionUseCase.swift | 4 +- .../usecases/VerifiedProfileUseCase.swift | 4 +- .../verifiers/CredentialDidVerifier.swift | 4 +- .../verifiers/CredentialIssuerVerifier.swift | 4 +- ...CredentialManifestByDeepLinkVerifier.swift | 4 +- .../CredentialsByDeepLinkVerifier.swift | 4 +- .../verifiers/OffersByDeepLinkVerifier.swift | 4 +- ...resentationRequestByDeepLinkVerifier.swift | 4 +- VCL/VCL/impl/extensions/ArrayExtensions.swift | 10 +- VCL/VCL/impl/extensions/DataExtensions.swift | 14 +-- .../extensions/DictionaryExtensions.swift | 12 +- .../impl/extensions/StringExtensions.swift | 12 +- .../local/VCLJwtSignServiceLocalImpl.swift | 8 +- .../local/VCLJwtVerifyServiceLocalImpl.swift | 2 +- .../remote/VCLJwtSignServiceRemoteImpl.swift | 10 +- .../VCLJwtVerifyServiceRemoteImpl.swift | 4 +- .../impl/keys/VCLKeyServiceLocalImpl.swift | 8 +- .../impl/keys/VCLKeyServiceRemoteImpl.swift | 6 +- .../utils/ProfileServiceTypeVerifier.swift | 10 +- .../VCLFinalizeOffersDescriptorTest.swift | 4 +- VCL/VCLTests/entities/VCLOffersTest.swift | 6 +- VCL/VCLTests/entities/VCLSubmissionTest.swift | 2 +- .../jwt/remote/VCLJwtSignServiceTest.swift | 8 +- .../resources/CredentialTypesModelMock.swift | 2 +- .../resources/EmptyExecutor.swift | 4 +- .../valid/CredentialTypeSchemaMocks.swift | 2 +- .../valid/VCLJwtSignServiceMock.swift | 2 +- .../valid/VCLJwtVerifyServiceMock.swift | 2 +- .../resources/valid/VCLKeyServiceMock.swift | 8 +- .../valid/network/NetworkServiceSuccess.swift | 2 +- ...edentialTypesUIFormSchemaUseCaseTest.swift | 20 ++-- .../ExchangeProgressUseCaseTest.swift | 2 +- .../usecases/JwtServiceUseCaseTest.swift | 2 +- .../PresentationSubmissionUseCaseTest.swift | 6 +- VCL/VCLTests/utils/UtilsTest.swift | 22 ++-- .../verifiers/CredentialDidVerifierTest.swift | 2 +- .../CredentialIssuerVerifierTest.swift | 2 +- .../OffersByDeepLinkVerifierTest.swift | 4 +- 181 files changed, 626 insertions(+), 599 deletions(-) delete mode 100644 VCL/VCL/impl/data/utils/Utils.swift create mode 100644 VCL/VCL/impl/data/verifiers/VerificationUtils.swift diff --git a/VCL/VCL.xcodeproj/project.pbxproj b/VCL/VCL.xcodeproj/project.pbxproj index 5dae297..6554cfd 100644 --- a/VCL/VCL.xcodeproj/project.pbxproj +++ b/VCL/VCL.xcodeproj/project.pbxproj @@ -282,7 +282,7 @@ 28D3F8CE2A641842001CF3C2 /* CredentialDidVerifierImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D3F8CD2A641842001CF3C2 /* CredentialDidVerifierImpl.swift */; }; 28D3F8D02A642AB5001CF3C2 /* CredentialIssuerVerifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D3F8CF2A642AB5001CF3C2 /* CredentialIssuerVerifier.swift */; }; 28D3F8D22A642B29001CF3C2 /* CredentialIssuerVerifierImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D3F8D12A642B29001CF3C2 /* CredentialIssuerVerifierImpl.swift */; }; - 28D3F8D82A643513001CF3C2 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D3F8D72A643513001CF3C2 /* Utils.swift */; }; + 28D3F8D82A643513001CF3C2 /* VerificationUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D3F8D72A643513001CF3C2 /* VerificationUtils.swift */; }; 28D4D6182A0CEDD500059A87 /* VCLKeyServiceLocalImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D4D6172A0CEDD500059A87 /* VCLKeyServiceLocalImpl.swift */; }; 28D4D61B2A0CEDFC00059A87 /* VCLKeyService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D4D61A2A0CEDFC00059A87 /* VCLKeyService.swift */; }; 28DB58C22BB458AE00DD9553 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 28DB58C12BB458AE00DD9553 /* PrivacyInfo.xcprivacy */; }; @@ -575,7 +575,7 @@ 28D3F8CD2A641842001CF3C2 /* CredentialDidVerifierImpl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CredentialDidVerifierImpl.swift; sourceTree = ""; }; 28D3F8CF2A642AB5001CF3C2 /* CredentialIssuerVerifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CredentialIssuerVerifier.swift; sourceTree = ""; }; 28D3F8D12A642B29001CF3C2 /* CredentialIssuerVerifierImpl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CredentialIssuerVerifierImpl.swift; sourceTree = ""; }; - 28D3F8D72A643513001CF3C2 /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = ""; }; + 28D3F8D72A643513001CF3C2 /* VerificationUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerificationUtils.swift; sourceTree = ""; }; 28D4D6172A0CEDD500059A87 /* VCLKeyServiceLocalImpl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VCLKeyServiceLocalImpl.swift; sourceTree = ""; }; 28D4D61A2A0CEDFC00059A87 /* VCLKeyService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VCLKeyService.swift; sourceTree = ""; }; 28DB58C12BB458AE00DD9553 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; @@ -721,7 +721,6 @@ 28641546264D65E2006C1AA3 /* models */, 28641538264D65E2006C1AA3 /* repositories */, 28641556264D65E2006C1AA3 /* usecases */, - 28D3F8C02A64178B001CF3C2 /* utils */, 28A6FAA92B28DF9B00C7675E /* verifiers */, ); path = data; @@ -1234,6 +1233,7 @@ 28A6FAB42B28E09C00C7675E /* CredentialsByDeepLinkVerifierImpl.swift */, 28A6FAB32B28E09B00C7675E /* OffersByDeepLinkVerifierImpl.swift */, 28A6FAB52B28E09C00C7675E /* PresentationRequestByDeepLinkVerifierImpl.swift */, + 28D3F8D72A643513001CF3C2 /* VerificationUtils.swift */, ); path = verifiers; sourceTree = ""; @@ -1273,14 +1273,6 @@ path = valid; sourceTree = ""; }; - 28D3F8C02A64178B001CF3C2 /* utils */ = { - isa = PBXGroup; - children = ( - 28D3F8D72A643513001CF3C2 /* Utils.swift */, - ); - path = utils; - sourceTree = ""; - }; 28D3F8CA2A6417A7001CF3C2 /* verifiers */ = { isa = PBXGroup; children = ( @@ -1619,7 +1611,7 @@ 28648A642AA8736D002FD0E2 /* VCLInjectedCryptoServicesDescriptor.swift in Sources */, 281EDC30295AE46200D2D381 /* VCLJwtDescriptor.swift in Sources */, 286415FC264D65E2006C1AA3 /* VCLPublicJwk.swift in Sources */, - 28D3F8D82A643513001CF3C2 /* Utils.swift in Sources */, + 28D3F8D82A643513001CF3C2 /* VerificationUtils.swift in Sources */, 28600695274A81540018AC8F /* VCLOffers.swift in Sources */, 28C7585B26C1798500269A09 /* VCLSubmissionResult.swift in Sources */, 28FA80E826789D25000A3C7F /* JwtServiceUseCaseImpl.swift in Sources */, diff --git a/VCL/VCL/api/VCL.swift b/VCL/VCL/api/VCL.swift index cc97fc2..b0667d8 100644 --- a/VCL/VCL/api/VCL.swift +++ b/VCL/VCL/api/VCL.swift @@ -7,12 +7,12 @@ // Copyright 2022 Velocity Career Labs inc. // SPDX-License-Identifier: Apache-2.0 -public protocol VCL: Sendable { +public protocol VCL { func initialize( initializationDescriptor: VCLInitializationDescriptor, - successHandler: @escaping @Sendable () -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping () -> Void, + errorHandler: @escaping (VCLError) -> Void ) var countries: VCLCountries? { get } @@ -21,94 +21,94 @@ public protocol VCL: Sendable { func getPresentationRequest( presentationRequestDescriptor: VCLPresentationRequestDescriptor, - successHandler: @escaping @Sendable (VCLPresentationRequest) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLPresentationRequest) -> Void, + errorHandler: @escaping (VCLError) -> Void ) func submitPresentation( presentationSubmission: VCLPresentationSubmission, - successHandler: @escaping @Sendable (VCLSubmissionResult) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLSubmissionResult) -> Void, + errorHandler: @escaping (VCLError) -> Void ) func getExchangeProgress( exchangeDescriptor: VCLExchangeDescriptor, - successHandler: @escaping @Sendable (VCLExchange) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLExchange) -> Void, + errorHandler: @escaping (VCLError) -> Void ) func searchForOrganizations( organizationsSearchDescriptor: VCLOrganizationsSearchDescriptor, - successHandler: @escaping @Sendable (VCLOrganizations) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLOrganizations) -> Void, + errorHandler: @escaping (VCLError) -> Void ) func getCredentialManifest( credentialManifestDescriptor: VCLCredentialManifestDescriptor, - successHandler: @escaping @Sendable (VCLCredentialManifest) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLCredentialManifest) -> Void, + errorHandler: @escaping (VCLError) -> Void ) func generateOffers( generateOffersDescriptor: VCLGenerateOffersDescriptor, - successHandler: @escaping @Sendable (VCLOffers) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLOffers) -> Void, + errorHandler: @escaping (VCLError) -> Void ) func checkForOffers( generateOffersDescriptor: VCLGenerateOffersDescriptor, sessionToken: VCLToken, - successHandler: @escaping @Sendable (VCLOffers) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLOffers) -> Void, + errorHandler: @escaping (VCLError) -> Void ) func finalizeOffers( finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, sessionToken: VCLToken, - successHandler: @escaping @Sendable (VCLJwtVerifiableCredentials) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLJwtVerifiableCredentials) -> Void, + errorHandler: @escaping (VCLError) -> Void ) func getCredentialTypesUIFormSchema( credentialTypesUIFormSchemaDescriptor: VCLCredentialTypesUIFormSchemaDescriptor, - successHandler: @escaping @Sendable (VCLCredentialTypesUIFormSchema) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLCredentialTypesUIFormSchema) -> Void, + errorHandler: @escaping (VCLError) -> Void ) func getVerifiedProfile( verifiedProfileDescriptor: VCLVerifiedProfileDescriptor, - successHandler: @escaping @Sendable (VCLVerifiedProfile) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLVerifiedProfile) -> Void, + errorHandler: @escaping (VCLError) -> Void ) func verifyJwt( jwt: VCLJwt, publicJwk: VCLPublicJwk, remoteCryptoServicesToken: VCLToken?, - successHandler: @escaping @Sendable (Bool) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (Bool) -> Void, + errorHandler: @escaping (VCLError) -> Void ) func generateSignedJwt( jwtDescriptor: VCLJwtDescriptor, didJwk: VCLDidJwk, remoteCryptoServicesToken: VCLToken?, - successHandler: @escaping @Sendable (VCLJwt) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLJwt) -> Void, + errorHandler: @escaping (VCLError) -> Void ) func generateDidJwk( didJwkDescriptor: VCLDidJwkDescriptor, - successHandler: @escaping @Sendable (VCLDidJwk) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLDidJwk) -> Void, + errorHandler: @escaping (VCLError) -> Void ) } extension VCL { public func getPresentationRequest( presentationRequestDescriptor: VCLPresentationRequestDescriptor, - successHandler: @escaping @Sendable (VCLPresentationRequest) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLPresentationRequest) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { getPresentationRequest( presentationRequestDescriptor: presentationRequestDescriptor, @@ -119,8 +119,8 @@ extension VCL { public func submitPresentation( presentationSubmission: VCLPresentationSubmission, - successHandler: @escaping @Sendable (VCLSubmissionResult) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLSubmissionResult) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { submitPresentation( presentationSubmission: presentationSubmission, @@ -131,8 +131,8 @@ extension VCL { public func getCredentialManifest( credentialManifestDescriptor: VCLCredentialManifestDescriptor, - successHandler: @escaping @Sendable (VCLCredentialManifest) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLCredentialManifest) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { getCredentialManifest( credentialManifestDescriptor: credentialManifestDescriptor, @@ -143,8 +143,8 @@ extension VCL { public func generateOffers( generateOffersDescriptor: VCLGenerateOffersDescriptor, - successHandler: @escaping @Sendable (VCLOffers) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLOffers) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { generateOffers( generateOffersDescriptor: generateOffersDescriptor, @@ -156,8 +156,8 @@ extension VCL { public func finalizeOffers( finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, sessionToken: VCLToken, - successHandler: @escaping @Sendable (VCLJwtVerifiableCredentials) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLJwtVerifiableCredentials) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { finalizeOffers( finalizeOffersDescriptor: finalizeOffersDescriptor, @@ -171,8 +171,8 @@ extension VCL { jwt: VCLJwt, publicJwk: VCLPublicJwk, remoteCryptoServicesToken: VCLToken? = nil, - successHandler: @escaping @Sendable (Bool) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (Bool) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { verifyJwt( jwt: jwt, @@ -187,8 +187,8 @@ extension VCL { didJwk: VCLDidJwk, jwtDescriptor: VCLJwtDescriptor, remoteCryptoServicesToken: VCLToken? = nil, - successHandler: @escaping @Sendable (VCLJwt) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLJwt) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { generateSignedJwt( jwtDescriptor: jwtDescriptor, @@ -201,8 +201,8 @@ extension VCL { public func generateDidJwk( didJwkDescriptor: VCLDidJwkDescriptor = VCLDidJwkDescriptor(), - successHandler: @escaping @Sendable (VCLDidJwk) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLDidJwk) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { generateDidJwk( didJwkDescriptor: didJwkDescriptor, diff --git a/VCL/VCL/api/VCLCryptoServiceType.swift b/VCL/VCL/api/VCLCryptoServiceType.swift index b01f4a7..0e1328e 100644 --- a/VCL/VCL/api/VCLCryptoServiceType.swift +++ b/VCL/VCL/api/VCLCryptoServiceType.swift @@ -9,7 +9,7 @@ import Foundation -public enum VCLCryptoServiceType: String, Sendable { +public enum VCLCryptoServiceType: String { case Local = "local" case Remote = "remote" case Injected = "injected" diff --git a/VCL/VCL/api/VCLEnvironment.swift b/VCL/VCL/api/VCLEnvironment.swift index 1e945ee..b4a0cde 100644 --- a/VCL/VCL/api/VCLEnvironment.swift +++ b/VCL/VCL/api/VCLEnvironment.swift @@ -9,7 +9,7 @@ import Foundation -public enum VCLEnvironment: String, Sendable { +public enum VCLEnvironment: String { case Prod = "prod" case Staging = "staging" case Qa = "qa" diff --git a/VCL/VCL/api/VCLProvider.swift b/VCL/VCL/api/VCLProvider.swift index df9ab2a..b08df15 100644 --- a/VCL/VCL/api/VCLProvider.swift +++ b/VCL/VCL/api/VCLProvider.swift @@ -7,7 +7,7 @@ // Copyright 2022 Velocity Career Labs inc. // SPDX-License-Identifier: Apache-2.0 -public final class VCLProvider: Sendable { +public final class VCLProvider { private init(){} diff --git a/VCL/VCL/api/VCLSignatureAlgorithm.swift b/VCL/VCL/api/VCLSignatureAlgorithm.swift index 20a8387..2e2ef05 100644 --- a/VCL/VCL/api/VCLSignatureAlgorithm.swift +++ b/VCL/VCL/api/VCLSignatureAlgorithm.swift @@ -9,7 +9,7 @@ import Foundation -public enum VCLSignatureAlgorithm: String, Sendable { +public enum VCLSignatureAlgorithm: String { case ES256 = "P-256" case SECP256k1 = "secp256k1" diff --git a/VCL/VCL/api/VCLXVnfProtocolVersion.swift b/VCL/VCL/api/VCLXVnfProtocolVersion.swift index 1bef6d8..b914e74 100644 --- a/VCL/VCL/api/VCLXVnfProtocolVersion.swift +++ b/VCL/VCL/api/VCLXVnfProtocolVersion.swift @@ -9,7 +9,7 @@ import Foundation -public enum VCLXVnfProtocolVersion: String, Sendable { +public enum VCLXVnfProtocolVersion: String { case XVnfProtocolVersion1 = "1.0" case XVnfProtocolVersion2 = "2.0" diff --git a/VCL/VCL/api/entities/VCLClaims.swift b/VCL/VCL/api/entities/VCLClaims.swift index 479e9a9..f34f894 100644 --- a/VCL/VCL/api/entities/VCLClaims.swift +++ b/VCL/VCL/api/entities/VCLClaims.swift @@ -10,12 +10,12 @@ import Foundation import VCToken -public struct VCLClaims: Sendable, Claims, Decodable, Encodable { +public struct VCLClaims: Claims, Decodable, Encodable { - public let all: [String: Sendable] + public let all: [String: Any] public init(from decoder: Decoder) throws { - self.all = [String : Sendable]() + self.all = [String : Any]() // VCLLog.d("Dummy implementation") } @@ -23,7 +23,7 @@ public struct VCLClaims: Sendable, Claims, Decodable, Encodable { // VCLLog.d("Empty implementation") } - public init(all: [String : Sendable]) { + public init(all: [String : Any]) { self.all = all } diff --git a/VCL/VCL/api/entities/VCLCountries.swift b/VCL/VCL/api/entities/VCLCountries.swift index 05396a8..1ac3f5b 100644 --- a/VCL/VCL/api/entities/VCLCountries.swift +++ b/VCL/VCL/api/entities/VCLCountries.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLCountries: Sendable { +public struct VCLCountries { public let all: [VCLCountry]? public init(all: [VCLCountry]?) { diff --git a/VCL/VCL/api/entities/VCLCountry.swift b/VCL/VCL/api/entities/VCLCountry.swift index 3a8b584..0bf2829 100644 --- a/VCL/VCL/api/entities/VCLCountry.swift +++ b/VCL/VCL/api/entities/VCLCountry.swift @@ -9,13 +9,13 @@ import Foundation -public struct VCLCountry: Sendable, VCLPlace { - public let payload: [String: Sendable] +public struct VCLCountry: VCLPlace { + public let payload: [String: Any] public let code: String public let name: String public let regions: VCLRegions? - public init(payload: [String: Sendable], code: String, name: String, regions: VCLRegions?) { + public init(payload: [String: Any], code: String, name: String, regions: VCLRegions?) { self.payload = payload self.code = code self.name = name diff --git a/VCL/VCL/api/entities/VCLCredentialManifest.swift b/VCL/VCL/api/entities/VCLCredentialManifest.swift index 342ab57..6556113 100644 --- a/VCL/VCL/api/entities/VCLCredentialManifest.swift +++ b/VCL/VCL/api/entities/VCLCredentialManifest.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLCredentialManifest: Sendable { +public struct VCLCredentialManifest { public let jwt: VCLJwt public let vendorOriginContext: String? public let verifiedProfile: VCLVerifiedProfile @@ -37,24 +37,24 @@ public struct VCLCredentialManifest: Sendable { public var did: String { get { return iss } } public var issuerId: String { get { jwt.payload?[CodingKeys.KeyIssuer] as? String - ?? (jwt.payload?[CodingKeys.KeyIssuer] as? [String: Sendable])?[CodingKeys.KeyId] as? String + ?? (jwt.payload?[CodingKeys.KeyIssuer] as? [String: Any])?[CodingKeys.KeyId] as? String ?? "" } } public var aud: String { get { return retrieveAud() } } public var exchangeId: String { get { return jwt.payload?[CodingKeys.KeyExchangeId] as? String ?? "" } } - public var presentationDefinitionId: String { get { (jwt.payload?[CodingKeys.KeyPresentationDefinitionId] as? [String: Sendable])?[CodingKeys.KeyId] as? String ?? "" } } + public var presentationDefinitionId: String { get { (jwt.payload?[CodingKeys.KeyPresentationDefinitionId] as? [String: Any])?[CodingKeys.KeyId] as? String ?? "" } } public var finalizeOffersUri: String { get { - (jwt.payload?[VCLCredentialManifest.CodingKeys.KeyMetadata] as? [String: Sendable])?[VCLCredentialManifest.CodingKeys.KeyFinalizeOffersUri] as? String ?? "" } } + (jwt.payload?[VCLCredentialManifest.CodingKeys.KeyMetadata] as? [String: Any])?[VCLCredentialManifest.CodingKeys.KeyFinalizeOffersUri] as? String ?? "" } } public var checkOffersUri: String { get { - (jwt.payload?[VCLCredentialManifest.CodingKeys.KeyMetadata] as? [String: Sendable])?[VCLCredentialManifest.CodingKeys.KeyCheckOffersUri] as? String ?? "" } } + (jwt.payload?[VCLCredentialManifest.CodingKeys.KeyMetadata] as? [String: Any])?[VCLCredentialManifest.CodingKeys.KeyCheckOffersUri] as? String ?? "" } } public var submitPresentationUri: String { get { - (jwt.payload?[VCLCredentialManifest.CodingKeys.KeyMetadata] as? [String: Sendable])?[VCLCredentialManifest.CodingKeys.KeySubmitIdentificationUri] as? String ?? "" } } + (jwt.payload?[VCLCredentialManifest.CodingKeys.KeyMetadata] as? [String: Any])?[VCLCredentialManifest.CodingKeys.KeySubmitIdentificationUri] as? String ?? "" } } private func retrieveAud() -> String { - let url = ((jwt.payload?[CodingKeys.KeyMetadata] as? [String: Sendable])?[CodingKeys.KeyFinalizeOffersUri] as? String) ?? "" + let url = ((jwt.payload?[CodingKeys.KeyMetadata] as? [String: Any])?[CodingKeys.KeyFinalizeOffersUri] as? String) ?? "" if let range = url.range(of: "/issue/") { return String(url[.. [String: Sendable?] { + func generateRequestBody(proof: VCLJwt?) -> [String: Any?] { var retVal = self.payload if let proof = proof { retVal[CodingKeys.KeyProof] = [ diff --git a/VCL/VCL/api/entities/VCLGenerateOffersDescriptor.swift b/VCL/VCL/api/entities/VCLGenerateOffersDescriptor.swift index 43184d5..5906d18 100644 --- a/VCL/VCL/api/entities/VCLGenerateOffersDescriptor.swift +++ b/VCL/VCL/api/entities/VCLGenerateOffersDescriptor.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLGenerateOffersDescriptor: Sendable { +public struct VCLGenerateOffersDescriptor { public let credentialManifest: VCLCredentialManifest public let types: [String]? public let offerHashes: [String]? @@ -27,11 +27,11 @@ public struct VCLGenerateOffersDescriptor: Sendable { self.identificationVerifiableCredentials = identificationVerifiableCredentials } - public var payload: [String: Sendable?] { get { + public var payload: [String: Any?] { get { [ CodingKeys.KeyExchangeId: exchangeId, - CodingKeys.KeyTypes: types ?? [Sendable](), - CodingKeys.KeyOfferHashes: offerHashes ?? [Sendable]() + CodingKeys.KeyTypes: types ?? [Any](), + CodingKeys.KeyOfferHashes: offerHashes ?? [Any]() ] } } diff --git a/VCL/VCL/api/entities/VCLIssuingType.swift b/VCL/VCL/api/entities/VCLIssuingType.swift index 3f818ed..b9fd5b3 100644 --- a/VCL/VCL/api/entities/VCLIssuingType.swift +++ b/VCL/VCL/api/entities/VCLIssuingType.swift @@ -9,7 +9,7 @@ import Foundation -public enum VCLIssuingType: String, Sendable { +public enum VCLIssuingType: String { case Career = "Career" case Identity = "Identity" case Refresh = "Refresh" diff --git a/VCL/VCL/api/entities/VCLJwt.swift b/VCL/VCL/api/entities/VCLJwt.swift index 12fbc08..5e9d9bf 100644 --- a/VCL/VCL/api/entities/VCLJwt.swift +++ b/VCL/VCL/api/entities/VCLJwt.swift @@ -10,17 +10,17 @@ import Foundation @preconcurrency import VCToken -public struct VCLJwt: Sendable { - public private(set) var header: [String: Sendable]? = nil - public private(set) var payload: [String: Sendable]? = nil +public struct VCLJwt { + public private(set) var header: [String: Any]? = nil + public private(set) var payload: [String: Any]? = nil public private(set) var signature: String? = nil public private(set) var encodedJwt: String = "" public private(set) var jwsToken: JwsToken? = nil public init( - header: [String: Sendable]?, - payload: [String: Sendable]?, + header: [String: Any]?, + payload: [String: Any]?, signature: String?, encodedJwt: String ) { @@ -44,8 +44,8 @@ public struct VCLJwt: Sendable { } private mutating func initialize( - header: [String: Sendable]? = nil, - payload: [String: Sendable]? = nil, + header: [String: Any]? = nil, + payload: [String: Any]? = nil, signature: String? = nil, encodedJwt: String ) { @@ -81,7 +81,7 @@ public struct VCLJwt: Sendable { } var kid: String? { get { - return (header?[CodingKeys.KeyKid] as? String) ?? ((header?[CodingKeys.KeyJwk] as? [String: Sendable])?[CodingKeys.KeyKid]) as? String + return (header?[CodingKeys.KeyKid] as? String) ?? ((header?[CodingKeys.KeyJwk] as? [String: Any])?[CodingKeys.KeyKid]) as? String } } var iss: String? { get { return self.payload?[CodingKeys.KeyIss] as? String diff --git a/VCL/VCL/api/entities/VCLJwtDescriptor.swift b/VCL/VCL/api/entities/VCLJwtDescriptor.swift index 58781db..049dad3 100644 --- a/VCL/VCL/api/entities/VCLJwtDescriptor.swift +++ b/VCL/VCL/api/entities/VCLJwtDescriptor.swift @@ -9,9 +9,9 @@ import Foundation -public struct VCLJwtDescriptor: Sendable { +public struct VCLJwtDescriptor { /// Json formatted payload - public let payload: [String: Sendable]? + public let payload: [String: Any]? /// JWT ID public let jti: String /// The did of the wallet owner @@ -20,7 +20,7 @@ public struct VCLJwtDescriptor: Sendable { public let aud: String? public init( - payload: [String : Sendable]? = nil, + payload: [String : Any]? = nil, jti: String = UUID().uuidString, iss: String, aud: String? = nil diff --git a/VCL/VCL/api/entities/VCLJwtVerifiableCredentials.swift b/VCL/VCL/api/entities/VCLJwtVerifiableCredentials.swift index bd38776..cac08fb 100644 --- a/VCL/VCL/api/entities/VCLJwtVerifiableCredentials.swift +++ b/VCL/VCL/api/entities/VCLJwtVerifiableCredentials.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLJwtVerifiableCredentials: Sendable { +public struct VCLJwtVerifiableCredentials { public let passedCredentials: [VCLJwt] public let failedCredentials: [VCLJwt] diff --git a/VCL/VCL/api/entities/VCLOffer.swift b/VCL/VCL/api/entities/VCLOffer.swift index 8021a69..1d71354 100644 --- a/VCL/VCL/api/entities/VCLOffer.swift +++ b/VCL/VCL/api/entities/VCLOffer.swift @@ -9,14 +9,14 @@ import Foundation -public struct VCLOffer: Sendable { - public let payload: [String: Sendable] +public struct VCLOffer { + public let payload: [String: Any] - public init(payload: [String : Sendable]) { + public init(payload: [String : Any]) { self.payload = payload } - public var issuerId: String { get { (payload[CodingKeys.KeyIssuer] as? [String: Sendable])?[CodingKeys.KeyId] as? String + public var issuerId: String { get { (payload[CodingKeys.KeyIssuer] as? [String: Any])?[CodingKeys.KeyId] as? String ?? payload[CodingKeys.KeyIssuer] as? String ?? "" }} diff --git a/VCL/VCL/api/entities/VCLOffers.swift b/VCL/VCL/api/entities/VCLOffers.swift index 2308763..1e71ba7 100644 --- a/VCL/VCL/api/entities/VCLOffers.swift +++ b/VCL/VCL/api/entities/VCLOffers.swift @@ -9,15 +9,15 @@ import Foundation -public struct VCLOffers: Sendable { - public let payload: [String: Sendable] +public struct VCLOffers { + public let payload: [String: Any] public let all: [VCLOffer] public let responseCode: Int public let sessionToken: VCLToken public let challenge: String? public init( - payload: [String: Sendable], + payload: [String: Any], all: [VCLOffer], responseCode: Int, sessionToken: VCLToken, @@ -39,7 +39,7 @@ public struct VCLOffers: Sendable { // VCLXVnfProtocolVersion.XVnfProtocolVersion2 return VCLOffers( payload: offersDictionary, - all: offersFromJsonArray(offersDictionary[VCLOffers.CodingKeys.KeyOffers] as? [[String : Sendable]] ?? []), + all: offersFromJsonArray(offersDictionary[VCLOffers.CodingKeys.KeyOffers] as? [[String: Any]] ?? []), responseCode: responseCode, sessionToken: sessionToken, challenge: offersDictionary[VCLOffers.CodingKeys.KeyChallenge] as? String @@ -64,7 +64,7 @@ public struct VCLOffers: Sendable { } } - static func offersFromJsonArray(_ offersJsonArray: [[String: Sendable]]) -> [VCLOffer] { + static func offersFromJsonArray(_ offersJsonArray: [[String: Any]]) -> [VCLOffer] { var allOffers = [VCLOffer]() for i in 0.. [VCLService] { var retVal = [VCLService]() - if let serviceJsonArr = payload[CodingKeys.KeyService] as? [[String: Sendable]] { + if let serviceJsonArr = payload[CodingKeys.KeyService] as? [[String: Any]] { for i in 0..: Sendable { +public enum VCLResult { case success(Value) case failure(VCLError) } diff --git a/VCL/VCL/api/entities/VCLService.swift b/VCL/VCL/api/entities/VCLService.swift index 8a67b29..d0dbc94 100644 --- a/VCL/VCL/api/entities/VCLService.swift +++ b/VCL/VCL/api/entities/VCLService.swift @@ -9,13 +9,13 @@ import Foundation -public struct VCLService: Sendable { - public let payload: [String: Sendable] +public struct VCLService { + public let payload: [String: Any] public var id: String { retrieveId() } public var type: String { retrieveType() } public var serviceEndpoint: String { retrieveServiceEndpoint() } - public init(payload: [String: Sendable]) { + public init(payload: [String: Any]) { self.payload = payload } diff --git a/VCL/VCL/api/entities/VCLServiceType.swift b/VCL/VCL/api/entities/VCLServiceType.swift index f35362b..ac4e8da 100644 --- a/VCL/VCL/api/entities/VCLServiceType.swift +++ b/VCL/VCL/api/entities/VCLServiceType.swift @@ -9,7 +9,7 @@ import Foundation -public enum VCLServiceType: String, Sendable { +public enum VCLServiceType: String { case Inspector = "Inspector" case Issuer = "Issuer" case NotaryIssuer = "NotaryIssuer" diff --git a/VCL/VCL/api/entities/VCLServiceTypes.swift b/VCL/VCL/api/entities/VCLServiceTypes.swift index adeac72..e67b769 100644 --- a/VCL/VCL/api/entities/VCLServiceTypes.swift +++ b/VCL/VCL/api/entities/VCLServiceTypes.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLServiceTypes: Sendable { +public struct VCLServiceTypes { public let all: [VCLServiceType] diff --git a/VCL/VCL/api/entities/VCLSubmission.swift b/VCL/VCL/api/entities/VCLSubmission.swift index 86acbd8..2a0324d 100644 --- a/VCL/VCL/api/entities/VCLSubmission.swift +++ b/VCL/VCL/api/entities/VCLSubmission.swift @@ -10,14 +10,14 @@ import Foundation protocol PayloadGeneratable { - func generatePayload(iss: String?) -> [String: Sendable] + func generatePayload(iss: String?) -> [String: Any] } protocol RequestBodyGeneratable { - func generateRequestBody(jwt: VCLJwt) -> [String: Sendable] + func generateRequestBody(jwt: VCLJwt) -> [String: Any] } -public protocol VCLSubmission: Sendable { +public protocol VCLSubmission { var submitUri: String { get } var exchangeId: String { get } var presentationDefinitionId: String { get } @@ -31,13 +31,13 @@ public protocol VCLSubmission: Sendable { } extension VCLSubmission { - func generatePayload(iss: String?) -> [String: Sendable] { - var retVal = [String: Sendable]() + func generatePayload(iss: String?) -> [String: Any] { + var retVal = [String: Any]() retVal[SubmissionCodingKeys.KeyJti] = self.jti retVal[SubmissionCodingKeys.KeyIss] = iss - var vp = [String: Sendable]() + var vp = [String: Any]() vp[SubmissionCodingKeys.KeyType] = SubmissionCodingKeys.ValueVerifiablePresentation - var presentationSubmissionDict = [String: Sendable]() + var presentationSubmissionDict = [String: Any]() presentationSubmissionDict[SubmissionCodingKeys.KeyId] = self.submissionId presentationSubmissionDict[SubmissionCodingKeys.KeyDefinitionId] = presentationDefinitionId var descriptorMap = [[String: String]]() @@ -58,8 +58,8 @@ extension VCLSubmission { return retVal } - func generateRequestBody(jwt: VCLJwt) -> [String: Sendable] { - var retVal = [String: Sendable]() + func generateRequestBody(jwt: VCLJwt) -> [String: Any] { + var retVal = [String: Any]() retVal[SubmissionCodingKeys.KeyExchangeId] = exchangeId retVal[SubmissionCodingKeys.KeyJwtVp] = jwt.encodedJwt retVal[SubmissionCodingKeys.KeyPushDelegate] = pushDelegate?.toDictionary() diff --git a/VCL/VCL/api/entities/VCLSubmissionResult.swift b/VCL/VCL/api/entities/VCLSubmissionResult.swift index 052349d..c7655b2 100644 --- a/VCL/VCL/api/entities/VCLSubmissionResult.swift +++ b/VCL/VCL/api/entities/VCLSubmissionResult.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLSubmissionResult: Sendable { +public struct VCLSubmissionResult { public let sessionToken: VCLToken public let exchange: VCLExchange diff --git a/VCL/VCL/api/entities/VCLToken.swift b/VCL/VCL/api/entities/VCLToken.swift index 11a29e3..8695081 100644 --- a/VCL/VCL/api/entities/VCLToken.swift +++ b/VCL/VCL/api/entities/VCLToken.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLToken: Sendable { +public struct VCLToken { /// token value represented as jwt string public let value: String /// token value represented as VCLJwt object diff --git a/VCL/VCL/api/entities/VCLVerifiableCredential.swift b/VCL/VCL/api/entities/VCLVerifiableCredential.swift index a2978dd..df1f066 100644 --- a/VCL/VCL/api/entities/VCLVerifiableCredential.swift +++ b/VCL/VCL/api/entities/VCLVerifiableCredential.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLVerifiableCredential: Sendable { +public struct VCLVerifiableCredential { public let inputDescriptor: String public let jwtVc: String diff --git a/VCL/VCL/api/entities/VCLVerifiedProfile.swift b/VCL/VCL/api/entities/VCLVerifiedProfile.swift index 97951e5..ab9beac 100644 --- a/VCL/VCL/api/entities/VCLVerifiedProfile.swift +++ b/VCL/VCL/api/entities/VCLVerifiedProfile.swift @@ -9,15 +9,15 @@ import Foundation -public struct VCLVerifiedProfile: Sendable { +public struct VCLVerifiedProfile { - public let payload: [String: Sendable] + public let payload: [String: Any] - public init(payload: [String: Sendable]) { + public init(payload: [String: Any]) { self.payload = payload } - public var credentialSubject: [String: Sendable]? { get { payload[CodingKeys.KeyCredentialSubject] as? [String : Sendable] } } + public var credentialSubject: [String: Any]? { get { payload[CodingKeys.KeyCredentialSubject] as? [String : Any] } } public var name: String? { get { credentialSubject?[CodingKeys.KeyName] as? String } } public var logo: String? { get { credentialSubject?[CodingKeys.KeyLogo] as? String } } diff --git a/VCL/VCL/api/entities/VCLVerifiedProfileDescriptor.swift b/VCL/VCL/api/entities/VCLVerifiedProfileDescriptor.swift index ccab390..b69a128 100644 --- a/VCL/VCL/api/entities/VCLVerifiedProfileDescriptor.swift +++ b/VCL/VCL/api/entities/VCLVerifiedProfileDescriptor.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLVerifiedProfileDescriptor: Sendable { +public struct VCLVerifiedProfileDescriptor { public let did: String diff --git a/VCL/VCL/api/entities/error/VCLError.swift b/VCL/VCL/api/entities/error/VCLError.swift index 305ef03..65ae388 100644 --- a/VCL/VCL/api/entities/error/VCLError.swift +++ b/VCL/VCL/api/entities/error/VCLError.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLError: Sendable, Error { +public struct VCLError: Error { public let payload: String? public let error: String? public let errorCode: String @@ -68,7 +68,7 @@ public struct VCLError: Sendable, Error { } } - public func toDictionary() -> [String: Sendable?] { + public func toDictionary() -> [String: Any?] { return [ CodingKeys.KeyPayload: payload, CodingKeys.KeyError: error, diff --git a/VCL/VCL/api/entities/initialization/VCLCryptoServicesDescriptor.swift b/VCL/VCL/api/entities/initialization/VCLCryptoServicesDescriptor.swift index 8175111..7ee726a 100644 --- a/VCL/VCL/api/entities/initialization/VCLCryptoServicesDescriptor.swift +++ b/VCL/VCL/api/entities/initialization/VCLCryptoServicesDescriptor.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLCryptoServicesDescriptor: Sendable { +public struct VCLCryptoServicesDescriptor { public let cryptoServiceType: VCLCryptoServiceType public let injectedCryptoServicesDescriptor: VCLInjectedCryptoServicesDescriptor? public let remoteCryptoServicesUrlsDescriptor: VCLRemoteCryptoServicesUrlsDescriptor? diff --git a/VCL/VCL/api/entities/initialization/VCLInitializationDescriptor.swift b/VCL/VCL/api/entities/initialization/VCLInitializationDescriptor.swift index 05ae81e..454ac25 100644 --- a/VCL/VCL/api/entities/initialization/VCLInitializationDescriptor.swift +++ b/VCL/VCL/api/entities/initialization/VCLInitializationDescriptor.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLInitializationDescriptor: Sendable { +public struct VCLInitializationDescriptor { public let environment: VCLEnvironment public let xVnfProtocolVersion: VCLXVnfProtocolVersion public let cacheSequence: Int diff --git a/VCL/VCL/api/entities/initialization/VCLInjectedCryptoServicesDescriptor.swift b/VCL/VCL/api/entities/initialization/VCLInjectedCryptoServicesDescriptor.swift index 000e391..60082ba 100644 --- a/VCL/VCL/api/entities/initialization/VCLInjectedCryptoServicesDescriptor.swift +++ b/VCL/VCL/api/entities/initialization/VCLInjectedCryptoServicesDescriptor.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLInjectedCryptoServicesDescriptor: Sendable { +public struct VCLInjectedCryptoServicesDescriptor { public let keyService: VCLKeyService public let jwtSignService: VCLJwtSignService public let jwtVerifyService: VCLJwtVerifyService? diff --git a/VCL/VCL/api/entities/initialization/VCLJwtServiceUrls.swift b/VCL/VCL/api/entities/initialization/VCLJwtServiceUrls.swift index 6818773..b932a2d 100644 --- a/VCL/VCL/api/entities/initialization/VCLJwtServiceUrls.swift +++ b/VCL/VCL/api/entities/initialization/VCLJwtServiceUrls.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLJwtServiceUrls: Sendable { +public struct VCLJwtServiceUrls { public let jwtSignServiceUrl: String public let jwtVerifyServiceUrl: String? diff --git a/VCL/VCL/api/entities/initialization/VCLKeyServiceUrls.swift b/VCL/VCL/api/entities/initialization/VCLKeyServiceUrls.swift index fd51b07..9272cdf 100644 --- a/VCL/VCL/api/entities/initialization/VCLKeyServiceUrls.swift +++ b/VCL/VCL/api/entities/initialization/VCLKeyServiceUrls.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLKeyServiceUrls: Sendable { +public struct VCLKeyServiceUrls { public let createDidKeyServiceUrl: String public init(createDidKeyServiceUrl: String) { diff --git a/VCL/VCL/api/entities/initialization/VCLRemoteCryptoServicesUrlsDescriptor.swift b/VCL/VCL/api/entities/initialization/VCLRemoteCryptoServicesUrlsDescriptor.swift index 0d381f9..52d653e 100644 --- a/VCL/VCL/api/entities/initialization/VCLRemoteCryptoServicesUrlsDescriptor.swift +++ b/VCL/VCL/api/entities/initialization/VCLRemoteCryptoServicesUrlsDescriptor.swift @@ -9,7 +9,7 @@ import Foundation -public struct VCLRemoteCryptoServicesUrlsDescriptor: Sendable { +public struct VCLRemoteCryptoServicesUrlsDescriptor { public let keyServiceUrls: VCLKeyServiceUrls public let jwtServiceUrls: VCLJwtServiceUrls diff --git a/VCL/VCL/api/jwt/VCLJwtSignService.swift b/VCL/VCL/api/jwt/VCLJwtSignService.swift index 5822507..83b78d8 100644 --- a/VCL/VCL/api/jwt/VCLJwtSignService.swift +++ b/VCL/VCL/api/jwt/VCLJwtSignService.swift @@ -9,13 +9,13 @@ import Foundation -public protocol VCLJwtSignService: Sendable { +public protocol VCLJwtSignService { func sign( jwtDescriptor: VCLJwtDescriptor, nonce: String?, didJwk: VCLDidJwk, remoteCryptoServicesToken: VCLToken?, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } @@ -25,7 +25,7 @@ extension VCLJwtSignService { nonce: String? = nil, didJwk: VCLDidJwk, remoteCryptoServicesToken: VCLToken? = nil, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { sign( jwtDescriptor: jwtDescriptor, diff --git a/VCL/VCL/api/jwt/VCLJwtVerifyService.swift b/VCL/VCL/api/jwt/VCLJwtVerifyService.swift index d2978a9..b633cd1 100644 --- a/VCL/VCL/api/jwt/VCLJwtVerifyService.swift +++ b/VCL/VCL/api/jwt/VCLJwtVerifyService.swift @@ -9,11 +9,11 @@ import Foundation -public protocol VCLJwtVerifyService: Sendable { +public protocol VCLJwtVerifyService { func verify( jwt: VCLJwt, publicJwk: VCLPublicJwk, remoteCryptoServicesToken: VCLToken?, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/api/keys/VCLKeyService.swift b/VCL/VCL/api/keys/VCLKeyService.swift index 6802fac..2802367 100644 --- a/VCL/VCL/api/keys/VCLKeyService.swift +++ b/VCL/VCL/api/keys/VCLKeyService.swift @@ -11,10 +11,10 @@ import Foundation @preconcurrency import VCToken @preconcurrency import VCCrypto -public protocol VCLKeyService: Sendable { +public protocol VCLKeyService { func generateDidJwk( didJwkDescriptor: VCLDidJwkDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/VCLImpl.swift b/VCL/VCL/impl/VCLImpl.swift index 2b395b1..69a77a5 100644 --- a/VCL/VCL/impl/VCLImpl.swift +++ b/VCL/VCL/impl/VCLImpl.swift @@ -7,7 +7,7 @@ // Copyright 2022 Velocity Career Labs inc. // SPDX-License-Identifier: Apache-2.0 -public final class VCLImpl: @unchecked Sendable, VCL { +public final class VCLImpl: VCL { private static let ModelsToInitializeAmount = 3 @@ -35,8 +35,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { public func initialize( initializationDescriptor: VCLInitializationDescriptor, - successHandler: @escaping @Sendable () -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping () -> Void, + errorHandler: @escaping (VCLError) -> Void ) { self.initializationDescriptor = initializationDescriptor @@ -86,8 +86,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { } private func completionHandler( - _ successHandler: @escaping @Sendable () -> Void, - _ errorHandler: @escaping @Sendable (VCLError) -> Void + _ successHandler: @escaping () -> Void, + _ errorHandler: @escaping (VCLError) -> Void ) { if let error = self.initializationWatcher.firstError() { errorHandler(error) @@ -108,8 +108,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { private func cacheRemoteData( cacheSequence: Int, - successHandler: @escaping @Sendable () -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping () -> Void, + errorHandler: @escaping (VCLError) -> Void ) { credentialTypesModel = VclBlocksProvider.provideCredentialTypesModel() @@ -176,8 +176,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { public func getPresentationRequest( presentationRequestDescriptor: VCLPresentationRequestDescriptor, - successHandler: @escaping @Sendable (VCLPresentationRequest) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLPresentationRequest) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { if let did = presentationRequestDescriptor.did { profileServiceTypeVerifier?.verifyServiceTypeOfVerifiedProfile( @@ -211,8 +211,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { public func submitPresentation( presentationSubmission: VCLPresentationSubmission, - successHandler: @escaping @Sendable (VCLSubmissionResult) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLSubmissionResult) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { presentationSubmissionUseCase.submit( submission: presentationSubmission @@ -229,8 +229,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { public func getExchangeProgress( exchangeDescriptor: VCLExchangeDescriptor, - successHandler: @escaping @Sendable (VCLExchange) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLExchange) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { exchangeProgressUseCase.getExchangeProgress( exchangeDescriptor: exchangeDescriptor @@ -247,8 +247,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { public func searchForOrganizations( organizationsSearchDescriptor: VCLOrganizationsSearchDescriptor, - successHandler: @escaping @Sendable (VCLOrganizations) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLOrganizations) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { organizationsUseCase.searchForOrganizations(organizationsSearchDescriptor: organizationsSearchDescriptor) { [weak self] organizationsResult in @@ -263,8 +263,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { public func getCredentialManifest( credentialManifestDescriptor: VCLCredentialManifestDescriptor, - successHandler: @escaping @Sendable (VCLCredentialManifest) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLCredentialManifest) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { VCLLog.d("credentialManifestDescriptor: \(credentialManifestDescriptor.toPropsString())") if let did = credentialManifestDescriptor.did { @@ -299,8 +299,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { public func generateOffers( generateOffersDescriptor: VCLGenerateOffersDescriptor, - successHandler: @escaping @Sendable (VCLOffers) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLOffers) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { let identificationSubmission = VCLIdentificationSubmission( credentialManifest: generateOffersDescriptor.credentialManifest, @@ -336,8 +336,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { public func checkForOffers( generateOffersDescriptor: VCLGenerateOffersDescriptor, sessionToken: VCLToken, - successHandler: @escaping @Sendable (VCLOffers) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLOffers) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { invokeGenerateOffersUseCase( generateOffersDescriptor: generateOffersDescriptor, @@ -350,8 +350,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { private func invokeGenerateOffersUseCase( generateOffersDescriptor: VCLGenerateOffersDescriptor, sessionToken: VCLToken, - successHandler: @escaping @Sendable (VCLOffers) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLOffers) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { generateOffersUseCase.generateOffers( generateOffersDescriptor: generateOffersDescriptor, @@ -370,8 +370,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { public func finalizeOffers( finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, sessionToken: VCLToken, - successHandler: @escaping @Sendable (VCLJwtVerifiableCredentials) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLJwtVerifiableCredentials) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { finalizeOffersUseCase.finalizeOffers( finalizeOffersDescriptor: finalizeOffersDescriptor, @@ -389,8 +389,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { public func getCredentialTypesUIFormSchema( credentialTypesUIFormSchemaDescriptor: VCLCredentialTypesUIFormSchemaDescriptor, - successHandler: @escaping @Sendable (VCLCredentialTypesUIFormSchema) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLCredentialTypesUIFormSchema) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { if let countries = countriesModel.data { credentialTypesUIFormSchemaUseCase.getCredentialTypesUIFormSchema( @@ -413,8 +413,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { public func getVerifiedProfile( verifiedProfileDescriptor: VCLVerifiedProfileDescriptor, - successHandler: @escaping @Sendable (VCLVerifiedProfile) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLVerifiedProfile) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { verifiedProfileUseCase.getVerifiedProfile(verifiedProfileDescriptor: verifiedProfileDescriptor) { [weak self] verifiedProfileResult in @@ -431,8 +431,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { jwt: VCLJwt, publicJwk: VCLPublicJwk, remoteCryptoServicesToken: VCLToken? = nil, - successHandler: @escaping @Sendable (Bool) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (Bool) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { jwtServiceUseCase.verifyJwt( jwt: jwt, @@ -453,8 +453,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { jwtDescriptor: VCLJwtDescriptor, didJwk: VCLDidJwk, remoteCryptoServicesToken: VCLToken? = nil, - successHandler: @escaping @Sendable (VCLJwt) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLJwt) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { jwtServiceUseCase.generateSignedJwt( jwtDescriptor: jwtDescriptor, @@ -473,8 +473,8 @@ public final class VCLImpl: @unchecked Sendable, VCL { public func generateDidJwk( didJwkDescriptor: VCLDidJwkDescriptor = VCLDidJwkDescriptor(), - successHandler: @escaping @Sendable (VCLDidJwk) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLDidJwk) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { keyServiceUseCase.generateDidJwk( didJwkDescriptor: didJwkDescriptor diff --git a/VCL/VCL/impl/data/infrastructure/db/CacheServiceImpl.swift b/VCL/VCL/impl/data/infrastructure/db/CacheServiceImpl.swift index 39b8d95..466c47d 100644 --- a/VCL/VCL/impl/data/infrastructure/db/CacheServiceImpl.swift +++ b/VCL/VCL/impl/data/infrastructure/db/CacheServiceImpl.swift @@ -9,7 +9,7 @@ import Foundation -final class CacheServiceImpl: @unchecked Sendable, CacheService { +final class CacheServiceImpl: CacheService { private static let KEY_CACHE_SEQUENCE_COUNTRIES = "KEY_CACHE_SEQUENCE_COUNTRIES" private static let KEY_CACHE_SEQUENCE_CREDENTIAL_TYPES = "KEY_CACHE_SEQUENCE_CREDENTIAL_TYPES" diff --git a/VCL/VCL/impl/data/infrastructure/executors/DsptchQueueImpl.swift b/VCL/VCL/impl/data/infrastructure/executors/DsptchQueueImpl.swift index 7ef2c4f..ffbf9ac 100644 --- a/VCL/VCL/impl/data/infrastructure/executors/DsptchQueueImpl.swift +++ b/VCL/VCL/impl/data/infrastructure/executors/DsptchQueueImpl.swift @@ -21,13 +21,13 @@ class DsptchQueueImpl: DsptchQueue { attributes: .concurrent) } - func async(flags: DispatchWorkItemFlags, _ block: @escaping @Sendable () -> Void) { + func async(flags: DispatchWorkItemFlags, _ block: @escaping () -> Void) { self.dispatchQueue.async(flags: flags) { block() } } - func sync(_ block: @escaping @Sendable () -> T) -> T { + func sync(_ block: @escaping () -> T) -> T { return self.dispatchQueue.sync { return block() } diff --git a/VCL/VCL/impl/data/infrastructure/executors/ExecutorImpl.swift b/VCL/VCL/impl/data/infrastructure/executors/ExecutorImpl.swift index 2b9de8e..e338f30 100644 --- a/VCL/VCL/impl/data/infrastructure/executors/ExecutorImpl.swift +++ b/VCL/VCL/impl/data/infrastructure/executors/ExecutorImpl.swift @@ -17,13 +17,13 @@ final class ExecutorImpl: Executor { // Private init to prevent external instantiation private init() {} - func runOnMain(_ block: @escaping @Sendable () -> Void) { + func runOnMain(_ block: @escaping () -> Void) { DispatchQueue.main.async { block() } } - func runOnBackground(_ block: @escaping @Sendable () -> Void) { + func runOnBackground(_ block: @escaping () -> Void) { DispatchQueue.global().async { block() } diff --git a/VCL/VCL/impl/data/infrastructure/network/NetworkServiceImpl.swift b/VCL/VCL/impl/data/infrastructure/network/NetworkServiceImpl.swift index a19c658..8e0e9e0 100644 --- a/VCL/VCL/impl/data/infrastructure/network/NetworkServiceImpl.swift +++ b/VCL/VCL/impl/data/infrastructure/network/NetworkServiceImpl.swift @@ -18,7 +18,7 @@ final class NetworkServiceImpl: NetworkService { method: Request.HttpMethod, headers: Array<(String, String)>? = nil, cachePolicy: NSURLRequest.CachePolicy, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { sendRequest( request: Request.Builder() @@ -33,7 +33,7 @@ final class NetworkServiceImpl: NetworkService { ) } - private func sendRequest(request: Request,completionBlock: @escaping @Sendable (VCLResult) -> Void) { + private func sendRequest(request: Request,completionBlock: @escaping (VCLResult) -> Void) { logRequest(request) guard let urlRequest = createUrlRequest(request: request) else { completionBlock(.failure(VCLError(message: "Request error: \(request.stringify())"))) diff --git a/VCL/VCL/impl/data/models/CountriesModelImpl.swift b/VCL/VCL/impl/data/models/CountriesModelImpl.swift index c90b937..5854499 100644 --- a/VCL/VCL/impl/data/models/CountriesModelImpl.swift +++ b/VCL/VCL/impl/data/models/CountriesModelImpl.swift @@ -9,7 +9,7 @@ import Foundation -final class CountriesModelImpl: @unchecked Sendable, CountriesModel { +final class CountriesModelImpl: CountriesModel { private(set) var data: VCLCountries? = nil let countriesUseCase: CountriesUseCase @@ -20,7 +20,7 @@ final class CountriesModelImpl: @unchecked Sendable, CountriesModel { func initialize( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { countriesUseCase.getCountries(cacheSequence: cacheSequence) { [weak self] result in do { diff --git a/VCL/VCL/impl/data/models/CredentialTypeSchemasModelImpl.swift b/VCL/VCL/impl/data/models/CredentialTypeSchemasModelImpl.swift index ade91ad..2751094 100644 --- a/VCL/VCL/impl/data/models/CredentialTypeSchemasModelImpl.swift +++ b/VCL/VCL/impl/data/models/CredentialTypeSchemasModelImpl.swift @@ -7,7 +7,7 @@ // Copyright 2022 Velocity Career Labs inc. // SPDX-License-Identifier: Apache-2.0 -class CredentialTypeSchemasModelImpl: @unchecked Sendable, CredentialTypeSchemasModel { +class CredentialTypeSchemasModelImpl: CredentialTypeSchemasModel { private(set) var data: VCLCredentialTypeSchemas? let credentialTypeSchemasUseCase: CredentialTypeSchemasUseCase @@ -18,7 +18,7 @@ class CredentialTypeSchemasModelImpl: @unchecked Sendable, CredentialTypeSchemas func initialize( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { credentialTypeSchemasUseCase.getCredentialTypeSchemas(cacheSequence: cacheSequence) { [weak self] result in do { diff --git a/VCL/VCL/impl/data/models/CredentialTypesModelImpl.swift b/VCL/VCL/impl/data/models/CredentialTypesModelImpl.swift index 7367a27..7dcc169 100644 --- a/VCL/VCL/impl/data/models/CredentialTypesModelImpl.swift +++ b/VCL/VCL/impl/data/models/CredentialTypesModelImpl.swift @@ -7,7 +7,7 @@ // Copyright 2022 Velocity Career Labs inc. // SPDX-License-Identifier: Apache-2.0 -class CredentialTypesModelImpl: @unchecked Sendable, CredentialTypesModel { +class CredentialTypesModelImpl: CredentialTypesModel { private(set) var data: VCLCredentialTypes? = nil let credentialTypesUseCase: CredentialTypesUseCase @@ -18,7 +18,7 @@ class CredentialTypesModelImpl: @unchecked Sendable, CredentialTypesModel { func initialize( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { credentialTypesUseCase.getCredentialTypes(cacheSequence: cacheSequence) { [weak self] response in do { diff --git a/VCL/VCL/impl/data/repositories/CountriesRepositoryImpl.swift b/VCL/VCL/impl/data/repositories/CountriesRepositoryImpl.swift index 32adce4..2fa04b7 100644 --- a/VCL/VCL/impl/data/repositories/CountriesRepositoryImpl.swift +++ b/VCL/VCL/impl/data/repositories/CountriesRepositoryImpl.swift @@ -21,7 +21,7 @@ final class CountriesRepositoryImpl: CountriesRepository { func getCountries( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { let endpoint = Urls.Countries if (cacheService.isResetCacheCountries(cacheSequence: cacheSequence)) { @@ -29,7 +29,7 @@ final class CountriesRepositoryImpl: CountriesRepository { } else { if let countries = cacheService.getCountries(key: endpoint) { if let countriesList = countries.toList() { - completionBlock(.success(self.listToCountries(countriesList as? [[String: Sendable]]))) + completionBlock(.success(self.listToCountries(countriesList as? [[String: Any]]))) } else { completionBlock(.failure(VCLError(message: "Failed to parse \(countries)"))) } @@ -42,7 +42,7 @@ final class CountriesRepositoryImpl: CountriesRepository { private func fetchCountries( endpoint: String, cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { networkService.sendRequest( endpoint: endpoint, @@ -55,7 +55,7 @@ final class CountriesRepositoryImpl: CountriesRepository { do { let payload = try res.get().payload self?.cacheService.setCountries(key: endpoint, value: payload, cacheSequence: cacheSequence) - if let countriesList = payload.toList() as? [[String: Sendable]], let self = self { + if let countriesList = payload.toList() as? [[String: Any]], let self = self { completionBlock(.success(self.listToCountries(countriesList))) } else { completionBlock(.failure(VCLError(message: "Failed to parse \(String(data: payload, encoding: .utf8) ?? "")"))) @@ -66,7 +66,7 @@ final class CountriesRepositoryImpl: CountriesRepository { } } - private func listToCountries(_ countriesDictArr: [[String: Sendable]]?) -> VCLCountries { + private func listToCountries(_ countriesDictArr: [[String: Any]]?) -> VCLCountries { var countries = [VCLCountry]() countriesDictArr?.forEach{ countries.append(parseCountry($0)) @@ -74,10 +74,10 @@ final class CountriesRepositoryImpl: CountriesRepository { return VCLCountries(all: countries) } - private func parseCountry(_ countryDict: [String: Sendable]) -> VCLCountry { + private func parseCountry(_ countryDict: [String: Any]) -> VCLCountry { var regions: VCLRegions? = nil - if let dictArrRegions = countryDict[VCLCountry.Codes.KeyRegions] as? [[String: Sendable]] { + if let dictArrRegions = countryDict[VCLCountry.Codes.KeyRegions] as? [[String: Any]] { var regionsList = [VCLRegion]() dictArrRegions.forEach { regionDict in regionsList.append(VCLRegion( diff --git a/VCL/VCL/impl/data/repositories/CredentialManifestRepositoryImpl.swift b/VCL/VCL/impl/data/repositories/CredentialManifestRepositoryImpl.swift index 35142d0..4c91a0d 100644 --- a/VCL/VCL/impl/data/repositories/CredentialManifestRepositoryImpl.swift +++ b/VCL/VCL/impl/data/repositories/CredentialManifestRepositoryImpl.swift @@ -18,7 +18,7 @@ final class CredentialManifestRepositoryImpl: CredentialManifestRepository { func getCredentialManifest( credentialManifestDescriptor: VCLCredentialManifestDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { if let endpoint = credentialManifestDescriptor.endpoint { networkService.sendRequest( diff --git a/VCL/VCL/impl/data/repositories/CredentialTypeSchemaRepositoryImpl.swift b/VCL/VCL/impl/data/repositories/CredentialTypeSchemaRepositoryImpl.swift index b2ce0a8..f265a48 100644 --- a/VCL/VCL/impl/data/repositories/CredentialTypeSchemaRepositoryImpl.swift +++ b/VCL/VCL/impl/data/repositories/CredentialTypeSchemaRepositoryImpl.swift @@ -22,7 +22,7 @@ final class CredentialTypeSchemaRepositoryImpl: CredentialTypeSchemaRepository { func getCredentialTypeSchema( schemaName: String, cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { let endpoint = Urls.CredentialTypeSchemas + schemaName if(cacheService.isResetCacheCredentialTypeSchema(cacheSequence: cacheSequence)) { @@ -43,7 +43,7 @@ final class CredentialTypeSchemaRepositoryImpl: CredentialTypeSchemaRepository { private func fetchCredentialTypeSchema( endpoint: String, cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { networkService.sendRequest( endpoint: endpoint, diff --git a/VCL/VCL/impl/data/repositories/CredentialTypesRepositoryImpl.swift b/VCL/VCL/impl/data/repositories/CredentialTypesRepositoryImpl.swift index 48d0e2c..535607b 100644 --- a/VCL/VCL/impl/data/repositories/CredentialTypesRepositoryImpl.swift +++ b/VCL/VCL/impl/data/repositories/CredentialTypesRepositoryImpl.swift @@ -21,14 +21,14 @@ final class CredentialTypesRepositoryImpl: CredentialTypesRepository { func getCredentialTypes( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { let endpoint = Urls.CredentialTypes if(cacheService.isResetCacheCredentialTypes(cacheSequence: cacheSequence)) { fetchCredentialTypes(endpoint: endpoint, cacheSequence: cacheSequence, completionBlock: completionBlock) } else { if let credentialTypes = cacheService.getCredentialTypes(key: endpoint) { - if let credentialTypesList = credentialTypes.toList() as? [[String: Sendable]?] { + if let credentialTypesList = credentialTypes.toList() as? [[String: Any]?] { completionBlock(.success(self.parse(credentialTypesList))) } else { completionBlock(.failure(VCLError(message: "Failed to parse VCLCredentialTypes)"))) @@ -42,7 +42,7 @@ final class CredentialTypesRepositoryImpl: CredentialTypesRepository { private func fetchCredentialTypes( endpoint: String, cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { networkService.sendRequest( endpoint: endpoint, @@ -55,7 +55,7 @@ final class CredentialTypesRepositoryImpl: CredentialTypesRepository { do { let payload = try res.get().payload self?.cacheService.setCredentialTypes(key: endpoint, value: payload, cacheSequence: cacheSequence) - if let credentialTypesList = payload.toList() as? [[String: Sendable]?], let self = self { + if let credentialTypesList = payload.toList() as? [[String: Any]?], let self = self { completionBlock(.success(self.parse(credentialTypesList))) } else { completionBlock(.failure(VCLError(message: "Failed to parse VCLCredentialTypes)"))) @@ -66,7 +66,7 @@ final class CredentialTypesRepositoryImpl: CredentialTypesRepository { } } - private func parse(_ credentialTypesList: [[String: Sendable]?]) -> VCLCredentialTypes { + private func parse(_ credentialTypesList: [[String: Any]?]) -> VCLCredentialTypes { var credentialTypesArr = [VCLCredentialType]() for i in 0..) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { networkService.sendRequest( endpoint: Urls.CredentialTypesFormSchema.replacingOccurrences(of: Params.CredentialType, with: credentialTypesUIFormSchemaDescriptor.credentialType), @@ -54,11 +54,11 @@ final class CredentialTypesUIFormSchemaRepositoryImpl: CredentialTypesUIFormSche _ credentialTypesUIFormSchemaDescriptor: VCLCredentialTypesUIFormSchemaDescriptor, _ countries: VCLCountries, _ regions: VCLRegions?, - _ formSchemaDict: [String: Sendable] - ) -> [String: Sendable] { + _ formSchemaDict: [String: Any] + ) -> [String: Any] { var formSchemaDictCP = formSchemaDict for (key, value) in formSchemaDictCP { - if let valueDict = value as? [String: Sendable] { + if let valueDict = value as? [String: Any] { if key == VCLCredentialTypesUIFormSchema.CodingKeys.KeyAddressCountry { if let allCountries = countries.all { formSchemaDictCP = updateAddressEnums( @@ -93,9 +93,9 @@ final class CredentialTypesUIFormSchemaRepositoryImpl: CredentialTypesUIFormSche private func updateAddressEnums( _ places: [VCLPlace], _ key: String, - _ valueDict: [String: Sendable], - _ formSchemaDict: [String: Sendable] - ) -> [String: Sendable] { + _ valueDict: [String: Any], + _ formSchemaDict: [String: Any] + ) -> [String: Any] { var formSchemaDictCP = formSchemaDict var valueDictCP = valueDict let valueDictHasKeyUiEnum = valueDictCP[VCLCredentialTypesUIFormSchema.CodingKeys.KeyUiEnum] != nil diff --git a/VCL/VCL/impl/data/repositories/ExchangeProgressRepositoryImpl.swift b/VCL/VCL/impl/data/repositories/ExchangeProgressRepositoryImpl.swift index 9b57022..8024d56 100644 --- a/VCL/VCL/impl/data/repositories/ExchangeProgressRepositoryImpl.swift +++ b/VCL/VCL/impl/data/repositories/ExchangeProgressRepositoryImpl.swift @@ -19,7 +19,7 @@ final class ExchangeProgressRepositoryImpl: ExchangeProgressRepository { func getExchangeProgress( exchangeDescriptor: VCLExchangeDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { networkService.sendRequest( endpoint: exchangeDescriptor.processUri + @@ -44,7 +44,7 @@ final class ExchangeProgressRepositoryImpl: ExchangeProgressRepository { } } - private func parseExchange(_ exchangeJsonDict: [String: Sendable]?) -> VCLExchange { + private func parseExchange(_ exchangeJsonDict: [String: Any]?) -> VCLExchange { return VCLExchange( id: exchangeJsonDict?[VCLExchange.CodingKeys.KeyId] as? String, type: exchangeJsonDict?[VCLExchange.CodingKeys.KeyType] as? String, diff --git a/VCL/VCL/impl/data/repositories/FinalizeOffersRepositoryImpl.swift b/VCL/VCL/impl/data/repositories/FinalizeOffersRepositoryImpl.swift index 0d98e11..dc23e5a 100644 --- a/VCL/VCL/impl/data/repositories/FinalizeOffersRepositoryImpl.swift +++ b/VCL/VCL/impl/data/repositories/FinalizeOffersRepositoryImpl.swift @@ -23,7 +23,7 @@ final class FinalizeOffersRepositoryImpl: FinalizeOffersRepository { finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, sessionToken: VCLToken, proof: VCLJwt? = nil, - completionBlock: @escaping @Sendable (VCLResult<[VCLJwt]>) -> Void + completionBlock: @escaping (VCLResult<[VCLJwt]>) -> Void ) { networkService.sendRequest( endpoint: finalizeOffersDescriptor.finalizeOffersUri, diff --git a/VCL/VCL/impl/data/repositories/GenerateOffersRepositoryImpl.swift b/VCL/VCL/impl/data/repositories/GenerateOffersRepositoryImpl.swift index f810a2b..fc3bd56 100644 --- a/VCL/VCL/impl/data/repositories/GenerateOffersRepositoryImpl.swift +++ b/VCL/VCL/impl/data/repositories/GenerateOffersRepositoryImpl.swift @@ -19,7 +19,7 @@ final class GenerateOffersRepositoryImpl: GenerateOffersRepository { func generateOffers( generateOffersDescriptor: VCLGenerateOffersDescriptor, sessionToken: VCLToken, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { networkService.sendRequest( endpoint: generateOffersDescriptor.checkOffersUri, diff --git a/VCL/VCL/impl/data/repositories/JwtServiceRepositoryImpl.swift b/VCL/VCL/impl/data/repositories/JwtServiceRepositoryImpl.swift index 2cb5a29..0fc2610 100644 --- a/VCL/VCL/impl/data/repositories/JwtServiceRepositoryImpl.swift +++ b/VCL/VCL/impl/data/repositories/JwtServiceRepositoryImpl.swift @@ -26,7 +26,7 @@ final class JwtServiceRepositoryImpl: JwtServiceRepository { jwt: VCLJwt, publicJwk: VCLPublicJwk, remoteCryptoServicesToken: VCLToken?, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { jwtVerifyService.verify( jwt: jwt, @@ -41,7 +41,7 @@ final class JwtServiceRepositoryImpl: JwtServiceRepository { nonce: String? = nil, didJwk: VCLDidJwk, remoteCryptoServicesToken: VCLToken?, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { jwtSignService.sign( jwtDescriptor: jwtDescriptor, diff --git a/VCL/VCL/impl/data/repositories/KeyServiceRepositoryImpl.swift b/VCL/VCL/impl/data/repositories/KeyServiceRepositoryImpl.swift index 58772d0..763a9b9 100644 --- a/VCL/VCL/impl/data/repositories/KeyServiceRepositoryImpl.swift +++ b/VCL/VCL/impl/data/repositories/KeyServiceRepositoryImpl.swift @@ -19,7 +19,7 @@ final class KeyServiceRepositoryImpl: KeyServiceRepository { func generateDidJwk( didJwkDescriptor: VCLDidJwkDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { keyService.generateDidJwk( didJwkDescriptor: didJwkDescriptor, diff --git a/VCL/VCL/impl/data/repositories/OrganizationsRepositoryImpl.swift b/VCL/VCL/impl/data/repositories/OrganizationsRepositoryImpl.swift index 45f93d9..b17d8e8 100644 --- a/VCL/VCL/impl/data/repositories/OrganizationsRepositoryImpl.swift +++ b/VCL/VCL/impl/data/repositories/OrganizationsRepositoryImpl.swift @@ -19,7 +19,7 @@ final class OrganizationsRepositoryImpl: OrganizationsRepository { func searchForOrganizations( organizationsSearchDescriptor: VCLOrganizationsSearchDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { var endpoint = Urls.Organizations if let qp = organizationsSearchDescriptor.queryParams { @@ -45,9 +45,9 @@ final class OrganizationsRepositoryImpl: OrganizationsRepository { } } - private func parse(organizationDict: [String: Sendable]?) -> VCLOrganizations { + private func parse(organizationDict: [String: Any]?) -> VCLOrganizations { var organizations = [VCLOrganization]() - if let organizationsJsonArray = organizationDict?[VCLOrganizations.CodingKeys.KeyResult] as? [[String: Sendable]] { + if let organizationsJsonArray = organizationDict?[VCLOrganizations.CodingKeys.KeyResult] as? [[String: Any]] { for i in 0..) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { if let endpoint = presentationRequestDescriptor.endpoint { networkService.sendRequest( diff --git a/VCL/VCL/impl/data/repositories/ResolveKidRepositoryImpl.swift b/VCL/VCL/impl/data/repositories/ResolveKidRepositoryImpl.swift index 9e491b6..48bd908 100644 --- a/VCL/VCL/impl/data/repositories/ResolveKidRepositoryImpl.swift +++ b/VCL/VCL/impl/data/repositories/ResolveKidRepositoryImpl.swift @@ -17,7 +17,7 @@ final class ResolveKidRepositoryImpl: ResolveKidRepository { self.networkService = networkService } - func getPublicKey(kid: String, completionBlock: @escaping @Sendable (VCLResult) -> Void) { + func getPublicKey(kid: String, completionBlock: @escaping (VCLResult) -> Void) { networkService.sendRequest( endpoint: Urls.ResolveKid + kid + "?format=\(VCLPublicJwk.Format.jwk)", contentType: Request.ContentType.ApplicationJson, diff --git a/VCL/VCL/impl/data/repositories/SubmissionRepositoryImpl.swift b/VCL/VCL/impl/data/repositories/SubmissionRepositoryImpl.swift index acd332a..3ea9263 100644 --- a/VCL/VCL/impl/data/repositories/SubmissionRepositoryImpl.swift +++ b/VCL/VCL/impl/data/repositories/SubmissionRepositoryImpl.swift @@ -22,7 +22,7 @@ final class SubmissionRepositoryImpl: SubmissionRepository { func submit( submission: VCLSubmission, jwt: VCLJwt, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { self.networkService.sendRequest( endpoint: submission.submitUri, @@ -47,17 +47,17 @@ final class SubmissionRepositoryImpl: SubmissionRepository { }) } - private func parse(_ jsonDict: [String: Sendable]?, _ jti: String, _ submissionId: String) -> VCLSubmissionResult { + private func parse(_ jsonDict: [String: Any]?, _ jti: String, _ submissionId: String) -> VCLSubmissionResult { let exchangeJsonDict = jsonDict?[VCLSubmissionResult.CodingKeys.KeyExchange] return VCLSubmissionResult( sessionToken: VCLToken(value: jsonDict?[VCLSubmissionResult.CodingKeys.KeyToken] as? String ?? ""), - exchange: parseExchange(exchangeJsonDict as? [String: Sendable]), + exchange: parseExchange(exchangeJsonDict as? [String: Any]), jti: jti, submissionId: submissionId ) } - private func parseExchange(_ exchangeJsonDict: [String: Sendable]?) -> VCLExchange { + private func parseExchange(_ exchangeJsonDict: [String: Any]?) -> VCLExchange { return VCLExchange( id: exchangeJsonDict?[VCLExchange.CodingKeys.KeyId] as? String, type: exchangeJsonDict?[VCLExchange.CodingKeys.KeyType] as? String, diff --git a/VCL/VCL/impl/data/repositories/VerifiedProfileRepositoryImpl.swift b/VCL/VCL/impl/data/repositories/VerifiedProfileRepositoryImpl.swift index 5f059cd..a0c4959 100644 --- a/VCL/VCL/impl/data/repositories/VerifiedProfileRepositoryImpl.swift +++ b/VCL/VCL/impl/data/repositories/VerifiedProfileRepositoryImpl.swift @@ -19,7 +19,7 @@ final class VerifiedProfileRepositoryImpl: VerifiedProfileRepository { func getVerifiedProfile( verifiedProfileDescriptor: VCLVerifiedProfileDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { networkService.sendRequest( endpoint: Urls.VerifiedProfile.replacingOccurrences(of: Params.Did, with: verifiedProfileDescriptor.did), diff --git a/VCL/VCL/impl/data/usecases/CountriesUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/CountriesUseCaseImpl.swift index 170be8d..5b331f7 100644 --- a/VCL/VCL/impl/data/usecases/CountriesUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/CountriesUseCaseImpl.swift @@ -24,7 +24,7 @@ final class CountriesUseCaseImpl: CountriesUseCase { func getCountries( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in guard let self = self else { return } diff --git a/VCL/VCL/impl/data/usecases/CredentialManifestUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/CredentialManifestUseCaseImpl.swift index d10f8dd..706d965 100644 --- a/VCL/VCL/impl/data/usecases/CredentialManifestUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/CredentialManifestUseCaseImpl.swift @@ -34,7 +34,7 @@ final class CredentialManifestUseCaseImpl: CredentialManifestUseCase { func getCredentialManifest( credentialManifestDescriptor: VCLCredentialManifestDescriptor, verifiedProfile: VCLVerifiedProfile, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in self?.credentialManifestRepository.getCredentialManifest( @@ -63,7 +63,7 @@ final class CredentialManifestUseCaseImpl: CredentialManifestUseCase { private func onGetCredentialManifestSuccess( _ credentialManifest: VCLCredentialManifest, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { if let deepLink = credentialManifest.deepLink { credentialManifestByDeepLinkVerifier.verifyCredentialManifest( @@ -92,7 +92,7 @@ final class CredentialManifestUseCaseImpl: CredentialManifestUseCase { private func onCredentialManifestDidVerificationSuccess( _ credentialManifest: VCLCredentialManifest, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { if let kid = credentialManifest.jwt.kid?.replacingOccurrences(of: "#", with: "#".encode() ?? "") { self.resolveKidRepository.getPublicKey(kid: kid) { @@ -118,7 +118,7 @@ final class CredentialManifestUseCaseImpl: CredentialManifestUseCase { private func onResolvePublicKeySuccess( _ publicJwk: VCLPublicJwk, _ credentialManifest: VCLCredentialManifest, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { self.jwtServiceRepository.verifyJwt( jwt: credentialManifest.jwt, @@ -142,7 +142,7 @@ final class CredentialManifestUseCaseImpl: CredentialManifestUseCase { private func onVerificationSuccess( _ isVerified: Bool, _ credentialManifest: VCLCredentialManifest, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { if (isVerified) { executor.runOnMain { @@ -158,7 +158,7 @@ final class CredentialManifestUseCaseImpl: CredentialManifestUseCase { private func onError( _ error: Error, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnMain { completionBlock(.failure(VCLError(error: error))) diff --git a/VCL/VCL/impl/data/usecases/CredentialTypeSchemasUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/CredentialTypeSchemasUseCaseImpl.swift index 4e826dc..932d504 100644 --- a/VCL/VCL/impl/data/usecases/CredentialTypeSchemasUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/CredentialTypeSchemasUseCaseImpl.swift @@ -25,7 +25,7 @@ actor CredentialTypeSchemasMapStorage { } } -final class CredentialTypeSchemasUseCaseImpl: Sendable, CredentialTypeSchemasUseCase { +final class CredentialTypeSchemasUseCaseImpl: CredentialTypeSchemasUseCase { private let credentialTypeSchemasRepository: CredentialTypeSchemaRepository private let credentialTypes: VCLCredentialTypes @@ -49,7 +49,7 @@ final class CredentialTypeSchemasUseCaseImpl: Sendable, CredentialTypeSchemasUse func getCredentialTypeSchemas( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { let schemaNamesArr = self.credentialTypes.all?.compactMap { $0.schemaName } ?? [] diff --git a/VCL/VCL/impl/data/usecases/CredentialTypesUIFormSchemaUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/CredentialTypesUIFormSchemaUseCaseImpl.swift index 86c693d..2593ee3 100644 --- a/VCL/VCL/impl/data/usecases/CredentialTypesUIFormSchemaUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/CredentialTypesUIFormSchemaUseCaseImpl.swift @@ -26,7 +26,7 @@ final class CredentialTypesUIFormSchemaUseCaseImpl: CredentialTypesUIFormSchemaU func getCredentialTypesUIFormSchema( credentialTypesUIFormSchemaDescriptor: VCLCredentialTypesUIFormSchemaDescriptor, countries: VCLCountries, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in self?.credentialTypesUIFormSchemaRepository.getCredentialTypesUIFormSchema( diff --git a/VCL/VCL/impl/data/usecases/CredentialTypesUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/CredentialTypesUseCaseImpl.swift index 731fb43..1d2c453 100644 --- a/VCL/VCL/impl/data/usecases/CredentialTypesUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/CredentialTypesUseCaseImpl.swift @@ -21,7 +21,7 @@ final class CredentialTypesUseCaseImpl: CredentialTypesUseCase { func getCredentialTypes( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in guard let self = self else { return } diff --git a/VCL/VCL/impl/data/usecases/ExchangeProgressUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/ExchangeProgressUseCaseImpl.swift index 6ff7dca..69ec717 100644 --- a/VCL/VCL/impl/data/usecases/ExchangeProgressUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/ExchangeProgressUseCaseImpl.swift @@ -24,7 +24,7 @@ final class ExchangeProgressUseCaseImpl: ExchangeProgressUseCase { func getExchangeProgress( exchangeDescriptor: VCLExchangeDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in guard let self = self else { return } diff --git a/VCL/VCL/impl/data/usecases/FinalizeOffersUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/FinalizeOffersUseCaseImpl.swift index d0ba829..bfb1423 100644 --- a/VCL/VCL/impl/data/usecases/FinalizeOffersUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/FinalizeOffersUseCaseImpl.swift @@ -37,7 +37,7 @@ final class FinalizeOffersUseCaseImpl: FinalizeOffersUseCase { func finalizeOffers( finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, sessionToken: VCLToken, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in if let challenge = finalizeOffersDescriptor.challenge { @@ -81,7 +81,7 @@ final class FinalizeOffersUseCaseImpl: FinalizeOffersUseCase { finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, sessionToken: VCLToken, proof: VCLJwt? = nil, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { weakSelf?.finalizeOffersRepository.finalizeOffers( finalizeOffersDescriptor: finalizeOffersDescriptor, @@ -129,7 +129,7 @@ final class FinalizeOffersUseCaseImpl: FinalizeOffersUseCase { private func verifyCredentialsByDeepLink( _ jwtCredentials: [VCLJwt], _ finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { if let deepLink = finalizeOffersDescriptor.credentialManifest.deepLink { credentialsByDeepLinkVerifier.verifyCredentials( @@ -152,7 +152,7 @@ final class FinalizeOffersUseCaseImpl: FinalizeOffersUseCase { private func verifyCredentialsByIssuer( _ jwtCredentials: [VCLJwt], _ finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { credentialIssuerVerifier.verifyCredentials( jwtCredentials: jwtCredentials, @@ -169,7 +169,7 @@ final class FinalizeOffersUseCaseImpl: FinalizeOffersUseCase { private func verifyCredentialByDid( _ jwtCredentials: [VCLJwt], _ finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { credentialDidVerifier.verifyCredentials( jwtCredentials: jwtCredentials, @@ -185,7 +185,7 @@ final class FinalizeOffersUseCaseImpl: FinalizeOffersUseCase { private func onError( _ error: VCLError, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnMain { completionBlock(VCLResult.failure(error)) } } diff --git a/VCL/VCL/impl/data/usecases/GenerateOffersUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/GenerateOffersUseCaseImpl.swift index b108e93..8bb8dd1 100644 --- a/VCL/VCL/impl/data/usecases/GenerateOffersUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/GenerateOffersUseCaseImpl.swift @@ -28,7 +28,7 @@ final class GenerateOffersUseCaseImpl: GenerateOffersUseCase { func generateOffers( generateOffersDescriptor: VCLGenerateOffersDescriptor, sessionToken: VCLToken, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in self?.generateOffersRepository.generateOffers( @@ -53,7 +53,7 @@ final class GenerateOffersUseCaseImpl: GenerateOffersUseCase { private func verifyOffersByDeepLink( offers: VCLOffers, generateOffersDescriptor: VCLGenerateOffersDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { if let deepLink = generateOffersDescriptor.credentialManifest.deepLink { offersByDeepLinkVerifier.verifyOffers(offers: offers, deepLink: deepLink) { @@ -78,7 +78,7 @@ final class GenerateOffersUseCaseImpl: GenerateOffersUseCase { private func onError( _ error: VCLError, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnMain { completionBlock(VCLResult.failure(error)) } } diff --git a/VCL/VCL/impl/data/usecases/JwtServiceUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/JwtServiceUseCaseImpl.swift index 715f184..9489178 100644 --- a/VCL/VCL/impl/data/usecases/JwtServiceUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/JwtServiceUseCaseImpl.swift @@ -26,7 +26,7 @@ final class JwtServiceUseCaseImpl: JwtServiceUseCase { jwt: VCLJwt, publicJwk: VCLPublicJwk, remoteCryptoServicesToken: VCLToken?, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in guard let self = self else { return } @@ -45,7 +45,7 @@ final class JwtServiceUseCaseImpl: JwtServiceUseCase { nonce: String? = nil, didJwk: VCLDidJwk, remoteCryptoServicesToken: VCLToken?, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in guard let self = self else { return } diff --git a/VCL/VCL/impl/data/usecases/KeyServiceUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/KeyServiceUseCaseImpl.swift index 6aab168..9f8b00c 100644 --- a/VCL/VCL/impl/data/usecases/KeyServiceUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/KeyServiceUseCaseImpl.swift @@ -24,7 +24,7 @@ final class KeyServiceUseCaseImpl: KeyServiceUseCase { func generateDidJwk( didJwkDescriptor: VCLDidJwkDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in guard let self = self else { return } diff --git a/VCL/VCL/impl/data/usecases/OrganizationsUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/OrganizationsUseCaseImpl.swift index 4535771..6959fea 100644 --- a/VCL/VCL/impl/data/usecases/OrganizationsUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/OrganizationsUseCaseImpl.swift @@ -24,7 +24,7 @@ final class OrganizationsUseCaseImpl: OrganizationsUseCase { func searchForOrganizations( organizationsSearchDescriptor: VCLOrganizationsSearchDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in guard let self = self else { return } diff --git a/VCL/VCL/impl/data/usecases/PresentationRequestUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/PresentationRequestUseCaseImpl.swift index 388e3a5..b602273 100644 --- a/VCL/VCL/impl/data/usecases/PresentationRequestUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/PresentationRequestUseCaseImpl.swift @@ -34,7 +34,7 @@ final class PresentationRequestUseCaseImpl: PresentationRequestUseCase { func getPresentationRequest( presentationRequestDescriptor: VCLPresentationRequestDescriptor, verifiedProfile: VCLVerifiedProfile, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in guard let self = self else { return } @@ -62,7 +62,7 @@ final class PresentationRequestUseCaseImpl: PresentationRequestUseCase { private func onGetPresentationRequestSuccess( _ presentationRequest: VCLPresentationRequest, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { if let kid = presentationRequest.jwt.kid?.replacingOccurrences(of: "#", with: "#".encode() ?? "") { self.resolveKidRepository.getPublicKey(kid: kid) { @@ -87,7 +87,7 @@ final class PresentationRequestUseCaseImpl: PresentationRequestUseCase { private func onResolvePublicKeySuccess( _ publicJwk: VCLPublicJwk, _ presentationRequest: VCLPresentationRequest, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { self.jwtServiceRepository.verifyJwt( jwt: presentationRequest.jwt, @@ -123,7 +123,7 @@ final class PresentationRequestUseCaseImpl: PresentationRequestUseCase { private func onVerificationSuccess( _ isVerified: Bool, _ presentationRequest: VCLPresentationRequest, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { if isVerified == true { executor.runOnMain { @@ -136,7 +136,7 @@ final class PresentationRequestUseCaseImpl: PresentationRequestUseCase { private func onError( _ error: Error, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnMain { completionBlock(.failure(VCLError(error: error))) diff --git a/VCL/VCL/impl/data/usecases/SubmissionUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/SubmissionUseCaseImpl.swift index 1f5c04f..953955c 100644 --- a/VCL/VCL/impl/data/usecases/SubmissionUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/SubmissionUseCaseImpl.swift @@ -27,7 +27,7 @@ final class SubmissionUseCaseImpl: SubmissionUseCase { func submit( submission: VCLSubmission, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in self?.jwtServiceRepository.generateSignedJwt( diff --git a/VCL/VCL/impl/data/usecases/VerifiedProfileUseCaseImpl.swift b/VCL/VCL/impl/data/usecases/VerifiedProfileUseCaseImpl.swift index 0b04362..12d31dd 100644 --- a/VCL/VCL/impl/data/usecases/VerifiedProfileUseCaseImpl.swift +++ b/VCL/VCL/impl/data/usecases/VerifiedProfileUseCaseImpl.swift @@ -24,7 +24,7 @@ final class VerifiedProfileUseCaseImpl: VerifiedProfileUseCase { func getVerifiedProfile( verifiedProfileDescriptor: VCLVerifiedProfileDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { executor.runOnBackground { [weak self] in guard let self = self else { return } diff --git a/VCL/VCL/impl/data/utils/Utils.swift b/VCL/VCL/impl/data/utils/Utils.swift deleted file mode 100644 index 223ae37..0000000 --- a/VCL/VCL/impl/data/utils/Utils.swift +++ /dev/null @@ -1,71 +0,0 @@ -// -// Utils.swift -// VCL -// -// Created by Michael Avoyan on 16/07/2023. -// -// Copyright 2022 Velocity Career Labs inc. -// SPDX-License-Identifier: Apache-2.0 - -import Foundation - -class Utils { - static func getCredentialType(_ jwtCredential: VCLJwt) -> String? { - return ((jwtCredential.payload?[CredentialIssuerVerifierImpl.CodingKeys.KeyVC] as? [String: Sendable])?[CredentialIssuerVerifierImpl.CodingKeys.KeyType] as? [String])?.first - } - - static func getCredentialSubject(_ jwtCredential: VCLJwt) -> [String: Sendable]? { - return ((jwtCredential.payload?[CredentialIssuerVerifierImpl.CodingKeys.KeyVC] as? [String: Sendable])?[CredentialIssuerVerifierImpl.CodingKeys.KeyCredentialSubject] as? [String: Sendable]) - } - - static func getIdentifier( - _ primaryOrgProp: String?, - _ jsonObject: [String: Sendable] - ) -> String? { - if(primaryOrgProp == nil) { - return nil - } - var identifier: String? = nil - var stack = [[String: Sendable]]() - stack.append(jsonObject) - - while (stack.isEmpty == false) { - let obj = stack.remove(at: stack.count - 1) - - identifier = getPrimaryIdentifier(obj[primaryOrgProp!]) - if (identifier != nil) { - break - } - - obj.forEach { _, value in - if let valueDict = value as? [String: Sendable] { - stack.append(valueDict) - } - } - } - return identifier - } - - static func getPrimaryIdentifier( - _ credentialSubject: Sendable? - ) -> String? { - if ((credentialSubject as? String)?.isEmpty == false) { - return credentialSubject as? String - } - return (credentialSubject as? [String: Sendable])?["identifier"] as? String - ?? (credentialSubject as? [String: Sendable])?["id"] as? String - } - - static func offersFromJsonArray(offersJsonArray: [[String: Sendable]]) -> [VCLOffer] { - var allOffers = [VCLOffer]() - offersJsonArray.forEach { - allOffers.append(VCLOffer(payload: $0)) - } - return allOffers - } - - static func getCredentialIssuerId(jwtCredential: VCLJwt) -> String? { - let vc: [String: Sendable]? = jwtCredential.payload?["vc"] as? [String: Sendable] - return (vc?["issuer"] as? [String: Sendable])?["id"] as? String ?? vc?["issuer"] as? String - } -} diff --git a/VCL/VCL/impl/data/verifiers/CredentialDidVerifierImpl.swift b/VCL/VCL/impl/data/verifiers/CredentialDidVerifierImpl.swift index bcc0725..5eed9b8 100644 --- a/VCL/VCL/impl/data/verifiers/CredentialDidVerifierImpl.swift +++ b/VCL/VCL/impl/data/verifiers/CredentialDidVerifierImpl.swift @@ -16,7 +16,7 @@ final class CredentialDidVerifierImpl: CredentialDidVerifier { func verifyCredentials( jwtCredentials: [VCLJwt], finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { var passedCredentials = [VCLJwt]() var failedCredentials = [VCLJwt]() diff --git a/VCL/VCL/impl/data/verifiers/CredentialIssuerVerifierEmptyImpl.swift b/VCL/VCL/impl/data/verifiers/CredentialIssuerVerifierEmptyImpl.swift index 403cd86..ec8038d 100644 --- a/VCL/VCL/impl/data/verifiers/CredentialIssuerVerifierEmptyImpl.swift +++ b/VCL/VCL/impl/data/verifiers/CredentialIssuerVerifierEmptyImpl.swift @@ -13,7 +13,7 @@ final class CredentialIssuerVerifierEmptyImpl: CredentialIssuerVerifier { func verifyCredentials( jwtCredentials: [VCLJwt], finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { VCLLog.d("Empty implementation - credential issuer is always approved...") completionBlock(.success(true)) diff --git a/VCL/VCL/impl/data/verifiers/CredentialIssuerVerifierImpl.swift b/VCL/VCL/impl/data/verifiers/CredentialIssuerVerifierImpl.swift index eb78613..6f29661 100644 --- a/VCL/VCL/impl/data/verifiers/CredentialIssuerVerifierImpl.swift +++ b/VCL/VCL/impl/data/verifiers/CredentialIssuerVerifierImpl.swift @@ -20,9 +20,9 @@ actor GlobalErrorStorage { } actor CompleteContextsStorage { - private var completeContexts = [[String: Sendable]]() + private var completeContexts = [[String: Any]]() - func append(_ completeContext: [String: Sendable]) { + func append(_ completeContext: [String: Any]) { completeContexts.append(completeContext) } @@ -30,7 +30,7 @@ actor CompleteContextsStorage { return completeContexts.isEmpty } - func get() -> [[String: Sendable]] { return completeContexts } + func get() -> [[String: Any]] { return completeContexts } } actor IsCredentialVerifiedStorage { @@ -41,7 +41,7 @@ actor IsCredentialVerifiedStorage { func get() -> Bool { return isVeirfied } } -final class CredentialIssuerVerifierImpl: @unchecked Sendable, CredentialIssuerVerifier { +final class CredentialIssuerVerifierImpl: CredentialIssuerVerifier { private let credentialTypesModel: CredentialTypesModel private let networkService: NetworkService @@ -71,7 +71,7 @@ final class CredentialIssuerVerifierImpl: @unchecked Sendable, CredentialIssuerV func verifyCredentials( jwtCredentials: [VCLJwt], finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { if (jwtCredentials.isEmpty) /* nothing to verify */ { completionBlock(VCLResult.success(true)) @@ -84,7 +84,7 @@ final class CredentialIssuerVerifierImpl: @unchecked Sendable, CredentialIssuerV jwtCredentials.forEach { jwtCredential in executor.runOnBackground { [weak self] in - if let credentialTypeName = Utils.getCredentialType(jwtCredential) { + if let credentialTypeName = VerificationUtils.getCredentialType(jwtCredential) { if let credentialType = self?.credentialTypesModel.credentialTypeByTypeName(type: credentialTypeName) { self?.mainDispatcher.enter() @@ -142,7 +142,7 @@ final class CredentialIssuerVerifierImpl: @unchecked Sendable, CredentialIssuerV _ jwtCredential: VCLJwt, _ credentialType: VCLCredentialType, _ serviceTypes: VCLServiceTypes, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { if ( serviceTypes.contains(serviceType: VCLServiceType.IdentityIssuer) || @@ -166,7 +166,7 @@ final class CredentialIssuerVerifierImpl: @unchecked Sendable, CredentialIssuerV func verifyIdentityIssuer( _ credentialType: VCLCredentialType, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { if ( credentialType.issuerCategory == VCLServiceType.IdentityIssuer.rawValue || @@ -187,13 +187,13 @@ final class CredentialIssuerVerifierImpl: @unchecked Sendable, CredentialIssuerV func verifyRegularIssuer( _ jwtCredential: VCLJwt, _ permittedServiceCategory: VCLServiceTypes, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { if (permittedServiceCategory.contains(serviceType: VCLServiceType.NotaryIssuer)) { completionBlock(VCLResult.success(true)) } else if (permittedServiceCategory.contains(serviceType: VCLServiceType.Issuer)) { - if let credentialSubject = Utils.getCredentialSubject(jwtCredential) { - if let credentialSubjectContexts = retrieveContextFromCredentialSubject(credentialSubject) { + if let credentialSubject = VerificationUtils.getCredentialSubjectFromCredential(jwtCredential) { + if let credentialSubjectContexts = VerificationUtils.getContextsFromCredential(jwtCredential) { resolveCredentialSubjectContexts(credentialSubjectContexts, self) { [weak self] credentialSubjectContextsResult in do { let completeContexts = try credentialSubjectContextsResult.get() @@ -232,19 +232,10 @@ final class CredentialIssuerVerifierImpl: @unchecked Sendable, CredentialIssuerV } } - private func retrieveContextFromCredentialSubject(_ credentialSubject: [String: Sendable]) -> [String]? { - if let credentialSubjectContexts = credentialSubject[CodingKeys.KeyContext] as? [String] { - return credentialSubjectContexts - } else if let credentialSubjectContext = credentialSubject[CodingKeys.KeyContext] as? String { - return [credentialSubjectContext] - } - return nil - } - private func resolveCredentialSubjectContexts( _ credentialSubjectContexts: [String], _ self: CredentialIssuerVerifierImpl, - _ completionBlock: @escaping @Sendable (VCLResult<[[String: Sendable]]>) -> Void + _ completionBlock: @escaping (VCLResult<[[String: Any]]>) -> Void ) { let completeContextsStorage = CompleteContextsStorage() @@ -291,13 +282,13 @@ final class CredentialIssuerVerifierImpl: @unchecked Sendable, CredentialIssuerV } private func onResolveCredentialSubjectContexts( - _ credentialSubject: [String: Sendable], + _ credentialSubject: [String: Any], _ jwtCredential: VCLJwt, - _ completeContexts: [[String: Sendable]], + _ completeContexts: [[String: Any]], _ self: CredentialIssuerVerifierImpl?, - _ completionBlock: @escaping @Sendable (VCLResult) -> Void + _ completionBlock: @escaping (VCLResult) -> Void ) { - if let credentialSubjectType = (((credentialSubject[CodingKeys.KeyType] as? [Sendable])?[0] as? String) ?? credentialSubject[CodingKeys.KeyType] as? String) { + if let credentialSubjectType = (((credentialSubject[CodingKeys.KeyType] as? [Any])?[0] as? String) ?? credentialSubject[CodingKeys.KeyType] as? String) { let globalErrorStorage = GlobalErrorStorage() let isCredentialVerifiedStorage = IsCredentialVerifiedStorage() @@ -307,14 +298,14 @@ final class CredentialIssuerVerifierImpl: @unchecked Sendable, CredentialIssuerV self.completeConetxDispatcher.enter() self.executor.runOnBackground { - let activeContext = (((completeContext[CodingKeys.KeyContext] as? [String: Sendable])?[credentialSubjectType] as? [String: Sendable]))?[CodingKeys.KeyContext] as? [String: Sendable] ?? completeContext + let activeContext = (((completeContext[CodingKeys.KeyContext] as? [String: Any])?[credentialSubjectType] as? [String: Any]))?[CodingKeys.KeyContext] as? [String: Any] ?? completeContext if let K = self.findKeyForPrimaryOrganizationValue(activeContext) { - if let did = Utils.getIdentifier(K, credentialSubject) { + if let did = VerificationUtils.getIdentifier(K, credentialSubject) { // Comparing issuer.id instead of iss // https://velocitycareerlabs.atlassian.net/browse/VL-6178?focusedCommentId=46933 // https://velocitycareerlabs.atlassian.net/browse/VL-6988 // if (jwtCredential.iss == did) - let credentialIssuerId = Utils.getCredentialIssuerId(jwtCredential: jwtCredential) + let credentialIssuerId = VerificationUtils.getCredentialIssuerId(jwtCredential: jwtCredential) VCLLog.d("Comparing credentialIssuerId: \(credentialIssuerId ?? "") with did: \(did)") if (credentialIssuerId == did) { Task { @@ -373,10 +364,10 @@ final class CredentialIssuerVerifierImpl: @unchecked Sendable, CredentialIssuerV } private func findKeyForPrimaryOrganizationValue( - _ activeContext: [String: Sendable] + _ activeContext: [String: Any] ) -> String? { for (key, value) in activeContext { - if let valueMap = value as? [String: Sendable] { + if let valueMap = value as? [String: Any] { if (valueMap[CodingKeys.KeyId] as? String == CodingKeys.ValPrimaryOrganization || valueMap[CodingKeys.KeyId] as? String == CodingKeys.ValPrimarySourceProfile) { return key diff --git a/VCL/VCL/impl/data/verifiers/CredentialManifestByDeepLinkVerifierImpl.swift b/VCL/VCL/impl/data/verifiers/CredentialManifestByDeepLinkVerifierImpl.swift index fd39c76..587c6f8 100644 --- a/VCL/VCL/impl/data/verifiers/CredentialManifestByDeepLinkVerifierImpl.swift +++ b/VCL/VCL/impl/data/verifiers/CredentialManifestByDeepLinkVerifierImpl.swift @@ -13,7 +13,7 @@ final class CredentialManifestByDeepLinkVerifierImpl: CredentialManifestByDeepLi func verifyCredentialManifest( credentialManifest: VCLCredentialManifest, deepLink: VCLDeepLink, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { if credentialManifest.issuerId == deepLink.did { completionBlock(.success(true)) diff --git a/VCL/VCL/impl/data/verifiers/CredentialsByDeepLinkVerifierImpl.swift b/VCL/VCL/impl/data/verifiers/CredentialsByDeepLinkVerifierImpl.swift index 11a1285..9e7b301 100644 --- a/VCL/VCL/impl/data/verifiers/CredentialsByDeepLinkVerifierImpl.swift +++ b/VCL/VCL/impl/data/verifiers/CredentialsByDeepLinkVerifierImpl.swift @@ -13,7 +13,7 @@ final class CredentialsByDeepLinkVerifierImpl: CredentialsByDeepLinkVerifier { func verifyCredentials( jwtCredentials: [VCLJwt], deepLink: VCLDeepLink, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { if let mismatchedCredential = jwtCredentials.first(where: { $0.iss != deepLink.did }) { VCLLog.e("mismatched credential: \(mismatchedCredential.encodedJwt) \ndeepLink: \(deepLink.value)") diff --git a/VCL/VCL/impl/data/verifiers/OffersByDeepLinkVerifierImpl.swift b/VCL/VCL/impl/data/verifiers/OffersByDeepLinkVerifierImpl.swift index e25b5d2..94908bd 100644 --- a/VCL/VCL/impl/data/verifiers/OffersByDeepLinkVerifierImpl.swift +++ b/VCL/VCL/impl/data/verifiers/OffersByDeepLinkVerifierImpl.swift @@ -13,7 +13,7 @@ final class OffersByDeepLinkVerifierImpl: OffersByDeepLinkVerifier { func verifyOffers( offers: VCLOffers, deepLink: VCLDeepLink, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { if let mismatchedOffer = offers.all.first(where: { $0.issuerId != deepLink.did }) { VCLLog.e("mismatched offer: \(mismatchedOffer.payload) \ndeepLink: \(deepLink.value)") diff --git a/VCL/VCL/impl/data/verifiers/PresentationRequestByDeepLinkVerifierImpl.swift b/VCL/VCL/impl/data/verifiers/PresentationRequestByDeepLinkVerifierImpl.swift index 5c27177..85a3673 100644 --- a/VCL/VCL/impl/data/verifiers/PresentationRequestByDeepLinkVerifierImpl.swift +++ b/VCL/VCL/impl/data/verifiers/PresentationRequestByDeepLinkVerifierImpl.swift @@ -13,7 +13,7 @@ final class PresentationRequestByDeepLinkVerifierImpl: PresentationRequestByDeep func verifyPresentationRequest( presentationRequest: VCLPresentationRequest, deepLink: VCLDeepLink, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { if presentationRequest.iss == deepLink.did { completionBlock(.success(true)) diff --git a/VCL/VCL/impl/data/verifiers/VerificationUtils.swift b/VCL/VCL/impl/data/verifiers/VerificationUtils.swift new file mode 100644 index 0000000..c93c5ac --- /dev/null +++ b/VCL/VCL/impl/data/verifiers/VerificationUtils.swift @@ -0,0 +1,109 @@ +// +// VerificationUtils.swift +// VCL +// +// Created by Michael Avoyan on 16/07/2023. +// +// Copyright 2022 Velocity Career Labs inc. +// SPDX-License-Identifier: Apache-2.0 + +import Foundation + +class VerificationUtils { + static func getCredentialType(_ jwtCredential: VCLJwt) -> String? { + return ((jwtCredential.payload?[CredentialIssuerVerifierImpl.CodingKeys.KeyVC] as? [String: AnyHashable])?[CredentialIssuerVerifierImpl.CodingKeys.KeyType] as? [String])?.first + } + + internal static func getCredentialSubjectFromCredential(_ jwtCredential: VCLJwt) -> [String: Any]? { + return getCredentialSubjectFromPayload(credentialPayload: jwtCredential.payload) + } + + internal static func getContextsFromCredential(_ jwtCredential: VCLJwt) -> [String]? { + guard let credentialPayloadJson = jwtCredential.payload else { + return nil + } + + let rootContextsList = getContextsFromPayload(map: credentialPayloadJson[CredentialIssuerVerifierImpl.CodingKeys.KeyVC] as? [String: Any]) + let credentialSubjectContextsList = getContextsFromPayload(map: getCredentialSubjectFromPayload(credentialPayload: credentialPayloadJson)) + + if rootContextsList == nil && credentialSubjectContextsList == nil { + return nil + } + + let rootContexts = rootContextsList as? [String] ?? [] + let credentialSubjectContexts = credentialSubjectContextsList as? [String] ?? [] + + return Array(merge(rootContexts, credentialSubjectContexts)) + } + + + private static func getCredentialSubjectFromPayload(credentialPayload: [String: Any]?) -> [String: Any]? { + guard let vcMap = credentialPayload?[CredentialIssuerVerifierImpl.CodingKeys.KeyVC] as? [String: Any], + let credentialSubject = vcMap[CredentialIssuerVerifierImpl.CodingKeys.KeyCredentialSubject] as? [String: Any] else { + return nil + } + return credentialSubject + } + + private static func getContextsFromPayload(map: [String: Any]?) -> [Any]? { + if let credentialSubjectContexts = map?[CredentialIssuerVerifierImpl.CodingKeys.KeyContext] as? [Any] { + return credentialSubjectContexts + } + if let credentialSubjectContext = map?[CredentialIssuerVerifierImpl.CodingKeys.KeyContext] as? String { + return [credentialSubjectContext] + } + return nil + } + + + internal static func getIdentifier( + _ primaryOrgProp: String?, + _ jsonObject: [String: Any] + ) -> String? { + if(primaryOrgProp == nil) { + return nil + } + var identifier: String? = nil + var stack = [[String: Any]]() + stack.append(jsonObject) + + while (stack.isEmpty == false) { + let obj = stack.remove(at: stack.count - 1) + + identifier = getPrimaryIdentifier(obj[primaryOrgProp!]) + if (identifier != nil) { + break + } + + obj.forEach { _, value in + if let valueDict = value as? [String: Any] { + stack.append(valueDict) + } + } + } + return identifier + } + + internal static func getPrimaryIdentifier( + _ credentialSubject: Any? + ) -> String? { + if ((credentialSubject as? String)?.isEmpty == false) { + return credentialSubject as? String + } + return (credentialSubject as? [String: Any])?["identifier"] as? String + ?? (credentialSubject as? [String: Any])?["id"] as? String + } + + internal static func offersFromJsonArray(offersJsonArray: [[String: Any]]) -> [VCLOffer] { + var allOffers = [VCLOffer]() + offersJsonArray.forEach { + allOffers.append(VCLOffer(payload: $0)) + } + return allOffers + } + + internal static func getCredentialIssuerId(jwtCredential: VCLJwt) -> String? { + let vc: [String: Any]? = jwtCredential.payload?["vc"] as? [String: Any] + return (vc?["issuer"] as? [String: Any])?["id"] as? String ?? vc?["issuer"] as? String + } +} diff --git a/VCL/VCL/impl/domain/infrastructure/db/CacheService.swift b/VCL/VCL/impl/domain/infrastructure/db/CacheService.swift index 97208eb..ce9b8fb 100644 --- a/VCL/VCL/impl/domain/infrastructure/db/CacheService.swift +++ b/VCL/VCL/impl/domain/infrastructure/db/CacheService.swift @@ -9,7 +9,7 @@ import Foundation -protocol CacheService: Sendable { +protocol CacheService { func getCountries(key: String) -> Data? func setCountries(key: String, value: Data, cacheSequence: Int) func isResetCacheCountries(cacheSequence: Int) -> Bool diff --git a/VCL/VCL/impl/domain/infrastructure/executors/Dispatcher.swift b/VCL/VCL/impl/domain/infrastructure/executors/Dispatcher.swift index 3b15203..ba726ae 100644 --- a/VCL/VCL/impl/domain/infrastructure/executors/Dispatcher.swift +++ b/VCL/VCL/impl/domain/infrastructure/executors/Dispatcher.swift @@ -9,7 +9,7 @@ import Foundation -protocol Dispatcher: Sendable { +protocol Dispatcher { func enter() func leave() func notify(qos: DispatchQoS, flags: DispatchWorkItemFlags, queue: DispatchQueue, execute work: @escaping @convention(block) () -> Void) diff --git a/VCL/VCL/impl/domain/infrastructure/executors/DsptchQueue.swift b/VCL/VCL/impl/domain/infrastructure/executors/DsptchQueue.swift index 7e17138..42fd4be 100644 --- a/VCL/VCL/impl/domain/infrastructure/executors/DsptchQueue.swift +++ b/VCL/VCL/impl/domain/infrastructure/executors/DsptchQueue.swift @@ -10,6 +10,6 @@ import Foundation protocol DsptchQueue { - func async(flags: DispatchWorkItemFlags, _ block: @escaping @Sendable () -> Void) - func sync(_ block: @escaping @Sendable () -> T) -> T + func async(flags: DispatchWorkItemFlags, _ block: @escaping () -> Void) + func sync(_ block: @escaping () -> T) -> T } diff --git a/VCL/VCL/impl/domain/infrastructure/executors/Executor.swift b/VCL/VCL/impl/domain/infrastructure/executors/Executor.swift index f635413..d80cd8d 100644 --- a/VCL/VCL/impl/domain/infrastructure/executors/Executor.swift +++ b/VCL/VCL/impl/domain/infrastructure/executors/Executor.swift @@ -9,7 +9,7 @@ import Foundation -protocol Executor: Sendable { - func runOnMain(_ block: @escaping @Sendable () -> Void) - func runOnBackground(_ block: @escaping @Sendable () -> Void) +protocol Executor { + func runOnMain(_ block: @escaping () -> Void) + func runOnBackground(_ block: @escaping () -> Void) } diff --git a/VCL/VCL/impl/domain/infrastructure/network/NetworkService.swift b/VCL/VCL/impl/domain/infrastructure/network/NetworkService.swift index f9fd8b2..10a0c46 100644 --- a/VCL/VCL/impl/domain/infrastructure/network/NetworkService.swift +++ b/VCL/VCL/impl/domain/infrastructure/network/NetworkService.swift @@ -9,7 +9,7 @@ import Foundation -protocol NetworkService: Sendable { +protocol NetworkService { func sendRequest( endpoint: String, body: String?, @@ -17,7 +17,7 @@ protocol NetworkService: Sendable { method: Request.HttpMethod, headers: Array<(String, String)>?, cachePolicy: NSURLRequest.CachePolicy, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } @@ -29,7 +29,7 @@ extension NetworkService { method: Request.HttpMethod, headers: Array<(String, String)>? = nil, cachePolicy: NSURLRequest.CachePolicy = .reloadIgnoringLocalCacheData, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { sendRequest( endpoint: endpoint, diff --git a/VCL/VCL/impl/domain/models/CountriesModel.swift b/VCL/VCL/impl/domain/models/CountriesModel.swift index addeaec..3decf94 100644 --- a/VCL/VCL/impl/domain/models/CountriesModel.swift +++ b/VCL/VCL/impl/domain/models/CountriesModel.swift @@ -13,6 +13,6 @@ protocol CountriesModel: Model { var data: VCLCountries? { get } func initialize( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/models/CredentialTypeSchemasModel.swift b/VCL/VCL/impl/domain/models/CredentialTypeSchemasModel.swift index 91736b6..50a9e6e 100644 --- a/VCL/VCL/impl/domain/models/CredentialTypeSchemasModel.swift +++ b/VCL/VCL/impl/domain/models/CredentialTypeSchemasModel.swift @@ -13,6 +13,6 @@ protocol CredentialTypeSchemasModel: Model { var data: VCLCredentialTypeSchemas? { get } func initialize( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/models/CredentialTypesModel.swift b/VCL/VCL/impl/domain/models/CredentialTypesModel.swift index d199434..8abb89f 100644 --- a/VCL/VCL/impl/domain/models/CredentialTypesModel.swift +++ b/VCL/VCL/impl/domain/models/CredentialTypesModel.swift @@ -13,7 +13,7 @@ protocol CredentialTypesModel: Model { var data: VCLCredentialTypes? { get } func initialize( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) func credentialTypeByTypeName(type: String) -> VCLCredentialType? } diff --git a/VCL/VCL/impl/domain/models/Model.swift b/VCL/VCL/impl/domain/models/Model.swift index 006db66..e5d0f53 100644 --- a/VCL/VCL/impl/domain/models/Model.swift +++ b/VCL/VCL/impl/domain/models/Model.swift @@ -9,11 +9,11 @@ import Foundation -protocol Model: Sendable { +protocol Model { var data: T? { get } } extension Model { - typealias T = Sendable - var data: Sendable? { nil } + typealias T = Any + var data: Any? { nil } } diff --git a/VCL/VCL/impl/domain/repositories/CountriesRepository.swift b/VCL/VCL/impl/domain/repositories/CountriesRepository.swift index 80ff4c4..7de6181 100644 --- a/VCL/VCL/impl/domain/repositories/CountriesRepository.swift +++ b/VCL/VCL/impl/domain/repositories/CountriesRepository.swift @@ -9,9 +9,9 @@ import Foundation -protocol CountriesRepository: Sendable { +protocol CountriesRepository { func getCountries( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/repositories/CredentialManifestRepository.swift b/VCL/VCL/impl/domain/repositories/CredentialManifestRepository.swift index bcea1d8..802dcab 100644 --- a/VCL/VCL/impl/domain/repositories/CredentialManifestRepository.swift +++ b/VCL/VCL/impl/domain/repositories/CredentialManifestRepository.swift @@ -9,9 +9,9 @@ import Foundation -protocol CredentialManifestRepository: Sendable { +protocol CredentialManifestRepository { func getCredentialManifest( credentialManifestDescriptor: VCLCredentialManifestDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/repositories/CredentialTypeSchemaRepository.swift b/VCL/VCL/impl/domain/repositories/CredentialTypeSchemaRepository.swift index af8b2ae..4863234 100644 --- a/VCL/VCL/impl/domain/repositories/CredentialTypeSchemaRepository.swift +++ b/VCL/VCL/impl/domain/repositories/CredentialTypeSchemaRepository.swift @@ -9,10 +9,10 @@ import Foundation -protocol CredentialTypeSchemaRepository: Sendable { +protocol CredentialTypeSchemaRepository { func getCredentialTypeSchema( schemaName: String, cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/repositories/CredentialTypesRepository.swift b/VCL/VCL/impl/domain/repositories/CredentialTypesRepository.swift index 40ac454..961e20b 100644 --- a/VCL/VCL/impl/domain/repositories/CredentialTypesRepository.swift +++ b/VCL/VCL/impl/domain/repositories/CredentialTypesRepository.swift @@ -9,9 +9,9 @@ import Foundation -protocol CredentialTypesRepository: Sendable { +protocol CredentialTypesRepository { func getCredentialTypes( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/repositories/CredentialTypesUIFormSchemaRepository.swift b/VCL/VCL/impl/domain/repositories/CredentialTypesUIFormSchemaRepository.swift index fc96c69..1782941 100644 --- a/VCL/VCL/impl/domain/repositories/CredentialTypesUIFormSchemaRepository.swift +++ b/VCL/VCL/impl/domain/repositories/CredentialTypesUIFormSchemaRepository.swift @@ -9,10 +9,10 @@ import Foundation -protocol CredentialTypesUIFormSchemaRepository: Sendable { +protocol CredentialTypesUIFormSchemaRepository { func getCredentialTypesUIFormSchema( credentialTypesUIFormSchemaDescriptor: VCLCredentialTypesUIFormSchemaDescriptor, countries: VCLCountries, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/repositories/ExchangeProgressRepository.swift b/VCL/VCL/impl/domain/repositories/ExchangeProgressRepository.swift index 39a8fe5..68e9ea1 100644 --- a/VCL/VCL/impl/domain/repositories/ExchangeProgressRepository.swift +++ b/VCL/VCL/impl/domain/repositories/ExchangeProgressRepository.swift @@ -9,9 +9,9 @@ import Foundation -protocol ExchangeProgressRepository: Sendable { +protocol ExchangeProgressRepository { func getExchangeProgress( exchangeDescriptor: VCLExchangeDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/repositories/FinalizeOffersRepository.swift b/VCL/VCL/impl/domain/repositories/FinalizeOffersRepository.swift index 9f45676..fa6055a 100644 --- a/VCL/VCL/impl/domain/repositories/FinalizeOffersRepository.swift +++ b/VCL/VCL/impl/domain/repositories/FinalizeOffersRepository.swift @@ -9,11 +9,11 @@ import Foundation -protocol FinalizeOffersRepository: Sendable { +protocol FinalizeOffersRepository { func finalizeOffers( finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, sessionToken: VCLToken, proof: VCLJwt?, - completionBlock: @escaping @Sendable (VCLResult<[VCLJwt]>) -> Void + completionBlock: @escaping (VCLResult<[VCLJwt]>) -> Void ) } diff --git a/VCL/VCL/impl/domain/repositories/GenerateOffersRepository.swift b/VCL/VCL/impl/domain/repositories/GenerateOffersRepository.swift index 42aae7c..a91e516 100644 --- a/VCL/VCL/impl/domain/repositories/GenerateOffersRepository.swift +++ b/VCL/VCL/impl/domain/repositories/GenerateOffersRepository.swift @@ -9,9 +9,9 @@ import Foundation -protocol GenerateOffersRepository: Sendable { +protocol GenerateOffersRepository { func generateOffers( generateOffersDescriptor: VCLGenerateOffersDescriptor, sessionToken: VCLToken, - completionBlock: @escaping @Sendable (VCLResult) -> Void) + completionBlock: @escaping (VCLResult) -> Void) } diff --git a/VCL/VCL/impl/domain/repositories/JwtServiceRepository.swift b/VCL/VCL/impl/domain/repositories/JwtServiceRepository.swift index a63a43e..6504fe6 100644 --- a/VCL/VCL/impl/domain/repositories/JwtServiceRepository.swift +++ b/VCL/VCL/impl/domain/repositories/JwtServiceRepository.swift @@ -9,19 +9,19 @@ import Foundation -protocol JwtServiceRepository: Sendable { +protocol JwtServiceRepository { func verifyJwt( jwt: VCLJwt, publicJwk: VCLPublicJwk, remoteCryptoServicesToken: VCLToken?, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) func generateSignedJwt( jwtDescriptor: VCLJwtDescriptor, nonce: String?, // nonce == challenge didJwk: VCLDidJwk, remoteCryptoServicesToken: VCLToken?, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } @@ -31,7 +31,7 @@ extension JwtServiceRepository { nonce: String? = nil, didJwk: VCLDidJwk, remoteCryptoServicesToken: VCLToken? = nil, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { generateSignedJwt( jwtDescriptor: jwtDescriptor, diff --git a/VCL/VCL/impl/domain/repositories/KeyServiceRepository.swift b/VCL/VCL/impl/domain/repositories/KeyServiceRepository.swift index 34b9e62..f218d12 100644 --- a/VCL/VCL/impl/domain/repositories/KeyServiceRepository.swift +++ b/VCL/VCL/impl/domain/repositories/KeyServiceRepository.swift @@ -9,9 +9,9 @@ import Foundation -protocol KeyServiceRepository: Sendable { +protocol KeyServiceRepository { func generateDidJwk( didJwkDescriptor: VCLDidJwkDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/repositories/OrganizationsRepository.swift b/VCL/VCL/impl/domain/repositories/OrganizationsRepository.swift index deaade4..ea874eb 100644 --- a/VCL/VCL/impl/domain/repositories/OrganizationsRepository.swift +++ b/VCL/VCL/impl/domain/repositories/OrganizationsRepository.swift @@ -9,9 +9,9 @@ import Foundation -protocol OrganizationsRepository: Sendable { +protocol OrganizationsRepository { func searchForOrganizations( organizationsSearchDescriptor: VCLOrganizationsSearchDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/repositories/PresentationRequestRepository.swift b/VCL/VCL/impl/domain/repositories/PresentationRequestRepository.swift index 3a509a4..05f26bf 100644 --- a/VCL/VCL/impl/domain/repositories/PresentationRequestRepository.swift +++ b/VCL/VCL/impl/domain/repositories/PresentationRequestRepository.swift @@ -9,9 +9,9 @@ import Foundation -protocol PresentationRequestRepository: Sendable { +protocol PresentationRequestRepository { func getPresentationRequest( presentationRequestDescriptor: VCLPresentationRequestDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/repositories/ResolveKidRepository.swift b/VCL/VCL/impl/domain/repositories/ResolveKidRepository.swift index 3c3f544..a4d7acc 100644 --- a/VCL/VCL/impl/domain/repositories/ResolveKidRepository.swift +++ b/VCL/VCL/impl/domain/repositories/ResolveKidRepository.swift @@ -9,9 +9,9 @@ import Foundation -protocol ResolveKidRepository: Sendable { +protocol ResolveKidRepository { func getPublicKey( kid: String, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/repositories/SubmissionRepository.swift b/VCL/VCL/impl/domain/repositories/SubmissionRepository.swift index d7049f3..97f13c3 100644 --- a/VCL/VCL/impl/domain/repositories/SubmissionRepository.swift +++ b/VCL/VCL/impl/domain/repositories/SubmissionRepository.swift @@ -9,10 +9,10 @@ import Foundation -protocol SubmissionRepository: Sendable { +protocol SubmissionRepository { func submit( submission: VCLSubmission, jwt: VCLJwt, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/repositories/VerifiedProfileRepository.swift b/VCL/VCL/impl/domain/repositories/VerifiedProfileRepository.swift index 71c771f..9a20f87 100644 --- a/VCL/VCL/impl/domain/repositories/VerifiedProfileRepository.swift +++ b/VCL/VCL/impl/domain/repositories/VerifiedProfileRepository.swift @@ -9,9 +9,9 @@ import Foundation -protocol VerifiedProfileRepository: Sendable { +protocol VerifiedProfileRepository { func getVerifiedProfile( verifiedProfileDescriptor: VCLVerifiedProfileDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/usecases/CountriesUseCase.swift b/VCL/VCL/impl/domain/usecases/CountriesUseCase.swift index b6dd61e..4df19cc 100644 --- a/VCL/VCL/impl/domain/usecases/CountriesUseCase.swift +++ b/VCL/VCL/impl/domain/usecases/CountriesUseCase.swift @@ -9,9 +9,9 @@ import Foundation -protocol CountriesUseCase: Sendable { +protocol CountriesUseCase { func getCountries( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/usecases/CredentialManifestUseCase.swift b/VCL/VCL/impl/domain/usecases/CredentialManifestUseCase.swift index 8d65dbf..322e332 100644 --- a/VCL/VCL/impl/domain/usecases/CredentialManifestUseCase.swift +++ b/VCL/VCL/impl/domain/usecases/CredentialManifestUseCase.swift @@ -9,10 +9,10 @@ import Foundation -protocol CredentialManifestUseCase: Sendable { +protocol CredentialManifestUseCase { func getCredentialManifest( credentialManifestDescriptor: VCLCredentialManifestDescriptor, verifiedProfile: VCLVerifiedProfile, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/usecases/CredentialTypeSchemasUseCase.swift b/VCL/VCL/impl/domain/usecases/CredentialTypeSchemasUseCase.swift index 38cff38..543a3d7 100644 --- a/VCL/VCL/impl/domain/usecases/CredentialTypeSchemasUseCase.swift +++ b/VCL/VCL/impl/domain/usecases/CredentialTypeSchemasUseCase.swift @@ -7,9 +7,9 @@ // Copyright 2022 Velocity Career Labs inc. // SPDX-License-Identifier: Apache-2.0 -protocol CredentialTypeSchemasUseCase: Sendable { +protocol CredentialTypeSchemasUseCase { func getCredentialTypeSchemas( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/usecases/CredentialTypesFormSchemaUseCase.swift b/VCL/VCL/impl/domain/usecases/CredentialTypesFormSchemaUseCase.swift index 70f4115..bbc24c8 100644 --- a/VCL/VCL/impl/domain/usecases/CredentialTypesFormSchemaUseCase.swift +++ b/VCL/VCL/impl/domain/usecases/CredentialTypesFormSchemaUseCase.swift @@ -9,10 +9,10 @@ import Foundation -protocol CredentialTypesUIFormSchemaUseCase: Sendable { +protocol CredentialTypesUIFormSchemaUseCase { func getCredentialTypesUIFormSchema( credentialTypesUIFormSchemaDescriptor: VCLCredentialTypesUIFormSchemaDescriptor, countries: VCLCountries, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/usecases/CredentialTypesUseCase.swift b/VCL/VCL/impl/domain/usecases/CredentialTypesUseCase.swift index 7154f19..90120f0 100644 --- a/VCL/VCL/impl/domain/usecases/CredentialTypesUseCase.swift +++ b/VCL/VCL/impl/domain/usecases/CredentialTypesUseCase.swift @@ -7,9 +7,9 @@ // Copyright 2022 Velocity Career Labs inc. // SPDX-License-Identifier: Apache-2.0 -protocol CredentialTypesUseCase: Sendable { +protocol CredentialTypesUseCase { func getCredentialTypes( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/usecases/ExchangeProgressUseCase.swift b/VCL/VCL/impl/domain/usecases/ExchangeProgressUseCase.swift index 1c6cff3..ad18296 100644 --- a/VCL/VCL/impl/domain/usecases/ExchangeProgressUseCase.swift +++ b/VCL/VCL/impl/domain/usecases/ExchangeProgressUseCase.swift @@ -9,9 +9,9 @@ import Foundation -protocol ExchangeProgressUseCase: Sendable { +protocol ExchangeProgressUseCase { func getExchangeProgress( exchangeDescriptor: VCLExchangeDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/usecases/FinalizeOffersUseCase.swift b/VCL/VCL/impl/domain/usecases/FinalizeOffersUseCase.swift index eedb562..82d5b72 100644 --- a/VCL/VCL/impl/domain/usecases/FinalizeOffersUseCase.swift +++ b/VCL/VCL/impl/domain/usecases/FinalizeOffersUseCase.swift @@ -9,10 +9,10 @@ import Foundation -protocol FinalizeOffersUseCase: Sendable { +protocol FinalizeOffersUseCase { func finalizeOffers( finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, sessionToken: VCLToken, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/usecases/GenerateOffersUseCase.swift b/VCL/VCL/impl/domain/usecases/GenerateOffersUseCase.swift index 6c46e2c..c2540fb 100644 --- a/VCL/VCL/impl/domain/usecases/GenerateOffersUseCase.swift +++ b/VCL/VCL/impl/domain/usecases/GenerateOffersUseCase.swift @@ -9,10 +9,10 @@ import Foundation -protocol GenerateOffersUseCase: Sendable { +protocol GenerateOffersUseCase { func generateOffers( generateOffersDescriptor: VCLGenerateOffersDescriptor, sessionToken: VCLToken, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/usecases/JwtServiceUseCase.swift b/VCL/VCL/impl/domain/usecases/JwtServiceUseCase.swift index 26a8410..16f3e8e 100644 --- a/VCL/VCL/impl/domain/usecases/JwtServiceUseCase.swift +++ b/VCL/VCL/impl/domain/usecases/JwtServiceUseCase.swift @@ -9,19 +9,19 @@ import Foundation -protocol JwtServiceUseCase: Sendable { +protocol JwtServiceUseCase { func verifyJwt( jwt: VCLJwt, publicJwk: VCLPublicJwk, remoteCryptoServicesToken: VCLToken?, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) func generateSignedJwt( jwtDescriptor: VCLJwtDescriptor, nonce: String?, didJwk: VCLDidJwk, remoteCryptoServicesToken: VCLToken?, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } @@ -31,7 +31,7 @@ extension JwtServiceUseCase { nonce: String? = nil, didJwk: VCLDidJwk, remoteCryptoServicesToken: VCLToken?, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { generateSignedJwt( jwtDescriptor: jwtDescriptor, diff --git a/VCL/VCL/impl/domain/usecases/KeyServiceUserCase.swift b/VCL/VCL/impl/domain/usecases/KeyServiceUserCase.swift index 2060fd7..9854c05 100644 --- a/VCL/VCL/impl/domain/usecases/KeyServiceUserCase.swift +++ b/VCL/VCL/impl/domain/usecases/KeyServiceUserCase.swift @@ -9,9 +9,9 @@ import Foundation -protocol KeyServiceUseCase: Sendable { +protocol KeyServiceUseCase { func generateDidJwk( didJwkDescriptor: VCLDidJwkDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/usecases/OrganizationsUseCase.swift b/VCL/VCL/impl/domain/usecases/OrganizationsUseCase.swift index ee7ccd0..db933ae 100644 --- a/VCL/VCL/impl/domain/usecases/OrganizationsUseCase.swift +++ b/VCL/VCL/impl/domain/usecases/OrganizationsUseCase.swift @@ -9,9 +9,9 @@ import Foundation -protocol OrganizationsUseCase: Sendable { +protocol OrganizationsUseCase { func searchForOrganizations( organizationsSearchDescriptor: VCLOrganizationsSearchDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/usecases/PresentationRequestUseCase.swift b/VCL/VCL/impl/domain/usecases/PresentationRequestUseCase.swift index a7d7668..cedd75c 100644 --- a/VCL/VCL/impl/domain/usecases/PresentationRequestUseCase.swift +++ b/VCL/VCL/impl/domain/usecases/PresentationRequestUseCase.swift @@ -9,10 +9,10 @@ import Foundation -protocol PresentationRequestUseCase: Sendable { +protocol PresentationRequestUseCase { func getPresentationRequest( presentationRequestDescriptor: VCLPresentationRequestDescriptor, verifiedProfile: VCLVerifiedProfile, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/usecases/SubmissionUseCase.swift b/VCL/VCL/impl/domain/usecases/SubmissionUseCase.swift index 54aa6f0..c62bd2e 100644 --- a/VCL/VCL/impl/domain/usecases/SubmissionUseCase.swift +++ b/VCL/VCL/impl/domain/usecases/SubmissionUseCase.swift @@ -9,9 +9,9 @@ import Foundation -protocol SubmissionUseCase: Sendable { +protocol SubmissionUseCase { func submit( submission: VCLSubmission, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/usecases/VerifiedProfileUseCase.swift b/VCL/VCL/impl/domain/usecases/VerifiedProfileUseCase.swift index 21ab6ac..9490a4a 100644 --- a/VCL/VCL/impl/domain/usecases/VerifiedProfileUseCase.swift +++ b/VCL/VCL/impl/domain/usecases/VerifiedProfileUseCase.swift @@ -9,9 +9,9 @@ import Foundation -protocol VerifiedProfileUseCase: Sendable { +protocol VerifiedProfileUseCase { func getVerifiedProfile( verifiedProfileDescriptor: VCLVerifiedProfileDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/verifiers/CredentialDidVerifier.swift b/VCL/VCL/impl/domain/verifiers/CredentialDidVerifier.swift index 867449d..142fd60 100644 --- a/VCL/VCL/impl/domain/verifiers/CredentialDidVerifier.swift +++ b/VCL/VCL/impl/domain/verifiers/CredentialDidVerifier.swift @@ -9,10 +9,10 @@ import Foundation -protocol CredentialDidVerifier: Sendable { +protocol CredentialDidVerifier { func verifyCredentials( jwtCredentials: [VCLJwt], finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/verifiers/CredentialIssuerVerifier.swift b/VCL/VCL/impl/domain/verifiers/CredentialIssuerVerifier.swift index 8e61140..95d9a51 100644 --- a/VCL/VCL/impl/domain/verifiers/CredentialIssuerVerifier.swift +++ b/VCL/VCL/impl/domain/verifiers/CredentialIssuerVerifier.swift @@ -9,10 +9,10 @@ import Foundation -protocol CredentialIssuerVerifier: Sendable { +protocol CredentialIssuerVerifier { func verifyCredentials( jwtCredentials: [VCLJwt], finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/verifiers/CredentialManifestByDeepLinkVerifier.swift b/VCL/VCL/impl/domain/verifiers/CredentialManifestByDeepLinkVerifier.swift index ad05cc5..c822e89 100644 --- a/VCL/VCL/impl/domain/verifiers/CredentialManifestByDeepLinkVerifier.swift +++ b/VCL/VCL/impl/domain/verifiers/CredentialManifestByDeepLinkVerifier.swift @@ -9,10 +9,10 @@ import Foundation -protocol CredentialManifestByDeepLinkVerifier: Sendable { +protocol CredentialManifestByDeepLinkVerifier { func verifyCredentialManifest( credentialManifest: VCLCredentialManifest, deepLink: VCLDeepLink, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/verifiers/CredentialsByDeepLinkVerifier.swift b/VCL/VCL/impl/domain/verifiers/CredentialsByDeepLinkVerifier.swift index 20a13c7..a036963 100644 --- a/VCL/VCL/impl/domain/verifiers/CredentialsByDeepLinkVerifier.swift +++ b/VCL/VCL/impl/domain/verifiers/CredentialsByDeepLinkVerifier.swift @@ -9,10 +9,10 @@ import Foundation -protocol CredentialsByDeepLinkVerifier: Sendable { +protocol CredentialsByDeepLinkVerifier { func verifyCredentials( jwtCredentials: [VCLJwt], deepLink: VCLDeepLink, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/verifiers/OffersByDeepLinkVerifier.swift b/VCL/VCL/impl/domain/verifiers/OffersByDeepLinkVerifier.swift index 4ec15d0..f7ddd5d 100644 --- a/VCL/VCL/impl/domain/verifiers/OffersByDeepLinkVerifier.swift +++ b/VCL/VCL/impl/domain/verifiers/OffersByDeepLinkVerifier.swift @@ -9,10 +9,10 @@ import Foundation -protocol OffersByDeepLinkVerifier: Sendable { +protocol OffersByDeepLinkVerifier { func verifyOffers( offers: VCLOffers, deepLink: VCLDeepLink, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/domain/verifiers/PresentationRequestByDeepLinkVerifier.swift b/VCL/VCL/impl/domain/verifiers/PresentationRequestByDeepLinkVerifier.swift index e82d5bb..8245e30 100644 --- a/VCL/VCL/impl/domain/verifiers/PresentationRequestByDeepLinkVerifier.swift +++ b/VCL/VCL/impl/domain/verifiers/PresentationRequestByDeepLinkVerifier.swift @@ -9,10 +9,10 @@ import Foundation -protocol PresentationRequestByDeepLinkVerifier: Sendable { +protocol PresentationRequestByDeepLinkVerifier { func verifyPresentationRequest( presentationRequest: VCLPresentationRequest, deepLink: VCLDeepLink, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) } diff --git a/VCL/VCL/impl/extensions/ArrayExtensions.swift b/VCL/VCL/impl/extensions/ArrayExtensions.swift index 49803a0..8313b62 100644 --- a/VCL/VCL/impl/extensions/ArrayExtensions.swift +++ b/VCL/VCL/impl/extensions/ArrayExtensions.swift @@ -20,10 +20,16 @@ extension Array { } } -public func == (lhs: [Sendable], rhs: [Sendable] ) -> Bool { +func merge(_ arrays: Array?...) -> Set { + return arrays.compactMap{ $0 } + .compactMap{ Set($0) } + .reduce(Set()){ $0.union($1) } +} + +public func == (lhs: [Any], rhs: [Any] ) -> Bool { return NSArray(array: lhs).isEqual(to: rhs) } -public func != (lhs: [Sendable], rhs: [Sendable] ) -> Bool { +public func != (lhs: [Any], rhs: [Any] ) -> Bool { return !(lhs == rhs) } diff --git a/VCL/VCL/impl/extensions/DataExtensions.swift b/VCL/VCL/impl/extensions/DataExtensions.swift index 1cde589..a7c8382 100644 --- a/VCL/VCL/impl/extensions/DataExtensions.swift +++ b/VCL/VCL/impl/extensions/DataExtensions.swift @@ -10,13 +10,13 @@ import Foundation extension Data { - func toDictionary() -> [String: Sendable]? { - var retVal: [String: Sendable]? = nil + func toDictionary() -> [String: Any]? { + var retVal: [String: Any]? = nil do { retVal = try JSONSerialization.jsonObject( with: self, options: [] - ) as? [String : Sendable] + ) as? [String : Any] } catch { // VCLLog.error(error) @@ -24,18 +24,18 @@ extension Data { return retVal } - func toList() -> [Sendable]? { + func toList() -> [Any]? { do { - return try JSONSerialization.jsonObject(with: self, options: []) as? [Sendable] + return try JSONSerialization.jsonObject(with: self, options: []) as? [Any] } catch { // VCLLog.e(error) } return nil } - func toListOfDictionaries() -> [[String: Sendable]]? { + func toListOfDictionaries() -> [[String: Any]]? { do { - return try JSONSerialization.jsonObject(with: self, options: []) as? [[String: Sendable]] + return try JSONSerialization.jsonObject(with: self, options: []) as? [[String: Any]] } catch { // VCLLog.e(error) } diff --git a/VCL/VCL/impl/extensions/DictionaryExtensions.swift b/VCL/VCL/impl/extensions/DictionaryExtensions.swift index 2672637..a750df5 100644 --- a/VCL/VCL/impl/extensions/DictionaryExtensions.swift +++ b/VCL/VCL/impl/extensions/DictionaryExtensions.swift @@ -19,15 +19,15 @@ extension Dictionary { } } /// A recursive function that replaces all values for a given key - func update(_ dict: [String: Sendable], set value: Sendable, for key: String) -> [String: Sendable] { + func update(_ dict: [String: Any], set value: Any, for key: String) -> [String: Any] { var newDict = dict for (k, v) in newDict { if k == key { newDict[k] = value - } else if let subDict = v as? [String: Sendable] { + } else if let subDict = v as? [String: Any] { newDict[k] = update(subDict, set: value, for: key) - } else if let subArray = v as? [[String: Sendable]] { - var newArray = [[String: Sendable]]() + } else if let subArray = v as? [[String: Any]] { + var newArray = [[String: Any]]() for item in subArray { newArray.append(update(item, set: value, for: key)) } @@ -38,10 +38,10 @@ extension Dictionary { } } -public func == (lhs: [String: Sendable], rhs: [String: Sendable]) -> Bool { +public func == (lhs: [String: Any], rhs: [String: Any]) -> Bool { return NSDictionary(dictionary: lhs).isEqual(to: rhs) } -public func != (lhs: [String: Sendable], rhs: [String: Sendable]) -> Bool { +public func != (lhs: [String: Any], rhs: [String: Any]) -> Bool { return !(lhs == rhs) } diff --git a/VCL/VCL/impl/extensions/StringExtensions.swift b/VCL/VCL/impl/extensions/StringExtensions.swift index 94e7676..01db57d 100644 --- a/VCL/VCL/impl/extensions/StringExtensions.swift +++ b/VCL/VCL/impl/extensions/StringExtensions.swift @@ -49,10 +49,10 @@ extension String { return urlVars.isEmpty ? "" : "?" + urlVars.joined(separator: "&") } - func toDictionary() -> [String: Sendable]? { + func toDictionary() -> [String: Any]? { if let data = self.data(using: .utf8) { do { - return try JSONSerialization.jsonObject(with: data, options: []) as? [String: Sendable] + return try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] } catch { // VCLLog.e(error) } @@ -60,10 +60,10 @@ extension String { return nil } - func toList() -> [Sendable]? { + func toList() -> [Any]? { if let data = self.data(using: .utf8) { do { - return try JSONSerialization.jsonObject(with: data, options: []) as? [Sendable] + return try JSONSerialization.jsonObject(with: data, options: []) as? [Any] } catch { // VCLLog.error(error) } @@ -71,10 +71,10 @@ extension String { return nil } - func toListOfDictionaries() -> [[String: Sendable]]? { + func toListOfDictionaries() -> [[String: Any]]? { if let data = self.data(using: .utf8) { do { - return try JSONSerialization.jsonObject(with: data, options: []) as? [[String: Sendable]] + return try JSONSerialization.jsonObject(with: data, options: []) as? [[String: Any]] } catch { // VCLLog.error(error) } diff --git a/VCL/VCL/impl/jwt/local/VCLJwtSignServiceLocalImpl.swift b/VCL/VCL/impl/jwt/local/VCLJwtSignServiceLocalImpl.swift index 5dd037e..c6fe1c5 100644 --- a/VCL/VCL/impl/jwt/local/VCLJwtSignServiceLocalImpl.swift +++ b/VCL/VCL/impl/jwt/local/VCLJwtSignServiceLocalImpl.swift @@ -30,7 +30,7 @@ final class VCLJwtSignServiceLocalImpl: VCLJwtSignService { nonce: String? = nil, didJwk: VCLDidJwk, remoteCryptoServicesToken: VCLToken? = nil, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { let secp256k1Signer = Secp256k1Signer() getSecretReference( @@ -88,7 +88,7 @@ final class VCLJwtSignServiceLocalImpl: VCLJwtSignService { private func getSecretReference( keyId: String, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { keyServiceLocalImpl?.retrieveSecretReference(keyId: keyId, completionBlock: completionBlock) } @@ -96,8 +96,8 @@ final class VCLJwtSignServiceLocalImpl: VCLJwtSignService { private func generateClaims( jwtDescriptor: VCLJwtDescriptor, nonce: String? - ) -> [String: Sendable] { - var retVal = jwtDescriptor.payload ?? [String: Sendable]() + ) -> [String: Any] { + var retVal = jwtDescriptor.payload ?? [String: Any]() retVal[CodingKeys.KeyIss] = jwtDescriptor.iss retVal[CodingKeys.KeyAud] = jwtDescriptor.aud retVal[CodingKeys.KeySub] = randomString(length: 10) diff --git a/VCL/VCL/impl/jwt/local/VCLJwtVerifyServiceLocalImpl.swift b/VCL/VCL/impl/jwt/local/VCLJwtVerifyServiceLocalImpl.swift index 9bf51cb..1b5ec12 100644 --- a/VCL/VCL/impl/jwt/local/VCLJwtVerifyServiceLocalImpl.swift +++ b/VCL/VCL/impl/jwt/local/VCLJwtVerifyServiceLocalImpl.swift @@ -15,7 +15,7 @@ final class VCLJwtVerifyServiceLocalImpl: VCLJwtVerifyService { jwt: VCLJwt, publicJwk: VCLPublicJwk, remoteCryptoServicesToken: VCLToken? = nil, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { do { let pubKey = ECPublicJwk( diff --git a/VCL/VCL/impl/jwt/remote/VCLJwtSignServiceRemoteImpl.swift b/VCL/VCL/impl/jwt/remote/VCLJwtSignServiceRemoteImpl.swift index 992defd..b39d797 100644 --- a/VCL/VCL/impl/jwt/remote/VCLJwtSignServiceRemoteImpl.swift +++ b/VCL/VCL/impl/jwt/remote/VCLJwtSignServiceRemoteImpl.swift @@ -24,7 +24,7 @@ final class VCLJwtSignServiceRemoteImpl: VCLJwtSignService { nonce: String? = nil, didJwk: VCLDidJwk, remoteCryptoServicesToken: VCLToken? = nil, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { networkService.sendRequest( endpoint: jwtSignServiceUrl, @@ -52,10 +52,10 @@ final class VCLJwtSignServiceRemoteImpl: VCLJwtSignService { jwtDescriptor: VCLJwtDescriptor, nonce: String?, didJwk: VCLDidJwk - ) -> [String: Sendable] { - var retVal = [String: Sendable]() - var header = [String: Sendable]() - var options = [String: Sendable]() + ) -> [String: Any] { + var retVal = [String: Any]() + var header = [String: Any]() + var options = [String: Any]() var payload = jwtDescriptor.payload ?? [:] // HeaderValues.XVnfProtocolVersion == VCLXVnfProtocolVersion.XVnfProtocolVersion1 diff --git a/VCL/VCL/impl/jwt/remote/VCLJwtVerifyServiceRemoteImpl.swift b/VCL/VCL/impl/jwt/remote/VCLJwtVerifyServiceRemoteImpl.swift index ee99952..b2a17a2 100644 --- a/VCL/VCL/impl/jwt/remote/VCLJwtVerifyServiceRemoteImpl.swift +++ b/VCL/VCL/impl/jwt/remote/VCLJwtVerifyServiceRemoteImpl.swift @@ -23,7 +23,7 @@ final class VCLJwtVerifyServiceRemoteImpl: VCLJwtVerifyService { jwt: VCLJwt, publicJwk: VCLPublicJwk, remoteCryptoServicesToken: VCLToken? = nil, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { networkService.sendRequest( endpoint: jwtVerifyServiceUrl, @@ -48,7 +48,7 @@ final class VCLJwtVerifyServiceRemoteImpl: VCLJwtVerifyService { private func generatePayloadToVerify( jwt: VCLJwt, publicJwk: VCLPublicJwk - ) -> [String: Sendable] { + ) -> [String: Any] { return [ CodingKeys.KeyJwt: jwt.encodedJwt, CodingKeys.KeyPublicKey: publicJwk.valueDict diff --git a/VCL/VCL/impl/keys/VCLKeyServiceLocalImpl.swift b/VCL/VCL/impl/keys/VCLKeyServiceLocalImpl.swift index 9aad680..99c16ea 100644 --- a/VCL/VCL/impl/keys/VCLKeyServiceLocalImpl.swift +++ b/VCL/VCL/impl/keys/VCLKeyServiceLocalImpl.swift @@ -27,7 +27,7 @@ final class VCLKeyServiceLocalImpl: VCLKeyService { func generateDidJwk( didJwkDescriptor: VCLDidJwkDescriptor = VCLDidJwkDescriptor(), - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { generateSecret { [weak self] secretResult in do { @@ -53,7 +53,7 @@ final class VCLKeyServiceLocalImpl: VCLKeyService { func generateSecret( signatureAlgorithm: VCLSignatureAlgorithm = VCLSignatureAlgorithm.SECP256k1, // ignored - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { do { completionBlock(.success(try keyManagementOperations.generateKey())) @@ -64,7 +64,7 @@ final class VCLKeyServiceLocalImpl: VCLKeyService { func retrieveSecretReference( keyId: String, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { if let keyId = UUID(uuidString: keyId) { completionBlock(.success(keyManagementOperations.retrieveKeyFromStorage(withId: keyId))) @@ -75,7 +75,7 @@ final class VCLKeyServiceLocalImpl: VCLKeyService { func retrievePublicJwk( secret: VCCryptoSecret, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { do { completionBlock(.success(try tokenSigning.getPublicJwk(from: secret, withKeyId: secret.id.uuidString))) diff --git a/VCL/VCL/impl/keys/VCLKeyServiceRemoteImpl.swift b/VCL/VCL/impl/keys/VCLKeyServiceRemoteImpl.swift index 8d43319..d4e8185 100644 --- a/VCL/VCL/impl/keys/VCLKeyServiceRemoteImpl.swift +++ b/VCL/VCL/impl/keys/VCLKeyServiceRemoteImpl.swift @@ -23,7 +23,7 @@ final class VCLKeyServiceRemoteImpl: VCLKeyService { func generateDidJwk( didJwkDescriptor: VCLDidJwkDescriptor = VCLDidJwkDescriptor(), - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { networkService.sendRequest( endpoint: keyServiceUrls.createDidKeyServiceUrl, @@ -41,7 +41,7 @@ final class VCLKeyServiceRemoteImpl: VCLKeyService { .success( VCLDidJwk( did: didJwkJson[CodingKeys.KeyDid] as? String ?? "", - publicJwk: VCLPublicJwk(valueDict: didJwkJson[CodingKeys.KeyPublicJwk]as? [String: Sendable] ?? [:]), + publicJwk: VCLPublicJwk(valueDict: didJwkJson[CodingKeys.KeyPublicJwk]as? [String: Any] ?? [:]), kid: didJwkJson[CodingKeys.KeyKid] as? String ?? "", keyId: didJwkJson[CodingKeys.KeyKeyId] as? String ?? "" ) @@ -62,7 +62,7 @@ final class VCLKeyServiceRemoteImpl: VCLKeyService { private func generatePayloadToCreateDidJwk( signatureAlgorithm: VCLSignatureAlgorithm - ) -> [String: Sendable] { + ) -> [String: Any] { return [ CodingKeys.KeyCrv: signatureAlgorithm.curve, ] diff --git a/VCL/VCL/impl/utils/ProfileServiceTypeVerifier.swift b/VCL/VCL/impl/utils/ProfileServiceTypeVerifier.swift index 687e0f5..b595f48 100644 --- a/VCL/VCL/impl/utils/ProfileServiceTypeVerifier.swift +++ b/VCL/VCL/impl/utils/ProfileServiceTypeVerifier.swift @@ -9,7 +9,7 @@ import Foundation -final class ProfileServiceTypeVerifier: Sendable { +final class ProfileServiceTypeVerifier { private let verifiedProfileUseCase: VerifiedProfileUseCase @@ -20,8 +20,8 @@ final class ProfileServiceTypeVerifier: Sendable { func verifyServiceTypeOfVerifiedProfile( verifiedProfileDescriptor: VCLVerifiedProfileDescriptor, expectedServiceTypes: VCLServiceTypes, - successHandler: @escaping @Sendable (VCLVerifiedProfile) -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping (VCLVerifiedProfile) -> Void, + errorHandler: @escaping (VCLError) -> Void ) { verifiedProfileUseCase.getVerifiedProfile(verifiedProfileDescriptor: verifiedProfileDescriptor) { [weak self] verifiedProfileResult in @@ -46,8 +46,8 @@ final class ProfileServiceTypeVerifier: Sendable { private func verifyServiceType( verifiedProfile: VCLVerifiedProfile, expectedServiceTypes: VCLServiceTypes, - successHandler: @escaping @Sendable () -> Void, - errorHandler: @escaping @Sendable (VCLError) -> Void + successHandler: @escaping () -> Void, + errorHandler: @escaping (VCLError) -> Void ) { if (verifiedProfile.serviceTypes.containsAtLeastOneOf(serviceTypes: expectedServiceTypes)) { successHandler() diff --git a/VCL/VCLTests/entities/VCLFinalizeOffersDescriptorTest.swift b/VCL/VCLTests/entities/VCLFinalizeOffersDescriptorTest.swift index d796812..74b2a81 100644 --- a/VCL/VCLTests/entities/VCLFinalizeOffersDescriptorTest.swift +++ b/VCL/VCLTests/entities/VCLFinalizeOffersDescriptorTest.swift @@ -18,7 +18,7 @@ class VCLFinalizeOffersDescriptorTest: XCTestCase { private let keyService = VCLKeyServiceLocalImpl(secretStore: SecretStoreMock.Instance) private let offers = VCLOffers( - payload: [String: Sendable](), + payload: [String: Any](), all: [VCLOffer(payload: [:])], responseCode: 200, sessionToken: VCLToken(value: ""), @@ -77,7 +77,7 @@ class VCLFinalizeOffersDescriptorTest: XCTestCase { assert(requestBody["approvedOfferIds"] as? [String] == self!.approvedOfferIds) assert(requestBody["rejectedOfferIds"] as? [String] == self!.rejectedOfferIds) - let proof = requestBody["proof"] as? [String: Sendable] + let proof = requestBody["proof"] as? [String: Any] assert((proof?["proof_type"] as? String) == "jwt") assert((proof?["jwt"] as? String) == jwt.encodedJwt) // equivalent to checking nonce in proof jwt diff --git a/VCL/VCLTests/entities/VCLOffersTest.swift b/VCL/VCLTests/entities/VCLOffersTest.swift index 323a0c5..26baac9 100644 --- a/VCL/VCLTests/entities/VCLOffersTest.swift +++ b/VCL/VCLTests/entities/VCLOffersTest.swift @@ -35,7 +35,7 @@ class VCLOffersTest: XCTestCase { func testOffersFromJsonArray() { assert( - subject1.payload[VCLOffers.CodingKeys.KeyOffers] as! [[String: Sendable]] == OffersMocks.OffersJsonArrayStr.toListOfDictionaries()! + subject1.payload[VCLOffers.CodingKeys.KeyOffers] as! [[String: Any]] == OffersMocks.OffersJsonArrayStr.toListOfDictionaries()! ) assert(subject1.challenge == nil) testExpectations(subject1) @@ -46,7 +46,7 @@ class VCLOffersTest: XCTestCase { func testOffersFromJsonDictionary() { assert( - subject2.payload[VCLOffers.CodingKeys.KeyOffers] as! [[String: Sendable]] == OffersMocks.OffersJsonArrayStr.toListOfDictionaries()! + subject2.payload[VCLOffers.CodingKeys.KeyOffers] as! [[String: Any]] == OffersMocks.OffersJsonArrayStr.toListOfDictionaries()! ) assert(subject2.challenge == OffersMocks.challenge) testExpectations(subject2) @@ -57,7 +57,7 @@ class VCLOffersTest: XCTestCase { func testOffersFromEmptyJsonArray() { assert( - subject3.payload[VCLOffers.CodingKeys.KeyOffers] as! [[String: Sendable]] == OffersMocks.offersJsonEmptyArrayStr.toListOfDictionaries()! + subject3.payload[VCLOffers.CodingKeys.KeyOffers] as! [[String: Any]] == OffersMocks.offersJsonEmptyArrayStr.toListOfDictionaries()! ) assert(subject3.challenge == nil) testExpectationsEmpty(subject3) diff --git a/VCL/VCLTests/entities/VCLSubmissionTest.swift b/VCL/VCLTests/entities/VCLSubmissionTest.swift index c02cfc1..56eddd2 100644 --- a/VCL/VCLTests/entities/VCLSubmissionTest.swift +++ b/VCL/VCLTests/entities/VCLSubmissionTest.swift @@ -54,7 +54,7 @@ final class VCLSubmissionTest: XCTestCase { assert(requestBodyJsonObj[SubmissionCodingKeys.KeyExchangeId] as? String == subjectPresentationSubmission.exchangeId) assert(requestBodyJsonObj[SubmissionCodingKeys.KeyContext] as? [String] == SubmissionCodingKeys.ValueContextList) - let pushDelegateBodyJsonObj = requestBodyJsonObj[SubmissionCodingKeys.KeyPushDelegate] as! [String: Sendable] + let pushDelegateBodyJsonObj = requestBodyJsonObj[SubmissionCodingKeys.KeyPushDelegate] as! [String: Any] assert(pushDelegateBodyJsonObj[VCLPushDelegate.CodingKeys.KeyPushUrl] as? String == PresentationSubmissionMocks.PushDelegate.pushUrl) assert(pushDelegateBodyJsonObj[VCLPushDelegate.CodingKeys.KeyPushToken] as? String == PresentationSubmissionMocks.PushDelegate.pushToken) diff --git a/VCL/VCLTests/infrastructure/jwt/remote/VCLJwtSignServiceTest.swift b/VCL/VCLTests/infrastructure/jwt/remote/VCLJwtSignServiceTest.swift index 4c12e8e..1987a68 100644 --- a/VCL/VCLTests/infrastructure/jwt/remote/VCLJwtSignServiceTest.swift +++ b/VCL/VCLTests/infrastructure/jwt/remote/VCLJwtSignServiceTest.swift @@ -42,12 +42,12 @@ class VCLJwtSignServiceTest: XCTestCase { nonce: "nonce 1", didJwk: didJwk ) - let header = payloadToSign["header"] as? [String: Sendable] - let options = payloadToSign["options"] as? [String: Sendable] - let payload = payloadToSign["payload"] as? [String: Sendable] + let header = payloadToSign["header"] as? [String: Any] + let options = payloadToSign["options"] as? [String: Any] + let payload = payloadToSign["payload"] as? [String: Any] assert(header?["kid"] as? String == didJwk.kid) - assert(header?["jwk"] as? [String: Sendable] ?? [:] == didJwk.publicJwk.valueDict) + assert(header?["jwk"] as? [String: Any] ?? [:] == didJwk.publicJwk.valueDict) assert(options?["keyId"] as? String == didJwk.keyId) diff --git a/VCL/VCLTests/infrastructure/resources/CredentialTypesModelMock.swift b/VCL/VCLTests/infrastructure/resources/CredentialTypesModelMock.swift index beaa24b..018f302 100644 --- a/VCL/VCLTests/infrastructure/resources/CredentialTypesModelMock.swift +++ b/VCL/VCLTests/infrastructure/resources/CredentialTypesModelMock.swift @@ -32,7 +32,7 @@ class CredentialTypesModelMock: CredentialTypesModel { func initialize( cacheSequence: Int, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { } diff --git a/VCL/VCLTests/infrastructure/resources/EmptyExecutor.swift b/VCL/VCLTests/infrastructure/resources/EmptyExecutor.swift index 67c441f..7f083c2 100644 --- a/VCL/VCLTests/infrastructure/resources/EmptyExecutor.swift +++ b/VCL/VCLTests/infrastructure/resources/EmptyExecutor.swift @@ -12,11 +12,11 @@ import Foundation final class EmptyExecutor: Executor { - func runOnMain(_ block: @escaping @Sendable () -> Void) { + func runOnMain(_ block: @escaping () -> Void) { block() } - func runOnBackground(_ block: @escaping @Sendable () -> Void) { + func runOnBackground(_ block: @escaping () -> Void) { block() } } diff --git a/VCL/VCLTests/infrastructure/resources/valid/CredentialTypeSchemaMocks.swift b/VCL/VCLTests/infrastructure/resources/valid/CredentialTypeSchemaMocks.swift index 4f4c9e1..e5f9cbb 100644 --- a/VCL/VCLTests/infrastructure/resources/valid/CredentialTypeSchemaMocks.swift +++ b/VCL/VCLTests/infrastructure/resources/valid/CredentialTypeSchemaMocks.swift @@ -63,7 +63,7 @@ class CredentialTypeSchemaMocks { " ]}\n" static let CredentialType = VCLCredentialType( - payload: [String: Sendable](), + payload: [String: Any](), id: "60759e68c4a22d1aea4820a5", schema: "???", createdAt: "2021-04-13T13:36:40.832Z", diff --git a/VCL/VCLTests/infrastructure/resources/valid/VCLJwtSignServiceMock.swift b/VCL/VCLTests/infrastructure/resources/valid/VCLJwtSignServiceMock.swift index 79788bd..15b7646 100644 --- a/VCL/VCLTests/infrastructure/resources/valid/VCLJwtSignServiceMock.swift +++ b/VCL/VCLTests/infrastructure/resources/valid/VCLJwtSignServiceMock.swift @@ -16,7 +16,7 @@ class VCLJwtSignServiceMock: VCLJwtSignService { nonce: String?, didJwk: VCLDidJwk, remoteCryptoServicesToken: VCLToken?, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { completionBlock(.success(VCLJwt(encodedJwt: ""))) } diff --git a/VCL/VCLTests/infrastructure/resources/valid/VCLJwtVerifyServiceMock.swift b/VCL/VCLTests/infrastructure/resources/valid/VCLJwtVerifyServiceMock.swift index af8e74b..fef4420 100644 --- a/VCL/VCLTests/infrastructure/resources/valid/VCLJwtVerifyServiceMock.swift +++ b/VCL/VCLTests/infrastructure/resources/valid/VCLJwtVerifyServiceMock.swift @@ -15,7 +15,7 @@ class VCLJwtVerifyServiceMock: VCLJwtVerifyService { jwt: VCLJwt, publicJwk: VCLPublicJwk, remoteCryptoServicesToken: VCLToken?, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { completionBlock(.success(true)) } diff --git a/VCL/VCLTests/infrastructure/resources/valid/VCLKeyServiceMock.swift b/VCL/VCLTests/infrastructure/resources/valid/VCLKeyServiceMock.swift index e758923..129480d 100644 --- a/VCL/VCLTests/infrastructure/resources/valid/VCLKeyServiceMock.swift +++ b/VCL/VCLTests/infrastructure/resources/valid/VCLKeyServiceMock.swift @@ -15,26 +15,26 @@ import VCCrypto final class VCLKeyServiceMock: VCLKeyService { func generateDidJwk( didJwkDescriptor: VCLDidJwkDescriptor, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { completionBlock(.success(VCLDidJwk(did: "", publicJwk: VCLPublicJwk(valueStr: ""), kid: "", keyId: ""))) } func generateSecret( signatureAlgorithm: VCLSignatureAlgorithm, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { } func retrieveSecretReference( keyId: String, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { } func retrievePublicJwk( secret: VCCrypto.VCCryptoSecret, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { } diff --git a/VCL/VCLTests/infrastructure/resources/valid/network/NetworkServiceSuccess.swift b/VCL/VCLTests/infrastructure/resources/valid/network/NetworkServiceSuccess.swift index e7ea2d3..21cdf94 100644 --- a/VCL/VCLTests/infrastructure/resources/valid/network/NetworkServiceSuccess.swift +++ b/VCL/VCLTests/infrastructure/resources/valid/network/NetworkServiceSuccess.swift @@ -24,7 +24,7 @@ final class NetworkServiceSuccess: NetworkService { method: Request.HttpMethod, headers: Array<(String, String)>?, cachePolicy: NSURLRequest.CachePolicy, - completionBlock: @escaping @Sendable (VCLResult) -> Void + completionBlock: @escaping (VCLResult) -> Void ) { completionBlock(.success(Response(payload: self.validResponse.toData(), code: 0))) } diff --git a/VCL/VCLTests/usecases/CredentialTypesUIFormSchemaUseCaseTest.swift b/VCL/VCLTests/usecases/CredentialTypesUIFormSchemaUseCaseTest.swift index 12d0035..0fea5be 100644 --- a/VCL/VCLTests/usecases/CredentialTypesUIFormSchemaUseCaseTest.swift +++ b/VCL/VCLTests/usecases/CredentialTypesUIFormSchemaUseCaseTest.swift @@ -22,7 +22,7 @@ final class CredentialTypesUIFormSchemaUseCaseTest: XCTestCase { private var mockedCountries: VCLCountries! override func setUp() { - mockedCountries = jsonArrToCountries(CredentialTypesUIFormSchemaMocks.CountriesJson.toList() as! [[String: Sendable]]) + mockedCountries = jsonArrToCountries(CredentialTypesUIFormSchemaMocks.CountriesJson.toList() as! [[String: Any]]) } func testCredentialTypesFormSchemaFull() { @@ -41,7 +41,7 @@ final class CredentialTypesUIFormSchemaUseCaseTest: XCTestCase { countries: mockedCountries ) { do { - let addressJsonObj = try $0.get().payload["place"] as! [String: Sendable] + let addressJsonObj = try $0.get().payload["place"] as! [String: Any] let addressCountryJsonObj = addressJsonObj[VCLCredentialTypesUIFormSchema.CodingKeys.KeyAddressCountry] as! [String: Any] let addressRegionJsonObj = addressJsonObj[VCLCredentialTypesUIFormSchema.CodingKeys.KeyAddressRegion] as! [String: Any] @@ -77,7 +77,7 @@ final class CredentialTypesUIFormSchemaUseCaseTest: XCTestCase { countries: mockedCountries ) { do { - let addressJsonObj = try $0.get().payload["place"] as! [String: Sendable] + let addressJsonObj = try $0.get().payload["place"] as! [String: Any] let addressCountryJsonObj = addressJsonObj[VCLCredentialTypesUIFormSchema.CodingKeys.KeyAddressCountry] as! [String: Any] let addressRegionJsonObj = addressJsonObj[VCLCredentialTypesUIFormSchema.CodingKeys.KeyAddressRegion] as! [String: Any] @@ -113,7 +113,7 @@ final class CredentialTypesUIFormSchemaUseCaseTest: XCTestCase { countries: mockedCountries ) { do { - let addressJsonObj = try $0.get().payload["place"] as! [String: Sendable] + let addressJsonObj = try $0.get().payload["place"] as! [String: Any] let addressCountryJsonObj = addressJsonObj[VCLCredentialTypesUIFormSchema.CodingKeys.KeyAddressCountry] as! [String: Any] let addressRegionJsonObj = addressJsonObj[VCLCredentialTypesUIFormSchema.CodingKeys.KeyAddressRegion] as! [String: Any] @@ -149,9 +149,9 @@ final class CredentialTypesUIFormSchemaUseCaseTest: XCTestCase { countries: mockedCountries ) { do { - let addressJsonObj = try $0.get().payload["place"] as! [String: Sendable] - let addressCountryJsonObj = addressJsonObj[VCLCredentialTypesUIFormSchema.CodingKeys.KeyAddressCountry] as! [String: Sendable] - let addressRegionJsonObj = addressJsonObj[VCLCredentialTypesUIFormSchema.CodingKeys.KeyAddressRegion] as! [String: Sendable] + let addressJsonObj = try $0.get().payload["place"] as! [String: Any] + let addressCountryJsonObj = addressJsonObj[VCLCredentialTypesUIFormSchema.CodingKeys.KeyAddressCountry] as! [String: Any] + let addressRegionJsonObj = addressJsonObj[VCLCredentialTypesUIFormSchema.CodingKeys.KeyAddressRegion] as! [String: Any] let expectedAddressCountryCodes = addressCountryJsonObj[VCLCredentialTypesUIFormSchema.CodingKeys.KeyUiEnum] as! [String] let expectedAddressCountryNames = addressCountryJsonObj[VCLCredentialTypesUIFormSchema.CodingKeys.KeyUiNames] as? [String] @@ -194,7 +194,7 @@ final class CredentialTypesUIFormSchemaUseCaseTest: XCTestCase { } } - private func jsonArrToCountries(_ countriesArr: [[String: Sendable]]) -> VCLCountries { + private func jsonArrToCountries(_ countriesArr: [[String: Any]]) -> VCLCountries { var countries = [VCLCountry]() for i in 0.. VCLCountry { + private func parseCountry(_ countryDict: [String: Any]) -> VCLCountry { var regions: VCLRegions? = nil - if let regionsArr = countryDict[VCLCountry.Codes.KeyRegions] as? [[String: Sendable]] { + if let regionsArr = countryDict[VCLCountry.Codes.KeyRegions] as? [[String: Any]] { var regionsList = [VCLRegion]() for i in 0.. VCLExchange { + private func expectedExchange(exchangeJsonDict: [String: Any]) -> VCLExchange { return VCLExchange( id: (exchangeJsonDict[VCLExchange.CodingKeys.KeyId] as! String), type: (exchangeJsonDict[VCLExchange.CodingKeys.KeyType] as! String), diff --git a/VCL/VCLTests/usecases/JwtServiceUseCaseTest.swift b/VCL/VCLTests/usecases/JwtServiceUseCaseTest.swift index 2d4e34c..ef852de 100644 --- a/VCL/VCLTests/usecases/JwtServiceUseCaseTest.swift +++ b/VCL/VCLTests/usecases/JwtServiceUseCaseTest.swift @@ -48,7 +48,7 @@ final class JwtServiceUseCaseTest: XCTestCase { do { let jwt = try $0.get() assert(jwt.header?["alg"] as? String == VCLSignatureAlgorithm.SECP256k1.jwsAlgorithm) - assert(((jwt.header?["jwk"] as? [String: Sendable])?["crv"] as? String) == VCLSignatureAlgorithm.SECP256k1.rawValue) + assert(((jwt.header?["jwk"] as? [String: Any])?["crv"] as? String) == VCLSignatureAlgorithm.SECP256k1.rawValue) assert(jwt.header?["typ"] as? String == "JWT") } catch { XCTFail("\(error)") diff --git a/VCL/VCLTests/usecases/PresentationSubmissionUseCaseTest.swift b/VCL/VCLTests/usecases/PresentationSubmissionUseCaseTest.swift index 214f24a..ef80f25 100644 --- a/VCL/VCLTests/usecases/PresentationSubmissionUseCaseTest.swift +++ b/VCL/VCLTests/usecases/PresentationSubmissionUseCaseTest.swift @@ -69,17 +69,17 @@ final class PresentationSubmissionUseCaseTest: XCTestCase { } } - private func expectedPresentationSubmissionResult(_ jsonDict: [String: Sendable], _ jti: String, submissionId: String) -> VCLSubmissionResult { + private func expectedPresentationSubmissionResult(_ jsonDict: [String: Any], _ jti: String, submissionId: String) -> VCLSubmissionResult { let exchangeJsonDict = jsonDict[VCLSubmissionResult.CodingKeys.KeyExchange] return VCLSubmissionResult( sessionToken: VCLToken(value: (jsonDict[VCLSubmissionResult.CodingKeys.KeyToken] as! String)), - exchange: expectedExchange(exchangeJsonDict as! [String : Sendable]), + exchange: expectedExchange(exchangeJsonDict as! [String : Any]), jti: jti, submissionId: submissionId ) } - private func expectedExchange(_ exchangeJsonDict: [String: Sendable]) -> VCLExchange { + private func expectedExchange(_ exchangeJsonDict: [String: Any]) -> VCLExchange { return VCLExchange( id: (exchangeJsonDict[VCLExchange.CodingKeys.KeyId] as! String), type: (exchangeJsonDict[VCLExchange.CodingKeys.KeyType] as! String), diff --git a/VCL/VCLTests/utils/UtilsTest.swift b/VCL/VCLTests/utils/UtilsTest.swift index b84df97..f89ec1d 100644 --- a/VCL/VCLTests/utils/UtilsTest.swift +++ b/VCL/VCLTests/utils/UtilsTest.swift @@ -13,7 +13,7 @@ import XCTest class UtilsTest: XCTestCase { func testGetIdentifier() { - let jsonObject: [String: Sendable] = [ + let jsonObject: [String: AnyHashable] = [ "a": "ValueA", "b": ["identifier": "ValueB"], "c": ["id1": "ValueC"], @@ -22,49 +22,49 @@ class UtilsTest: XCTestCase { ] let primaryOrgProp = "id" - let result = Utils.getIdentifier(primaryOrgProp, jsonObject) + let result = VerificationUtils.getIdentifier(primaryOrgProp, jsonObject) // assert("ValueC" == result) // what about this case? assert("ValueD" == result) } func testGetIdentifierNoMatch() { - let jsonObject: [String: Sendable] = [ + let jsonObject: [String: AnyHashable] = [ "a": "ValueA", "b": ["identifier": "ValueB"], "c": ["x": "ValueX"] ] let primaryOrgProp = "id" - let result = Utils.getIdentifier(primaryOrgProp, jsonObject) + let result = VerificationUtils.getIdentifier(primaryOrgProp, jsonObject) assert(result == nil) } func testGetPrimaryIdentifier() { let value = "ValueX" - let result = Utils.getPrimaryIdentifier(value) + let result = VerificationUtils.getPrimaryIdentifier(value) assert("ValueX" == result) } func testGetPrimaryIdentifierMapWithId() { - let value: [String: Sendable] = ["id": "ValueY"] - let result = Utils.getPrimaryIdentifier(value) + let value = ["id": "ValueY"] + let result = VerificationUtils.getPrimaryIdentifier(value) assert("ValueY" == result) } func testGetPrimaryIdentifierMapWithIdentifier() { - let value: [String: Sendable] = ["identifier": "ValueZ"] - let result = Utils.getPrimaryIdentifier(value) + let value = ["identifier": "ValueZ"] + let result = VerificationUtils.getPrimaryIdentifier(value) assert("ValueZ" == result) } func testGetPrimaryIdentifierNull() { - let value: [String: Sendable]? = nil - let result = Utils.getPrimaryIdentifier(value) + let value: [String: AnyHashable]? = nil + let result = VerificationUtils.getPrimaryIdentifier(value) assert(result == nil) } diff --git a/VCL/VCLTests/verifiers/CredentialDidVerifierTest.swift b/VCL/VCLTests/verifiers/CredentialDidVerifierTest.swift index 9735e39..408c299 100644 --- a/VCL/VCLTests/verifiers/CredentialDidVerifierTest.swift +++ b/VCL/VCLTests/verifiers/CredentialDidVerifierTest.swift @@ -17,7 +17,7 @@ class CredentialDidVerifierTest: XCTestCase { CredentialMocks.JwtCredentialsFromNotaryIssuer.toList()?.count ?? 0 private let credentialsFromRegularIssuerAmount = CredentialMocks.JwtCredentialsFromRegularIssuer.toList()?.count ?? 0 - private let OffersMock = VCLOffers(payload: [String: Sendable](), all: [VCLOffer(payload: [:])], responseCode: 1, sessionToken: VCLToken(value: ""), challenge: "") + private let OffersMock = VCLOffers(payload: [String: Any](), all: [VCLOffer(payload: [:])], responseCode: 1, sessionToken: VCLToken(value: ""), challenge: "") var finalizeOffersDescriptorOfNotaryIssuer: VCLFinalizeOffersDescriptor! var credentialManifestFromNotaryIssuer: VCLCredentialManifest! diff --git a/VCL/VCLTests/verifiers/CredentialIssuerVerifierTest.swift b/VCL/VCLTests/verifiers/CredentialIssuerVerifierTest.swift index bfe4525..4b31904 100644 --- a/VCL/VCLTests/verifiers/CredentialIssuerVerifierTest.swift +++ b/VCL/VCLTests/verifiers/CredentialIssuerVerifierTest.swift @@ -357,7 +357,7 @@ class CredentialIssuerVerifierTest: XCTestCase { let _ = try $0.get() XCTFail("\(VCLErrorCode.InvalidCredentialSubjectContext.rawValue) error code is expected") } catch { - assert((error as! VCLError).errorCode == VCLErrorCode.InvalidCredentialSubjectContext.rawValue) + assert((error as! VCLError).errorCode == VCLErrorCode.InvalidCredentialSubjectType.rawValue) } } } diff --git a/VCL/VCLTests/verifiers/OffersByDeepLinkVerifierTest.swift b/VCL/VCLTests/verifiers/OffersByDeepLinkVerifierTest.swift index d13b634..f482ae3 100644 --- a/VCL/VCLTests/verifiers/OffersByDeepLinkVerifierTest.swift +++ b/VCL/VCLTests/verifiers/OffersByDeepLinkVerifierTest.swift @@ -23,8 +23,8 @@ class OffersByDeepLinkVerifierTest: XCTestCase { override func setUp() { offers = VCLOffers( payload: offersPayload, - all: Utils.offersFromJsonArray( - offersJsonArray: offersPayload[VCLOffers.CodingKeys.KeyOffers] as? [[String: Sendable]] ?? [] + all: VerificationUtils.offersFromJsonArray( + offersJsonArray: offersPayload[VCLOffers.CodingKeys.KeyOffers] as? [[String: Any]] ?? [] ), responseCode: 0, sessionToken: VCLToken(value: ""), From 6de8f268867ab6f2ef6f24e2e81d8bbb72666632 Mon Sep 17 00:00:00 2001 From: Michael Avoyan <64565419+michaelavoyan@users.noreply.github.com> Date: Sun, 1 Dec 2024 10:57:06 +0200 Subject: [PATCH 2/2] v2.6.9 --- VCL/VCL.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/VCL/VCL.xcodeproj/project.pbxproj b/VCL/VCL.xcodeproj/project.pbxproj index 6554cfd..99798dd 100644 --- a/VCL/VCL.xcodeproj/project.pbxproj +++ b/VCL/VCL.xcodeproj/project.pbxproj @@ -1900,7 +1900,7 @@ buildSettings = { CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 152; + CURRENT_PROJECT_VERSION = 153; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 7DDDGP43MJ; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1913,7 +1913,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 2.6.8; + MARKETING_VERSION = 2.6.9; PRODUCT_BUNDLE_IDENTIFIER = io.velocitycareerlabs.VCL; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1930,7 +1930,7 @@ buildSettings = { CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 152; + CURRENT_PROJECT_VERSION = 153; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 7DDDGP43MJ; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1943,7 +1943,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 2.6.8; + MARKETING_VERSION = 2.6.9; PRODUCT_BUNDLE_IDENTIFIER = io.velocitycareerlabs.VCL; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = "";