MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / generate_access_token

Function generate_access_token

packages/server/src/auth.rs:16–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14const LAUNCHPAD_ORIGINS: &[&str] = &["https://app.simdeck.sh"];
15
16pub fn generate_access_token() -> String {
17 let mut bytes = [0u8; 32];
18 if File::open("/dev/urandom")
19 .and_then(|mut file| file.read_exact(&mut bytes))
20 .is_err()
21 {
22 let fallback = format!(
23 "{}:{}:{:?}",
24 std::process::id(),
25 chrono_free_now_nanos(),
26 std::thread::current().id()
27 );
28 return hex::encode(Sha256::digest(fallback.as_bytes()));
29 }
30 hex::encode(bytes)
31}
32
33pub fn server_identity(config: &Config) -> String {
34 server_identity_for_token(&config.access_token)

Callers 3

start_project_serviceFunction · 0.85
apply_credentialsFunction · 0.85
generate_pairing_codeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected