Skip to content

Commit

Permalink
chore: moar changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tvolk131 committed Sep 28, 2024
1 parent 5076e7d commit e0cef1e
Show file tree
Hide file tree
Showing 5 changed files with 386 additions and 44 deletions.
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Keystache

Keystache is a desktop Nostr key management and Bitcoin wallet.

## Description

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:

- Nostr key management (creation, storage, and deletion)
- Nostr relay management
- Bitcoin wallet functionality through Fedimint federations
- Secure, encrypted local storage of keys and data

## Features

- **Nostr Key Management**: Create, store, and manage Nostr keys securely.
- **Relay Management**: Connect to and manage Nostr relays.
- **Fedimint Bitcoin Wallet**: Send and receive Bitcoin through Fedimint federations.
- **Encrypted Storage**: All sensitive data is encrypted at rest.
- **User-Friendly Interface**: Built with Iced, a cross-platform GUI library for Rust.

## Installation

To build Keystache from source:

1. Ensure you have Rust and Cargo installed on your system.
2. Clone the repository:
```
git clone https://github.com/Open-Source-Justice-Foundation/Keystache.git
```
3. Navigate to the project directory:
```
cd Keystache
```
4. Build the project:
```
cargo build --release
```
5. Run the application:
```
cargo run --release
```

## Usage

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:

- Manage Nostr keys
- Connect to and manage Nostr relays
- Send and receive Bitcoin through Fedimint federations
- Adjust settings and view application information

## Development

Keystache is built using Rust and the Iced GUI library. The project structure is as follows:

- `src/`: Contains the main application code
- `src/db/`: Database-related code
- `src/fedimint/`: Fedimint integration
- `src/nostr/`: Nostr-related functionality
- `src/routes/`: Application routes and views
- `src/ui_components/`: Reusable UI components
- `assets/`: Contains icons and other static assets

## Contributing

Contributions to Keystache are welcome! Please feel free to submit pull requests, create issues, or suggest improvements.

## License

[Insert appropriate license information here]

## Acknowledgments

Keystache is created by Tommy Volk and generously funded by OpenSats.

## Contact

For questions or support, please [insert contact information or link to support resources].
1 change: 1 addition & 0 deletions assets/icons/search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 12 additions & 16 deletions src/nostr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ impl NostrModule {
async_stream::stream! {
let mut last_state = NostrState::default();

tokio::time::sleep(Duration::from_secs(2)).await;
this.find_federations().await;

loop {
let new_state = this.get_state().await;
if new_state != last_state {
Expand All @@ -82,9 +79,12 @@ impl NostrModule {
)
}

pub async fn find_federations(&self) {
println!("Finding federation recommendations...");

pub async fn find_federations(
&self,
) -> Result<
BTreeMap<FederationId, (BTreeSet<PublicKey>, BTreeSet<InviteCode>)>,
nostr_sdk::client::Error,
> {
let fedimint_recommendation_events = self
.client
.get_events_of(
Expand All @@ -94,11 +94,10 @@ impl NostrModule {
.custom_tag(SingleLetterTag::lowercase(Alphabet::N), vec!["mainnet"])],
EventSource::both(None),
)
.await
.unwrap();
.await?;

let mut federations = BTreeMap::new();

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

println!("{:#?}", federations);
println!(
"Found {} recommendations for {} federations",
fedimint_recommendation_events.len(),
federations.len()
);
federations.retain(|_, (_, invite_codes)| !invite_codes.is_empty());

Ok(federations)
}

/// Fetches the current state of the Nostr SDK client.
Expand Down
Loading

0 comments on commit e0cef1e

Please sign in to comment.