Skip to content

Commit e0cef1e

Browse files
committed
chore: moar changes
1 parent 5076e7d commit e0cef1e

File tree

5 files changed

+386
-44
lines changed

5 files changed

+386
-44
lines changed

README.md

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Keystache
2+
3+
Keystache is a desktop Nostr key management and Bitcoin wallet.
4+
5+
## Description
6+
7+
Keystache is designed to provide a secure and user-friendly interface for managing Nostr keys and interacting with Fedimint Bitcoin federations. It offers features such as:
8+
9+
- Nostr key management (creation, storage, and deletion)
10+
- Nostr relay management
11+
- Bitcoin wallet functionality through Fedimint federations
12+
- Secure, encrypted local storage of keys and data
13+
14+
## Features
15+
16+
- **Nostr Key Management**: Create, store, and manage Nostr keys securely.
17+
- **Relay Management**: Connect to and manage Nostr relays.
18+
- **Fedimint Bitcoin Wallet**: Send and receive Bitcoin through Fedimint federations.
19+
- **Encrypted Storage**: All sensitive data is encrypted at rest.
20+
- **User-Friendly Interface**: Built with Iced, a cross-platform GUI library for Rust.
21+
22+
## Installation
23+
24+
To build Keystache from source:
25+
26+
1. Ensure you have Rust and Cargo installed on your system.
27+
2. Clone the repository:
28+
```
29+
git clone https://github.com/Open-Source-Justice-Foundation/Keystache.git
30+
```
31+
3. Navigate to the project directory:
32+
```
33+
cd Keystache
34+
```
35+
4. Build the project:
36+
```
37+
cargo build --release
38+
```
39+
5. Run the application:
40+
```
41+
cargo run --release
42+
```
43+
44+
## Usage
45+
46+
After launching Keystache, you'll be prompted to create a new password or enter an existing one to unlock your database. Once inside, you can:
47+
48+
- Manage Nostr keys
49+
- Connect to and manage Nostr relays
50+
- Send and receive Bitcoin through Fedimint federations
51+
- Adjust settings and view application information
52+
53+
## Development
54+
55+
Keystache is built using Rust and the Iced GUI library. The project structure is as follows:
56+
57+
- `src/`: Contains the main application code
58+
- `src/db/`: Database-related code
59+
- `src/fedimint/`: Fedimint integration
60+
- `src/nostr/`: Nostr-related functionality
61+
- `src/routes/`: Application routes and views
62+
- `src/ui_components/`: Reusable UI components
63+
- `assets/`: Contains icons and other static assets
64+
65+
## Contributing
66+
67+
Contributions to Keystache are welcome! Please feel free to submit pull requests, create issues, or suggest improvements.
68+
69+
## License
70+
71+
[Insert appropriate license information here]
72+
73+
## Acknowledgments
74+
75+
Keystache is created by Tommy Volk and generously funded by OpenSats.
76+
77+
## Contact
78+
79+
For questions or support, please [insert contact information or link to support resources].

assets/icons/search.svg

+1
Loading

src/nostr.rs

+12-16
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ impl NostrModule {
6666
async_stream::stream! {
6767
let mut last_state = NostrState::default();
6868

69-
tokio::time::sleep(Duration::from_secs(2)).await;
70-
this.find_federations().await;
71-
7269
loop {
7370
let new_state = this.get_state().await;
7471
if new_state != last_state {
@@ -82,9 +79,12 @@ impl NostrModule {
8279
)
8380
}
8481

85-
pub async fn find_federations(&self) {
86-
println!("Finding federation recommendations...");
87-
82+
pub async fn find_federations(
83+
&self,
84+
) -> Result<
85+
BTreeMap<FederationId, (BTreeSet<PublicKey>, BTreeSet<InviteCode>)>,
86+
nostr_sdk::client::Error,
87+
> {
8888
let fedimint_recommendation_events = self
8989
.client
9090
.get_events_of(
@@ -94,11 +94,10 @@ impl NostrModule {
9494
.custom_tag(SingleLetterTag::lowercase(Alphabet::N), vec!["mainnet"])],
9595
EventSource::both(None),
9696
)
97-
.await
98-
.unwrap();
97+
.await?;
98+
99+
let mut federations = BTreeMap::new();
99100

100-
let mut federations: BTreeMap<FederationId, (BTreeSet<PublicKey>, BTreeSet<InviteCode>)> =
101-
BTreeMap::new();
102101
for recommendation_event in &fedimint_recommendation_events {
103102
for d_tag in recommendation_event.get_tags_content(TagKind::SingleLetter(
104103
SingleLetterTag::lowercase(Alphabet::D),
@@ -122,12 +121,9 @@ impl NostrModule {
122121
}
123122
}
124123

125-
println!("{:#?}", federations);
126-
println!(
127-
"Found {} recommendations for {} federations",
128-
fedimint_recommendation_events.len(),
129-
federations.len()
130-
);
124+
federations.retain(|_, (_, invite_codes)| !invite_codes.is_empty());
125+
126+
Ok(federations)
131127
}
132128

133129
/// Fetches the current state of the Nostr SDK client.

0 commit comments

Comments
 (0)