Skip to content

Commit 699bac2

Browse files
authored
Implement anonymous mode (#493)
1 parent de11d9b commit 699bac2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+6238
-6967
lines changed

.cargo/config.toml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/target
22
/contacts/*
33
/esplora/.docker_data/
4-
data/
4+
./data/
55
/frontend_build/*
66
/identity/*
77
/bills/*

CHANGELOG.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
# 0.3.11
2+
3+
* Add LICENSE to crates
4+
* Remove the `bcr-ebill-web` crate
5+
* Use a list of Nostr relays everywhere, instead of a single one, including in the config
6+
* Add Blank Endorse Bill data model implementation
7+
* Rename `IdentityPublicData` to `BillIdentParticipant`
8+
* same for `LightIdentityPublicData`
9+
* Introduce the concept of `BillParticipant`, with the variants `Ident` and `Anon`
10+
* `Anon` includes a `BillAnonParticipant`
11+
* `Ident` includes a `BillIdentParticipant`
12+
* Use `BillParticipant` in parts of the bill where a participant can be anonymous
13+
* Add the possibility to add anonymous contacts
14+
* They only have Node Id, Name and E-Mail as fields
15+
* E-Mail is optional
16+
* This changes the data model for contacts, `email` and `postal_address` are now optional
17+
* Additional validation rules ensure the fields can only be set for non-anon contacts
18+
* Adds an endpoint `Api.contact().deanonymize()` to de-anonymize a contact by adding all necessary fields for a personal, or company contact
19+
* It takes the same payload as creating a contact and fails for non-anon contacts
20+
* Add the possibility to add an anonymous identity
21+
* They only have Node Id, (nick)name and E-Mail as fields
22+
* E-Mail is optional
23+
* Adds an endpoint `Api.identity().deanonymize()` to de-anonymize an identity by adding all necessary fields for a personal identity
24+
* It takes the same payload as creating an identity and fails for a non-anon identity
25+
* Anon identity can't issue bills, or create a company
26+
* Add the possibility to issue and endorse blank
27+
* New `Api.bill()` methods for blank endorsements
28+
* `issue_blank`
29+
* `offer_to_sell_blank`
30+
* `endorse_bill_blank`
31+
* `mint_bill_blank`
32+
* Can issue (non-self-drafted) blank bills (payee is anon)
33+
* Can endorse/mint/offer to sell to anon endorsee/mint/buyer
34+
* If caller of a bill action is anonymous in the bill, any action they take stay anonymous (e.g. endorse)
35+
* Add endpoint to check payment for singular bill
36+
* `Api.bill().check_payment_for_bill(id)`
37+
* Fix TS type for identity detail
38+
* Return identity on `create` and `deanonymize` identity for consistency
39+
140
# 0.3.10
241

342
* Change default testnet block explorer to `https://esplora.minibill.tech`

Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
[workspace]
22
resolver = "3"
33
members = [
4-
"crates/bcr-ebill-web",
54
"crates/bcr-ebill-core",
6-
"crates/bcr-ebill-api",
75
"crates/bcr-ebill-persistence",
86
"crates/bcr-ebill-transport",
7+
"crates/bcr-ebill-api",
98
"crates/bcr-ebill-wasm",
109
]
1110

@@ -33,15 +32,14 @@ serde_repr = "0.1"
3332
futures = { version = "0.3", default-features = false }
3433
anyhow = { version = "1", default-features = false }
3534
thiserror = { version = "2", default-features = false }
36-
lazy_static = "1.5"
3735
uuid = { version = "1", default-features = false, features = ["v4", "js"] }
3836
bitcoin = { version = "0.32", default-features = false }
3937
bip39 = { version = "2.1", features = ["rand"] }
4038
ecies = { version = "0.2", default-features = false, features = ["pure"] }
4139
nostr = { version = "0.40"}
4240
nostr-sdk = { version = "0.40", features = ["nip04", "nip59"] }
4341
getrandom = { version = "0.3.1", features = ["wasm_js"] }
44-
reqwest = { version = "0.12", default-features = false, features = ["json"] }
4542
async-broadcast = "0.7.2"
4643
rstest = "0.25.0"
4744
secp256k1 = { version = "0.29" }
45+
reqwest = { version = "0.12", default-features = false }

Dockerfile

Lines changed: 0 additions & 63 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ The project consists of the following crates:
88

99
* `bcr-ebill-core` - core data models and traits
1010
* `bcr-ebill-persistence` - persistence traits and SurrealDB implementation
11-
* `bcr-ebill-transport` - network transport traits and Nostr implementation
11+
* `bcr-ebill-transport` - network transport API traits and Nostr implementation
1212
* `bcr-ebill-api` - API of the E-Bills project, contains most of the business logic
13-
* `bcr-ebill-web` - Entrypoint for Web applications using the Rocket web server
1413
* `bcr-ebill-wasm` - Entrypoint for WASM version of the E-Bill API
1514

16-
### Entrypoints
15+
### Entrypoint
1716

18-
There are both `WASM` and `Web` entry points into the API. You can find the documentation to build and configure them [here](docs/index.md):
17+
There is a `WASM` entry point into the API. You can find the documentation to build and configure it [here](docs/index.md):
1918

2019
### Tests
2120

crates/bcr-ebill-api/Cargo.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bcr-ebill-api"
3-
version = "0.3.10"
3+
version = "0.3.11"
44
edition = "2024"
55
license = "MIT"
66

@@ -22,14 +22,19 @@ uuid.workspace = true
2222
bitcoin.workspace = true
2323
nostr-sdk.workspace = true
2424
futures.workspace = true
25-
reqwest.workspace = true
2625
infer = { version = "0.19.0", default-features = false }
2726
bcr-ebill-core = { path = "../bcr-ebill-core" }
2827
bcr-ebill-persistence = { path = "../bcr-ebill-persistence" }
2928
bcr-ebill-transport = { path = "../bcr-ebill-transport" }
3029
tokio.workspace = true
3130
tokio_with_wasm.workspace = true
3231

32+
[target.'cfg(target_arch = "wasm32")'.dependencies]
33+
reqwest = { workspace = true, features = ["json"] }
34+
35+
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
36+
reqwest = { workspace = true, features = ["default", "json"] }
37+
3338
[dev-dependencies]
3439
mockall = "0.13.1"
3540
nostr-relay-builder = "0.40"

crates/bcr-ebill-api/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ pub use persistence::notification::NotificationFilter;
2424
pub struct Config {
2525
pub bitcoin_network: String,
2626
pub esplora_base_url: String,
27-
pub nostr_relay: String,
28-
pub surreal_db_connection: String,
27+
pub nostr_relays: Vec<String>,
28+
pub db_config: SurrealDbConfig,
2929
pub data_dir: String,
3030
}
3131

crates/bcr-ebill-api/src/persistence/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::Config;
22
use bcr_ebill_persistence::{
33
BackupStoreApi, ContactStoreApi, NostrEventOffsetStoreApi, NotificationStoreApi,
44
SurrealBackupStore, SurrealBillChainStore, SurrealBillStore, SurrealCompanyChainStore,
5-
SurrealCompanyStore, SurrealContactStore, SurrealDbConfig, SurrealIdentityChainStore,
6-
SurrealIdentityStore, SurrealNostrEventOffsetStore, SurrealNotificationStore,
5+
SurrealCompanyStore, SurrealContactStore, SurrealIdentityChainStore, SurrealIdentityStore,
6+
SurrealNostrEventOffsetStore, SurrealNotificationStore,
77
bill::{BillChainStoreApi, BillStoreApi},
88
company::{CompanyChainStoreApi, CompanyStoreApi},
99
db::nostr_send_queue::SurrealNostrEventQueueStore,
@@ -46,8 +46,7 @@ pub struct DbContext {
4646

4747
/// Creates a new instance of the DbContext with the given SurrealDB configuration.
4848
pub async fn get_db_context(conf: &Config) -> bcr_ebill_persistence::Result<DbContext> {
49-
let surreal_db_config = SurrealDbConfig::new(&conf.surreal_db_connection);
50-
let db = get_surreal_db(&surreal_db_config).await?;
49+
let db = get_surreal_db(&conf.db_config).await?;
5150

5251
let company_store = Arc::new(SurrealCompanyStore::new(db.clone()));
5352
#[cfg(target_arch = "wasm32")]

0 commit comments

Comments
 (0)