Update rand to 0.8.0, add getrandom js for web (#450)

* Add getrandom with js feature for JavaScript web compatibility

* Update to rand 0.8.0, closes #440

* Update to rand_pcg 0.3.0, closes #434

* Update rsa_public_encrypt_pkcs1 to 0.3.0, updates rand 0.8.0
This commit is contained in:
iceiix 2020-12-27 16:14:11 -08:00 committed by GitHub
parent 503a98d7a8
commit 352f1965af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 206 additions and 56 deletions

252
Cargo.lock generated
View File

@ -110,6 +110,12 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "base-x"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b"
[[package]]
name = "base64"
version = "0.13.0"
@ -250,11 +256,8 @@ version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
dependencies = [
"libc",
"num-integer",
"num-traits",
"time",
"winapi 0.3.9",
]
[[package]]
@ -359,7 +362,7 @@ dependencies = [
"approx",
"bit-set",
"cgmath",
"num",
"num 0.2.1",
"rand 0.6.5",
"smallvec 0.6.13",
]
@ -594,6 +597,12 @@ dependencies = [
"generic-array",
]
[[package]]
name = "discard"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
[[package]]
name = "dispatch"
version = "0.2.0"
@ -764,7 +773,20 @@ checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
dependencies = [
"cfg-if 0.1.10",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
"wasi",
]
[[package]]
name = "getrandom"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4"
dependencies = [
"cfg-if 0.1.10",
"libc",
"stdweb",
"wasi",
"wasm-bindgen",
]
[[package]]
@ -1383,14 +1405,28 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36"
dependencies = [
"num-bigint",
"num-complex",
"num-bigint 0.2.6",
"num-complex 0.2.4",
"num-integer",
"num-iter",
"num-rational 0.2.4",
"num-traits",
]
[[package]]
name = "num"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f"
dependencies = [
"num-bigint 0.3.1",
"num-complex 0.3.1",
"num-integer",
"num-iter",
"num-rational 0.3.2",
"num-traits",
]
[[package]]
name = "num-bigint"
version = "0.2.6"
@ -1403,6 +1439,17 @@ dependencies = [
"serde",
]
[[package]]
name = "num-bigint"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e9a41747ae4633fce5adffb4d2e81ffc5e89593cb19917f8fb2cc5ff76507bf"
dependencies = [
"autocfg 1.0.1",
"num-integer",
"num-traits",
]
[[package]]
name = "num-complex"
version = "0.2.4"
@ -1414,6 +1461,15 @@ dependencies = [
"serde",
]
[[package]]
name = "num-complex"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5"
dependencies = [
"num-traits",
]
[[package]]
name = "num-integer"
version = "0.1.44"
@ -1442,7 +1498,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"
dependencies = [
"autocfg 1.0.1",
"num-bigint",
"num-bigint 0.2.6",
"num-integer",
"num-traits",
"serde",
@ -1455,6 +1511,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07"
dependencies = [
"autocfg 1.0.1",
"num-bigint 0.3.1",
"num-integer",
"num-traits",
]
@ -1768,19 +1825,6 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9"
dependencies = [
"cloudabi",
"fuchsia-cprng",
"libc",
"rand_core 0.3.1",
"winapi 0.3.9",
]
[[package]]
name = "rand"
version = "0.6.5"
@ -1806,13 +1850,25 @@ version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom",
"getrandom 0.1.15",
"libc",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"rand_hc 0.2.0",
]
[[package]]
name = "rand"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a76330fb486679b4ace3670f117bbc9e16204005c4bde9c4bd372f45bed34f12"
dependencies = [
"libc",
"rand_chacha 0.3.0",
"rand_core 0.6.0",
"rand_hc 0.3.0",
]
[[package]]
name = "rand_chacha"
version = "0.1.1"
@ -1833,6 +1889,16 @@ dependencies = [
"rand_core 0.5.1",
]
[[package]]
name = "rand_chacha"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
dependencies = [
"ppv-lite86",
"rand_core 0.6.0",
]
[[package]]
name = "rand_core"
version = "0.3.1"
@ -1854,7 +1920,16 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom",
"getrandom 0.1.15",
]
[[package]]
name = "rand_core"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8b34ba8cfb21243bd8df91854c830ff0d785fff2e82ebd4434c2644cb9ada18"
dependencies = [
"getrandom 0.2.0",
]
[[package]]
@ -1875,6 +1950,15 @@ dependencies = [
"rand_core 0.5.1",
]
[[package]]
name = "rand_hc"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
dependencies = [
"rand_core 0.6.0",
]
[[package]]
name = "rand_isaac"
version = "0.1.1"
@ -1921,11 +2005,11 @@ dependencies = [
[[package]]
name = "rand_pcg"
version = "0.2.1"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
checksum = "7de198537002b913568a3847e53535ace266f93526caf5c360ec41d72c5787f0"
dependencies = [
"rand_core 0.5.1",
"rand_core 0.6.0",
]
[[package]]
@ -2032,15 +2116,24 @@ dependencies = [
[[package]]
name = "rsa_public_encrypt_pkcs1"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c82a2353440d2314c25680aefd2e34e7e47e3dd60fddccb2228a6e3b977845ee"
checksum = "67c5f557ca03d0c2dc8207adb765f6fd18ad535a7031208dd0e9208b8e91caef"
dependencies = [
"num",
"rand 0.5.6",
"num 0.3.1",
"rand 0.8.0",
"simple_asn1",
]
[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
dependencies = [
"semver",
]
[[package]]
name = "rusttype"
version = "0.9.2"
@ -2117,6 +2210,21 @@ dependencies = [
"libc",
]
[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
dependencies = [
"semver-parser",
]
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.118"
@ -2173,6 +2281,12 @@ dependencies = [
"opaque-debug 0.3.0",
]
[[package]]
name = "sha1"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
[[package]]
name = "shared_library"
version = "0.1.9"
@ -2185,12 +2299,13 @@ dependencies = [
[[package]]
name = "simple_asn1"
version = "0.2.1"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57f6bbbcefb91c0dac9b27c91ba13bd2aa29a815fe980f5b1e07d523fbf7b350"
checksum = "39465bdea3e86aa6f95f69d1b7e3010634fdeda0bc4b6c9124cbcd7419873065"
dependencies = [
"chrono",
"num",
"num-bigint 0.3.1",
"num-traits",
]
[[package]]
@ -2258,6 +2373,55 @@ dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "stdweb"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5"
dependencies = [
"discard",
"rustc_version",
"stdweb-derive",
"stdweb-internal-macros",
"stdweb-internal-runtime",
"wasm-bindgen",
]
[[package]]
name = "stdweb-derive"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
dependencies = [
"proc-macro2",
"quote",
"serde",
"serde_derive",
"syn",
]
[[package]]
name = "stdweb-internal-macros"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11"
dependencies = [
"base-x",
"proc-macro2",
"quote",
"serde",
"serde_derive",
"serde_json",
"sha1",
"syn",
]
[[package]]
name = "stdweb-internal-runtime"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0"
[[package]]
name = "steven_blocks"
version = "0.0.1"
@ -2308,14 +2472,15 @@ dependencies = [
"collision",
"console_error_panic_hook",
"flate2",
"getrandom 0.2.0",
"glow",
"glutin",
"image",
"instant",
"lazy_static",
"log",
"rand 0.7.3",
"rand_pcg 0.2.1",
"rand 0.8.0",
"rand_pcg 0.3.0",
"reqwest",
"rsa_public_encrypt_pkcs1",
"serde",
@ -2442,17 +2607,6 @@ dependencies = [
"weezl",
]
[[package]]
name = "time"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi 0.3.9",
]
[[package]]
name = "tinyvec"
version = "1.1.0"
@ -2676,12 +2830,6 @@ version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasm-bindgen"
version = "0.2.69"

View File

@ -28,14 +28,15 @@ serde_json = "1.0.60"
flate2 = { version = "1.0.19", features = ["rust_backend"], default-features = false }
zip = { version = "0.5.6", features = ["deflate"], default-features = false }
image = "0.23.12"
rand = "0.7.3"
rand_pcg = "0.2.1"
getrandom = { version = "0.2", features = ["js"] }
rand = "0.8.0"
rand_pcg = "0.3.0"
base64 = "0.13.0"
log = { version = "0.4.11", features = ["std"] }
cgmath = "0.17.0"
lazy_static = "1.4.0"
collision = "0.20.1"
rsa_public_encrypt_pkcs1 = "0.2.0"
rsa_public_encrypt_pkcs1 = "0.3.0"
structopt = "0.3.21"
clipboard = "0.5.0"
instant = "0.1.9"

View File

@ -175,7 +175,7 @@ impl super::Screen for Login {
let mut client_token = self.vars.get(auth::AUTH_CLIENT_TOKEN).clone();
if client_token.is_empty() {
client_token = std::iter::repeat(())
.map(|()| rand::thread_rng().sample(&rand::distributions::Alphanumeric))
.map(|()| rand::thread_rng().sample(&rand::distributions::Alphanumeric) as char)
.take(20)
.collect();
self.vars.set(auth::AUTH_CLIENT_TOKEN, client_token);

View File

@ -528,6 +528,7 @@ impl super::Screen for ServerList {
let name: String = std::iter::repeat(())
.map(|()| {
rand::thread_rng().sample(&rand::distributions::Alphanumeric)
as char
})
.take(30)
.collect();