Skip to content

Commit

Permalink
Merge pull request #83 from near/daniyar/fix-random-tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
itegulov authored Apr 20, 2023
2 parents 49b88c0 + 855bb63 commit 640bf3e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mpc-recovery/src/leader_node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use hyper::{Body, Client, Method, Request};
use near_crypto::{PublicKey, SecretKey};
use near_primitives::types::AccountId;
use near_primitives::views::FinalExecutionStatus;
use rand::{distributions::Alphanumeric, Rng};
use std::collections::btree_map::Entry;
use std::collections::BTreeMap;
use std::net::SocketAddr;
Expand Down Expand Up @@ -60,12 +61,18 @@ pub async fn run(config: Config) {
}

let client = NearRpcAndRelayerClient::connect(&near_rpc, relayer_url);
// FIXME: We don't have a token for ourselves, but are still forced to allocate allowance.
// Using randomly generated tokens ensures the uniqueness of tokens on the relayer side.
let fake_oauth_token: String = rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(16)
.map(char::from)
.collect();
client
.register_account(RegisterAccountRequest {
account_id: account_creator_id.clone(),
allowance: 300_000_000_000_000,
// FIXME: We don't have a token for ourselves, but are still forced to allocate allowance
oauth_token: "".to_string(),
oauth_token: fake_oauth_token,
})
.await
.unwrap();
Expand Down

0 comments on commit 640bf3e

Please sign in to comment.