Skip to content

Commit

Permalink
add ECDSA_256r1N in condition when checking if code is transferable (#…
Browse files Browse the repository at this point in the history
…148)

* add ECDSA_256r1N in condition when checking if code is transferable

Signed-off-by: arshdeep singh <[email protected]>

* fix format and updated version

Signed-off-by: arshdeep singh <[email protected]>

---------

Signed-off-by: arshdeep singh <[email protected]>
  • Loading branch information
Arsh-Sandhu authored May 23, 2023
1 parent 8ee80b8 commit 2b2a39f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cesride"
version = "0.6.0"
version = "0.6.1"
edition = "2021"
description = "Cryptographic primitives for use with Composable Event Streaming Representation (CESR)"
license = "Apache-2.0"
Expand Down
10 changes: 8 additions & 2 deletions src/core/matter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,12 @@ pub trait Matter: Default {
}

fn transferable(&self) -> bool {
const CODES: &[&str] =
&[tables::Codex::Ed25519N, tables::Codex::ECDSA_256k1N, tables::Codex::Ed448N];
const CODES: &[&str] = &[
tables::Codex::Ed25519N,
tables::Codex::ECDSA_256k1N,
tables::Codex::Ed448N,
tables::Codex::ECDSA_256r1N,
];

!CODES.contains(&self.code().as_str())
}
Expand Down Expand Up @@ -817,8 +821,10 @@ mod test {
#[rstest]
#[case(TestMatter::new_with_code_and_raw(matter::Codex::Ed25519, b"00000000000000000000000000000000").unwrap(), true)]
#[case(TestMatter::new_with_code_and_raw(matter::Codex::ECDSA_256k1, b"000000000000000000000000000000000").unwrap(), true)]
#[case(TestMatter::new_with_code_and_raw(matter::Codex::ECDSA_256r1, b"000000000000000000000000000000000").unwrap(), true)]
#[case(TestMatter::new_with_code_and_raw(matter::Codex::Ed25519N, b"00000000000000000000000000000000").unwrap(), false)]
#[case(TestMatter::new_with_code_and_raw(matter::Codex::ECDSA_256k1N, b"000000000000000000000000000000000").unwrap(), false)]
#[case(TestMatter::new_with_code_and_raw(matter::Codex::ECDSA_256r1N, b"000000000000000000000000000000000").unwrap(), false)]
fn transferable(#[case] matter: TestMatter, #[case] result: bool) {
assert_eq!(matter.transferable(), result);
}
Expand Down

0 comments on commit 2b2a39f

Please sign in to comment.