Skip to content

Commit 82640d2

Browse files
Major upgrade from WACC to Comrade DSL, added bs-p2p, bs-peer, all the bs (#18)
Major upgrade for BetterSign from my Comrade and BestSign projects. branched off of comrade/bestsign branch 81b2c99 p2p peer wallet evolved traits type-safe fixes #4, #15, supersedes #16 Commits: * scaffold comrade & component * add parser * eval script test passing * fix comments * fixup comments * cleanup * fix bug in lock/unlock curr/proposed stack push * rename crypto to reference its the reference impl it has wacc and runtime and parser and ast... what else do you call it * add wasm component * cleanup * WIP: Start to scaffold the main API Work in progress * nice clean api * add rustdoc comments * scaffold virtual runtime * rename vm -> runtime because it runs the script * haul in deps for wasm runtime * makeruntimes optional and extensible * add runtime trait and Runner bounds * fix typo * scaffold build bytes and justfile recipes * set wasmi_runtime_layer to v0.40 * add wasm32 build, test, just recipes * random module is for wasm32 only * add layer definitions * use Pairable supertrait * tested logs * impl try_unlock * more tests * test passing! * add readme rustdoc tests * small fixes * add direct runtime * switch to direct runtime as default * web tests * rm dead code * use CondSync since wasm32 doesn't need Send + Sync * comrade use Pairs only rm Pairable * mk comrade worspace dep * update lifetime * fix missing dep (again) cryptidtech/multicid@2458479 * update trait to incl Error too * update plog and open * haul in bs-p2p * use Self::Error assoc type in traits * add cond_send for wasm32 and native compat * constraint data references by (Cond)Sync bounds * elide lifetimes where poss, add Panics comments to uncheched fns * rm workspace dep with js feat * trait, associate types, sync and async * add `with_domain` for non-"/" paths * readme edits * add readme * readme * use shiny new traits in bs and cli * READMEs (plural) * README * map_err * use set_error method * WIP: Stash * add prev_cid to VerifyIter * fix comments * first pass (incomplete) * add wallet with updated traits * update deps * fix content-addressable errors and tests * immutable trait * use wallet in browser peer * fix Error types in trait and tests testing passes * add README note for running tests * fix Codec * fix the fix * add entry_key mod * fix bug in verifyiter * add failing comrade tests * upraded, passing tests * cleanup * store BsPeer config to blockstore * add tests to update_plog * update cli plog * use directories for blockstore * save arbitrary data to log and blockstore * add cargo config.toml * add vlad.cid() method * store plog entries to blockstore * use test fixtures * evolve key, keypath and signing traits * tidy up * add dep * use NonZeroUsize for threshold and limit, plus general update * progress VladParams * modernize VladParams API * rn, mv, tightly couple FirstEntryKeyParams to Vlad * refactor open::Config * update cli and docs for VladParams type safety * refactor update::Config * derive first lock script from within Vlad * web tests * add update and load tests * add network to bs-peer * add resolver and interop test * progress tests * passing interop tests * revamp Resolver trait * use ResolverExt in bs crate * complete rustdoc para * add log detail * add error details * plog get_value includes ops * improve native test * downgrade trace * add test README details * add more docs * export DefaultBsPeer * export bs_peer utils * impl Display for Vlad and test it * save swarm config to directories * re-exports * log runtime errors * rename from peerpiper to bettersign * export Client * scaffold bs-server * record plog to DHT * error is not connected and trying to DHT publish * convert Entry to use bon builder, add rustdocs * update checks seqno for lipmaa and sets accordingly * move entry as it gets signed * no more cloning * update tests * add justfile for chromedriver download * new Vlad generate API * add Vlad::try_from_str * Nonce creation methods * better rustdocs * re-export ResolverExt * mv Resolver to network client * docs * add PartialEq * make public fn * impl Clone for BsPeer * entry signing key methods * wrap plog on Arc Mutex * shorter lock hold in block * fix tests (deadlock) * enable StartConfig * derive Hash on types * export Libp2pEvents * entrie vlad goes in DHT as bytes * add tracing * add timeout, SuperResolver supertrait for CondSend so we can use timeout in both wasm and tokio * rm unneeded lock * store entries on update * cleanup deps * updated API and tests * add ability to rotate keys * publish to pubsub too * rm dead import * add vlad length to test output * [email protected]
1 parent e04d40e commit 82640d2

File tree

205 files changed

+15187
-4835
lines changed

Some content is hidden

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

205 files changed

+15187
-4835
lines changed

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[target.wasm32-unknown-unknown]
2+
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ Cargo.lock
1313
# MSVC Windows builds of rustc generate these, which store debugging information
1414
*.pdb
1515
.idea/
16+
crates/bs-p2p/local_keypair

Cargo.toml

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ members = [
66
"crates/bs",
77
"crates/bs-p2p",
88
"crates/bs-traits",
9+
"crates/comrade",
10+
"crates/comrade-component",
11+
"crates/comrade-reference",
12+
"crates/bs-p2p",
913
"crates/content-addressable",
1014
"crates/multibase",
1115
"crates/multicid",
@@ -17,13 +21,19 @@ members = [
1721
"crates/multiutil",
1822
"crates/provenance-log",
1923
"crates/rng",
20-
"crates/wacc",
24+
"crates/bs-peer",
25+
"crates/interop-tests",
26+
"crates/bs-wallets",
27+
"crates/bs-server",
2128
]
2229

2330
[workspace.package]
2431
version = "1.0.0"
2532
edition = "2021"
26-
authors = ["Dave Grantham <[email protected]>"]
33+
authors = [
34+
"Dave Grantham <[email protected]>",
35+
"Doug Anderson <[email protected]>",
36+
]
2737
description = "The BetterSign Provenance-Based Identity Solution"
2838
readme = "README.md"
2939
license = "FSL-1.1 OR Apache-2.0"
@@ -32,13 +42,17 @@ license = "FSL-1.1 OR Apache-2.0"
3242
unexpected_cfgs = { level = "warn", check-cfg = [
3343
'cfg(feature, values("cargo-clippy"))',
3444
'cfg(fuzzing)',
35-
]}
45+
] }
3646

3747
[workspace.dependencies]
3848
# Crate ependencies
3949
bs = { path = "crates/bs" }
4050
bs-p2p = { path = "crates/bs-p2p" }
51+
bs-peer = { path = "crates/bs-peer" }
4152
bs-traits = { path = "crates/bs-traits" }
53+
bs-wallets = { path = "crates/bs-wallets" }
54+
comrade = { path = "crates/comrade" }
55+
comrade-reference = { path = "crates/comrade-reference" }
4256
multibase = { path = "crates/multibase" }
4357
multicid = { path = "crates/multicid" }
4458
multicodec = { path = "crates/multicodec" }
@@ -49,29 +63,41 @@ multitrait = { path = "crates/multitrait" }
4963
multiutil = { path = "crates/multiutil" }
5064
provenance-log = { path = "crates/provenance-log" }
5165
rng = { path = "crates/rng" }
52-
wacc = { path = "crates/wacc" }
5366

5467
# Core dependencies
5568
best-practices = { version = "0.1.0", git = "https://github.com/cryptidtech/best-practices.git" }
69+
blockstore = "0.7.1"
70+
cid = "0.11.0"
5671
criterion = "0.5.1"
5772
elliptic-curve = "0.13.8"
5873
hex = "0.4.3"
74+
libp2p = { version = "0.54.1" }
75+
multihash-codetable = { version = "0.1.4" }
5976
rand = { version = "0.9.0", features = ["os_rng"] }
6077
rand_core = "0.9.3"
6178
rand_6 = { version = "0.6.4", package = "rand" }
6279
rand_core_6 = { version = "0.6.4", package = "rand_core" }
63-
serde = { version = "1.0.219", default-features = false, features = ["alloc", "derive"]}
64-
serde_cbor = { version = "0.11.2", features = ["tags"]}
65-
serde_json = { version = "1.0.104"}
66-
serde_test = { version = "1.0.104"}
80+
serde = { version = "1.0.219", default-features = false, features = [
81+
"alloc",
82+
"derive",
83+
] }
84+
serde_cbor = { version = "0.11.2", features = ["tags"] }
85+
serde_json = { version = "1.0.104" }
86+
serde_test = { version = "1.0.104" }
6787
sha3 = "0.10.8"
6888
test-log = { version = "0.2.17", features = ["trace", "color"] }
6989
thiserror = "2.0.12"
70-
tokio = { version = "1.44.2", features = ["fs", "io-util", "macros", "rt", "test-util"] }
90+
tokio = { version = "1.44.2" }
7191
tracing = "0.1.41"
7292
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
7393
unsigned-varint = { version = "0.8.0", features = ["std"] }
94+
web-sys = { version = "0.3.77" }
95+
wasm-bindgen-futures = "0.4.50"
7496

7597
[profile.bench]
7698
opt-level = 3
7799
debug = false
100+
101+
# until lands: https://github.com/libp2p/rust-libp2p/issues/5877
102+
[patch.crates-io]
103+
libp2p-webrtc-utils = { git = "https://github.com/DougAnderson444/rust-libp2p.git", branch = "core-v0.42-webrtc-utils-0.3.0" }

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88

99
[<img src="https://img.youtube.com/vi/LxU4wG4ryFo/hqdefault.jpg" width="100%" />](https://www.youtube.com/watch?v=LxU4wG4ryFo)
1010

11+
## Tests
12+
13+
Run the [just command](https://just.systems/man/en/) in the root of the repository to run the tests:
14+
15+
```
16+
just test
17+
```
18+
1119
## Introduction
1220

1321
BetterSign (`bs`) is a new signing tool designed to use provenance based

cli/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ anyhow = "1.0"
2020
async-trait = "0.1"
2121
best-practices.workspace = true
2222
bs.workspace = true
23+
bs-traits.workspace = true
2324
clap = { version = "4.5.36", features = ["cargo"] }
2425
colored = "3.0.0"
2526
csv = "1.3.1"
@@ -42,15 +43,15 @@ rustyline = { version = "15.0.0", features = ["derive"] }
4243
serde = { workspace = true, optional = true }
4344
serde_cbor.workspace = true
4445
serde_json.workspace = true
45-
ssh-key = { version = "0.6.2", features = ["crypto", "ed25519"]}
46+
ssh-key = { version = "0.6.2", features = ["crypto", "ed25519"] }
4647
ssh-agent-client-rs = "1.0.0"
4748
structopt = "0.3.26"
4849
thiserror.workspace = true
49-
tokio = { version = "1.44.2", features = ["full"] }
50+
tokio = { workspace = true, features = ["full"] }
5051
toml = "0.8.20"
5152
tracing.workspace = true
5253
tracing-subscriber.workspace = true
53-
wacc.workspace = true
54+
comrade.workspace = true
5455

5556
[dev-dependencies]
5657
tokio-test = "0.4.4"

cli/src/error.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// SPDX-License-Identifier: FSL-1.1
2+
use provenance_log::Key;
3+
24
/// Errors generated from this crate
35
#[derive(Debug, thiserror::Error)]
46
#[non_exhaustive]
@@ -29,6 +31,15 @@ pub enum Error {
2931
/// Bs errors
3032
#[error(transparent)]
3133
Bs(#[from] bs::Error),
34+
35+
/// Error opening a provenance log
36+
#[error(transparent)]
37+
Open(#[from] bs::error::OpenError),
38+
39+
/// Error updating a provenance log
40+
#[error(transparent)]
41+
Update(#[from] bs::error::UpdateError),
42+
3243
/// Multicid error
3344
#[error(transparent)]
3445
Multicid(#[from] multicid::Error),
@@ -98,6 +109,10 @@ pub enum Error {
98109
/// Invalid backend type
99110
#[error("Invalid backend type {0}")]
100111
InvalidBackendType(String),
112+
113+
/// From<std::string::FromUtf8Error>
114+
#[error(transparent)]
115+
FromUtf8Error(#[from] std::string::FromUtf8Error),
101116
}
102117

103118
/// SshAgent error
@@ -158,4 +173,8 @@ pub enum PlogError {
158173
/// No string value given
159174
#[error("No string value given")]
160175
NoStringValue,
176+
177+
/// No key present for that KeyPath
178+
#[error("No key present for that KeyPath {0}")]
179+
NoKeyPresent(Key),
161180
}

0 commit comments

Comments
 (0)