-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update zkryptium/json-proof-token deps and new BLS key representation
- Loading branch information
1 parent
bdf6b54
commit ac4b5c0
Showing
7 changed files
with
127 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use core::fmt::Display; | ||
use core::fmt::Formatter; | ||
use core::fmt::Result; | ||
|
||
/// Supported BLS Curves. | ||
/// | ||
/// [More Info](https://datatracker.ietf.org/doc/html/draft-ietf-cose-bls-key-representations-05#name-curve-parameter-registratio) | ||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] | ||
pub enum BlsCurve { | ||
/// A cryptographic key on the Barreto-Lynn-Scott (BLS) curve featuring an embedding degree 12 with 381-bit p in the subgroup of G1. | ||
BLS12381G1, | ||
/// A cryptographic key on the Barreto-Lynn-Scott (BLS) curve featuring an embedding degree 12 with 381-bit p in the subgroup of G2. | ||
BLS12381G2, | ||
/// A cryptographic key on the Barreto-Lynn-Scott (BLS) curve featuring an embedding degree 48 with 581-bit p in the subgroup of G1. | ||
BLS48581G1, | ||
/// A cryptographic key on the Barreto-Lynn-Scott (BLS) curve featuring an embedding degree 48 with 581-bit p in the subgroup of G2. | ||
BLS48581G2, | ||
} | ||
|
||
impl BlsCurve { | ||
/// Returns the name of the curve as a string slice. | ||
pub const fn name(self) -> &'static str { | ||
match self { | ||
Self::BLS12381G1 => "BLS12381G1", | ||
Self::BLS12381G2 => "BLS12381G2", | ||
Self::BLS48581G1 => "BLS48581G1", | ||
Self::BLS48581G2 => "BLS48581G2", | ||
} | ||
} | ||
} | ||
|
||
impl Display for BlsCurve { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> Result { | ||
f.write_str(self.name()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.