Skip to content

Commit

Permalink
logs
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelavoyan committed Dec 19, 2023
1 parent e31a149 commit 1d42f7e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion VCL/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
defaultConfig {
minSdk 24
targetSdk 33
versionName "1.21.0"
versionName "1.21.1"
versionCode 117
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import io.velocitycareerlabs.api.entities.VCLJwt
import io.velocitycareerlabs.api.entities.VCLJwtVerifiableCredentials
import io.velocitycareerlabs.api.entities.VCLResult
import io.velocitycareerlabs.impl.domain.verifiers.CredentialDidVerifier
import java.util.concurrent.CompletableFuture
import java.util.concurrent.CopyOnWriteArrayList

internal class CredentialDidVerifierImpl: CredentialDidVerifier {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ import io.velocitycareerlabs.api.entities.VCLResult
import io.velocitycareerlabs.api.entities.error.VCLError
import io.velocitycareerlabs.api.entities.error.VCLErrorCode
import io.velocitycareerlabs.impl.domain.verifiers.CredentialManifestByDeepLinkVerifier
import io.velocitycareerlabs.impl.utils.VCLLog

class CredentialManifestByDeepLinkVerifierImpl: CredentialManifestByDeepLinkVerifier {
private val TAG = CredentialManifestByDeepLinkVerifierImpl::class.simpleName

override fun verifyCredentialManifest(
credentialManifest: VCLCredentialManifest,
deepLink: VCLDeepLink,
Expand All @@ -22,6 +25,7 @@ class CredentialManifestByDeepLinkVerifierImpl: CredentialManifestByDeepLinkVeri
if (credentialManifest.issuerId == deepLink.did) {
completionBlock(VCLResult.Success(true))
} else {
VCLLog.e(TAG, "credential manifest: ${credentialManifest.jwt.encodedJwt} \ndeepLink: ${deepLink.value}")
completionBlock((VCLResult.Failure(VCLError(errorCode = VCLErrorCode.MismatchedRequestIssuerDid.value))))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ import io.velocitycareerlabs.api.entities.VCLResult
import io.velocitycareerlabs.api.entities.error.VCLError
import io.velocitycareerlabs.api.entities.error.VCLErrorCode
import io.velocitycareerlabs.impl.domain.verifiers.CredentialsByDeepLinkVerifier
import java.util.concurrent.CompletableFuture
import io.velocitycareerlabs.impl.utils.VCLLog

class CredentialsByDeepLinkVerifierImpl: CredentialsByDeepLinkVerifier {
private val TAG = CredentialsByDeepLinkVerifierImpl::class.simpleName

override fun verifyCredentials(
jwtCredentials: List<VCLJwt>,
deepLink: VCLDeepLink,
completionBlock: (VCLResult<Boolean>) -> Unit
) {
val errorCredential = jwtCredentials.find { it.iss != deepLink.did }
errorCredential?.let {
jwtCredentials.find { it.iss != deepLink.did }?.let { mismatchedCredential ->
VCLLog.e(TAG, "mismatched credential: ${mismatchedCredential.encodedJwt} \ndeepLink: ${deepLink.value}")
completionBlock(VCLResult.Failure(VCLError(errorCode = VCLErrorCode.MismatchedCredentialIssuerDid.value)))
} ?: run {
completionBlock(VCLResult.Success(true))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ import io.velocitycareerlabs.api.entities.VCLResult
import io.velocitycareerlabs.api.entities.error.VCLError
import io.velocitycareerlabs.api.entities.error.VCLErrorCode
import io.velocitycareerlabs.impl.domain.verifiers.OffersByDeepLinkVerifier
import io.velocitycareerlabs.impl.utils.VCLLog

class OffersByDeepLinkVerifierImpl: OffersByDeepLinkVerifier {
private val TAG = OffersByDeepLinkVerifierImpl::class.simpleName

override fun verifyOffers(
offers: VCLOffers,
deepLink: VCLDeepLink,
completionBlock: (VCLResult<Boolean>) -> Unit
) {
val errorOffer = offers.all.find { it.issuerId != deepLink.did }
errorOffer?.let {
offers.all.find { it.issuerId != deepLink.did }?.let { mismatchedOffer ->
VCLLog.e(TAG, "mismatched offer: ${mismatchedOffer.payload} \ndeepLink: ${deepLink.value}")
completionBlock(VCLResult.Failure(VCLError(errorCode = VCLErrorCode.MismatchedOfferIssuerDid.value)))
} ?: run {
completionBlock(VCLResult.Success(true))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ import io.velocitycareerlabs.api.entities.VCLResult
import io.velocitycareerlabs.api.entities.error.VCLError
import io.velocitycareerlabs.api.entities.error.VCLErrorCode
import io.velocitycareerlabs.impl.domain.verifiers.PresentationRequestByDeepLinkVerifier
import io.velocitycareerlabs.impl.utils.VCLLog

class PresentationRequestByDeepLinkVerifierImpl: PresentationRequestByDeepLinkVerifier {
private val TAG = PresentationRequestByDeepLinkVerifierImpl::class.simpleName

override fun verifyPresentationRequest(
presentationRequest: VCLPresentationRequest,
deepLink: VCLDeepLink,
Expand All @@ -22,6 +25,7 @@ class PresentationRequestByDeepLinkVerifierImpl: PresentationRequestByDeepLinkVe
if (presentationRequest.iss == deepLink.did) {
completionBlock(VCLResult.Success(true))
} else {
VCLLog.e(TAG, "presentation request: ${presentationRequest.jwt.encodedJwt} \ndeepLink: ${deepLink.value}")
completionBlock(VCLResult.Failure(
VCLError(errorCode = VCLErrorCode.MismatchedPresentationRequestInspectorDid.value)
))
Expand Down

0 comments on commit 1d42f7e

Please sign in to comment.