Skip to content

Commit

Permalink
add random token
Browse files Browse the repository at this point in the history
  • Loading branch information
Mon-ius committed Feb 18, 2024
1 parent 53f8d8c commit 85260e4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rws-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rws-cli"
version = "0.1.8"
version = "0.1.9"
edition = "2021"

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions rws-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fn main() {
// .w_id(&args.device_id)
.random_id()
.random_key()
.random_token()
.random_dev()
.random_tz()
.build();
Expand Down
12 changes: 11 additions & 1 deletion rws/src/warp/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::fmt;
pub struct WClientBuilder<'w> {
_id: Option<&'w str>,
_key: Option<&'w str>,
_token: Option<&'w str>,
_model: Option<&'w str>,
_type: Option<&'w str>,
_tos: Option<&'w str>,
Expand All @@ -17,6 +18,7 @@ impl<'w> fmt::Debug for WClientBuilder<'w> {
f.debug_struct("Client")
.field("id", &self._id.unwrap_or("default_id"))
.field("key", &self._key.unwrap_or("default_key"))
.field("token", &self._token.unwrap_or("default_token"))
.field("model", &self._model.unwrap_or("default_model"))
.field("type", &self._type.unwrap_or("default_type"))
.field("tos", &self._tos.unwrap_or("default_tos"))
Expand All @@ -30,6 +32,7 @@ impl<'w> WClientBuilder<'w> {
Self {
_id: None,
_key: None,
_token: None,
_model: None,
_type: None,
_tos: None,
Expand All @@ -45,6 +48,10 @@ impl<'w> WClientBuilder<'w> {
self._key = Some(_key);
self
}
pub fn w_token(mut self, _token: &'w str) -> Self {
self._token = Some(_token);
self
}
pub fn w_model(mut self, _model: &'w str) -> Self {
self._model = Some(_model);
self
Expand All @@ -66,6 +73,7 @@ impl<'w> WClientBuilder<'w> {
WClientBuilder {
_id: Some(self._id.unwrap_or("default_id")),
_key: Some(self._key.unwrap_or("default_key")),
_token: Some(self._token.unwrap_or("default_token")),
_model: Some(self._model.unwrap_or("default_model")),
_type: Some(self._type.unwrap_or("default_type")),
_tos: Some(self._tos.unwrap_or("default_tos")),
Expand All @@ -79,7 +87,9 @@ impl<'w> WClientBuilder<'w> {
pub fn random_key(self) -> Self {
self.w_key(random::fake::take(43, |_c| true))
}

pub fn random_token(self) -> Self {
self.w_token(random::fake::take(134, |_c| true))
}
pub fn random_dev(self) -> Self {
let (t, z) = random::dev::sample();
self.w_model(t)
Expand Down

0 comments on commit 85260e4

Please sign in to comment.