-
Notifications
You must be signed in to change notification settings - Fork 16
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
Decouple from UniFFI code-gen'd Web5Exception #334
Conversation
enum class Dsa { | ||
ED25519, | ||
SECP256K1; | ||
} | ||
|
||
internal fun dsaFromRustCore(rustCore: RustCoreDsa): Dsa { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect
@@ -14,8 +16,14 @@ class Ed25519Generator { | |||
* @return Jwk the JWK with private key material included. | |||
*/ | |||
fun generate(): Jwk { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chad says:
You can simplify the generate() function by removing the redundant catch block for the generic Exception, as it will automatically be propagated if not caught.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also since there are a lot of these it could be cleaner to do it this way with return try:
return try {
val rustCoreJwkData = ed25519GeneratorGenerate()
Jwk.fromRustCoreJwkData(rustCoreJwkData)
} catch (e: RustCoreException) {
throw Web5Exception.fromRustCore(e)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch! done
added this issue to investigate further for less verbose exception handling - #335 |
9d6d3b5
to
e484f59
Compare
this is the last piece to completely decouple us from uniffi codegen at the api surface
also fixed the Dsa which was still a lingering coupling