diff options
author | bryan newbold <bnewbold@robocracy.org> | 2023-02-19 15:37:20 -0800 |
---|---|---|
committer | bryan newbold <bnewbold@robocracy.org> | 2023-02-19 15:37:20 -0800 |
commit | b8ba815b4cafdff48694d14c994e862738d342ef (patch) | |
tree | 5719721c9f32ad242622d44eea7ec7212ce49312 | |
parent | 2c3977da3ee2229721d4551982537235066e22c8 (diff) | |
download | adenosine-b8ba815b4cafdff48694d14c994e862738d342ef.tar.gz adenosine-b8ba815b4cafdff48694d14c994e862738d342ef.zip |
move a bunch of code from pds to common
-rw-r--r-- | Cargo.lock | 48 | ||||
-rw-r--r-- | adenosine-pds/Cargo.toml | 12 | ||||
-rw-r--r-- | adenosine-pds/src/bin/adenosine-pds.rs | 1 | ||||
-rw-r--r-- | adenosine-pds/src/bsky.rs | 2 | ||||
-rw-r--r-- | adenosine-pds/src/lib.rs | 16 | ||||
-rw-r--r-- | adenosine-pds/src/web.rs | 2 | ||||
-rw-r--r-- | adenosine/Cargo.toml | 16 | ||||
-rw-r--r-- | adenosine/src/car.rs (renamed from adenosine-pds/src/car.rs) | 0 | ||||
-rw-r--r-- | adenosine/src/crypto.rs (renamed from adenosine-pds/src/crypto.rs) | 4 | ||||
-rw-r--r-- | adenosine/src/did.rs (renamed from adenosine-pds/src/did.rs) | 3 | ||||
-rw-r--r-- | adenosine/src/lib.rs | 7 | ||||
-rw-r--r-- | adenosine/src/mst.rs (renamed from adenosine-pds/src/mst.rs) | 0 | ||||
-rw-r--r-- | adenosine/src/repo.rs (renamed from adenosine-pds/src/repo.rs) | 4 | ||||
-rw-r--r-- | adenosine/src/ucan_p256.rs (renamed from adenosine-pds/src/ucan_p256.rs) | 0 | ||||
-rw-r--r-- | adenosine/src/vendored.rs (renamed from adenosine-pds/src/vendored.rs) | 0 | ||||
-rw-r--r-- | adenosine/src/vendored/iroh_car/README.md (renamed from adenosine-pds/src/vendored/iroh_car/README.md) | 0 | ||||
-rw-r--r-- | adenosine/src/vendored/iroh_car/error.rs (renamed from adenosine-pds/src/vendored/iroh_car/error.rs) | 0 | ||||
-rw-r--r-- | adenosine/src/vendored/iroh_car/header.rs (renamed from adenosine-pds/src/vendored/iroh_car/header.rs) | 0 | ||||
-rw-r--r-- | adenosine/src/vendored/iroh_car/lib.rs (renamed from adenosine-pds/src/vendored/iroh_car/lib.rs) | 0 | ||||
-rw-r--r-- | adenosine/src/vendored/iroh_car/mod.rs (renamed from adenosine-pds/src/vendored/iroh_car/mod.rs) | 0 | ||||
-rw-r--r-- | adenosine/src/vendored/iroh_car/reader.rs (renamed from adenosine-pds/src/vendored/iroh_car/reader.rs) | 0 | ||||
-rw-r--r-- | adenosine/src/vendored/iroh_car/util.rs (renamed from adenosine-pds/src/vendored/iroh_car/util.rs) | 0 | ||||
-rw-r--r-- | adenosine/src/vendored/iroh_car/writer.rs (renamed from adenosine-pds/src/vendored/iroh_car/writer.rs) | 0 |
23 files changed, 63 insertions, 52 deletions
@@ -7,17 +7,31 @@ name = "adenosine" version = "0.2.0" dependencies = [ "anyhow", + "async-trait", "base64", + "bs58", "data-encoding", "env_logger", + "futures", + "integer-encoding", + "ipfs-sqlite-block-store", + "k256", "lazy_static", + "libipld", "log", + "multibase", + "multihash", + "p256", "rand", "regex", "reqwest", "serde", "serde_json", + "sha256", + "thiserror", "time", + "tokio", + "ucan", ] [[package]] @@ -53,31 +67,21 @@ dependencies = [ "askama", "async-trait", "bcrypt", - "bs58", "data-encoding", "dotenvy", "futures", - "integer-encoding", "ipfs-sqlite-block-store", - "k256", "lazy_static", "libipld", "log", - "multibase", - "multihash", - "p256", "pretty_env_logger", "rouille", "rusqlite", "rusqlite_migration", "serde", "serde_json", - "sha256", "structopt", - "thiserror", - "time", "tokio", - "ucan", ] [[package]] @@ -284,9 +288,9 @@ dependencies = [ [[package]] name = "async-recursion" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cda8f4bcc10624c4e85bc66b3f452cca98cfa5ca002dc83a16aad2367641bea" +checksum = "3b015a331cc64ebd1774ba119538573603427eaace0a1950c423ab971f903796" dependencies = [ "proc-macro2", "quote", @@ -338,9 +342,9 @@ dependencies = [ [[package]] name = "atomic-waker" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" +checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599" [[package]] name = "atty" @@ -645,9 +649,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" +checksum = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e" dependencies = [ "crossbeam-utils", ] @@ -1169,9 +1173,9 @@ dependencies = [ [[package]] name = "gloo-timers" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c4a8d6391675c6b2ee1a6c8d06e8e2d03605c44cec1270675985a4c2a5500b" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" dependencies = [ "futures-channel", "futures-core", @@ -2448,9 +2452,9 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718dc5fff5b36f99093fc49b280cfc96ce6fc824317783bff5a1fed0c7a64819" +checksum = "416bda436f9aab92e02c8e10d49a15ddd339cea90b6e340fe51ed97abb548294" dependencies = [ "serde", ] @@ -2541,9 +2545,9 @@ dependencies = [ [[package]] name = "sha256" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e334db67871c14c18fc066ad14af13f9fdf5f9a91c61af432d1e3a39c8c6a141" +checksum = "328169f167261957e83d82be47f9e36629e257c62308129033d7f7e7c173d180" dependencies = [ "hex", "sha2 0.9.9", diff --git a/adenosine-pds/Cargo.toml b/adenosine-pds/Cargo.toml index 482a812..41cfaae 100644 --- a/adenosine-pds/Cargo.toml +++ b/adenosine-pds/Cargo.toml @@ -32,25 +32,13 @@ rouille = "3" adenosine = { version = "0.2.0", path = "../adenosine" } tokio = { version = "1", features = ["full"] } futures = "0.3" -sha256 = "1" lazy_static = "1" bcrypt = "0.13" data-encoding = "2" -k256 = { version = "0.11", features = ["ecdsa"] } -p256 = { version = "0.11", features = ["ecdsa"] } -multibase = "0.9" -ucan = "0.7.0-alpha.1" # TODO: replace this with data-encoding or similar; this is only needed for ucan_p256 stuff -bs58 = "0.4" async-trait = "0.1" dotenvy = "0.15" askama = { version = "0.11", features = ["serde-json"] } -time = { version = "0.3", features = ["formatting"] } - -# for vendored iroh-car -thiserror = "1.0" -integer-encoding = { version = "3", features = ["tokio_async"] } -multihash = "0.16" [package.metadata.deb] maintainer = "Bryan Newbold <bnewbold@robocracy.org>" diff --git a/adenosine-pds/src/bin/adenosine-pds.rs b/adenosine-pds/src/bin/adenosine-pds.rs index 1fef557..c16e7e0 100644 --- a/adenosine-pds/src/bin/adenosine-pds.rs +++ b/adenosine-pds/src/bin/adenosine-pds.rs @@ -1,3 +1,4 @@ +use adenosine::mst; use adenosine_pds::models::AccountRequest; use adenosine_pds::*; use anyhow::Result; diff --git a/adenosine-pds/src/bsky.rs b/adenosine-pds/src/bsky.rs index e966504..caa16f6 100644 --- a/adenosine-pds/src/bsky.rs +++ b/adenosine-pds/src/bsky.rs @@ -1,5 +1,4 @@ use crate::models::*; -use crate::repo::Mutation; /// Helper functions for doing database and repo operations relating to bluesky endpoints and /// records use crate::{ @@ -7,6 +6,7 @@ use crate::{ XrpcError, }; use adenosine::identifiers::{AtUri, DidOrHost, Nsid}; +use adenosine::repo::Mutation; use anyhow::anyhow; use libipld::Cid; use rusqlite::params; diff --git a/adenosine-pds/src/lib.rs b/adenosine-pds/src/lib.rs index 3664ce0..07905f9 100644 --- a/adenosine-pds/src/lib.rs +++ b/adenosine-pds/src/lib.rs @@ -15,24 +15,18 @@ use std::str::FromStr; use std::sync::Mutex; mod bsky; -mod car; -mod crypto; mod db; -mod did; pub mod models; -pub mod mst; -mod repo; -mod ucan_p256; -mod vendored; mod web; +pub use adenosine::crypto::{KeyPair, PubKey}; +pub use adenosine::did; +pub use adenosine::did::DidDocMeta; +pub use adenosine::repo::{Mutation, RepoCommit, RepoStore}; +pub use adenosine::ucan_p256::P256KeyMaterial; use bsky::*; -pub use crypto::{KeyPair, PubKey}; pub use db::AtpDatabase; -pub use did::DidDocMeta; pub use models::*; -pub use repo::{Mutation, RepoCommit, RepoStore}; -pub use ucan_p256::P256KeyMaterial; use web::*; pub struct AtpService { diff --git a/adenosine-pds/src/web.rs b/adenosine-pds/src/web.rs index fed9814..0d80b4e 100644 --- a/adenosine-pds/src/web.rs +++ b/adenosine-pds/src/web.rs @@ -1,6 +1,6 @@ use crate::models::*; -use crate::repo::RepoCommit; use adenosine::identifiers::{Did, Nsid, Tid}; +use adenosine::repo::RepoCommit; use askama::Template; #[derive(Template)] diff --git a/adenosine/Cargo.toml b/adenosine/Cargo.toml index a05aa78..456b0fe 100644 --- a/adenosine/Cargo.toml +++ b/adenosine/Cargo.toml @@ -24,6 +24,22 @@ lazy_static = "1" data-encoding = "2" rand = "0.8" time = { version = "0.3", features = ["formatting"] } +k256 = { version = "0.11", features = ["ecdsa"] } +p256 = { version = "0.11", features = ["ecdsa"] } +bs58 = "0.4" +libipld = "0.14" +ipfs-sqlite-block-store = "0.13" +tokio = { version = "1", features = ["full"] } +futures = "0.3" +sha256 = "1" +multibase = "0.9" +ucan = "0.7.0-alpha.1" +async-trait = "0.1" + +# for vendored iroh-car +thiserror = "1.0" +integer-encoding = { version = "3", features = ["tokio_async"] } +multihash = "0.16" # uncertain about these... anyhow = "1" diff --git a/adenosine-pds/src/car.rs b/adenosine/src/car.rs index 22f83bc..22f83bc 100644 --- a/adenosine-pds/src/car.rs +++ b/adenosine/src/car.rs diff --git a/adenosine-pds/src/crypto.rs b/adenosine/src/crypto.rs index adf4e02..3647928 100644 --- a/adenosine-pds/src/crypto.rs +++ b/adenosine/src/crypto.rs @@ -1,5 +1,5 @@ -use crate::P256KeyMaterial; -use adenosine::identifiers::Did; +use crate::identifiers::Did; +use crate::ucan_p256::P256KeyMaterial; use anyhow::{anyhow, ensure, Result}; use p256::ecdsa::signature::{Signer, Verifier}; use std::str::FromStr; diff --git a/adenosine-pds/src/did.rs b/adenosine/src/did.rs index 88fa5b8..c7d7d10 100644 --- a/adenosine-pds/src/did.rs +++ b/adenosine/src/did.rs @@ -1,9 +1,10 @@ +use crate::crypto::{KeyPair, PubKey}; /// DID and 'did:plc' stuff /// /// This is currently a partial/skeleton implementation, which only generates local/testing did:plc /// DIDs (and DID documents) using a single 'create' genesis block. Key rotation, etc, is not /// supported. -use crate::{Did, KeyPair, PubKey}; +use crate::identifiers::Did; use anyhow::Result; use libipld::cbor::DagCborCodec; use libipld::multihash::Code; diff --git a/adenosine/src/lib.rs b/adenosine/src/lib.rs index 461930f..dc4a1b9 100644 --- a/adenosine/src/lib.rs +++ b/adenosine/src/lib.rs @@ -6,7 +6,14 @@ use std::collections::HashMap; use std::str::FromStr; use std::time::Duration; +pub mod car; +pub mod crypto; +pub mod did; pub mod identifiers; +pub mod mst; +pub mod repo; +pub mod ucan_p256; +pub mod vendored; use identifiers::Nsid; static APP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),); diff --git a/adenosine-pds/src/mst.rs b/adenosine/src/mst.rs index 1d75da1..1d75da1 100644 --- a/adenosine-pds/src/mst.rs +++ b/adenosine/src/mst.rs diff --git a/adenosine-pds/src/repo.rs b/adenosine/src/repo.rs index f77b459..2383e52 100644 --- a/adenosine-pds/src/repo.rs +++ b/adenosine/src/repo.rs @@ -1,9 +1,9 @@ use crate::car::{ load_car_bytes_to_blockstore, load_car_path_to_blockstore, read_car_bytes_from_blockstore, }; +use crate::crypto::KeyPair; +use crate::identifiers::{Did, Nsid, Tid}; use crate::mst::{collect_mst_keys, generate_mst, CommitNode, MetadataNode, RootNode}; -use crate::KeyPair; -use adenosine::identifiers::{Did, Nsid, Tid}; use anyhow::{anyhow, ensure, Context, Result}; use ipfs_sqlite_block_store::BlockStore; use libipld::cbor::DagCborCodec; diff --git a/adenosine-pds/src/ucan_p256.rs b/adenosine/src/ucan_p256.rs index b8b6cd2..b8b6cd2 100644 --- a/adenosine-pds/src/ucan_p256.rs +++ b/adenosine/src/ucan_p256.rs diff --git a/adenosine-pds/src/vendored.rs b/adenosine/src/vendored.rs index 74584ad..74584ad 100644 --- a/adenosine-pds/src/vendored.rs +++ b/adenosine/src/vendored.rs diff --git a/adenosine-pds/src/vendored/iroh_car/README.md b/adenosine/src/vendored/iroh_car/README.md index 0cad81b..0cad81b 100644 --- a/adenosine-pds/src/vendored/iroh_car/README.md +++ b/adenosine/src/vendored/iroh_car/README.md diff --git a/adenosine-pds/src/vendored/iroh_car/error.rs b/adenosine/src/vendored/iroh_car/error.rs index 1edcefe..1edcefe 100644 --- a/adenosine-pds/src/vendored/iroh_car/error.rs +++ b/adenosine/src/vendored/iroh_car/error.rs diff --git a/adenosine-pds/src/vendored/iroh_car/header.rs b/adenosine/src/vendored/iroh_car/header.rs index cd0feb7..cd0feb7 100644 --- a/adenosine-pds/src/vendored/iroh_car/header.rs +++ b/adenosine/src/vendored/iroh_car/header.rs diff --git a/adenosine-pds/src/vendored/iroh_car/lib.rs b/adenosine/src/vendored/iroh_car/lib.rs index d4e5f66..d4e5f66 100644 --- a/adenosine-pds/src/vendored/iroh_car/lib.rs +++ b/adenosine/src/vendored/iroh_car/lib.rs diff --git a/adenosine-pds/src/vendored/iroh_car/mod.rs b/adenosine/src/vendored/iroh_car/mod.rs index b40e046..b40e046 100644 --- a/adenosine-pds/src/vendored/iroh_car/mod.rs +++ b/adenosine/src/vendored/iroh_car/mod.rs diff --git a/adenosine-pds/src/vendored/iroh_car/reader.rs b/adenosine/src/vendored/iroh_car/reader.rs index 90313f5..90313f5 100644 --- a/adenosine-pds/src/vendored/iroh_car/reader.rs +++ b/adenosine/src/vendored/iroh_car/reader.rs diff --git a/adenosine-pds/src/vendored/iroh_car/util.rs b/adenosine/src/vendored/iroh_car/util.rs index 90435b1..90435b1 100644 --- a/adenosine-pds/src/vendored/iroh_car/util.rs +++ b/adenosine/src/vendored/iroh_car/util.rs diff --git a/adenosine-pds/src/vendored/iroh_car/writer.rs b/adenosine/src/vendored/iroh_car/writer.rs index b7e25d3..b7e25d3 100644 --- a/adenosine-pds/src/vendored/iroh_car/writer.rs +++ b/adenosine/src/vendored/iroh_car/writer.rs |