hidden contact invite
This commit is contained in:
1 parent
ce44ee48b3
commit
7eace57528
6 files changed
+172
-37
No files matched your search
+6
-3
@@ -408,10 +408,13 @@ révèle la longueur des conversations.
|
||||
en attente vers l'espace caché ouvert par ce mot de passe, en le créant au besoin.
|
||||
`reveal_contact` fait l'inverse. La destination est écrite avant la source : un plantage entre
|
||||
les deux laisse une copie, jamais une perte.
|
||||
* Les nouveaux contacts naissent dans l'espace principal. Une fois cachés, leurs anciens blocs
|
||||
sont effacés puis recyclés.
|
||||
* Un nouveau contact peut naître **directement dans un espace caché** : les quatre fonctions
|
||||
d'invitation prennent `space: Option<mot de passe>`, et l'espace principal n'est alors jamais
|
||||
écrit. Les étapes suivantes demandent que cet espace soit déverrouillé. Un contact créé dans
|
||||
l'espace principal puis caché laisse ses anciens blocs effacés puis recyclés.
|
||||
* CLI : `-u/--unlock <mot de passe>` (répétable), `contact hide <nom> --space-password …`,
|
||||
`contact reveal`, `identity password --new-password …`. Un mot de passe qui n'ouvre rien est
|
||||
`contact reveal`, `identity password --new-password …`, `--space-password` sur les
|
||||
commandes d'invitation. Un mot de passe qui n'ouvre rien est
|
||||
ignoré sans message.
|
||||
|
||||
---
|
||||
|
||||
+20
-11
@@ -16,14 +16,15 @@ Pour reprendre le travail : lire ce fichier, prendre le premier lot ⬜ dont les
|
||||
|
||||
1. ~~**3.8** livraison au moins une fois~~ ✅
|
||||
2. ~~**4.5** brancher `meow-store` dans le client et la CLI~~ ✅
|
||||
3. ~~5.5, 5.6, 5.9~~ ✅, puis **5.10** (inviter dans un espace caché).
|
||||
4. **7.1 → 7.3** FFI et intégration dans bastet.
|
||||
3. ~~5.5, 5.6, 5.9, 5.10~~ ✅
|
||||
4. **7.1 → 7.8** FFI et nouvelle application Flutter (from scratch, voir phase 7).
|
||||
5. Le reste (phases 8–10) selon les priorités.
|
||||
|
||||
### Journal
|
||||
|
||||
| Date | Lots | Notes |
|
||||
|---|---|---|
|
||||
| 2026-11-20 | 5.10 | `create_invitation`, `answer_invitation`, `publish_invitation` et `accept_published_invitation` prennent `space: Option<&str>` : le contact naît directement dans l'espace caché (ouvert ou créé), l'espace principal n'est pas écrit. CLI : `--space-password` sur les quatre commandes d'invitation. Test client (serveur et fichier, caché des deux côtés) et section e2e. Phase 7 réécrite : nouvelle application dans `../bastet`, chat maison. |
|
||||
| 2026-11-20 | 5.9 | `subscribe()` (broadcast de tous les événements), `start()` → `ClientHandle { subscribe, lock, stop }`. Pull et vidage de la file découpés en préparation, réseau, application, pour ne jamais tenir le verrou pendant le réseau. Long-poll raccourci jusqu'au prochain réessai, backoff en cas de panne. `process` ne vide plus la file lui-même (c'est `sync` ou la tâche qui le fait). 44 tests, dont un test de tâche de fond (événement poussé, envoi immédiat pendant un long-poll de 20 s, accusé de lecture, réessai automatique, arrêt). |
|
||||
| 2026-11-20 | 5.6 | `Status` par message (`Queued`, `Sent`, `Delivered`, `Read`, sans retour en arrière), mis à jour dans le segment qui contient le message. Accusés `DELIVERED` (un par contact et par lot) et `READ` (`mark_read`) dans le ratchet, désactivables par identité (`Settings`). `Event::Receipt`. CLI : `read`, `identity receipts`, statuts dans `history`, `longpoll --exit` ignore les lots ne contenant que des accusés. Correction d'un test de store instable (motif de 3 octets trouvé par hasard dans l'aléa). 43 tests, e2e avec une section « accusés ». |
|
||||
| 2026-11-20 | 5.5 | `OutboxItem` enregistrés dans le store (un objet par élément et par espace), dans la même sauvegarde que le ratchet. Backoff exponentiel avec aléa, expiration après 7 jours (`Event::SendFailed`), dépôts regroupés par serveur avec repli élément par élément. Les messages de handshake passent aussi par la file. CLI : `outbox [--flush]`, « queued for … ». ARCHITECTURE : §5.1, et §7 (réseau de serveurs et Matriochka, points à trancher). 41 tests, e2e avec une section « file hors ligne ». |
|
||||
@@ -102,7 +103,7 @@ Pour reprendre le travail : lire ce fichier, prendre le premier lot ⬜ dont les
|
||||
| 5.7 | Fichiers : découpage en morceaux, reprise, déduplication, limite de taille. Le contenu reçu doit être écrit sur disque **avant** l'ack : aujourd'hui, la CLI écrit les fichiers après `sync`, alors que les acks sont déjà partis | e2e (`send-file`) | 🟡 envoi en un seul morceau |
|
||||
| 5.8 | Trafic leurre : mailbox fictives dans les pulls, ordre aléatoire, padding des requêtes | Tests | ⬜ |
|
||||
| 5.9 | Stream d'événements (`tokio::broadcast`) et tâche de synchronisation en arrière-plan | Tests | ✅ |
|
||||
| 5.10 | Inviter directement dans un espace caché (le contact ne passe jamais par l'espace principal) | Tests | ⬜ |
|
||||
| 5.10 | Inviter directement dans un espace caché (le contact ne passe jamais par l'espace principal) | Tests | ✅ |
|
||||
|
||||
## Phase 6 — `meow-cli` (`meow`)
|
||||
|
||||
@@ -115,17 +116,25 @@ Pour reprendre le travail : lire ce fichier, prendre le premier lot ⬜ dont les
|
||||
| 6.5 | `tests/e2e.sh` : parité avec `meowcli/test.sh` | Script vert | ✅ |
|
||||
| 6.6 | Sortie `--json` pour l'automatisation, et import d'identité v1 (pseudo et serveurs) | | ⬜ |
|
||||
|
||||
## Phase 7 — `meow-ffi` + intégration Flutter
|
||||
## Phase 7 — `meow-ffi` + nouvelle application Flutter
|
||||
|
||||
L'application est **refaite de zéro** dans `../bastet` (gabarit vide), l'ancienne étant
|
||||
conservée dans `../bastet_v1`. On n'utilise plus `bastet_chatview` (trop lourd) : l'écran de
|
||||
conversation est un widget maison, léger. On réutilise de la v1 :
|
||||
* `peer_secure`, `ble_connect` et `lan_connect` pour les invitations en présentiel ;
|
||||
* le thème (`lib/theme/`), les icônes et images (`assets/images`) et les traductions
|
||||
(`assets/translations`).
|
||||
|
||||
| Lot | Contenu | Fin | État |
|
||||
|---|---|---|---|
|
||||
| 7.1 | Crate `meow-ffi` (cdylib) avec `flutter_rust_bridge` v2, API miroir de `meow-client` | Génération Dart OK | ⬜ |
|
||||
| 7.2 | Build Android (`cargo-ndk` arm64-v8a, armeabi-v7a, x86_64) et Linux, script `deploy.sh` | `libmeow_ffi.so` chargé par bastet | ⬜ |
|
||||
| 7.3 | Adaptateur Dart dans bastet (`lib/meow2/`), remplacement écran par écran de `meowwrapper.dart` | Chat fonctionnel sur Linux | ⬜ |
|
||||
| 7.4 | Arrière-plan Android : WorkManager + `client.sync()` | Notifications | ⬜ |
|
||||
| 7.5 | Suppression de `meowjsonlib` et de `meowwrapper.dart` | | ⬜ |
|
||||
|
||||
Correspondance des 63 exports actuels de `meowjsonlib` → API v2 : voir l'annexe A.
|
||||
| 7.1 | Crate `meow-ffi` (cdylib, `flutter_rust_bridge` v2) : API miroir de `ClientHandle` (create/open/unlock, contacts, invitations, envoi, historique paginé, réglages) + `Stream<Event>` | Génération Dart OK, tests Dart minimaux | ⬜ |
|
||||
| 7.2 | Builds Android (`cargo-ndk` : arm64-v8a, armeabi-v7a, x86_64) et Linux, script `deploy.sh` vers `../bastet` | `libmeow_ffi.so` chargée par l'application | ⬜ |
|
||||
| 7.3 | Squelette de l'application : architecture (état, navigation), thème, icônes et traductions de la v1, écran de déverrouillage (un seul champ : mot de passe principal ou caché), création d'identité, serveurs | Lancement Linux | ⬜ |
|
||||
| 7.4 | Liste des contacts + **écran de conversation maison** : liste virtualisée chargée segment par segment, statuts (envoi, reçu, lu), accusés, fichiers, file d'envoi | Chat fonctionnel sur Linux | ⬜ |
|
||||
| 7.5 | Invitations : par serveur (lien + mot de passe), par fichier ou QR, et en présentiel via `peer_secure` (BLE/LAN) qui transporte les octets d'invitation v2 | e2e manuel entre deux appareils | ⬜ |
|
||||
| 7.6 | Espaces cachés dans l'UI (cacher/révéler, inviter dans un espace caché, aucune trace visuelle sans déverrouillage), réglages (accusés, mot de passe) | | ⬜ |
|
||||
| 7.7 | Android : synchronisation en arrière-plan (service ou WorkManager) et notifications **sans le texte des messages** | Notifications | ⬜ |
|
||||
| 7.8 | Retrait de `meowjsonlib`, `meowwrapper.dart` et `bastet_v1` | | ⬜ |
|
||||
|
||||
## Phase 8 — Fonctionnalités avancées
|
||||
|
||||
|
||||
@@ -154,6 +154,10 @@ struct ServerSel {
|
||||
/// Comma-separated server URLs or names (default: all my servers).
|
||||
#[arg(short, long, value_delimiter = ',')]
|
||||
servers: Vec<String>,
|
||||
/// Create the contact directly in the hidden space opened by this password
|
||||
/// (created if needed). Unlock it with -u for the next steps.
|
||||
#[arg(long)]
|
||||
space_password: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
@@ -386,6 +390,7 @@ async fn run() -> Result<()> {
|
||||
&message,
|
||||
&invitation_password,
|
||||
DEFAULT_INVITATION_TTL,
|
||||
sel.space_password.as_deref(),
|
||||
)
|
||||
.await?;
|
||||
println!("{url}");
|
||||
@@ -398,7 +403,13 @@ async fn run() -> Result<()> {
|
||||
}) => {
|
||||
let mut c = ctx.open().await?;
|
||||
let who = c
|
||||
.accept_published_invitation(&url, &invitation_password, name.as_deref(), &sel.servers)
|
||||
.accept_published_invitation(
|
||||
&url,
|
||||
&invitation_password,
|
||||
name.as_deref(),
|
||||
&sel.servers,
|
||||
sel.space_password.as_deref(),
|
||||
)
|
||||
.await?;
|
||||
println!("answered invitation from {who}");
|
||||
}
|
||||
@@ -497,7 +508,13 @@ async fn invitation(ctx: &Ctx, cmd: InvitationCmd) -> Result<()> {
|
||||
} => {
|
||||
let mut c = ctx.open().await?;
|
||||
let offer = c
|
||||
.create_invitation(&contact, &sel.servers, &message, DEFAULT_INVITATION_TTL)
|
||||
.create_invitation(
|
||||
&contact,
|
||||
&sel.servers,
|
||||
&message,
|
||||
DEFAULT_INVITATION_TTL,
|
||||
sel.space_password.as_deref(),
|
||||
)
|
||||
.await?;
|
||||
let out = out.unwrap_or_else(|| PathBuf::from(format!("{}-{contact}.mwiv2", c.nickname())));
|
||||
std::fs::write(&out, offer)?;
|
||||
@@ -522,7 +539,9 @@ async fn invitation(ctx: &Ctx, cmd: InvitationCmd) -> Result<()> {
|
||||
let mut c = ctx.open().await?;
|
||||
let offer = std::fs::read(&file)?;
|
||||
let initiator = c.inspect_invitation(&offer)?.initiator_name;
|
||||
let answer = c.answer_invitation(&offer, name.as_deref(), &sel.servers).await?;
|
||||
let answer = c
|
||||
.answer_invitation(&offer, name.as_deref(), &sel.servers, sel.space_password.as_deref())
|
||||
.await?;
|
||||
let out = out.unwrap_or_else(|| PathBuf::from(format!("{}-{initiator}.mwiv2", c.nickname())));
|
||||
std::fs::write(&out, answer)?;
|
||||
println!("{}", out.display());
|
||||
|
||||
@@ -343,6 +343,12 @@ impl MeowClient {
|
||||
/// Move a contact, with its history and files, into the hidden space opened by
|
||||
/// `password` (created if none). Several contacts may share a space.
|
||||
pub async fn hide_contact(&mut self, name: &str, password: &str) -> Result<()> {
|
||||
let target = self.hidden_space(password)?;
|
||||
self.move_contact(name, target)
|
||||
}
|
||||
|
||||
/// Index of the hidden space opened by `password`, created if none.
|
||||
fn hidden_space(&mut self, password: &str) -> Result<usize> {
|
||||
let found = lock(&self.store)?.unlock(password)?;
|
||||
let id = match found {
|
||||
Some(id) => id,
|
||||
@@ -351,8 +357,15 @@ impl MeowClient {
|
||||
if id == SpaceId::MAIN {
|
||||
return Err(Error::Invalid("this is the main password".into()));
|
||||
}
|
||||
let target = self.space_index(id)?;
|
||||
self.move_contact(name, target)
|
||||
self.space_index(id)
|
||||
}
|
||||
|
||||
/// Where a new contact goes: the main space, or the hidden space of `password`.
|
||||
fn target_space(&mut self, space: Option<&str>) -> Result<usize> {
|
||||
match space {
|
||||
None => Ok(0),
|
||||
Some(pw) => self.hidden_space(pw),
|
||||
}
|
||||
}
|
||||
|
||||
/// Move a hidden contact back to the main space.
|
||||
@@ -572,7 +585,10 @@ impl MeowClient {
|
||||
}
|
||||
|
||||
// ───────────────────────── invitations ─────────────────────────
|
||||
// New contacts are created in the main space; hide them afterwards if needed.
|
||||
// `space`: `None` creates the contact in the main space; `Some(password)` creates it
|
||||
// directly in that hidden space (opened, or created if needed), so it never touches
|
||||
// the main space. Later steps find the contact in any *unlocked* space: a hidden
|
||||
// space must be unlocked for its pending invitations to progress.
|
||||
|
||||
/// Step 1: create an invitation for `contact_name`. Returns the encoded offer.
|
||||
pub async fn create_invitation(
|
||||
@@ -581,12 +597,14 @@ impl MeowClient {
|
||||
server_urls: &[String],
|
||||
message: &str,
|
||||
ttl: u64,
|
||||
space: Option<&str>,
|
||||
) -> Result<Vec<u8>> {
|
||||
self.ensure_free_name(contact_name)?;
|
||||
let servers = self.resolve_servers(server_urls)?;
|
||||
let offer = invitation::create_offer(contact_name, self.nickname(), servers, message, now(), ttl)?;
|
||||
self.spaces[0].state.contacts.push(offer.contact);
|
||||
self.save_space(0)?;
|
||||
let si = self.target_space(space)?;
|
||||
self.spaces[si].state.contacts.push(offer.contact);
|
||||
self.save_space(si)?;
|
||||
Ok(offer.offer_bytes)
|
||||
}
|
||||
|
||||
@@ -600,6 +618,7 @@ impl MeowClient {
|
||||
offer_bytes: &[u8],
|
||||
contact_name: Option<&str>,
|
||||
server_urls: &[String],
|
||||
space: Option<&str>,
|
||||
) -> Result<Vec<u8>> {
|
||||
let info = self.inspect_invitation(offer_bytes)?;
|
||||
let name = contact_name.unwrap_or(&info.initiator_name).to_string();
|
||||
@@ -609,8 +628,9 @@ impl MeowClient {
|
||||
}
|
||||
let servers = self.resolve_servers(server_urls)?;
|
||||
let (contact, answer) = invitation::answer(offer_bytes, &name, self.nickname(), servers, now())?;
|
||||
self.spaces[0].state.contacts.push(contact);
|
||||
self.save_space(0)?;
|
||||
let si = self.target_space(space)?;
|
||||
self.spaces[si].state.contacts.push(contact);
|
||||
self.save_space(si)?;
|
||||
Ok(answer.encode_to_vec())
|
||||
}
|
||||
|
||||
@@ -652,8 +672,11 @@ impl MeowClient {
|
||||
message: &str,
|
||||
password: &str,
|
||||
ttl: u64,
|
||||
space: Option<&str>,
|
||||
) -> Result<String> {
|
||||
let offer = self.create_invitation(contact_name, server_urls, message, ttl).await?;
|
||||
let offer = self
|
||||
.create_invitation(contact_name, server_urls, message, ttl, space)
|
||||
.await?;
|
||||
let server = self.resolve_servers(server_urls)?.remove(0);
|
||||
let resp = self
|
||||
.transport
|
||||
@@ -682,6 +705,7 @@ impl MeowClient {
|
||||
password: &str,
|
||||
contact_name: Option<&str>,
|
||||
server_urls: &[String],
|
||||
space: Option<&str>,
|
||||
) -> Result<String> {
|
||||
let (base, code) = url
|
||||
.rsplit_once("/inv/")
|
||||
@@ -702,7 +726,9 @@ impl MeowClient {
|
||||
return Err(Error::Network("unexpected response".into()));
|
||||
};
|
||||
let info = self.inspect_invitation(&f.payload)?;
|
||||
let answer_bytes = self.answer_invitation(&f.payload, contact_name, server_urls).await?;
|
||||
let answer_bytes = self
|
||||
.answer_invitation(&f.payload, contact_name, server_urls, space)
|
||||
.await?;
|
||||
let answer = v2::InvitationMessage::decode(answer_bytes.as_slice()).map_err(meow_core::Error::from)?;
|
||||
let (si, ci) = self.by_invitation(&info.invitation_id)?;
|
||||
let queued = outbox::item(
|
||||
|
||||
@@ -92,9 +92,12 @@ async fn file_and_server_invitations_then_messaging() {
|
||||
let mut remote = client(&dir, "remote", &servers).await;
|
||||
|
||||
// ── file invitation ──
|
||||
let offer = bob.create_invitation("alice", &[], "hello alice", 3600).await.unwrap();
|
||||
let offer = bob
|
||||
.create_invitation("alice", &[], "hello alice", 3600, None)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(alice.inspect_invitation(&offer).unwrap().initiator_name, "bob");
|
||||
let answer = alice.answer_invitation(&offer, None, &[]).await.unwrap();
|
||||
let answer = alice.answer_invitation(&offer, None, &[], None).await.unwrap();
|
||||
let confirm = bob.accept_answer(&answer).await.unwrap();
|
||||
assert_eq!(bob.contact("alice").unwrap().state, State::ConfirmSent);
|
||||
bob.send_text("alice", "sent before finalize").await.unwrap();
|
||||
@@ -143,15 +146,15 @@ async fn file_and_server_invitations_then_messaging() {
|
||||
|
||||
// ── server invitation ──
|
||||
let url = bob
|
||||
.publish_invitation("remote", &[], "via server", "secret", 3600)
|
||||
.publish_invitation("remote", &[], "via server", "secret", 3600, None)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(remote
|
||||
.accept_published_invitation(&url, "wrong", None, &[])
|
||||
.accept_published_invitation(&url, "wrong", None, &[], None)
|
||||
.await
|
||||
.is_err());
|
||||
let who = remote
|
||||
.accept_published_invitation(&url, "secret", None, &[])
|
||||
.accept_published_invitation(&url, "secret", None, &[], None)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(who, "bob");
|
||||
@@ -330,8 +333,8 @@ async fn no_message_lost_when_the_client_dies() {
|
||||
// This test counts what stays on the server: no receipts traffic.
|
||||
no_receipt_settings(&mut bob).await;
|
||||
no_receipt_settings(&mut alice).await;
|
||||
let offer = bob.create_invitation("alice", &[], "", 3600).await.unwrap();
|
||||
let answer = alice.answer_invitation(&offer, None, &[]).await.unwrap();
|
||||
let offer = bob.create_invitation("alice", &[], "", 3600, None).await.unwrap();
|
||||
let answer = alice.answer_invitation(&offer, None, &[], None).await.unwrap();
|
||||
let confirm = bob.accept_answer(&answer).await.unwrap();
|
||||
alice.finalize_invitation(&confirm).await.unwrap();
|
||||
bob.sync(Duration::ZERO).await.unwrap();
|
||||
@@ -370,8 +373,11 @@ async fn no_message_lost_when_the_client_dies() {
|
||||
// the temporary answer mailbox of a server invitation...
|
||||
let mut carol = client(&dir, "carol", &servers).await;
|
||||
no_receipt_settings(&mut carol).await;
|
||||
let link = bob.publish_invitation("carol", &[], "", "", 3600).await.unwrap();
|
||||
carol.accept_published_invitation(&link, "", None, &[]).await.unwrap();
|
||||
let link = bob.publish_invitation("carol", &[], "", "", 3600, None).await.unwrap();
|
||||
carol
|
||||
.accept_published_invitation(&link, "", None, &[], None)
|
||||
.await
|
||||
.unwrap();
|
||||
bob.sync(Duration::ZERO).await.unwrap(); // step 2 → 3, answer mailbox retired
|
||||
carol.sync(Duration::ZERO).await.unwrap(); // step 3 → 4
|
||||
bob.sync(Duration::ZERO).await.unwrap(); // ack
|
||||
@@ -395,8 +401,8 @@ async fn no_message_lost_when_the_client_dies() {
|
||||
|
||||
/// File invitation from `a` to `b`, completed.
|
||||
async fn connect(a: &mut MeowClient, b: &mut MeowClient, b_name: &str) {
|
||||
let offer = a.create_invitation(b_name, &[], "", 3600).await.unwrap();
|
||||
let answer = b.answer_invitation(&offer, None, &[]).await.unwrap();
|
||||
let offer = a.create_invitation(b_name, &[], "", 3600, None).await.unwrap();
|
||||
let answer = b.answer_invitation(&offer, None, &[], None).await.unwrap();
|
||||
let confirm = a.accept_answer(&answer).await.unwrap();
|
||||
b.finalize_invitation(&confirm).await.unwrap();
|
||||
a.sync(Duration::ZERO).await.unwrap();
|
||||
@@ -707,3 +713,61 @@ async fn background_sync_publishes_events() {
|
||||
assert_eq!(texts(&bob.sync(Duration::ZERO).await.unwrap()), vec!["after stop"]);
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
// ───────────── invitations straight into hidden spaces (roadmap lot 5.10) ─────────────
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn invitations_straight_into_hidden_spaces() {
|
||||
let servers = vec![spawn_server().await];
|
||||
let dir = tmpdir();
|
||||
let mut alice = client(&dir, "alice", &servers).await;
|
||||
let mut bob = client(&dir, "bob", &servers).await;
|
||||
|
||||
// Server flow, hidden on both sides.
|
||||
let url = alice
|
||||
.publish_invitation("bob", &[], "", "", 3600, Some("a-secret"))
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(alice.is_hidden("bob").unwrap());
|
||||
assert_eq!(
|
||||
bob.accept_published_invitation(&url, "", None, &[], Some("b-secret"))
|
||||
.await
|
||||
.unwrap(),
|
||||
"alice"
|
||||
);
|
||||
assert!(bob.is_hidden("alice").unwrap());
|
||||
assert_eq!(
|
||||
no_receipts(alice.sync(Duration::ZERO).await.unwrap()),
|
||||
vec![Event::InvitationAccepted { contact: "bob".into() }]
|
||||
);
|
||||
bob.sync(Duration::ZERO).await.unwrap();
|
||||
alice.sync(Duration::ZERO).await.unwrap();
|
||||
bob.send_text("alice", "secret hello").await.unwrap();
|
||||
assert_eq!(texts(&alice.sync(Duration::ZERO).await.unwrap()), vec!["secret hello"]);
|
||||
|
||||
// File flow, hidden on the answering side only.
|
||||
let mut carol = client(&dir, "carol", &servers).await;
|
||||
let offer = alice.create_invitation("carol", &[], "", 3600, None).await.unwrap();
|
||||
carol
|
||||
.answer_invitation(&offer, None, &[], Some("c-secret"))
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(carol.is_hidden("alice").unwrap());
|
||||
|
||||
// Reopened without the space passwords: nothing; with them: the contacts.
|
||||
drop((alice, bob, carol));
|
||||
let path = |name: &str| dir.join(format!("{name}.mwid2"));
|
||||
let mut alice = MeowClient::open(&path("alice"), "pw").await.unwrap();
|
||||
let mut bob = MeowClient::open(&path("bob"), "pw").await.unwrap();
|
||||
let carol = MeowClient::open(&path("carol"), "pw").await.unwrap();
|
||||
assert_eq!(names(&alice), vec!["carol"]);
|
||||
assert!(names(&bob).is_empty());
|
||||
assert!(names(&carol).is_empty());
|
||||
assert!(alice.unlock("a-secret").await.unwrap());
|
||||
assert!(bob.unlock("b-secret").await.unwrap());
|
||||
assert_eq!(alice.contact("bob").unwrap().state, State::Active);
|
||||
assert_eq!(alice.history("bob").unwrap().len(), 1);
|
||||
alice.send_text("bob", "still secret").await.unwrap();
|
||||
assert_eq!(texts(&bob.sync(Duration::ZERO).await.unwrap()), vec!["still secret"]);
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
@@ -189,6 +189,20 @@ expect "reply from the hidden side" "sent to remote" meow bob -u hide-me send re
|
||||
expect "remote gets it" "[bob] hidden reply" meow remote
|
||||
expect "history kept" "[remote] hello from remote" meow bob -u hide-me history remote
|
||||
|
||||
step "INVITATION STRAIGHT INTO HIDDEN SPACES"
|
||||
meow dave identity create dave --force >/dev/null
|
||||
meow dave server add "$S1" >/dev/null
|
||||
URL="$(meow alice server-invitation create dave --servers "$S1" --space-password alice-hides)"
|
||||
expect "dave answers into his hidden space" "answered invitation from alice" \
|
||||
meow dave server-invitation get "$URL" --space-password dave-hides
|
||||
expect "step 3 needs alice's hidden space" "invitation accepted by dave" meow alice -u alice-hides
|
||||
expect "step 4" "contact alice is active" meow dave -u dave-hides
|
||||
expect "ack" "contact dave is active" meow alice -u alice-hides
|
||||
OUT="$(meow alice contact list; meow dave contact list)"
|
||||
if grep -q -e '^dave' -e '^alice' <<<"$OUT"; then red "hidden invitation visible in the main space"; exit 1; fi
|
||||
expect "talk" "sent to dave" meow alice -u alice-hides send dave "hidden from the start"
|
||||
expect "dave reads" "[alice] hidden from the start" meow dave -u dave-hides
|
||||
|
||||
# ── resilience: one server down ──
|
||||
step "ONE SERVER DOWN"
|
||||
kill "${PIDS[1]}"; wait "${PIDS[1]}" 2>/dev/null || true; PIDS[1]=""
|
||||
|
||||
Reference in new issue
Block a user