Skip to content

Linux + iPhone Continuity / iMessage / SMS

fix: encryption migration safeguards

Zack Bartel1197a004f6bc
diff --git a/po/cs.po b/po/cs.po
index 2a2ac3a..b0a2031 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Czech\n"
@@ -321,6 +321,18 @@ msgstr "připojuje se"
msgid "off (--bt-enable on)"
msgstr "vypnuto (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "Historie"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"pozastaveno – klíčenka plochy zatím nemá klíč.\n"
+"Odemkněte ji nebo spusťte „tether --bt-retention plaintext“."
+
#: src/cli/main.cpp
msgid "in use"
msgstr "používá se"
@@ -1074,7 +1086,8 @@ msgstr "Napsat zprávu"
#: src/gtk/contacts_view.cpp
msgid "No contacts yet. Check the Bluetooth link on the Devices page."
-msgstr "Zatím žádné kontakty. Zkontrolujte spojení Bluetooth na stránce Zařízení."
+msgstr ""
+"Zatím žádné kontakty. Zkontrolujte spojení Bluetooth na stránce Zařízení."
#: src/gtk/contacts_view.cpp
msgid "Search contacts"
@@ -1120,6 +1133,14 @@ msgstr "Režim kompatibility — zprávy a kontakty, bez zrcadlení oznámení."
msgid "This machine cannot carry the Bluetooth features."
msgstr "Tento stroj nezvládne funkce Bluetooth."
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"Historie zpráv je pozastavena: klíčenka plochy zatím nemá klíč.\n"
+"Odemkněte ji nebo výše zvolte Nešifrovaně."
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "Spojení"
diff --git a/po/de.po b/po/de.po
index e63be6f..646748b 100644
--- a/po/de.po
+++ b/po/de.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: German\n"
@@ -320,6 +320,18 @@ msgstr "verbindet"
msgid "off (--bt-enable on)"
msgstr "aus (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "Verlauf"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"pausiert – der Schlüsselbund bietet noch keinen Schlüssel an.\n"
+"Entsperren Sie ihn oder führen Sie „tether --bt-retention plaintext“ aus."
+
#: src/cli/main.cpp
msgid "in use"
msgstr "in Verwendung"
@@ -1099,7 +1111,9 @@ msgstr "Nachricht schreiben"
#: src/gtk/contacts_view.cpp
msgid "No contacts yet. Check the Bluetooth link on the Devices page."
-msgstr "Noch keine Kontakte. Prüfen Sie die Bluetooth-Verbindung auf der Seite Geräte."
+msgstr ""
+"Noch keine Kontakte. Prüfen Sie die Bluetooth-Verbindung auf der Seite "
+"Geräte."
#: src/gtk/contacts_view.cpp
msgid "Search contacts"
@@ -1147,6 +1161,14 @@ msgstr ""
msgid "This machine cannot carry the Bluetooth features."
msgstr "Dieser Rechner kann die Bluetooth-Funktionen nicht bereitstellen."
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"Der Nachrichtenverlauf pausiert: der Schlüsselbund bietet noch keinen\n"
+"Schlüssel an. Entsperren Sie ihn oder wählen Sie oben Unverschlüsselt."
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "Verbindung"
diff --git a/po/es.po b/po/es.po
index 03147d0..752fd93 100644
--- a/po/es.po
+++ b/po/es.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: Spanish\n"
@@ -322,6 +322,18 @@ msgstr "conectando"
msgid "off (--bt-enable on)"
msgstr "desactivado (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "Historial"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"en pausa: el depósito de claves aún no ofrece ninguna clave.\n"
+"Desbloquéalo o ejecuta «tether --bt-retention plaintext»."
+
#: src/cli/main.cpp
msgid "in use"
msgstr "en uso"
@@ -1090,7 +1102,9 @@ msgstr "Enviar mensaje"
#: src/gtk/contacts_view.cpp
msgid "No contacts yet. Check the Bluetooth link on the Devices page."
-msgstr "Aún no hay contactos. Comprueba el enlace Bluetooth en la página Dispositivos."
+msgstr ""
+"Aún no hay contactos. Comprueba el enlace Bluetooth en la página "
+"Dispositivos."
#: src/gtk/contacts_view.cpp
msgid "Search contacts"
@@ -1138,6 +1152,14 @@ msgstr ""
msgid "This machine cannot carry the Bluetooth features."
msgstr "Este equipo no puede ofrecer las funciones Bluetooth."
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"El historial de mensajes está en pausa: el depósito de claves aún no\n"
+"ofrece ninguna clave. Desbloquéalo o elige Sin cifrar arriba."
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "Enlace"
diff --git a/po/fr.po b/po/fr.po
index 9404a76..757c0dd 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: French\n"
@@ -326,6 +326,18 @@ msgstr "connexion en cours"
msgid "off (--bt-enable on)"
msgstr "désactivé (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "Historique"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"en pause : le trousseau du bureau n'a pas encore de clé à offrir.\n"
+"Déverrouillez-le ou lancez « tether --bt-retention plaintext »."
+
#: src/cli/main.cpp
msgid "in use"
msgstr "utilisé"
@@ -1097,7 +1109,9 @@ msgstr "Envoyer un message"
#: src/gtk/contacts_view.cpp
msgid "No contacts yet. Check the Bluetooth link on the Devices page."
-msgstr "Aucun contact pour l'instant. Vérifiez la liaison Bluetooth sur la page Appareils."
+msgstr ""
+"Aucun contact pour l'instant. Vérifiez la liaison Bluetooth sur la page "
+"Appareils."
#: src/gtk/contacts_view.cpp
msgid "Search contacts"
@@ -1145,6 +1159,14 @@ msgstr ""
msgid "This machine cannot carry the Bluetooth features."
msgstr "Cette machine ne peut pas assurer les fonctions Bluetooth."
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"L'historique des messages est en pause : le trousseau n'a pas encore de\n"
+"clé à offrir. Déverrouillez-le ou choisissez Non chiffré ci-dessus."
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "Lien"
diff --git a/po/it.po b/po/it.po
index 5061b82..8cc9c43 100644
--- a/po/it.po
+++ b/po/it.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Italian\n"
@@ -322,6 +322,18 @@ msgstr "in connessione"
msgid "off (--bt-enable on)"
msgstr "disattivato (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "Cronologia"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"in pausa: il portachiavi del desktop non ha ancora una chiave.\n"
+"Sbloccalo oppure esegui «tether --bt-retention plaintext»."
+
#: src/cli/main.cpp
msgid "in use"
msgstr "in uso"
@@ -1088,7 +1100,9 @@ msgstr "Invia messaggio"
#: src/gtk/contacts_view.cpp
msgid "No contacts yet. Check the Bluetooth link on the Devices page."
-msgstr "Ancora nessun contatto. Controlla il collegamento Bluetooth nella pagina Dispositivi."
+msgstr ""
+"Ancora nessun contatto. Controlla il collegamento Bluetooth nella pagina "
+"Dispositivi."
#: src/gtk/contacts_view.cpp
msgid "Search contacts"
@@ -1136,6 +1150,14 @@ msgstr ""
msgid "This machine cannot carry the Bluetooth features."
msgstr "Questa macchina non può supportare le funzioni Bluetooth."
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"La cronologia dei messaggi è in pausa: il portachiavi non ha ancora una\n"
+"chiave. Sbloccalo oppure scegli Non cifrato qui sopra."
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "Collegamento"
diff --git a/po/ja.po b/po/ja.po
index 8cc66e9..d1d7a72 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Japanese\n"
@@ -316,6 +316,18 @@ msgstr "接続中"
msgid "off (--bt-enable on)"
msgstr "オフ (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "履歴"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"一時停止中 - デスクトップのキーリングにまだ鍵がありません。\n"
+"ロックを解除するか、'tether --bt-retention plaintext' を実行してください。"
+
#: src/cli/main.cpp
msgid "in use"
msgstr "使用中"
@@ -1063,7 +1075,8 @@ msgstr "メッセージを送信"
#: src/gtk/contacts_view.cpp
msgid "No contacts yet. Check the Bluetooth link on the Devices page."
-msgstr "まだ連絡先はありません。デバイスページで Bluetooth 接続を確認してください。"
+msgstr ""
+"まだ連絡先はありません。デバイスページで Bluetooth 接続を確認してください。"
#: src/gtk/contacts_view.cpp
msgid "Search contacts"
@@ -1109,6 +1122,14 @@ msgstr "互換モード — メッセージと連絡先のみ、通知のミラ
msgid "This machine cannot carry the Bluetooth features."
msgstr "このマシンでは Bluetooth 機能を利用できません。"
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"メッセージ履歴は一時停止中です: デスクトップのキーリングにまだ鍵が\n"
+"ありません。ロックを解除するか、上で「暗号化しない」を選んでください。"
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "リンク"
diff --git a/po/ko.po b/po/ko.po
index 400b508..eb3c427 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Korean\n"
@@ -315,6 +315,18 @@ msgstr "연결 중"
msgid "off (--bt-enable on)"
msgstr "꺼짐 (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "기록"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"일시 중지됨 - 데스크톱 키링에 아직 키가 없습니다.\n"
+"키링을 잠금 해제하거나 'tether --bt-retention plaintext'를 실행하세요."
+
#: src/cli/main.cpp
msgid "in use"
msgstr "사용 중"
@@ -1097,6 +1109,14 @@ msgstr "호환 모드 — 메시지와 연락처만, 알림 미러링 없음."
msgid "This machine cannot carry the Bluetooth features."
msgstr "이 컴퓨터는 Bluetooth 기능을 지원할 수 없습니다."
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"메시지 기록이 일시 중지되었습니다: 데스크톱 키링에 아직 키가 없습니다.\n"
+"키링을 잠금 해제하거나 위에서 '암호화 안 함'을 선택하세요."
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "링크"
diff --git a/po/nl.po b/po/nl.po
index f5231ed..86614b9 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Dutch\n"
@@ -321,6 +321,18 @@ msgstr "verbinden"
msgid "off (--bt-enable on)"
msgstr "uit (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "Geschiedenis"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"gepauzeerd - de sleutelbos van het bureaublad heeft nog geen sleutel.\n"
+"Ontgrendel hem of voer 'tether --bt-retention plaintext' uit."
+
#: src/cli/main.cpp
msgid "in use"
msgstr "in gebruik"
@@ -1084,7 +1096,9 @@ msgstr "Bericht sturen"
#: src/gtk/contacts_view.cpp
msgid "No contacts yet. Check the Bluetooth link on the Devices page."
-msgstr "Nog geen contacten. Controleer de Bluetooth-verbinding op de pagina Apparaten."
+msgstr ""
+"Nog geen contacten. Controleer de Bluetooth-verbinding op de pagina "
+"Apparaten."
#: src/gtk/contacts_view.cpp
msgid "Search contacts"
@@ -1131,6 +1145,14 @@ msgstr ""
msgid "This machine cannot carry the Bluetooth features."
msgstr "Deze machine kan de Bluetooth-functies niet dragen."
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"Berichtgeschiedenis is gepauzeerd: de sleutelbos heeft nog geen sleutel.\n"
+"Ontgrendel hem of kies hierboven Onversleuteld."
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "Verbinding"
diff --git a/po/pl.po b/po/pl.po
index b73a957..8a50a95 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Polish\n"
@@ -323,6 +323,18 @@ msgstr "łączenie"
msgid "off (--bt-enable on)"
msgstr "wyłączone (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "Historia"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"wstrzymane – pęk kluczy pulpitu nie ma jeszcze klucza.\n"
+"Odblokuj go lub uruchom „tether --bt-retention plaintext”."
+
#: src/cli/main.cpp
msgid "in use"
msgstr "w użyciu"
@@ -1085,7 +1097,8 @@ msgstr "Wyślij wiadomość"
#: src/gtk/contacts_view.cpp
msgid "No contacts yet. Check the Bluetooth link on the Devices page."
-msgstr "Nie ma jeszcze kontaktów. Sprawdź połączenie Bluetooth na stronie Urządzenia."
+msgstr ""
+"Nie ma jeszcze kontaktów. Sprawdź połączenie Bluetooth na stronie Urządzenia."
#: src/gtk/contacts_view.cpp
msgid "Search contacts"
@@ -1131,6 +1144,14 @@ msgstr "Tryb zgodności — wiadomości i kontakty, bez kopiowania powiadomień.
msgid "This machine cannot carry the Bluetooth features."
msgstr "Ta maszyna nie udźwignie funkcji Bluetooth."
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"Historia wiadomości jest wstrzymana: pęk kluczy nie ma jeszcze klucza.\n"
+"Odblokuj go lub wybierz powyżej Bez szyfrowania."
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "Połączenie"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 2b39f9e..c3a295c 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Brazilian Portuguese\n"
@@ -321,6 +321,18 @@ msgstr "conectando"
msgid "off (--bt-enable on)"
msgstr "desativado (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "Histórico"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"em pausa - o chaveiro da área de trabalho ainda não tem uma chave.\n"
+"Desbloqueie-o ou execute \"tether --bt-retention plaintext\"."
+
#: src/cli/main.cpp
msgid "in use"
msgstr "em uso"
@@ -1085,7 +1097,8 @@ msgstr "Enviar mensagem"
#: src/gtk/contacts_view.cpp
msgid "No contacts yet. Check the Bluetooth link on the Devices page."
-msgstr "Ainda não há contatos. Verifique a conexão Bluetooth na página Dispositivos."
+msgstr ""
+"Ainda não há contatos. Verifique a conexão Bluetooth na página Dispositivos."
#: src/gtk/contacts_view.cpp
msgid "Search contacts"
@@ -1133,6 +1146,14 @@ msgstr ""
msgid "This machine cannot carry the Bluetooth features."
msgstr "Esta máquina não consegue sustentar os recursos de Bluetooth."
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"O histórico de mensagens está em pausa: o chaveiro ainda não tem uma\n"
+"chave. Desbloqueie-o ou escolha Sem criptografia acima."
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "Enlace"
diff --git a/po/ru.po b/po/ru.po
index 7b76f70..31ede25 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Russian\n"
@@ -323,6 +323,18 @@ msgstr "подключение"
msgid "off (--bt-enable on)"
msgstr "выключено (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "История"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"приостановлено — в связке ключей пока нет ключа.\n"
+"Разблокируйте её или выполните «tether --bt-retention plaintext»."
+
#: src/cli/main.cpp
msgid "in use"
msgstr "используется"
@@ -1084,7 +1096,8 @@ msgstr "Написать сообщение"
#: src/gtk/contacts_view.cpp
msgid "No contacts yet. Check the Bluetooth link on the Devices page."
-msgstr "Контактов пока нет. Проверьте связь по Bluetooth на странице «Устройства»."
+msgstr ""
+"Контактов пока нет. Проверьте связь по Bluetooth на странице «Устройства»."
#: src/gtk/contacts_view.cpp
msgid "Search contacts"
@@ -1131,6 +1144,14 @@ msgstr ""
msgid "This machine cannot carry the Bluetooth features."
msgstr "Эта машина не потянет функции Bluetooth."
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"История сообщений приостановлена: в связке ключей пока нет ключа.\n"
+"Разблокируйте её или выберите «Без шифрования» выше."
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "Соединение"
diff --git a/po/sv.po b/po/sv.po
index d1b2883..6f9d6cd 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Swedish\n"
@@ -320,6 +320,18 @@ msgstr "ansluter"
msgid "off (--bt-enable on)"
msgstr "av (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "Historik"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"pausad – skrivbordets nyckelring har ännu ingen nyckel.\n"
+"Lås upp den eller kör ”tether --bt-retention plaintext”."
+
#: src/cli/main.cpp
msgid "in use"
msgstr "används"
@@ -1071,7 +1083,8 @@ msgstr "Skicka meddelande"
#: src/gtk/contacts_view.cpp
msgid "No contacts yet. Check the Bluetooth link on the Devices page."
-msgstr "Inga kontakter ännu. Kontrollera Bluetooth-anslutningen på sidan Enheter."
+msgstr ""
+"Inga kontakter ännu. Kontrollera Bluetooth-anslutningen på sidan Enheter."
#: src/gtk/contacts_view.cpp
msgid "Search contacts"
@@ -1119,6 +1132,14 @@ msgstr ""
msgid "This machine cannot carry the Bluetooth features."
msgstr "Den här maskinen klarar inte Bluetooth-funktionerna."
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"Meddelandehistoriken är pausad: nyckelringen har ännu ingen nyckel.\n"
+"Lås upp den eller välj Okrypterat ovan."
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "Länk"
diff --git a/po/tether.pot b/po/tether.pot
index 3330036..7d18554 100644
--- a/po/tether.pot
+++ b/po/tether.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether 0.2.23\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -297,6 +297,16 @@ msgstr ""
msgid "off (--bt-enable on)"
msgstr ""
+#: src/cli/main.cpp
+msgid "History"
+msgstr ""
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+
#: src/cli/main.cpp
msgid "in use"
msgstr ""
@@ -1011,6 +1021,12 @@ msgstr ""
msgid "This machine cannot carry the Bluetooth features."
msgstr ""
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr ""
diff --git a/po/tr.po b/po/tr.po
index 1c8c238..cbefd21 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Turkish\n"
@@ -319,6 +319,18 @@ msgstr "bağlanıyor"
msgid "off (--bt-enable on)"
msgstr "kapalı (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "Geçmiş"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"duraklatıldı - masaüstü anahtarlığında henüz anahtar yok.\n"
+"Kilidini açın veya 'tether --bt-retention plaintext' komutunu çalıştırın."
+
#: src/cli/main.cpp
msgid "in use"
msgstr "kullanımda"
@@ -1070,7 +1082,8 @@ msgstr "Mesaj gönder"
#: src/gtk/contacts_view.cpp
msgid "No contacts yet. Check the Bluetooth link on the Devices page."
-msgstr "Henüz kişi yok. Aygıtlar sayfasındaki Bluetooth bağlantısını denetleyin."
+msgstr ""
+"Henüz kişi yok. Aygıtlar sayfasındaki Bluetooth bağlantısını denetleyin."
#: src/gtk/contacts_view.cpp
msgid "Search contacts"
@@ -1116,6 +1129,14 @@ msgstr "Uyumluluk kipi — mesajlar ve kişiler, bildirim yansıtma yok."
msgid "This machine cannot carry the Bluetooth features."
msgstr "Bu makine Bluetooth özelliklerini taşıyamaz."
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"İleti geçmişi duraklatıldı: masaüstü anahtarlığında henüz anahtar yok.\n"
+"Kilidini açın veya yukarıdan Şifresiz seçeneğini seçin."
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "Bağlantı"
diff --git a/po/uk.po b/po/uk.po
index ac4c82f..a368246 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Ukrainian\n"
@@ -324,6 +324,18 @@ msgstr "з'єднання"
msgid "off (--bt-enable on)"
msgstr "вимкнено (--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "Історія"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"призупинено — у сховищі ключів ще немає ключа.\n"
+"Розблокуйте його або виконайте «tether --bt-retention plaintext»."
+
#: src/cli/main.cpp
msgid "in use"
msgstr "використовується"
@@ -1083,7 +1095,8 @@ msgstr "Написати повідомлення"
#: src/gtk/contacts_view.cpp
msgid "No contacts yet. Check the Bluetooth link on the Devices page."
-msgstr "Контактів поки немає. Перевірте зʼєднання Bluetooth на сторінці «Пристрої»."
+msgstr ""
+"Контактів поки немає. Перевірте зʼєднання Bluetooth на сторінці «Пристрої»."
#: src/gtk/contacts_view.cpp
msgid "Search contacts"
@@ -1129,6 +1142,14 @@ msgstr "Режим сумісності — повідомлення та кон
msgid "This machine cannot carry the Bluetooth features."
msgstr "Ця машина не потягне функції Bluetooth."
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"Історію повідомлень призупинено: у сховищі ключів ще немає ключа.\n"
+"Розблокуйте його або виберіть «Без шифрування» вище."
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "З'єднання"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 9c36cc5..bab817a 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-03 19:48-0700\n"
+"POT-Creation-Date: 2026-09-03 20:40-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Simplified Chinese\n"
@@ -310,6 +310,18 @@ msgstr "正在连接"
msgid "off (--bt-enable on)"
msgstr "已关闭(--bt-enable on)"
+#: src/cli/main.cpp
+msgid "History"
+msgstr "历史记录"
+
+#: src/cli/main.cpp
+msgid ""
+"paused - the desktop keyring has no key to offer yet.\n"
+"Unlock it, or run 'tether --bt-retention plaintext'."
+msgstr ""
+"已暂停 - 桌面密钥环尚无可用密钥。\n"
+"请解锁密钥环,或运行 'tether --bt-retention plaintext'。"
+
#: src/cli/main.cpp
msgid "in use"
msgstr "使用中"
@@ -1071,6 +1083,14 @@ msgstr "兼容模式 —— 信息和通讯录,无通知镜像。"
msgid "This machine cannot carry the Bluetooth features."
msgstr "这台机器无法支持蓝牙功能。"
+#: src/gtk/devices_view.cpp
+msgid ""
+"Message history is paused: the desktop keyring has no key to offer\n"
+"yet. Unlock it, or choose Unencrypted above."
+msgstr ""
+"消息历史已暂停:桌面密钥环尚无可用密钥。\n"
+"请解锁密钥环,或在上方选择“不加密”。"
+
#: src/gtk/devices_view.cpp
msgid "Link"
msgstr "链路"
diff --git a/src/cli/main.cpp b/src/cli/main.cpp
index 57c5423..b0abce7 100644
--- a/src/cli/main.cpp
+++ b/src/cli/main.cpp
@@ -371,6 +371,11 @@ static int print_bt_status(tether::Client& client) {
resp.value("ancs_enabled", true) ? _("mirroring on")
: _("mirroring off (tether --bt-ancs on)"));
fields.emplace_back(_("Tether"), resp.value("enabled", true) ? _("connecting") : _("off (--bt-enable on)"));
+
+ if (resp.value("retention", "encrypted") == "encrypted" && !resp.value("retention_ready", true))
+ fields.emplace_back(_("History"),
+ _("paused - the desktop keyring has no key to offer yet.\n"
+ "Unlock it, or run 'tether --bt-retention plaintext'."));
print_fields(fields);
for (const auto& adapter : resp["adapters"]) {
diff --git a/src/core/include/tether/bluetooth/connection.hpp b/src/core/include/tether/bluetooth/connection.hpp
index 675d129..d959f3b 100644
--- a/src/core/include/tether/bluetooth/connection.hpp
+++ b/src/core/include/tether/bluetooth/connection.hpp
@@ -5,6 +5,7 @@
#include "tether/bluetooth/groups.hpp"
#include "tether/bluetooth/messages.hpp"
#include "tether/bluetooth/profile_supervisor.hpp"
+#include "tether/secret_store.hpp"
#include <functional>
#include <memory>
@@ -99,6 +100,9 @@ namespace tether::bluetooth {
// Closes the message journal and drops the in-memory history.
void discard_retained_messages();
+ // Follows a retention mode change on disk.
+ void move_retained_store(Retention previous, Retention next);
+
void set_group_replies_enabled(bool enabled);
void reload_group_rosters();
diff --git a/src/core/include/tether/bluetooth/journal.hpp b/src/core/include/tether/bluetooth/journal.hpp
index 317fd40..7b433a1 100644
--- a/src/core/include/tether/bluetooth/journal.hpp
+++ b/src/core/include/tether/bluetooth/journal.hpp
@@ -42,14 +42,15 @@ namespace tether::bluetooth {
// Malformed lines are skipped rather than aborting the load
std::vector<Message> load(int64_t now) const;
- // Rewrites the file to exactly `messages`, atomically. Refuses to empty
- // a populated journal, so a read that silently produced nothing cannot
- // destroy the history it failed to parse.
+ // Rewrites the file to exactly `messages`, atomically. Refuses when the
+ // last load could not read the whole file, so a wrong key or a truncated
+ // record cannot be compacted away.
bool compact(const std::vector<Message>& messages);
private:
std::ofstream out_;
std::string path_;
+ mutable size_t skipped_ = 0;
};
std::string serialize_message_line(const Message& message);
diff --git a/src/core/src/bluetooth/config.cpp b/src/core/src/bluetooth/config.cpp
index 5c7059c..fbc069b 100644
--- a/src/core/src/bluetooth/config.cpp
+++ b/src/core/src/bluetooth/config.cpp
@@ -23,7 +23,8 @@ namespace tether::bluetooth {
} // namespace
namespace {
- constexpr int CONFIG_VERSION = 1;
+ // 2 since 0.2.24 how to tell "never had a retention setting" from "lost one".
+ constexpr int CONFIG_VERSION = 2;
} // namespace
const char* to_string(AuthStrategy strategy) {
diff --git a/src/core/src/bluetooth/connection.cpp b/src/core/src/bluetooth/connection.cpp
index 0a4107a..d9d8c1b 100644
--- a/src/core/src/bluetooth/connection.cpp
+++ b/src/core/src/bluetooth/connection.cpp
@@ -169,6 +169,12 @@ namespace tether::bluetooth {
contact_store() = ContactStore();
}
+ void move_retained_store(Retention previous, Retention next) {
+ std::lock_guard<std::mutex> lock(g_messages_mutex);
+ g_journal.close();
+ migrate_contacts(previous, next);
+ }
+
void set_group_replies_enabled(bool enabled) {
std::lock_guard<std::mutex> lock(g_group_mutex);
g_group_replies_enabled = enabled;
@@ -1179,8 +1185,6 @@ namespace tether::bluetooth {
auto history = g_journal.load(now);
for (const auto& message : history)
g_messages.add(message);
- // load() already applied retention, so writing back what survived
- // is what actually trims the file. Idempotent when nothing aged out.
g_journal.compact(history);
debug::log(INFO, "bluetooth: replayed {} message(s) from the journal", history.size());
}
diff --git a/src/core/src/bluetooth/journal.cpp b/src/core/src/bluetooth/journal.cpp
index 5c6b61b..aed4c7b 100644
--- a/src/core/src/bluetooth/journal.cpp
+++ b/src/core/src/bluetooth/journal.cpp
@@ -144,8 +144,11 @@ namespace tether::bluetooth {
}
in.close();
- if (records.empty() && unreadable) {
- debug::log(WARN, "bluetooth: cannot read {} to migrate it; leaving it in place", source);
+ if (unreadable) {
+ debug::log(WARN,
+ "bluetooth: {} has {} unreadable line(s); leaving it in place rather than migrating part of it",
+ source,
+ unreadable);
return false;
}
@@ -157,6 +160,7 @@ namespace tether::bluetooth {
const bool merging = std::filesystem::exists(destination);
const std::string tmp = destination + ".tmp";
const std::string target = merging ? destination : tmp;
+ bool failed = false;
{
std::ofstream out(target, merging ? std::ios::app : std::ios::trunc);
if (!out.is_open()) {
@@ -165,15 +169,23 @@ namespace tether::bluetooth {
}
for (const auto& record : records) {
const std::string sealed = secret::seal(record, to);
- if (sealed.empty())
- return false;
+ if (sealed.empty()) {
+ debug::log(ERR, "bluetooth: cannot seal {}; leaving {} in place", destination, source);
+ failed = true;
+ break;
+ }
out << sealed << "\n";
}
- if (!out) {
+ if (!failed && !out) {
debug::log(ERR, "bluetooth: failed writing {}", target);
- return false;
+ failed = true;
}
}
+ if (failed) {
+ if (!merging)
+ std::filesystem::remove(tmp, ec);
+ return false;
+ }
restrict_permissions(target);
if (merging) {
@@ -244,6 +256,7 @@ namespace tether::bluetooth {
std::vector<Message> MessageJournal::load(int64_t now) const {
std::vector<Message> messages;
+ skipped_ = 0;
const std::string path = path_.empty() ? journal_path() : path_;
if (path.empty())
return messages;
@@ -265,6 +278,7 @@ namespace tether::bluetooth {
}
if (skipped)
debug::log(WARN, "bluetooth: skipped {} unreadable journal line(s)", skipped);
+ skipped_ = skipped;
return apply_retention(std::move(messages), now);
}
@@ -276,6 +290,11 @@ namespace tether::bluetooth {
std::error_code ec;
+ if (skipped_) {
+ debug::log(WARN, "bluetooth: refusing to rewrite {} after a partial read", path);
+ return false;
+ }
+
if (messages.empty() && std::filesystem::file_size(path, ec) > 0 && !ec) {
debug::log(WARN, "bluetooth: refusing to empty a populated journal");
return false;
diff --git a/src/core/src/net.cpp b/src/core/src/net.cpp
index 9af8d11..ac9e0aa 100644
--- a/src/core/src/net.cpp
+++ b/src/core/src/net.cpp
@@ -1128,8 +1128,7 @@ namespace tether {
std::filesystem::remove(bluetooth::contacts_path(mode), ec);
}
} else {
- bluetooth::migrate_journal(previous, config.retention);
- bluetooth::migrate_contacts(previous, config.retention);
+ bluetooth::move_retained_store(previous, config.retention);
}
}
broadcast_local_event(build_bt_status().dump());
diff --git a/src/core/src/secret_store.cpp b/src/core/src/secret_store.cpp
index 5221ee1..5a384fc 100644
--- a/src/core/src/secret_store.cpp
+++ b/src/core/src/secret_store.cpp
@@ -272,15 +272,20 @@ namespace tether {
return wait_and_retry(
"secret: wallet is locked and holds no store key; history starts once it unlocks");
- case KeyLookup::Absent:
- if (!generate(key))
+ case KeyLookup::Absent: {
+ // an earlier run with no secret service already sealed the store.
+ const bool promoted = key_from_file(key);
+ if (!promoted && !generate(key))
return false;
if (!key_to_service(key))
return wait_and_retry("secret: cannot store a new key in the wallet");
g_key = std::move(key);
g_failed_once = false;
- debug::log(INFO, "secret: generated a new store key in the wallet");
+ debug::log(INFO,
+ promoted ? "secret: adopted the store key file into the wallet"
+ : "secret: generated a new store key in the wallet");
return true;
+ }
case KeyLookup::NoService:
break;
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp
index 864ed15..b4be6be 100644
--- a/src/daemon/main.cpp
+++ b/src/daemon/main.cpp
@@ -238,8 +238,12 @@ int main(int argc, char** argv) {
otp});
});
+ auto bt_config = tether::bluetooth::load_config();
+
+ tether::secret::set_retention(bt_config.retention);
+
// Pick the controller before the first capability, a second adapter never comes up bound to the wrong one.
- bluez.set_preferred_adapter(tether::bluetooth::load_config().adapter);
+ bluez.set_preferred_adapter(bt_config.adapter);
if (bluez.start()) {
tether::bluetooth::g_bluez = &bluez;
loop.addFd(bluez.event_fd(), [&bluez](int) {
@@ -254,13 +258,8 @@ int main(int argc, char** argv) {
// Supervise the selected iPhone's bearers and OBEX sessions. ANCS is only
// attempted when the controller can carry it and pairing produced a bond
// that covers LE.
- auto bt_config = tether::bluetooth::load_config();
tether::bluetooth::g_bt_connections = &connections;
- // Before anything opens the journal or the contact cache: the mode picks
- // which file each of those lives in.
- tether::secret::set_retention(bt_config.retention);
-
tether::bluetooth::set_group_replies_enabled(bt_config.group_messages_enabled &&
bt_config.ancs_content_enabled && bt_config.ancs_enabled);
tether::bluetooth::reload_group_rosters();
diff --git a/src/gtk/devices_view.cpp b/src/gtk/devices_view.cpp
index b5f94aa..22c8416 100644
--- a/src/gtk/devices_view.cpp
+++ b/src/gtk/devices_view.cpp
@@ -245,6 +245,14 @@ namespace tether::ui {
running.empty() ? _("an older build") : running.c_str(),
TETHER_VERSION);
}
+
+ if (g_devices.bt_status.value("retention", "encrypted") == "encrypted" &&
+ !g_devices.bt_status.value("retention_ready", true)) {
+ if (!mode.empty())
+ mode += "\n";
+ mode += _("Message history is paused: the desktop keyring has no key to offer\n"
+ "yet. Unlock it, or choose Unencrypted above.");
+ }
}
set_text(g_devices.lbl_bt_mode, mode);
diff --git a/test/test_journal.cpp b/test/test_journal.cpp
index 243f79f..762c1e2 100644
--- a/test/test_journal.cpp
+++ b/test/test_journal.cpp
@@ -397,3 +397,105 @@ TEST(Journal, RetentionNoneWritesNothing) {
std::filesystem::remove_all(home);
}
+
+// One readable record is enough to clear the emptiness guard, so a journal the
+// wrong key cannot open used to be compacted down to whatever happened to decode.
+TEST(Journal, APartialReadIsNotCompactedAway) {
+ const auto home = scratch("partial");
+ const auto store = home / ".local" / "share" / "tether";
+ const auto sealed = store / "messages.ndjson.enc";
+
+ {
+ ScopedHome scoped(home);
+ MessageJournal journal;
+ ASSERT_TRUE(journal.open());
+ journal.append(make("/msg/1", NOW, "one"));
+ journal.append(make("/msg/2", NOW + 1, "two"));
+ journal.append(make("/msg/3", NOW + 2, "three"));
+ }
+ ASSERT_EQ(lines_of(sealed).size(), 3u);
+
+ // Dropping the key file makes the next open generate a fresh one in the same
+ // home, which is what a store sealed under a key the wallet later replaced
+ // looks like from here.
+ std::filesystem::remove(home / ".config" / "tether" / "store.key");
+
+ {
+ ScopedHome scoped(home);
+ MessageJournal journal;
+ ASSERT_TRUE(journal.open());
+ journal.append(make("/msg/4", NOW + 3, "four"));
+
+ auto loaded = journal.load(NOW + 3);
+ ASSERT_EQ(loaded.size(), 1u) << "the old key's records should not be readable here";
+ EXPECT_FALSE(journal.compact(loaded)) << "a partial read must not be written back";
+ }
+
+ EXPECT_EQ(lines_of(sealed).size(), 4u) << "the records the new key could not read were compacted away";
+
+ std::filesystem::remove_all(home);
+}
+
+// A mode change while the journal is open used to unlink the file out from under
+// the append stream, so every later message went to a deleted inode.
+TEST(Journal, AMigrationWhileOpenDoesNotStrandLaterAppends) {
+ const auto home = scratch("switch-open");
+ const auto store = home / ".local" / "share" / "tether";
+
+ ScopedHome scoped(home, Retention::Plaintext);
+ MessageJournal journal;
+ ASSERT_TRUE(journal.open());
+ journal.append(make("/msg/1", NOW, "before"));
+
+ // What bt_set_retention does: close first, then let the reopen migrate.
+ journal.close();
+ secret::set_retention(Retention::Encrypted);
+ ASSERT_TRUE(journal.open());
+ journal.append(make("/msg/2", NOW + 1, "after"));
+
+ EXPECT_FALSE(std::filesystem::exists(store / "messages.ndjson")) << "the plaintext copy outlived the switch";
+ EXPECT_EQ(lines_of(store / "messages.ndjson.enc").size(), 2u);
+
+ auto loaded = journal.load(NOW + 1);
+ ASSERT_EQ(loaded.size(), 2u) << "a message written after the switch was lost";
+ EXPECT_EQ(loaded[0].body, "before");
+ EXPECT_EQ(loaded[1].body, "after");
+
+ std::filesystem::remove_all(home);
+}
+
+// Migration unlinks the source, so carrying over only the lines that happened to
+// decode would destroy the rest.
+TEST(Journal, MigrationRefusesAPartiallyReadableSource) {
+ const auto home = scratch("migrate-partial");
+ const auto store = home / ".local" / "share" / "tether";
+ const auto sealed = store / "messages.ndjson.enc";
+
+ {
+ ScopedHome scoped(home);
+ MessageJournal journal;
+ ASSERT_TRUE(journal.open());
+ journal.append(make("/msg/1", NOW, "one"));
+ journal.append(make("/msg/2", NOW + 1, "two"));
+ }
+
+ // A line no key can open, appended to an otherwise readable store.
+ {
+ std::ofstream out(sealed, std::ios::app);
+ out << "bm90IGEgcmVhbCByZWNvcmQgYXQgYWxs\n";
+ }
+ ASSERT_EQ(lines_of(sealed).size(), 3u);
+
+ {
+ ScopedHome scoped(home, Retention::Plaintext);
+ MessageJournal journal;
+ ASSERT_TRUE(journal.open());
+ // open() creates the plaintext file to append to; the point is that the
+ // migration put nothing in it.
+ EXPECT_TRUE(lines_of(store / "messages.ndjson").empty())
+ << "a partial source was migrated instead of being left alone";
+ }
+ EXPECT_EQ(lines_of(sealed).size(), 3u) << "the unreadable source was removed";
+
+ std::filesystem::remove_all(home);
+}
diff --git a/test/test_vcard.cpp b/test/test_vcard.cpp
index ce12f18..5ad3870 100644
--- a/test/test_vcard.cpp
+++ b/test/test_vcard.cpp
@@ -390,3 +390,27 @@ TEST(ContactSearch, EveryEmittedAddressIsUsableAsARecipient) {
}
}
}
+
+// The interrupted-migration rule keeps the destination and drops the source. The
+// test above writes the same phonebook to both paths, so it cannot tell which one
+// survived; this one gives them different contents and pins the documented rule.
+TEST(ContactStore, AnInterruptedMigrationKeepsTheDestinationNotTheSource) {
+ ScopedStore scoped("migrate-destination-wins");
+
+ ASSERT_TRUE(save_contacts(three_contacts()));
+ ASSERT_TRUE(std::filesystem::exists(scoped.store() / "contacts.json.enc"));
+
+ // A stale plaintext cache holding somebody the sealed one has never heard of.
+ {
+ secret::set_retention(Retention::Plaintext);
+ ContactStore stale;
+ stale.set(parse_vcards("BEGIN:VCARD\nFN:Stale Contact\nTEL:+15550000009\nEND:VCARD\n"));
+ ASSERT_TRUE(save_contacts(stale));
+ }
+
+ secret::set_retention(Retention::Encrypted);
+ const ContactStore loaded = load_contacts();
+ EXPECT_EQ(loaded.name_for("tel:+15551234567"), "Ada Lovelace") << "the sealed cache was replaced by the source";
+ EXPECT_EQ(loaded.name_for("tel:+15550000009"), "") << "the stale source won over the destination";
+ EXPECT_FALSE(std::filesystem::exists(scoped.store() / "contacts.json")) << "the plaintext copy is still on disk";
+}