Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
strategy:
fail-fast: false
matrix:
toolchain: [ nightly, beta, stable ]
toolchain: [ nightly, beta, stable, 1.59.0 ]
steps:
- uses: actions/checkout@v2
- name: Install rust ${{ matrix.toolchain }}
Expand All @@ -81,24 +81,6 @@ jobs:
with:
command: check
args: --workspace --all-targets --all-features
toolchains-old:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: [ 1.51.0 ]
steps:
- uses: actions/checkout@v2
- name: Install rust ${{ matrix.toolchain }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- name: All features
uses: actions-rs/cargo@v1
with:
command: check
args: --workspace --all-targets --features all_msrv47
dependency:
runs-on: ubuntu-latest
steps:
Expand Down
74 changes: 63 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 12 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lnpbp"
version = "0.9.0-alpha.1"
version = "0.9.0-alpha.2"
license = "MIT"
authors = ["Dr. Maxim Orlovsky <[email protected]>"]
description = "LNP/BP Core Library implementing LNPBP specifications & standards"
Expand All @@ -24,28 +24,31 @@ required-features = ["cli"]

[dependencies]
amplify = { version = "3.13.0", features = ["stringly_conversions", "std"] }
strict_encoding = "2.0.0-alpha.2"
lnpbp_bech32 = { version = "0.9.0-alpha.1", path = "bech32" }
lnpbp_chain = { version = "0.9.0-alpha.1", path = "chain" }
lnpbp_elgamal = { version = "0.9.0", path = "elgamal", optional = true }
lnpbp_identity = { version = "0.9.0-beta.1", path = "identity", optional = true }
serde_crate = { package = "serde", version = "1", features = ["derive"], optional = true }
serde_with = { version = "1.8", features = ["hex"], optional = true }
# serde_with_macros = { version = "~1.2.0", optional = true } # Fix for the problem in 1.3.0
clap = { version = "~3.1.18", features = ["derive"], optional = true }
serde_yaml = { version = "0.9", optional = true }
serde_json = { version = "1", optional = true }
clap = { version = "~3.1.18", features = ["derive"], optional = true } # Used by cli only
serde_yaml = { version = "0.9", optional = true } # Used by cli only
serde_json = { version = "1", optional = true } # Used by cli only
base64-compat = { version = "1", optional = true } # Used by cli only
base58 = { version = "0.2", optional = true } # Used by cli only
colorize = { version = "0.1.0", optional = true } # Used by cli only

[features]
default = ["zip"]
all = ["serde", "elgamal", "zip", "cli"]
cli = ["clap", "serde", "base64-compat", "base58", "serde_yaml", "serde_json", "amplify/hex"]
all = ["serde", "elgamal", "identity", "zip", "cli"]
cli = ["clap", "serde", "identity", "base64-compat", "base58", "serde_yaml", "serde_json", "amplify/hex", "colorize"]
serde = ["serde_crate", "serde_with", "amplify/serde",
"lnpbp_bech32/serde", "lnpbp_chain/serde"]
identity = ["lnpbp_identity"]
elgamal = ["lnpbp_elgamal"] # Provides ElGamal encryption module from this library
zip = ["lnpbp_bech32/zip"]
all_msrv47 = ["serde", "elgamal", "zip"] # Used in testing against MSRV 1.47

[workspace]
members = [".", "bech32", "chain", "elgamal"]
default-members = [".", "bech32", "chain", "elgamal"]
members = [".", "bech32", "chain", "elgamal", "identity"]
default-members = [".", "bech32", "chain", "elgamal", "identity"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The development of the libraries is supported by LNP/BP Standards Association.

### Clone and compile library

Minimum supported rust compiler version (MSRV): 1.51.0 (if command-line tool is not used) and 1.54.0 (otherwise).
Minimum supported rust compiler version (MSRV): 1.59.0.

```shell script
git clone https://github.com/lnp-bp/rust-lnpbp
Expand Down
4 changes: 1 addition & 3 deletions chain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ hash_newtype!(
);

impl Default for AssetId {
fn default() -> Self {
AssetId::from_inner([0u8; 32])
}
fn default() -> Self { AssetId::from_inner([0u8; 32]) }
}

impl strict_encoding::Strategy for AssetId {
Expand Down
12 changes: 8 additions & 4 deletions elgamal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ pub fn encrypt<C: Signing + Verification>(
let mut hash = sha256::Hash::hash(&encryption_key.serialize());

// Tweaking the encryption key with the blinding factor
let tweak = Scalar::from_be_bytes(blinding_key.secret_bytes()).expect("negligible probability");
let tweak = Scalar::from_be_bytes(blinding_key.secret_bytes())
.expect("negligible probability");
encryption_key = encryption_key.add_exp_tweak(context, &tweak)?;

// Pad the message to the round number of 30-byte chunks with the generated
Expand Down Expand Up @@ -152,7 +153,8 @@ pub fn decrypt<C: Verification>(
}

// Tweak the encryption key with the blinding factor
let tweak = Scalar::from_be_bytes(decryption_key.secret_bytes()).expect("negligible probability");
let tweak = Scalar::from_be_bytes(decryption_key.secret_bytes())
.expect("negligible probability");
unblinding_key = unblinding_key.add_exp_tweak(context, &tweak)?;
let encryption_key = unblinding_key;

Expand Down Expand Up @@ -237,8 +239,10 @@ mod test {

let uk = unblinding_key.clone();
let ek = encryption_key.clone();
let tweak1 = Scalar::from_be_bytes(blinding_key.secret_bytes()).unwrap();
let tweak2 = Scalar::from_be_bytes(decryption_key.secret_bytes()).unwrap();
let tweak1 =
Scalar::from_be_bytes(blinding_key.secret_bytes()).unwrap();
let tweak2 =
Scalar::from_be_bytes(decryption_key.secret_bytes()).unwrap();
assert_eq!(
ek.add_exp_tweak(&SECP256K1, &tweak1).unwrap(),
uk.add_exp_tweak(&SECP256K1, &tweak2).unwrap()
Expand Down
22 changes: 22 additions & 0 deletions identity/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "lnpbp_identity"
version = "0.9.0-beta.1"
license = "MIT"
authors = ["Dr. Maxim Orlovsky <[email protected]>"]
description = "LNP/BP identity standards implementation"
repository = "https://github.com/LNP-BP/rust-lnpbp"
homepage = "https://github.com/LNP-BP/rust-lnpbp/tree/master/identity"
keywords = ["bitcoin", "lnp-bp", "identity", "ed25519", "secp256k1"]
categories = ["cryptography"]
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
amplify = "4.0.0-alpha.1"
secp256k1 = { version = "0.24.1", features = ["global-context", "rand-std"] }
strict_encoding = "2.0.0-alpha.2"
bech32 = "0.9.1"
crc32fast = "1.3.2"
mnemonic = "1.0.1"
bitcoin_hashes = "0.11.0"
Loading