Compare commits
8 commits
109b41aba7
...
140e31ef08
| Author | SHA1 | Date | |
|---|---|---|---|
| 140e31ef08 | |||
| 9c13fa267d | |||
| bd85e5905d | |||
| 229cd16bdd | |||
| 8940b099e9 | |||
| aa0cd97faa | |||
| a7910bb167 | |||
| 7ead9440ee |
4 changed files with 65 additions and 29 deletions
66
Cargo.lock
generated
66
Cargo.lock
generated
|
|
@ -21,7 +21,7 @@ dependencies = [
|
||||||
"gxhash",
|
"gxhash",
|
||||||
"hex",
|
"hex",
|
||||||
"hickory-resolver",
|
"hickory-resolver",
|
||||||
"hmac",
|
"hmac 0.13.0",
|
||||||
"juniper",
|
"juniper",
|
||||||
"juniper_rocket",
|
"juniper_rocket",
|
||||||
"k256",
|
"k256",
|
||||||
|
|
@ -34,14 +34,14 @@ dependencies = [
|
||||||
"p256",
|
"p256",
|
||||||
"prost",
|
"prost",
|
||||||
"quick-xml",
|
"quick-xml",
|
||||||
"rand 0.8.5",
|
"rand 0.10.1",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"rocket",
|
"rocket",
|
||||||
"rocket_cors",
|
"rocket_cors",
|
||||||
"sentry",
|
"sentry",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2",
|
"sha2 0.11.0",
|
||||||
"sha256",
|
"sha256",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
"thiserror 2.0.18",
|
"thiserror 2.0.18",
|
||||||
|
|
@ -667,6 +667,12 @@ dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cmov"
|
||||||
|
version = "0.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3f88a43d011fc4a6876cb7344703e297c71dda42494fee094d5f7c76bf13f746"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "combine"
|
name = "combine"
|
||||||
version = "4.6.7"
|
version = "4.6.7"
|
||||||
|
|
@ -843,6 +849,15 @@ dependencies = [
|
||||||
"hybrid-array",
|
"hybrid-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ctutils"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e"
|
||||||
|
dependencies = [
|
||||||
|
"cmov",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "data-encoding"
|
name = "data-encoding"
|
||||||
version = "2.11.0"
|
version = "2.11.0"
|
||||||
|
|
@ -975,6 +990,7 @@ dependencies = [
|
||||||
"block-buffer 0.12.0",
|
"block-buffer 0.12.0",
|
||||||
"const-oid 0.10.2",
|
"const-oid 0.10.2",
|
||||||
"crypto-common 0.2.1",
|
"crypto-common 0.2.1",
|
||||||
|
"ctutils",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -1005,7 +1021,7 @@ dependencies = [
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"pkcs8",
|
"pkcs8",
|
||||||
"rfc6979",
|
"rfc6979",
|
||||||
"sha2",
|
"sha2 0.10.9",
|
||||||
"signature",
|
"signature",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
@ -1552,7 +1568,7 @@ version = "0.12.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"
|
checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hmac",
|
"hmac 0.12.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -1564,6 +1580,15 @@ dependencies = [
|
||||||
"digest 0.10.7",
|
"digest 0.10.7",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hmac"
|
||||||
|
version = "0.13.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f"
|
||||||
|
dependencies = [
|
||||||
|
"digest 0.11.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "home"
|
name = "home"
|
||||||
version = "0.5.11"
|
version = "0.5.11"
|
||||||
|
|
@ -2167,7 +2192,7 @@ dependencies = [
|
||||||
"ecdsa",
|
"ecdsa",
|
||||||
"elliptic-curve",
|
"elliptic-curve",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"sha2",
|
"sha2 0.10.9",
|
||||||
"signature",
|
"signature",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -2590,7 +2615,7 @@ dependencies = [
|
||||||
"ecdsa",
|
"ecdsa",
|
||||||
"elliptic-curve",
|
"elliptic-curve",
|
||||||
"primeorder",
|
"primeorder",
|
||||||
"sha2",
|
"sha2 0.10.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -3097,7 +3122,7 @@ version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2"
|
checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hmac",
|
"hmac 0.12.1",
|
||||||
"subtle",
|
"subtle",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -3659,6 +3684,17 @@ dependencies = [
|
||||||
"digest 0.10.7",
|
"digest 0.10.7",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sha2"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"cpufeatures 0.3.0",
|
||||||
|
"digest 0.11.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sha256"
|
name = "sha256"
|
||||||
version = "1.6.0"
|
version = "1.6.0"
|
||||||
|
|
@ -3668,7 +3704,7 @@ dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"bytes",
|
"bytes",
|
||||||
"hex",
|
"hex",
|
||||||
"sha2",
|
"sha2 0.10.9",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -3820,7 +3856,7 @@ dependencies = [
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2",
|
"sha2 0.10.9",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thiserror 2.0.18",
|
"thiserror 2.0.18",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|
@ -3857,7 +3893,7 @@ dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2",
|
"sha2 0.10.9",
|
||||||
"sqlx-core",
|
"sqlx-core",
|
||||||
"sqlx-mysql",
|
"sqlx-mysql",
|
||||||
"sqlx-postgres",
|
"sqlx-postgres",
|
||||||
|
|
@ -3890,7 +3926,7 @@ dependencies = [
|
||||||
"generic-array",
|
"generic-array",
|
||||||
"hex",
|
"hex",
|
||||||
"hkdf",
|
"hkdf",
|
||||||
"hmac",
|
"hmac 0.12.1",
|
||||||
"itoa",
|
"itoa",
|
||||||
"log",
|
"log",
|
||||||
"md-5 0.10.6",
|
"md-5 0.10.6",
|
||||||
|
|
@ -3901,7 +3937,7 @@ dependencies = [
|
||||||
"rsa",
|
"rsa",
|
||||||
"serde",
|
"serde",
|
||||||
"sha1 0.10.6",
|
"sha1 0.10.6",
|
||||||
"sha2",
|
"sha2 0.10.9",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"sqlx-core",
|
"sqlx-core",
|
||||||
"stringprep",
|
"stringprep",
|
||||||
|
|
@ -3929,7 +3965,7 @@ dependencies = [
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"hex",
|
"hex",
|
||||||
"hkdf",
|
"hkdf",
|
||||||
"hmac",
|
"hmac 0.12.1",
|
||||||
"home",
|
"home",
|
||||||
"ipnetwork",
|
"ipnetwork",
|
||||||
"itoa",
|
"itoa",
|
||||||
|
|
@ -3940,7 +3976,7 @@ dependencies = [
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2",
|
"sha2 0.10.9",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"sqlx-core",
|
"sqlx-core",
|
||||||
"stringprep",
|
"stringprep",
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ once_cell = "1.20.3"
|
||||||
serde_json = "1.0.139"
|
serde_json = "1.0.139"
|
||||||
chrono = { version = "0.4.39", features = ["serde"] }
|
chrono = { version = "0.4.39", features = ["serde"] }
|
||||||
argon2 = "0.5.3"
|
argon2 = "0.5.3"
|
||||||
sha2 = "0.10.8"
|
sha2 = "0.11.0"
|
||||||
bytemuck = { version = "1.21.0", features = ["derive"] }
|
bytemuck = { version = "1.21.0", features = ["derive"] }
|
||||||
base64 = "0.22.1"
|
base64 = "0.22.1"
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
|
|
@ -31,7 +31,7 @@ thiserror = "2.0.11"
|
||||||
bcrypt = "0.19.0"
|
bcrypt = "0.19.0"
|
||||||
sqlx = { version = "0.8.3", features = [ "runtime-tokio", "tls-native-tls", "postgres", "chrono", "ipnetwork" ] }
|
sqlx = { version = "0.8.3", features = [ "runtime-tokio", "tls-native-tls", "postgres", "chrono", "ipnetwork" ] }
|
||||||
aes = "0.9.0"
|
aes = "0.9.0"
|
||||||
hmac = "0.12.1"
|
hmac = "0.13.0"
|
||||||
md-5 = "0.11.0"
|
md-5 = "0.11.0"
|
||||||
cbc = "0.1.2"
|
cbc = "0.1.2"
|
||||||
mii = { path = "./mii" }
|
mii = { path = "./mii" }
|
||||||
|
|
@ -45,7 +45,7 @@ juniper_rocket = "0.10.0"
|
||||||
|
|
||||||
prost = "0.14.0"
|
prost = "0.14.0"
|
||||||
lettre = "0.11.15"
|
lettre = "0.11.15"
|
||||||
rand = "0.8.5"
|
rand = { version = "0.10.0", features = ["std"] }
|
||||||
reqwest = "0.13.0"
|
reqwest = "0.13.0"
|
||||||
binrw = "0.15.1"
|
binrw = "0.15.1"
|
||||||
ecdsa = { version = "0.16.9", features = ["pem", "std", "verifying"] }
|
ecdsa = { version = "0.16.9", features = ["pem", "std", "verifying"] }
|
||||||
|
|
@ -55,4 +55,4 @@ k256 = "0.13.4"
|
||||||
dsa = "0.6.3"
|
dsa = "0.6.3"
|
||||||
openssl = "0.10.78"
|
openssl = "0.10.78"
|
||||||
time = "0.3.47"
|
time = "0.3.47"
|
||||||
hickory-resolver = { version = "0.24", features = ["tokio-runtime"] }
|
hickory-resolver = { version = "0.24", features = ["tokio-runtime"] }
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ use openssl::ecdsa::EcdsaSig;
|
||||||
use openssl::error::ErrorStack;
|
use openssl::error::ErrorStack;
|
||||||
use openssl::nid::Nid;
|
use openssl::nid::Nid;
|
||||||
use openssl::pkey::Public;
|
use openssl::pkey::Public;
|
||||||
use rand::Rng;
|
use rand::prelude::*;
|
||||||
use rocket::http::Status;
|
use rocket::http::Status;
|
||||||
use rocket::request::{FromRequest, Outcome};
|
use rocket::request::{FromRequest, Outcome};
|
||||||
use rocket::{Request, async_trait};
|
use rocket::{Request, async_trait};
|
||||||
|
|
@ -81,9 +81,9 @@ pub struct _CertificatePid {
|
||||||
fn generate_nintendo_hash(pid: i32, text_password: &str) -> String {
|
fn generate_nintendo_hash(pid: i32, text_password: &str) -> String {
|
||||||
let mut sha = Sha256::new();
|
let mut sha = Sha256::new();
|
||||||
|
|
||||||
sha.write_all(&bytes_of(&pid)).unwrap();
|
sha.update(&bytes_of(&pid));
|
||||||
sha.write_all(&[0x02, 0x65, 0x43, 0x46]).unwrap();
|
sha.update(&[0x02, 0x65, 0x43, 0x46]);
|
||||||
sha.write_all(text_password.as_bytes()).unwrap();
|
sha.update(text_password.as_bytes());
|
||||||
|
|
||||||
hex::encode(&sha.finalize()[..])
|
hex::encode(&sha.finalize()[..])
|
||||||
}
|
}
|
||||||
|
|
@ -193,18 +193,18 @@ pub async fn read_bearer_auth_token(connection: &Pool, token: &str) -> Option<Us
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_nex_password() -> String {
|
pub fn generate_nex_password() -> String {
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::rng();
|
||||||
let mut output = String::with_capacity(16);
|
let mut output = String::with_capacity(16);
|
||||||
|
|
||||||
while output.len() < 16 {
|
while output.len() < 16 {
|
||||||
let offset: u8 = rng.gen_range(0..62);
|
let offset: u8 = rng.random_range(0..62);
|
||||||
|
|
||||||
let character = if offset < 10 {
|
let character = if offset < 10 {
|
||||||
(offset + b'0') as char
|
(offset + b'0') as char
|
||||||
} else if offset < 36 {
|
} else if offset < 36 {
|
||||||
(offset + 55) as char
|
(offset + 55) as char // A-Z
|
||||||
} else {
|
} else {
|
||||||
(offset + 61) as char
|
(offset + 61) as char // a-z
|
||||||
};
|
};
|
||||||
|
|
||||||
output.push(character);
|
output.push(character);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use crate::nnid::timezones::{OFFSET_FROM_TIMEZONE};
|
||||||
use crate::Pool;
|
use crate::Pool;
|
||||||
use crate::xml::{Xml, YesNoVal};
|
use crate::xml::{Xml, YesNoVal};
|
||||||
use crate::email::send_verification_email;
|
use crate::email::send_verification_email;
|
||||||
use rand::Rng;
|
use rand::prelude::*;
|
||||||
// Not in use currently.
|
// Not in use currently.
|
||||||
//use mii::{get_image_png, get_image_tga};
|
//use mii::{get_image_png, get_image_tga};
|
||||||
use crate::mii_util::get_mii_img_url;
|
use crate::mii_util::get_mii_img_url;
|
||||||
|
|
@ -118,7 +118,7 @@ pub async fn create_account(database: &State<Pool>, data: Xml<AccountCreationDat
|
||||||
|
|
||||||
let pid = next_pid(database).await;
|
let pid = next_pid(database).await;
|
||||||
|
|
||||||
let verification_code: i32 = rand::thread_rng().gen_range(100_000..1_000_000);
|
let verification_code: i32 = rand::rng().random_range(100_000..1_000_000);
|
||||||
|
|
||||||
let AccountCreationData {
|
let AccountCreationData {
|
||||||
user_id,
|
user_id,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue