Skip to content

Commit

Permalink
Check if is a valid method
Browse files Browse the repository at this point in the history
  • Loading branch information
greenart7c3 committed Jan 10, 2025
1 parent 4ab6f3f commit e280be1
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ object IntentUtils {
if (parameters.isEmpty() || parameters.toString() == "[]") {
getIntentDataFromIntent(context, intent, packageName, route, account, onReady)
} else {
var type = SignerType.SIGN_EVENT
var type = SignerType.INVALID
var pubKey = ""
var compressionType = CompressionType.NONE
var callbackUrl: String? = null
Expand All @@ -119,7 +119,7 @@ object IntentUtils {
"nip04_decrypt" -> SignerType.NIP04_DECRYPT
"nip44_encrypt" -> SignerType.NIP44_ENCRYPT
"nip44_decrypt" -> SignerType.NIP44_DECRYPT
else -> SignerType.SIGN_EVENT
else -> SignerType.INVALID
}
}
if (parameter.toLowerCase(Locale.current) == "pubkey") {
Expand All @@ -143,6 +143,11 @@ object IntentUtils {
}
}

if (type == SignerType.INVALID) {
onReady(null)
return
}

when (type) {
SignerType.SIGN_EVENT -> {
val unsignedEvent = getUnsignedEvent(localData, account)
Expand Down Expand Up @@ -281,9 +286,14 @@ object IntentUtils {
"nip44_encrypt" -> SignerType.NIP44_ENCRYPT
"get_public_key" -> SignerType.GET_PUBLIC_KEY
"decrypt_zap_event" -> SignerType.DECRYPT_ZAP_EVENT
else -> SignerType.SIGN_EVENT
else -> SignerType.INVALID
}

if (type == SignerType.INVALID) {
onReady(null)
return
}

val data =
try {
decodeData(intent.data?.toString() ?: "", packageName == null)
Expand Down

0 comments on commit e280be1

Please sign in to comment.