mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-13 03:30:05 +00:00
add privateaccountkind
This commit is contained in:
parent
0eb128e515
commit
64a8ea5807
@ -8,12 +8,40 @@ use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "host")]
|
||||
pub use shared_key_derivation::{EphemeralPublicKey, EphemeralSecretKey, ViewingPublicKey};
|
||||
|
||||
use crate::{Commitment, Identifier, account::Account};
|
||||
use crate::{
|
||||
Commitment, Identifier,
|
||||
account::Account,
|
||||
program::{PdaSeed, ProgramId},
|
||||
};
|
||||
#[cfg(feature = "host")]
|
||||
pub mod shared_key_derivation;
|
||||
|
||||
pub type Scalar = [u8; 32];
|
||||
|
||||
/// Discriminates the type of private account a ciphertext belongs to, carrying the data needed
|
||||
/// to reconstruct the account's [`AccountId`] on the receiver side.
|
||||
///
|
||||
/// [`AccountId`]: crate::account::AccountId
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum PrivateAccountKind {
|
||||
Account(Identifier),
|
||||
Pda {
|
||||
program_id: ProgramId,
|
||||
seed: PdaSeed,
|
||||
identifier: Identifier,
|
||||
},
|
||||
}
|
||||
|
||||
impl PrivateAccountKind {
|
||||
#[must_use]
|
||||
pub fn identifier(&self) -> Identifier {
|
||||
match self {
|
||||
Self::Account(identifier) => *identifier,
|
||||
Self::Pda { identifier, .. } => *identifier,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Copy)]
|
||||
pub struct SharedSecretKey(pub [u8; 32]);
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ pub use commitment::{
|
||||
Commitment, CommitmentSetDigest, DUMMY_COMMITMENT, DUMMY_COMMITMENT_HASH, MembershipProof,
|
||||
compute_digest_for_path,
|
||||
};
|
||||
pub use encryption::{EncryptionScheme, SharedSecretKey};
|
||||
pub use encryption::{EncryptionScheme, PrivateAccountKind, SharedSecretKey};
|
||||
pub use nullifier::{Identifier, Nullifier, NullifierPublicKey, NullifierSecretKey};
|
||||
|
||||
pub mod account;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user