-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Ahmed Moussa <[email protected]> Signed-off-by: Cristian G <[email protected]>
- Loading branch information
1 parent
503ff23
commit 505e022
Showing
25 changed files
with
835 additions
and
611 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
37 changes: 37 additions & 0 deletions
37
atala-prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/domain/models/Claim.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,37 @@ | ||
package io.iohk.atala.prism.walletsdk.domain.models | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
class Claim( | ||
val key: String, | ||
val value: ClaimType | ||
) | ||
|
||
@Serializable | ||
sealed class ClaimType : Comparable<ClaimType> { | ||
data class StringValue(val value: String) : ClaimType() | ||
data class BoolValue(val value: Boolean) : ClaimType() | ||
data class DataValue(val value: ByteArray) : ClaimType() | ||
data class NumberValue(val value: Double) : ClaimType() | ||
|
||
override fun compareTo(other: ClaimType): Int { | ||
return when (this) { | ||
is StringValue -> { | ||
if (other is StringValue) { | ||
value.compareTo(other.value) | ||
} else { | ||
throw IllegalArgumentException("Cannot compare different types") | ||
} | ||
} | ||
is NumberValue -> { | ||
if (other is NumberValue) { | ||
value.compareTo(other.value) | ||
} else { | ||
throw IllegalArgumentException("Cannot compare different types") | ||
} | ||
} | ||
else -> throw IllegalArgumentException("Cannot compare non-comparable types") | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...prism-sdk/src/commonMain/kotlin/io/iohk/atala/prism/walletsdk/domain/models/Credential.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,9 @@ | ||
package io.iohk.atala.prism.walletsdk.domain.models | ||
|
||
abstract interface Credential { | ||
val id: String | ||
val issuer: String | ||
val subject: String? | ||
val claims: Array<Claim> | ||
val properties: Map<String, Any?> | ||
} |
Oops, something went wrong.