-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add back the account address field in credentials (#113)
adding this back as Sozo, Katana expects the contract address field to exist in order to perform certain operations - generating policies, injecting controller account. i've also changed the error handling to just return a generic MalformedCredentials error when the deserialization fails.
- Loading branch information
Showing
8 changed files
with
142 additions
and
127 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 |
---|---|---|
@@ -1,22 +1,35 @@ | ||
use crate::graphql::auth::me::MeMeCredentialsWebauthn as WebAuthnCredential; | ||
use serde::{Deserialize, Serialize}; | ||
use serde_with::serde_as; | ||
use starknet::core::types::Felt; | ||
|
||
#[serde_as] | ||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)] | ||
pub struct Account { | ||
/// Controller account information. | ||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] | ||
#[cfg_attr(test, derive(Default))] | ||
pub struct AccountInfo { | ||
/// The username of the account. | ||
pub id: String, | ||
pub name: Option<String>, | ||
pub credentials: AccountCredentials, | ||
pub controllers: Vec<Controller>, | ||
pub credentials: Vec<WebAuthnCredential>, | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)] | ||
pub struct AccountCredentials { | ||
pub webauthn: Vec<WebAuthnCredential>, | ||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] | ||
pub struct Controller { | ||
pub id: String, | ||
/// The address of the Controller contract. | ||
pub address: Felt, | ||
pub signers: Vec<ControllerSigner>, | ||
} | ||
|
||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] | ||
pub enum SignerType { | ||
WebAuthn, | ||
StarknetAccount, | ||
Other(String), | ||
} | ||
|
||
#[derive(Deserialize, Debug, Clone, Serialize, PartialEq, Eq, Default)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct WebAuthnCredential { | ||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] | ||
pub struct ControllerSigner { | ||
pub id: String, | ||
pub public_key: String, | ||
pub r#type: SignerType, | ||
} |
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.