feat(nip46): publish kind-0 metadata through the connected signer

This commit is contained in:
Avi 2026-09-23 15:30:35 -05:00
commit 6f4dbb2ca1
4 changed files with 108 additions and 4 deletions

View file

@ -648,6 +648,11 @@ async fn nip46_bunker_connect_params_match_spec_against_strict_amber() {
));
let signer = Nip46ClientSigner::new(app.clone());
// Register the handle on the App exactly like production's
// `ensure_nip46_signer` does: `App::signing_for` (used below for the
// kind-0 publish) resolves the live session through this handle.
// `Nip46ClientSigner::clone` shares the session state.
app.lock().await.nip46_signer = Some(std::sync::Arc::new(signer.clone()));
// No secret in the URI: the strict signer must still ack a well-formed
// connect whose params[0] is its own pubkey.
@ -705,6 +710,34 @@ async fn nip46_bunker_connect_params_match_spec_against_strict_amber() {
);
drop(app_guard);
// Kind-0 through the remote signer: the vault label becomes a signed
// network-visible profile (what other clients display as the name).
// Exercises the real GUI "Publish name" path — Signing::External with
// identity validation — against the strict signer.
let (settings, signing) = {
let guard = app.lock().await;
(
guard.settings.clone(),
guard
.signing_for(&identity_npub)
.await
.expect("signing source for the paired profile"),
)
};
let report = keynectr::profiles::publish_metadata_signed(
&settings,
"Strict Amber",
None,
None,
&signing,
)
.await
.expect("remote kind-0 publish");
assert!(
!report.succeeded.is_empty(),
"at least one relay must accept the signed kind-0"
);
signer.disconnect().await.ok();
}