Remove the sign_message signer method

Removes the SIGN_MESSAGE signer type and all its handling across the three
request ingestion paths (intent, ContentProvider, NIP-46 bunker), the UI
components, permission mapping, the ContentProvider authority declarations,
the now-unused Account.signString helper, and the sign_message string
resources. Updates the affected unit tests accordingly.
This commit is contained in:
Claude
2026-05-29 23:11:19 +00:00
parent 339f8cbc88
commit 8428b41f72
72 changed files with 6 additions and 549 deletions
+1 -1
View File
@@ -58,7 +58,7 @@
<provider
android:name=".SignerProvider"
android:authorities="${applicationId}.PING;${applicationId}.SIGN_MESSAGE;${applicationId}.SIGN_EVENT;${applicationId}.NIP04_ENCRYPT;${applicationId}.NIP04_DECRYPT;${applicationId}.NIP44_ENCRYPT;${applicationId}.NIP44_DECRYPT;${applicationId}.GET_PUBLIC_KEY;${applicationId}.DECRYPT_ZAP_EVENT"
android:authorities="${applicationId}.PING;${applicationId}.SIGN_EVENT;${applicationId}.NIP04_ENCRYPT;${applicationId}.NIP04_DECRYPT;${applicationId}.NIP44_ENCRYPT;${applicationId}.NIP44_DECRYPT;${applicationId}.GET_PUBLIC_KEY;${applicationId}.DECRYPT_ZAP_EVENT"
android:enabled="true"
android:exported="true"
tools:ignore="ExportedContentProvider" />
@@ -67,81 +67,6 @@ class SignerProvider : ContentProvider() {
}
return try {
when (uriString) {
"content://$appId.SIGN_MESSAGE" -> {
val message = projection?.first()
if (message == null) {
Log.d(Amber.TAG, "No message")
return null
}
val npub = IntentUtils.parsePubKey(projection[2])
if (npub == null) {
Log.d(Amber.TAG, "No npub")
return null
}
val account = LocalPreferences.loadFromEncryptedStorageSync(context!!, npub)
if (account == null) {
Log.d(Amber.TAG, "No account from storage")
return null
}
val historyDatabase = Amber.instance.getHistoryDatabase(account.npub)
val permDao = Amber.instance.dao(account.npub)
val permission =
permDao
.getPermission(
packageName,
"SIGN_MESSAGE",
)
val signPolicy = permDao.getSignPolicy(packageName)
val isRemembered = IntentUtils.isRemembered(signPolicy, permission) ?: return null
if (!isRemembered) {
scope.launch {
historyDatabase.dao().addHistory(
listOf(
HistoryEntity(
0,
packageName,
uriString.replace("content://$appId.", ""),
null,
TimeUtils.now(),
false,
content = message,
),
),
account.npub,
)
}
val cursor =
MatrixCursor(arrayOf("rejected")).also {
it.addRow(arrayOf("true"))
}
return cursor
}
val result = runBlocking { account.signString(message) }
scope.launch {
historyDatabase.dao().addHistory(
listOf(
HistoryEntity(
0,
packageName,
"SIGN_MESSAGE",
null,
TimeUtils.now(),
true,
content = message,
),
),
account.npub,
)
}
val localCursor = MatrixCursor(arrayOf("signature", "event", "result")).also {
it.addRow(arrayOf(result, result, result))
}
return localCursor
}
"content://$appId.SIGN_EVENT" -> {
val json = projection?.first()
if (json == null) {
@@ -18,7 +18,6 @@ import com.vitorpamplona.quartz.nip17Dm.NIP17Factory
import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent
import com.vitorpamplona.quartz.nip19Bech32.toNsec
import com.vitorpamplona.quartz.nip49PrivKeyEnc.Nip49
import com.vitorpamplona.quartz.nip55AndroidSigner.signString
import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent
import com.vitorpamplona.quartz.nip57Zaps.PrivateZapRequestBuilder
import kotlinx.coroutines.CancellationException
@@ -75,8 +74,6 @@ class Account(
content: String,
): T = signer.signerSync.sign(createdAt, kind, tags, content)
fun signString(message: String): String = signString(message, signer.keyPair.privKey!!).toHexKey()
fun nip49Encrypt(password: String): String = Nip49().encrypt(signer.keyPair.privKey!!.toHexKey(), password)
suspend fun nip44Encrypt(plainText: String, toPublicKey: String): String = signer.nip44Encrypt(plainText, toPublicKey)
@@ -69,7 +69,6 @@ data class Permission(
// LAST_COMMIT_CHECKED = "14ec14dac92d891715239bfb83ed1c9bdf2ac382"
fun toLocalizedString(context: Context, shouldTranslateConnect: Boolean = false): String = when (type.trim()) {
"sign_message" -> context.getString(R.string.sign_message)
"get_public_key" -> context.getString(R.string.read_your_public_key)
"nip04_encrypt" -> {
context.getString(R.string.encrypt_data_using_nip_4)
@@ -626,7 +625,6 @@ val supportedKindNumbers = listOf(
*(39003..39009).toList().map { Permission("sign_event", it) }.toTypedArray(),
*(9000..9030).toList().map { Permission("sign_event", it) }.toTypedArray(),
Permission("connect", null),
Permission("sign_message", null),
Permission("nip04_encrypt", null),
Permission("nip04_decrypt", null),
Permission("nip44_decrypt", null),
@@ -2,7 +2,6 @@ package com.greenart7c3.nostrsigner.models
enum class SignerType {
CONNECT,
SIGN_MESSAGE,
SIGN_EVENT,
NIP04_ENCRYPT,
NIP04_DECRYPT,
@@ -221,7 +221,6 @@ object BunkerRequestUtils {
}
fun getTypeFromBunker(bunkerRequest: BunkerRequest): SignerType = when (bunkerRequest.method) {
"sign_message" -> SignerType.SIGN_MESSAGE
"connect" -> SignerType.CONNECT
"sign_event" -> SignerType.SIGN_EVENT
"get_public_key" -> SignerType.GET_PUBLIC_KEY
@@ -237,7 +236,6 @@ object BunkerRequestUtils {
}
fun getDataFromBunker(bunkerRequest: BunkerRequest): String = when (bunkerRequest.method) {
"sign_message" -> bunkerRequest.params.first()
"connect" -> "ack"
"sign_event" -> {
val amberEvent = AmberEvent.fromJson(bunkerRequest.params.first())
@@ -137,7 +137,6 @@ object IntentRateLimitInspector {
}
private fun parseSignerType(value: String): SignerType? = when (value) {
"sign_message" -> SignerType.SIGN_MESSAGE
"sign_event" -> SignerType.SIGN_EVENT
"get_public_key" -> SignerType.GET_PUBLIC_KEY
"nip04_encrypt" -> SignerType.NIP04_ENCRYPT
@@ -126,8 +126,6 @@ object IntentUtils {
private val URL_ENCODED_REGEX = Regex("%[0-9a-fA-F]{2}")
private fun parseSignerType(type: String?): SignerType = when (type) {
"sign_message" ->
SignerType.SIGN_MESSAGE
"sign_event" ->
SignerType.SIGN_EVENT
"get_public_key" ->
@@ -304,23 +302,6 @@ object IntentUtils {
encryptedData = null,
)
}
SignerType.SIGN_MESSAGE -> {
IntentData(
data = localData,
name = appName,
type = type,
pubKey = pubKey,
id = intent.getStringExtra("id") ?: "",
callBackUrl = callbackUrl,
compression = compressionType,
returnType = returnType,
permissions = listOf(),
currentAccount = "",
route = route,
event = null,
encryptedData = null,
)
}
SignerType.SIGN_PSBT -> {
IntentData(
data = localData,
@@ -500,28 +481,6 @@ object IntentUtils {
encryptedData = null,
)
}
SignerType.SIGN_MESSAGE -> {
var npub = intent.getStringExtra("current_user")
if (npub != null) {
npub = parsePubKey(npub)
}
IntentData(
data = data,
name = name,
type = type,
pubKey = pubKey,
id = id,
callBackUrl = intent.extras?.getString("callbackUrl"),
compression = compressionType,
returnType = returnType,
permissions = permissions?.map { Permission(it.type.trim(), it.kind, it.checked) },
currentAccount = npub ?: Hex.decode(pubKey).toNpub(),
route = route,
event = null,
encryptedData = null,
)
}
SignerType.SIGN_PSBT -> {
var npub = intent.getStringExtra("current_user")
if (npub != null) {
@@ -412,59 +412,6 @@ fun BunkerMultiEventHomeScreen(
onLoading = {},
)
}
} else if (request.request.method == "sign_message") {
if (rememberType != RememberType.NEVER && isChecked) {
AmberUtils.acceptOrRejectPermission(
application,
localKey,
SignerType.SIGN_MESSAGE,
null,
true,
rememberType,
thisAccount,
encryptedData = request.encryptedData,
)
}
dao.insertApplicationWithPermissions(application)
historyDatabase.dao().addHistory(
listOf(
HistoryEntity(
0,
localKey,
SignerType.SIGN_MESSAGE.toString(),
null,
TimeUtils.now(),
isChecked,
content = request.request.params.first(),
),
),
thisAccount.npub,
)
val signedMessage = thisAccount.signString(request.request.params.first())
BunkerRequestUtils.remove(request.request.id)
if (isChecked) {
BunkerRequestUtils.sendBunkerResponse(
context,
thisAccount,
request,
BunkerResponse(request.request.id, signedMessage, null),
application.application.relays,
onLoading = {},
onDone = {},
)
} else {
AmberUtils.sendBunkerError(
account = thisAccount,
bunkerRequest = request,
relays = application.application.relays,
context = context,
closeApplication = application.application.closeApplication,
onLoading = {},
)
}
} else if (request.request is BunkerRequestConnect) {
if (savedApplication == null) {
dao.insertApplicationWithPermissions(application)
@@ -877,63 +877,6 @@ fun BunkerSingleEventHomeScreen(
)
},
)
} else if (type == SignerType.SIGN_MESSAGE) {
val permission =
applicationEntity?.permissions?.firstOrNull {
it.pkKey == key && it.type == type.toString()
}
val acceptUntil = permission?.acceptUntil ?: 0
val rejectUntil = permission?.rejectUntil ?: 0
val acceptOrReject = if (rejectUntil == 0L && acceptUntil == 0L) {
null
} else if (rejectUntil > TimeUtils.now() && rejectUntil > 0) {
false
} else if (acceptUntil > TimeUtils.now() && acceptUntil > 0) {
true
} else {
null
}
BunkerSignMessage(
modifier = modifier,
content = bunkerRequest.request.params.first(),
shouldRunOnAccept = acceptOrReject,
appName = appName,
onAccept = {
Amber.instance.applicationIOScope.launch(Dispatchers.IO) {
val result = account.signString(bunkerRequest.request.params.first())
BunkerRequestUtils.sendResult(
context = context,
account = account,
key = key,
response = result,
bunkerRequest = bunkerRequest,
kind = null,
onLoading = onLoading,
permissions = null,
appName = appName,
signPolicy = null,
shouldCloseApplication = bunkerRequest.closeApplication,
rememberType = it,
)
}
},
onReject = {
BunkerRequestUtils.sendRejection(
key = key,
account = account,
bunkerRequest = bunkerRequest,
appName = appName,
rememberType = it,
signerType = type,
kind = null,
onLoading = onLoading,
)
},
)
} else if (type == SignerType.SIGN_PSBT) {
val psbtHex = bunkerRequest.request.params.first()
val permission =
@@ -384,44 +384,6 @@ fun IntentMultiEventHomeScreen(
),
)
}
} else if (type == SignerType.SIGN_MESSAGE) {
if (rememberType != RememberType.NEVER && isChecked) {
AmberUtils.updatePermission(
application,
localKey,
type,
null,
true,
rememberType,
encryptedData = intentData.encryptedData,
)
permissionsChanged = true
}
historyList.add(
HistoryEntity(
0,
localKey,
type.toString(),
null,
TimeUtils.now(),
isChecked,
content = intentData.data,
),
)
val signedMessage = thisAccount.signString(intentData.data)
if (isChecked) {
results.add(
Result(
null,
signature = signedMessage,
result = signedMessage,
id = intentData.id,
rejected = null,
),
)
}
} else {
if (rememberType != RememberType.NEVER && isChecked) {
AmberUtils.updatePermission(
@@ -113,53 +113,6 @@ fun IntentSingleEventHomeScreen(
)
}
SignerType.SIGN_MESSAGE -> {
val permission =
applicationEntity?.permissions?.firstOrNull {
it.pkKey == key && it.type == intentData.type.toString()
}
val acceptOrReject = IntentUtils.isRemembered(applicationEntity?.application?.signPolicy, permission)
SignMessage(
modifier = modifier,
content = intentData.data,
shouldRunOnAccept = acceptOrReject,
packageName = packageName,
onAccept = {
Amber.instance.applicationIOScope.launch(Dispatchers.IO) {
val result = account.signString(intentData.data)
IntentUtils.sendResult(
context,
packageName,
account,
key,
clipboardManager,
result,
result,
intentData,
null,
onLoading,
onRemoveIntentData = onRemoveIntentData,
rememberType = it,
)
}
},
onReject = {
IntentUtils.sendRejection(
key = key,
account = account,
intentData = intentData,
appName = appName,
rememberType = it,
onLoading = onLoading,
onRemoveIntentData = onRemoveIntentData,
kind = null,
)
},
)
}
SignerType.SIGN_PSBT -> {
val permission =
applicationEntity?.permissions?.firstOrNull {
@@ -1,165 +0,0 @@
package com.greenart7c3.nostrsigner.ui.components
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Card
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.greenart7c3.nostrsigner.R
import com.greenart7c3.nostrsigner.ui.RememberType
@Composable
fun SignMessage(
modifier: Modifier,
content: String,
shouldRunOnAccept: Boolean?,
packageName: String?,
onAccept: (RememberType) -> Unit,
onReject: (RememberType) -> Unit,
) {
var rememberType by remember {
mutableStateOf(RememberType.NEVER)
}
Column(
modifier,
) {
LocalAppIcon(packageName)
val message = stringResource(R.string.sign_message)
Text(
buildAnnotatedString {
append(stringResource(R.string.requests_message, message))
},
fontSize = 18.sp,
)
Spacer(Modifier.size(4.dp))
Card(
modifier = Modifier
.fillMaxWidth(),
) {
Column(Modifier.padding(6.dp)) {
Text(
"Event content",
fontWeight = FontWeight.Bold,
)
Text(
content,
modifier = Modifier
.fillMaxWidth()
.padding(top = 8.dp),
)
}
}
Spacer(Modifier.weight(1f))
RememberMyChoice(
shouldRunOnAccept,
packageName,
false,
onAccept,
onReject,
) {
rememberType = it
}
AcceptRejectButtons(
onAccept = {
onAccept(rememberType)
},
onReject = {
onReject(rememberType)
},
)
}
}
@Composable
fun BunkerSignMessage(
modifier: Modifier,
content: String,
shouldRunOnAccept: Boolean?,
appName: String,
onAccept: (RememberType) -> Unit,
onReject: (RememberType) -> Unit,
) {
var rememberType by remember {
mutableStateOf(RememberType.NEVER)
}
Column(
modifier,
) {
val message = stringResource(R.string.sign_message)
Text(
buildAnnotatedString {
withStyle(style = SpanStyle(fontWeight = FontWeight.Bold)) {
append(appName)
}
append(" requests $message")
},
fontSize = 18.sp,
)
Spacer(Modifier.size(4.dp))
Card(
modifier = Modifier
.fillMaxWidth(),
) {
Column(Modifier.padding(6.dp)) {
Text(
stringResource(R.string.content),
fontWeight = FontWeight.Bold,
)
Text(
content,
modifier = Modifier
.fillMaxWidth()
.padding(top = 8.dp),
)
}
}
Spacer(Modifier.weight(1f))
RememberMyChoice(
shouldRunOnAccept,
null,
true,
onAccept,
onReject,
) {
rememberType = it
}
AcceptRejectButtons(
onAccept = {
onAccept(rememberType)
},
onReject = {
onReject(rememberType)
},
)
}
}
-1
View File
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
-1
View File
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
-1
View File
@@ -197,7 +197,6 @@
<string name="wants_you_to_sign_a">möchte ein %1$s signieren</string>
<string name="wants_you_to">möchte, dass du %1$s</string>
<string name="sign">%1$s signieren</string>
<string name="sign_message">Nachricht signieren</string>
<string name="sign_psbt">sign PSBT</string>
<string name="psbt_sending">Sending</string>
<string name="psbt_change">Change</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
-1
View File
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
-1
View File
@@ -197,7 +197,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="sign_psbt">sign PSBT</string>
<string name="psbt_sending">Sending</string>
<string name="psbt_change">Change</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
-1
View File
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
-1
View File
@@ -197,7 +197,6 @@
<string name="wants_you_to_sign_a">veut que vous signiez un %1$s</string>
<string name="wants_you_to">veut que vous %1$s</string>
<string name="sign">Signer %1$s</string>
<string name="sign_message">signer le message</string>
<string name="sign_psbt">sign PSBT</string>
<string name="psbt_sending">Sending</string>
<string name="psbt_change">Change</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
-1
View File
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
-1
View File
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
-1
View File
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -195,7 +195,6 @@
<string name="wants_you_to_sign_a">quer que você assine uma %1$s</string>
<string name="wants_you_to">quer você para %1$s</string>
<string name="sign">Assinar %1$s</string>
<string name="sign_message">Assinar a mensagem</string>
<string name="sign_psbt">sign PSBT</string>
<string name="psbt_sending">Sending</string>
<string name="psbt_change">Change</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
-1
View File
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -194,7 +194,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="sign_psbt">sign PSBT</string>
<string name="psbt_sending">Sending</string>
<string name="psbt_change">Change</string>
-1
View File
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
-1
View File
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
-1
View File
@@ -197,7 +197,6 @@
<string name="wants_you_to_sign_a">bir %1$s imzalamanızı istiyor</string>
<string name="wants_you_to">%1$s yapmanızı istiyor</string>
<string name="sign">%1$s İmzala</string>
<string name="sign_message">mesajı imzala</string>
<string name="sign_psbt">sign PSBT</string>
<string name="psbt_sending">Sending</string>
<string name="psbt_change">Change</string>
-1
View File
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">请求签署 %1$s</string>
<string name="wants_you_to">请求进行 %1$s</string>
<string name="sign">签署 %1$s</string>
<string name="sign_message">签署消息</string>
<string name="content">内容</string>
<string name="amber_is_running_in_background">Amber 正在后台运行</string>
<string name="bunker_notifications">Bunker 通知</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
@@ -175,7 +175,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="content">content</string>
<string name="amber_is_running_in_background">Amber is running in background</string>
<string name="bunker_notifications">Bunker Notifications</string>
-1
View File
@@ -197,7 +197,6 @@
<string name="wants_you_to_sign_a">请求签署 %1$s</string>
<string name="wants_you_to">请求进行 %1$s</string>
<string name="sign">签署 %1$s</string>
<string name="sign_message">签署消息</string>
<string name="sign_psbt">sign PSBT</string>
<string name="psbt_sending">Sending</string>
<string name="psbt_change">Change</string>
-1
View File
@@ -204,7 +204,6 @@
<string name="wants_you_to_sign_a">wants you to sign a %1$s</string>
<string name="wants_you_to">wants you to %1$s</string>
<string name="sign">Sign %1$s</string>
<string name="sign_message">sign message</string>
<string name="sign_psbt">sign PSBT</string>
<string name="psbt_sending">Sending</string>
<string name="psbt_change">Change</string>
+1 -1
View File
@@ -25,7 +25,7 @@
<provider
android:name=".SignerProvider"
android:authorities="${applicationId}.PING;${applicationId}.SIGN_MESSAGE;${applicationId}.SIGN_EVENT;${applicationId}.NIP04_ENCRYPT;${applicationId}.NIP04_DECRYPT;${applicationId}.NIP44_ENCRYPT;${applicationId}.NIP44_DECRYPT;${applicationId}.GET_PUBLIC_KEY;${applicationId}.DECRYPT_ZAP_EVENT"
android:authorities="${applicationId}.PING;${applicationId}.SIGN_EVENT;${applicationId}.NIP04_ENCRYPT;${applicationId}.NIP04_DECRYPT;${applicationId}.NIP44_ENCRYPT;${applicationId}.NIP44_DECRYPT;${applicationId}.GET_PUBLIC_KEY;${applicationId}.DECRYPT_ZAP_EVENT"
android:enabled="true"
android:exported="true" />
@@ -56,8 +56,8 @@ class BunkerRequestUtilsTest {
// ===== getTypeFromBunker =====
@Test
fun `getTypeFromBunker returns SIGN_MESSAGE for sign_message`() {
assertEquals(SignerType.SIGN_MESSAGE, BunkerRequestUtils.getTypeFromBunker(mockBunkerRequest("sign_message")))
fun `getTypeFromBunker returns INVALID for sign_message`() {
assertEquals(SignerType.INVALID, BunkerRequestUtils.getTypeFromBunker(mockBunkerRequest("sign_message")))
}
@Test
@@ -128,9 +128,9 @@ class BunkerRequestUtilsTest {
// ===== getDataFromBunker =====
@Test
fun `getDataFromBunker returns first param for sign_message`() {
fun `getDataFromBunker returns empty string for sign_message`() {
val request = mockBunkerRequest("sign_message", arrayOf("hello world"))
assertEquals("hello world", BunkerRequestUtils.getDataFromBunker(request))
assertEquals("", BunkerRequestUtils.getDataFromBunker(request))
}
@Test
@@ -351,7 +351,6 @@ class IntentUtilsBeforeAfterTest {
* making the duplication even worse).
*/
private fun oldParseSignerType(type: String?) = when (type) {
"sign_message" -> "SIGN_MESSAGE"
"sign_event" -> "SIGN_EVENT"
"nip04_encrypt" -> "NIP04_ENCRYPT"
"nip04_decrypt" -> "NIP04_DECRYPT"
@@ -383,7 +382,6 @@ class IntentUtilsBeforeAfterTest {
/** Expose the private parseSignerType for white-box testing. */
fun IntentUtils.parseSignerTypePublic(type: String?) = when (type) {
"sign_message" -> "SIGN_MESSAGE"
"sign_event" -> "SIGN_EVENT"
"get_public_key" -> "GET_PUBLIC_KEY"
"nip04_encrypt" -> "NIP04_ENCRYPT"