-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multi-identity & idComm generation (#15)
- Loading branch information
Showing
8 changed files
with
213 additions
and
35 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use strum::EnumString; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, uniffi::Object, EnumString, Hash)] | ||
#[strum(serialize_all = "snake_case")] | ||
pub enum CredentialType { | ||
Orb, | ||
Passport, | ||
SecurePassport, | ||
Device, | ||
} | ||
|
||
impl CredentialType { | ||
/// Returns a predefined seed string which is used to derive the identity commitment. | ||
/// | ||
/// [Protocol Reference](https://docs.semaphore.pse.dev/V2/technical-reference/circuits#proof-of-membership). | ||
/// | ||
/// For usage reference, review [sempahore-rs](https://github.com/worldcoin/semaphore-rs/blob/main/src/identity.rs#L44). | ||
/// | ||
/// - For `Orb`, it's a fixed legacy default value. Changing this default would break existing verifying apps, hence its explicit specification here. | ||
/// - `Passport` (NFC-based check on government-issued passport) | ||
/// - `SecurePassport` (NFC-based check on government-issued passport with additional chip authentication checks) | ||
#[must_use] | ||
pub const fn as_identity_trapdoor(&self) -> &[u8] { | ||
match self { | ||
Self::Orb => b"identity_trapdoor", | ||
Self::Device => b"phone_credential", | ||
Self::Passport => b"passport", | ||
Self::SecurePassport => b"secure_passport", | ||
} | ||
} | ||
} |
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.