Skip to content

Commit

Permalink
add id and type to credentials class
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkNenadov committed Jun 5, 2023
1 parent 7ba185e commit e0fa83c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package org.pythonbyte.haveibeenkwned.domain
import org.pythonbyte.krux.json.JsonObject

class KpasswordlessCredential {
var id = ""
var type = ""
var publicKey = ""
var userHandle = ""
var origin = ""
Expand All @@ -14,6 +16,10 @@ class KpasswordlessCredential {
return array.map { jsonObject ->
val credential = KpasswordlessCredential()

val descriptorObject = jsonObject.getObject("descriptor")

credential.id = descriptorObject.getString("id")
credential.type = descriptorObject.getString( "type" )
credential.publicKey = jsonObject.getString("publicKey")
credential.userHandle = jsonObject.getString("userHandle")
credential.origin = jsonObject.getString("origin")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class KpasswordlessServiceTest {
assertTrue( credentials.size > 0 )

credentials.forEach { credential ->
println("Id: " + credential.id)
println("Type: " + credential.type)
println("User Handle: " + credential.userHandle)
println("Device: " + credential.device)
}
Expand Down

0 comments on commit e0fa83c

Please sign in to comment.