fix android
This commit is contained in:
+1
-2
@@ -11,8 +11,7 @@ import com.nimbusds.jose.jwk.KeyUse
|
||||
import java.util.UUID
|
||||
|
||||
class CryptoUtil {
|
||||
fun digest(data: ByteArray, algorithmName: String): ByteArray {
|
||||
if(algorithmName != "sha256") throw Exception("Unsupported algorithm")
|
||||
fun digest(data: ByteArray): ByteArray {
|
||||
val digest = MessageDigest.getInstance("sha256")
|
||||
return digest.digest(data)
|
||||
}
|
||||
|
||||
+2
-1
@@ -8,7 +8,8 @@ class ExpoBlueskyOAuthClientModule : Module() {
|
||||
override fun definition() = ModuleDefinition {
|
||||
Name("ExpoBlueskyOAuthClient")
|
||||
|
||||
AsyncFunction("digest") { value: ByteArray ->
|
||||
AsyncFunction("digest") { value: ByteArray, algorithmName: String ->
|
||||
if(algorithmName != "sha256") throw Exception("Unsupported algorithm")
|
||||
return@AsyncFunction CryptoUtil().digest(value)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user