-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(da-clients): add secrets (#2954)
## What ❔ Add an opportunity to store the sensitive information of DA clients in the secrets. ## Why ❔ Some sensitive info is currently stored as plaintext, which is not secure, we should use secrets for those values ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zk fmt` and `zk lint`. --------- Co-authored-by: Danil <[email protected]>
- Loading branch information
1 parent
7ad0425
commit f4631e4
Showing
21 changed files
with
225 additions
and
76 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
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,20 @@ | ||
use std::str::FromStr; | ||
|
||
use secrecy::{ExposeSecret, Secret}; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct SeedPhrase(pub Secret<String>); | ||
|
||
impl PartialEq for SeedPhrase { | ||
fn eq(&self, other: &Self) -> bool { | ||
self.0.expose_secret().eq(other.0.expose_secret()) | ||
} | ||
} | ||
|
||
impl FromStr for SeedPhrase { | ||
type Err = anyhow::Error; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
Ok(SeedPhrase(s.parse()?)) | ||
} | ||
} |
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,11 +1,16 @@ | ||
use serde::Deserialize; | ||
use zksync_basic_types::seed_phrase::SeedPhrase; | ||
|
||
#[derive(Clone, Debug, PartialEq, Deserialize)] | ||
pub struct AvailConfig { | ||
pub api_node_url: String, | ||
pub bridge_api_url: String, | ||
pub seed: String, | ||
pub app_id: u32, | ||
pub timeout: usize, | ||
pub max_retries: usize, | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq)] | ||
pub struct AvailSecrets { | ||
pub seed_phrase: Option<SeedPhrase>, | ||
} |
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
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.