-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates from decentralised-dataexchange/main
Updates is SDK
- Loading branch information
Showing
31 changed files
with
1,541 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...et-oidc-android/src/main/java/com/ewc/eudi_wallet_oidc_android/CryptographicAlgorithms.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.ewc.eudi_wallet_oidc_android | ||
|
||
object CryptographicAlgorithms { | ||
final val ES256 = "ES256" | ||
final val EdDSA = "EdDSA" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
...idc-android/src/main/java/com/ewc/eudi_wallet_oidc_android/models/AuthorizationDetails.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
package com.ewc.eudi_wallet_oidc_android.models | ||
|
||
import com.google.gson.annotations.SerializedName | ||
data class CredentialTypeDefinition( | ||
@SerializedName("type") var type: ArrayList<String>? = arrayListOf() | ||
) | ||
|
||
data class AuthorizationDetails( | ||
|
||
@SerializedName("type") var type: String? = "openid_credential", | ||
@SerializedName("format") var format: String? = "jwt_vc", | ||
@SerializedName("format") var format: String? = null, | ||
@SerializedName("types") var types: ArrayList<String>? = arrayListOf(), | ||
@SerializedName("locations") var locations: ArrayList<String>? = arrayListOf() | ||
@SerializedName("locations") var locations: ArrayList<String>? = arrayListOf(), | ||
@SerializedName("credential_definition") var credentialDefinition: CredentialTypeDefinition? = CredentialTypeDefinition() | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...-wallet-oidc-android/src/main/java/com/ewc/eudi_wallet_oidc_android/models/DIDDocument.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.ewc.eudi_wallet_oidc_android.models | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
data class DIDDocument( | ||
@SerializedName("@context") | ||
val context: List<String>, | ||
|
||
@SerializedName("id") | ||
val id: String, | ||
|
||
@SerializedName("controller") | ||
val controller: List<String>, | ||
|
||
@SerializedName("verificationMethod") | ||
val verificationMethods: List<VerificationMethod>, | ||
|
||
@SerializedName("authentication") | ||
val authentication: List<String>, | ||
|
||
@SerializedName("assertionMethod") | ||
val assertionMethods: List<String>, | ||
|
||
@SerializedName("capabilityInvocation") | ||
val capabilityInvocations: List<String> | ||
) | ||
|
||
data class VerificationMethod( | ||
@SerializedName("id") | ||
val id: String, | ||
|
||
@SerializedName("type") | ||
val type: String, | ||
|
||
@SerializedName("controller") | ||
val controller: String, | ||
|
||
@SerializedName("publicKeyJwk") | ||
val publicKeyJwk: PublicKeyJwk | ||
) | ||
|
||
data class PublicKeyJwk( | ||
@SerializedName("kty") | ||
val kty: String, | ||
|
||
@SerializedName("crv") | ||
val crv: String, | ||
|
||
@SerializedName("x") | ||
val x: String, | ||
|
||
@SerializedName("y") | ||
val y: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
eudi-wallet-oidc-android/src/main/java/com/ewc/eudi_wallet_oidc_android/models/JwkKey.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.ewc.eudi_wallet_oidc_android.models | ||
|
||
// Data class representing a JSON Web Key (JWK). | ||
data class JwkKey( | ||
val kty: String, | ||
val kid: String, | ||
val crv: String, | ||
val x: String, | ||
val y: String, | ||
val use: String | ||
) |
4 changes: 4 additions & 0 deletions
4
...wallet-oidc-android/src/main/java/com/ewc/eudi_wallet_oidc_android/models/JwksResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.ewc.eudi_wallet_oidc_android.models | ||
|
||
// Data class representing a response containing a list of JSON Web Keys (JWKs). | ||
data class JwksResponse(val keys: List<JwkKey>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...c-android/src/main/java/com/ewc/eudi_wallet_oidc_android/models/WrappedVpTokenResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.ewc.eudi_wallet_oidc_android.models | ||
import com.google.gson.annotations.SerializedName | ||
data class VPTokenResponse( | ||
@SerializedName("location") var location: String? = null, | ||
) | ||
|
||
data class WrappedVpTokenResponse( | ||
var vpTokenResponse: VPTokenResponse? = null, | ||
var errorResponse: ErrorResponse? = null, | ||
) |
36 changes: 36 additions & 0 deletions
36
...ava/com/ewc/eudi_wallet_oidc_android/services/credentialValidation/CredentialValidator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.ewc.eudi_wallet_oidc_android.services.credentialValidation | ||
|
||
import com.ewc.eudi_wallet_oidc_android.services.exceptions.ExpiryException | ||
import com.ewc.eudi_wallet_oidc_android.services.exceptions.SignatureException | ||
|
||
class CredentialValidator:CredentialValidatorInterface { | ||
|
||
/** | ||
* Validates a JWT credential by checking its expiration and signature. | ||
* | ||
* @param jwt | ||
* @param jwksUri | ||
* @return | ||
* | ||
* Returns true if the JWT is valid; otherwise, throws IllegalArgumentException with appropriate messages. | ||
*/ | ||
@Throws(IllegalArgumentException::class) | ||
override suspend fun validateCredential(jwt: String?, jwksUri: String?): Boolean { | ||
try { | ||
// Check if the JWT has expired | ||
ExpiryValidator().isJwtExpired(jwt = jwt) | ||
|
||
// Validate the JWT signature using the provided JWKS URI | ||
SignatureValidator().validateSignature(jwt = jwt, jwksUri = jwksUri) | ||
|
||
// If both checks pass, return true indicating the credential is valid | ||
return true | ||
} catch (expiryException: ExpiryException) { | ||
// Throw IllegalArgumentException if JWT is expired | ||
throw IllegalArgumentException("JWT token expired") | ||
} catch (signatureException: SignatureException) { | ||
// Throw IllegalArgumentException if JWT signature is invalid | ||
throw IllegalArgumentException("JWT signature invalid") | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...wc/eudi_wallet_oidc_android/services/credentialValidation/CredentialValidatorInterface.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.ewc.eudi_wallet_oidc_android.services.credentialValidation | ||
|
||
interface CredentialValidatorInterface { | ||
/** | ||
* Validates a JWT credential by checking its expiration and signature. | ||
* | ||
* @param jwt | ||
* @param jwksUri | ||
* @return | ||
* | ||
* Returns true if the JWT is valid; otherwise, throws IllegalArgumentException with appropriate messages. | ||
*/ | ||
@Throws(IllegalArgumentException::class) | ||
suspend fun validateCredential(jwt: String?,jwksUri:String?):Boolean | ||
} |
Oops, something went wrong.