cbe8c0bf27
One wallet, one grin seed / one balance, but a SET of nostr identities (nsecs), exactly one active at a time. New identities module owns the held-identity index (identities.json): which identities the wallet holds, their order, and which is active. It stores no secrets; each held identity is its own NIP-49 ncryptsec on disk, exactly like the single identity today (identity.rs create/unlock/backup reused unchanged, plus save_at/load_at for the per-identity files and pubkey_hex for the index key). Migration is fund-safe and needs no key regen: a pre-feature wallet has only identity.json, which the index adopts in place as the single active identity number one; the legacy file is never overwritten, so an older build still opens the wallet on it (clean rollback). The store gains a per-identity last_active_at so a switch back to a dormant identity can catch up from when it last listened, not merely from the wallet-wide last connection. Unit tests cover migration, add/switch/cap/dedupe, active resolution across a reload, corrupt-index fallback, reencrypt-all, and the catch-up-since rule.
52 lines
1.3 KiB
Rust
52 lines
1.3 KiB
Rust
// Copyright 2026 The Goblin Developers
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
//! Nostr payment-messaging subsystem: contacts are nostr users, slatepacks
|
|
//! travel as NIP-17 private DMs (NIP-44 encrypted, NIP-59 gift-wrapped) over
|
|
//! relays reached through the in-process Nym mixnet client.
|
|
|
|
mod types;
|
|
pub use types::*;
|
|
|
|
pub mod config;
|
|
pub use config::{AcceptPolicy, NostrConfig};
|
|
|
|
pub mod pool;
|
|
pub mod relays;
|
|
|
|
mod store;
|
|
pub use store::NostrStore;
|
|
|
|
mod identity;
|
|
pub use identity::{IdentitySource, NostrIdentity};
|
|
|
|
pub mod identities;
|
|
pub use identities::{HeldError, HeldIdentities, MAX_IDENTITIES, catchup_since};
|
|
|
|
pub mod protocol;
|
|
pub use protocol::*;
|
|
|
|
pub mod wrapv3;
|
|
|
|
pub mod ingest;
|
|
pub use ingest::*;
|
|
|
|
mod client;
|
|
pub use client::{NostrProfile, NostrService, send_phase};
|
|
|
|
pub mod avatar;
|
|
pub mod nip05;
|
|
|
|
pub mod payuri;
|