add identifier to PrivacyPreservingAccount to allow passing different identifiers

This commit is contained in:
Sergio Chouhy 2026-04-15 16:51:20 -03:00
parent 985f610cea
commit 8fd25bc4bf
4 changed files with 11 additions and 4 deletions

View File

@ -16,6 +16,7 @@ pub enum PrivacyPreservingAccount {
PrivateForeign { PrivateForeign {
npk: NullifierPublicKey, npk: NullifierPublicKey,
vpk: ViewingPublicKey, vpk: ViewingPublicKey,
identifier: Identifier,
}, },
} }
@ -29,7 +30,7 @@ impl PrivacyPreservingAccount {
pub const fn is_private(&self) -> bool { pub const fn is_private(&self) -> bool {
matches!( matches!(
&self, &self,
Self::PrivateOwned(_) | Self::PrivateForeign { npk: _, vpk: _ } Self::PrivateOwned(_) | Self::PrivateForeign { npk: _, vpk: _, identifier: _ }
) )
} }
} }
@ -82,13 +83,13 @@ impl AccountManager {
(State::Private(pre), mask) (State::Private(pre), mask)
} }
PrivacyPreservingAccount::PrivateForeign { npk, vpk } => { PrivacyPreservingAccount::PrivateForeign { npk, vpk, identifier } => {
let acc = nssa_core::account::Account::default(); let acc = nssa_core::account::Account::default();
let auth_acc = AccountWithMetadata::new(acc, false, (&npk, 0)); let auth_acc = AccountWithMetadata::new(acc, false, (&npk, identifier));
let pre = AccountPreparedData { let pre = AccountPreparedData {
nsk: None, nsk: None,
npk, npk,
identifier: 0, identifier,
vpk, vpk,
pre_state: auth_acc, pre_state: auth_acc,
proof: None, proof: None,

View File

@ -44,6 +44,7 @@ impl NativeTokenTransfer<'_> {
PrivacyPreservingAccount::PrivateForeign { PrivacyPreservingAccount::PrivateForeign {
npk: to_npk, npk: to_npk,
vpk: to_vpk, vpk: to_vpk,
identifier: 0,
}, },
], ],
instruction_data, instruction_data,

View File

@ -50,6 +50,7 @@ impl NativeTokenTransfer<'_> {
PrivacyPreservingAccount::PrivateForeign { PrivacyPreservingAccount::PrivateForeign {
npk: to_npk, npk: to_npk,
vpk: to_vpk, vpk: to_vpk,
identifier: 0,
}, },
], ],
instruction_data, instruction_data,

View File

@ -262,6 +262,7 @@ impl Token<'_> {
PrivacyPreservingAccount::PrivateForeign { PrivacyPreservingAccount::PrivateForeign {
npk: recipient_npk, npk: recipient_npk,
vpk: recipient_vpk, vpk: recipient_vpk,
identifier: 0,
}, },
], ],
instruction_data, instruction_data,
@ -358,6 +359,7 @@ impl Token<'_> {
PrivacyPreservingAccount::PrivateForeign { PrivacyPreservingAccount::PrivateForeign {
npk: recipient_npk, npk: recipient_npk,
vpk: recipient_vpk, vpk: recipient_vpk,
identifier: 0,
}, },
], ],
instruction_data, instruction_data,
@ -621,6 +623,7 @@ impl Token<'_> {
PrivacyPreservingAccount::PrivateForeign { PrivacyPreservingAccount::PrivateForeign {
npk: holder_npk, npk: holder_npk,
vpk: holder_vpk, vpk: holder_vpk,
identifier: 0,
}, },
], ],
instruction_data, instruction_data,
@ -717,6 +720,7 @@ impl Token<'_> {
PrivacyPreservingAccount::PrivateForeign { PrivacyPreservingAccount::PrivateForeign {
npk: holder_npk, npk: holder_npk,
vpk: holder_vpk, vpk: holder_vpk,
identifier: 0,
}, },
], ],
instruction_data, instruction_data,