From e340d028f1865b4e6c5d365259ac324e649318eb Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Thu, 25 Apr 2024 01:04:41 +0200 Subject: [PATCH] release v0.1.0 --- .github/workflows/build.yml | 7 ++- .github/workflows/codecov.yml | 80 +++++++++++++++++------------------ .github/workflows/test.yml | 30 ++++++------- Cargo.lock | 2 - Cargo.toml | 14 ++++-- MANIFEST.yml | 2 +- src/ed25519.rs | 4 +- src/runtime.rs | 4 +- src/secret.rs | 4 +- 9 files changed, 78 insertions(+), 69 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4424fe7..0c82b5f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,10 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-20.04, ubuntu-22.04, macos-12, macos-13, windows-2019, windows-2022 ] + os: [ + ubuntu-20.04, ubuntu-22.04, macos-12, macos-13, + # windows-2019, windows-2022 + ] steps: - uses: actions/checkout@v2 - name: Install rust stable @@ -71,7 +74,7 @@ jobs: strategy: fail-fast: false matrix: - toolchain: [ nightly, beta, stable, 1.75.0 ] + toolchain: [ nightly, beta, stable, 1.70.0 ] steps: - uses: actions/checkout@v2 - name: Install rust ${{ matrix.toolchain }} diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 2077319..f0a56d8 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -9,43 +9,43 @@ on: env: CARGO_TERM_COLOR: always -jobs: - codecov: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: rustfmt, llvm-tools-preview - - name: Build - uses: actions-rs/cargo@v1 - with: - command: build - args: --release - env: - CARGO_INCREMENTAL: "0" - RUSTFLAGS: "-Cinstrument-coverage" - RUSTDOCFLAGS: "-Cinstrument-coverage" - - name: Test - uses: actions-rs/cargo@v1 - with: - command: test - args: --all-features --no-fail-fast - env: - CARGO_INCREMENTAL: "0" - RUSTFLAGS: "-Cinstrument-coverage" - RUSTDOCFLAGS: "-Cinstrument-coverage" - - name: Install grcov - run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi - - name: Generate coverage - run: grcov . --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - files: ./coverage.lcov - flags: rust - fail_ci_if_error: true +jobs: [ ] +# codecov: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# - name: Set up toolchain +# uses: actions-rs/toolchain@v1 +# with: +# profile: minimal +# toolchain: stable +# override: true +# components: rustfmt, llvm-tools-preview +# - name: Build +# uses: actions-rs/cargo@v1 +# with: +# command: build +# args: --release +# env: +# CARGO_INCREMENTAL: "0" +# RUSTFLAGS: "-Cinstrument-coverage" +# RUSTDOCFLAGS: "-Cinstrument-coverage" +# - name: Test +# uses: actions-rs/cargo@v1 +# with: +# command: test +# args: --all-features --no-fail-fast +# env: +# CARGO_INCREMENTAL: "0" +# RUSTFLAGS: "-Cinstrument-coverage" +# RUSTDOCFLAGS: "-Cinstrument-coverage" +# - name: Install grcov +# run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi +# - name: Generate coverage +# run: grcov . --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov +# - name: Upload coverage to Codecov +# uses: codecov/codecov-action@v3 +# with: +# files: ./coverage.lcov +# flags: rust +# fail_ci_if_error: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f40b2cd..cbf5fe5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,18 +24,18 @@ jobs: with: command: test args: --workspace --all-features --no-fail-fast - wasm-testing: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install rust nightly - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - override: true - - uses: Swatinem/rust-cache@v2 - - uses: jetli/wasm-pack-action@v0.3.0 - - name: Add wasm32 target - run: rustup target add wasm32-unknown-unknown - - name: Test in headless Chrome - run: wasm-pack test --headless --chrome +# wasm-testing: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# - name: Install rust nightly +# uses: actions-rs/toolchain@v1 +# with: +# toolchain: nightly +# override: true +# - uses: Swatinem/rust-cache@v2 +# - uses: jetli/wasm-pack-action@v0.3.0 +# - name: Add wasm32 target +# run: rustup target add wasm32-unknown-unknown +# - name: Test in headless Chrome +# run: wasm-pack test --headless --chrome diff --git a/Cargo.lock b/Cargo.lock index 7cd74fe..53c4eca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -571,13 +571,11 @@ dependencies = [ "aes", "amplify", "baid64", - "base64", "chrono", "clap", "crossbeam-channel", "ec25519", "fluent-uri", - "mnemonic", "percent-encoding", "rand", "rpassword", diff --git a/Cargo.toml b/Cargo.toml index 251b4a4..1c923d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,16 @@ [package] name = "s2id" version = "0.1.0" +description = "Self-sovereign identity library and command-lie" +keywords = ["did", "ssi", "identity", "pgp", "gpg"] +categories = ["encoding", "value-formatting", "command-line-utilities"] +readme = "README.md" +authors = ["Dr. Maxim Orlovsky "] +homepage = "https://github.com/LNP-BP/ssi" +repository = "https://github.com/LNP-BP/ssi" edition = "2021" +rust-version = "1.70.0" +license = "Apache-2.0" [lib] name = "ssi" @@ -23,14 +32,11 @@ shellexpand = { version = "3.1.0", optional = true } sha2 = "0.10.8" fluent-uri = "0.1.4" percent-encoding = "2.3.1" - +# Cli-specific rpassword = { version = "7.3.1", optional = true } aes = { version = "0.8.4", optional = true } crossbeam-channel = { version = "0.5.12", optional = true } -mnemonic = "1.0.1" -base64 = "0.22.0" - [features] default = ["cli"] cli = ["clap", "crossbeam-channel", "shellexpand", "rpassword", "aes"] diff --git a/MANIFEST.yml b/MANIFEST.yml index 73bf9dc..e204ebe 100644 --- a/MANIFEST.yml +++ b/MANIFEST.yml @@ -3,7 +3,7 @@ Type: Library Kind: Free software License: Apache-2.0 Language: Rust -Compiler: 1.75 +Compiler: 1.70 Author: Maxim Orlovsky Maintained: LNP/BP Standards Association, Switzerland Maintainers: diff --git a/src/ed25519.rs b/src/ed25519.rs index 0877968..4809965 100644 --- a/src/ed25519.rs +++ b/src/ed25519.rs @@ -35,7 +35,7 @@ use crate::{Algo, Chain, InvalidPubkey, InvalidSig, SsiPub, SsiSig}; pub struct Ed25519Secret(pub(crate) SecretKey); impl Ord for Ed25519Secret { - fn cmp(&self, other: &Self) -> Ordering { self.0.as_slice().cmp(&other.0.as_slice()) } + fn cmp(&self, other: &Self) -> Ordering { self.0.as_slice().cmp(other.0.as_slice()) } } impl PartialOrd for Ed25519Secret { @@ -107,7 +107,7 @@ impl SsiPub { pub fn verify_ed25519(self, msg: [u8; 32], sig: SsiSig) -> Result<(), InvalidSig> { let sig = Signature::from_slice(&sig.0).map_err(|_| InvalidSig::InvalidData)?; let pk = PublicKey::try_from(self)?; - pk.verify(&msg, &sig).map_err(|err| { + pk.verify(msg, &sig).map_err(|err| { eprintln!("{err}"); InvalidSig::InvalidSig }) diff --git a/src/runtime.rs b/src/runtime.rs index c7be22a..28a719b 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -19,7 +19,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub const SSI_DIR: &'static str = "~/.ssi"; +pub const SSI_DIR: &str = "~/.ssi"; use std::collections::{BTreeSet, HashSet}; use std::fs; @@ -63,6 +63,7 @@ impl SsiRuntime { .read(true) .write(true) .create(true) + .truncate(false) .open(path)?; let mut permissions = file.metadata()?.permissions(); permissions.set_mode(0o600); @@ -79,6 +80,7 @@ impl SsiRuntime { .read(true) .write(true) .create(true) + .truncate(false) .open(path)?; let mut permissions = file.metadata()?.permissions(); permissions.set_mode(0o600); diff --git a/src/secret.rs b/src/secret.rs index a570f3a..c89f30f 100644 --- a/src/secret.rs +++ b/src/secret.rs @@ -178,10 +178,10 @@ impl SsiSecret { fn replace(&mut self, secret: &[u8]) { match self { SsiSecret::Bip340(_, sk) => { - sk.0 = secp256k1::SecretKey::from_slice(&secret).expect("same size") + sk.0 = secp256k1::SecretKey::from_slice(secret).expect("same size") } SsiSecret::Ed25519(_, sk) => { - sk.0 = ec25519::SecretKey::from_slice(&secret).expect("same size") + sk.0 = ec25519::SecretKey::from_slice(secret).expect("same size") } } }