Skip to content

Commit

Permalink
PIN-4112 Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
nttdata-rtorsoli committed Oct 16, 2023
1 parent f391442 commit 3e925d9
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ object KeyAdapters {
implicit class PersistentKeyWrapper(private val p: PersistentKey) extends AnyVal {
def toApi: Either[Throwable, Key] = {
val apiKey = KeyConverter.fromBase64encodedPEMToAPIKey(p.kid, p.encodedPem, p.use.toJwk, p.algorithm)
p.userId match {
case Some(userId) => apiKey.map(_ => Key(userId, p.kid, p.name, p.encodedPem, p.algorithm, p.use.toApi, p.createdAt))
case None => p.relationshipId match {
case Some(relationshipId) => apiKey.map(_ => Key(relationshipId, p.kid, p.name, p.encodedPem, p.algorithm, p.use.toApi, p.createdAt))
case None => InvalidKey(p.kid, s"User Id and Relationship Id not found on key ${p.kid}").asLeft[Key]
}
p.userId match {
case Some(userId) =>
apiKey.map(_ => Key(userId, p.kid, p.name, p.encodedPem, p.algorithm, p.use.toApi, p.createdAt))
case None =>
p.relationshipId match {
case Some(relationshipId) =>
apiKey.map(_ => Key(relationshipId, p.kid, p.name, p.encodedPem, p.algorithm, p.use.toApi, p.createdAt))
case None => InvalidKey(p.kid, s"User Id and Relationship Id not found on key ${p.kid}").asLeft[Key]
}
}
}
}
Expand Down

0 comments on commit 3e925d9

Please sign in to comment.