Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android, iOS] added expected/missing methods to platform source sets #846

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ class AndroidKey() : Key() {
TODO("Not yet implemented")
}

override suspend fun deleteKey(): Boolean = kotlin.runCatching { keyStore.deleteEntry(internalKeyId) }.isSuccess

private fun getSignature(): Signature {
val sig = when (keyType) {
KeyType.secp256k1 -> Signature.getInstance(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ class IosKey private constructor(
override suspend fun getMeta(): KeyMeta {
error("Not yet implemented")
}

override suspend fun deleteKey(): Boolean = kotlin.runCatching {
when (options.keyType) {
KeyType.secp256r1 -> P256.PrivateKey.deleteFromKeychain(options.kid)
KeyType.Ed25519 -> Ed25519.PrivateKey.deleteFromKeychain(options.kid)
KeyType.RSA -> RSA.PrivateKey.deleteFromKeychain(options.kid)
else -> error("Not implemented")
}
}.isSuccess
}

// utility functions for swift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ actual class JWKKey actual constructor(private val jwk: String?, private val _ke
TODO("Not yet implemented")
}

actual override suspend fun deleteKey(): Boolean {
TODO("Not yet implemented")
}

actual override val hasPrivateKey: Boolean
get() = _jwkObj.toMap().any { it.key in privateParameters }

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package id.walt.oid4vc.util

import id.walt.oid4vc.providers.TokenTarget

actual object COSESign1Utils {
actual fun verifyCOSESign1Signature(
target: TokenTarget,
token: String
): Boolean {
TODO("Not yet implemented")
}
}