Compare commits
13 Commits
6e681f0ba1
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
b73fd9e64e
|
|||
|
5ef3b4d3e6
|
|||
|
3dda4e8e5b
|
|||
|
a1024943ff
|
|||
|
9eba818de9
|
|||
|
814b5e9442
|
|||
|
6d7273c6a3
|
|||
|
bd9ea78e53
|
|||
|
73d58350c2
|
|||
|
e45d14498c
|
|||
|
f2fd57c342
|
|||
|
ed54a7e6ef
|
|||
|
7c0865fafd
|
15
README.md
15
README.md
@@ -9,7 +9,8 @@ Project or files:
|
|||||||
│ └── zeroizing-alloc-demo
|
│ └── zeroizing-alloc-demo
|
||||||
├── __args
|
├── __args
|
||||||
│ ├── argh-test
|
│ ├── argh-test
|
||||||
│ └── clap-test
|
│ ├── clap-test
|
||||||
|
│ └── clap-test-2
|
||||||
├── __bin
|
├── __bin
|
||||||
│ ├── goblin
|
│ ├── goblin
|
||||||
│ └── object-demo
|
│ └── object-demo
|
||||||
@@ -32,6 +33,7 @@ Project or files:
|
|||||||
│ ├── aes_ctr_test
|
│ ├── aes_ctr_test
|
||||||
│ ├── aes_gcm_crypto
|
│ ├── aes_gcm_crypto
|
||||||
│ ├── asn1-der-test
|
│ ├── asn1-der-test
|
||||||
|
│ ├── bc1-btc-address
|
||||||
│ ├── btc-address
|
│ ├── btc-address
|
||||||
│ ├── crypto
|
│ ├── crypto
|
||||||
│ ├── crypto2-demo
|
│ ├── crypto2-demo
|
||||||
@@ -43,6 +45,9 @@ Project or files:
|
|||||||
│ ├── jose-test
|
│ ├── jose-test
|
||||||
│ ├── jsonwebtoken
|
│ ├── jsonwebtoken
|
||||||
│ ├── liboqs-rust-demo
|
│ ├── liboqs-rust-demo
|
||||||
|
│ ├── ml-kem-demo
|
||||||
|
│ ├── okta-bcrypt-issue
|
||||||
|
│ ├── orion-demo
|
||||||
│ ├── passkey-rs-demo
|
│ ├── passkey-rs-demo
|
||||||
│ ├── password-hash
|
│ ├── password-hash
|
||||||
│ ├── pkcs8
|
│ ├── pkcs8
|
||||||
@@ -173,6 +178,7 @@ Project or files:
|
|||||||
│ ├── nfqueue
|
│ ├── nfqueue
|
||||||
│ ├── ngrok-demo
|
│ ├── ngrok-demo
|
||||||
│ ├── pcap
|
│ ├── pcap
|
||||||
|
│ ├── pingora-demo
|
||||||
│ ├── quinn
|
│ ├── quinn
|
||||||
│ ├── rust_tcp
|
│ ├── rust_tcp
|
||||||
│ ├── rust-rawsock-demo
|
│ ├── rust-rawsock-demo
|
||||||
@@ -197,6 +203,7 @@ Project or files:
|
|||||||
│ └── tantivy
|
│ └── tantivy
|
||||||
├── __security
|
├── __security
|
||||||
│ ├── keychain-services
|
│ ├── keychain-services
|
||||||
|
│ ├── keyring-demo
|
||||||
│ ├── seckey
|
│ ├── seckey
|
||||||
│ ├── secmem-proc
|
│ ├── secmem-proc
|
||||||
│ ├── secrets
|
│ ├── secrets
|
||||||
@@ -245,7 +252,8 @@ Project or files:
|
|||||||
│ ├── rustyline
|
│ ├── rustyline
|
||||||
│ ├── structopt
|
│ ├── structopt
|
||||||
│ ├── tabled
|
│ ├── tabled
|
||||||
│ └── term
|
│ ├── term
|
||||||
|
│ └── tui-markup-demo
|
||||||
├── __time
|
├── __time
|
||||||
│ ├── chrono
|
│ ├── chrono
|
||||||
│ ├── humantime-demo
|
│ ├── humantime-demo
|
||||||
@@ -258,6 +266,7 @@ Project or files:
|
|||||||
│ ├── deno_rust_wasm_qr_decode
|
│ ├── deno_rust_wasm_qr_decode
|
||||||
│ ├── extism
|
│ ├── extism
|
||||||
│ ├── js-wasm
|
│ ├── js-wasm
|
||||||
|
│ ├── rust-wasm-plugins-examples
|
||||||
│ ├── wasi
|
│ ├── wasi
|
||||||
│ ├── wasm
|
│ ├── wasm
|
||||||
│ ├── wasmtime
|
│ ├── wasmtime
|
||||||
@@ -305,6 +314,6 @@ Project or files:
|
|||||||
├── vec.rs
|
├── vec.rs
|
||||||
└── while.rs
|
└── while.rs
|
||||||
|
|
||||||
277 directories, 38 files
|
286 directories, 38 files
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
261
__args/clap-test-2/Cargo.lock
generated
Normal file
261
__args/clap-test-2/Cargo.lock
generated
Normal file
@@ -0,0 +1,261 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstream"
|
||||||
|
version = "0.6.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"anstyle-parse",
|
||||||
|
"anstyle-query",
|
||||||
|
"anstyle-wincon",
|
||||||
|
"colorchoice",
|
||||||
|
"is_terminal_polyfill",
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle"
|
||||||
|
version = "1.0.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-parse"
|
||||||
|
version = "0.2.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
|
||||||
|
dependencies = [
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-query"
|
||||||
|
version = "1.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-wincon"
|
||||||
|
version = "3.0.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"once_cell_polyfill",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap"
|
||||||
|
version = "4.5.42"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ed87a9d530bb41a67537289bafcac159cb3ee28460e0a4571123d2a778a6a882"
|
||||||
|
dependencies = [
|
||||||
|
"clap_builder",
|
||||||
|
"clap_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap-test-2"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"clap",
|
||||||
|
"clap-verbosity-flag",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap-verbosity-flag"
|
||||||
|
version = "3.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eeab6a5cdfc795a05538422012f20a5496f050223c91be4e5420bfd13c641fb1"
|
||||||
|
dependencies = [
|
||||||
|
"clap",
|
||||||
|
"log",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_builder"
|
||||||
|
version = "4.5.42"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "64f4f3f3c77c94aff3c7e9aac9a2ca1974a5adf392a8bb751e827d6d127ab966"
|
||||||
|
dependencies = [
|
||||||
|
"anstream",
|
||||||
|
"anstyle",
|
||||||
|
"clap_lex",
|
||||||
|
"strsim",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_derive"
|
||||||
|
version = "4.5.41"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491"
|
||||||
|
dependencies = [
|
||||||
|
"heck",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_lex"
|
||||||
|
version = "0.7.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorchoice"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "heck"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "is_terminal_polyfill"
|
||||||
|
version = "1.70.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.27"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell_polyfill"
|
||||||
|
version = "1.70.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.95"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.40"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strsim"
|
||||||
|
version = "0.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.104"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "utf8parse"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.59.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm",
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_gnullvm",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_gnullvm",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
8
__args/clap-test-2/Cargo.toml
Normal file
8
__args/clap-test-2/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[package]
|
||||||
|
name = "clap-test-2"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
clap = { version = "4.5.42", features = ["derive", "env"] }
|
||||||
|
clap-verbosity-flag = "3"
|
||||||
158
__args/clap-test-2/src/main.rs
Normal file
158
__args/clap-test-2/src/main.rs
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
use clap::Parser;
|
||||||
|
|
||||||
|
// https://github.com/fastn-stack/kulfi/blob/main/malai/src/main.rs
|
||||||
|
fn main() {
|
||||||
|
let cli = Cli::parse();
|
||||||
|
println!("{:?}", cli);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(clap::Parser, Debug)]
|
||||||
|
#[command(version, about, long_about = None)]
|
||||||
|
pub struct Cli {
|
||||||
|
#[command(flatten)]
|
||||||
|
verbose: clap_verbosity_flag::Verbosity,
|
||||||
|
|
||||||
|
#[command(subcommand)]
|
||||||
|
pub command: Option<Command>,
|
||||||
|
|
||||||
|
// adding these two because when we run `cargo tauri dev,` it automatically passes these
|
||||||
|
// arguments. need to figure out why and how to disable that, till then this is a workaround
|
||||||
|
#[arg(default_value = "true", long, hide = true)]
|
||||||
|
no_default_features: bool,
|
||||||
|
#[arg(default_value = "auto", long, hide = true)]
|
||||||
|
color: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(clap::Subcommand, Debug)]
|
||||||
|
pub enum Command {
|
||||||
|
// TODO: add this to the docs when we have ACL
|
||||||
|
// By default it allows any peer to connect to the HTTP(s) service. You can pass --what-to-do
|
||||||
|
// argument to specify a What To Do service that can be used to add access control."
|
||||||
|
#[clap(about = "Expose HTTP Service on kulfi, connect using kulfi or browser")]
|
||||||
|
Http {
|
||||||
|
port: u16,
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
default_value = "127.0.0.1",
|
||||||
|
help = "Host serving the http service."
|
||||||
|
)]
|
||||||
|
host: String,
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
default_value = "kulfi.site",
|
||||||
|
help = "Use this for the HTTP bridge. To run an HTTP bridge, use `malai http-bridge`",
|
||||||
|
env = "MALAI_HTTP_BRIDGE"
|
||||||
|
)]
|
||||||
|
bridge: String,
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
help = "Make the exposed service public. Anyone will be able to access."
|
||||||
|
)]
|
||||||
|
public: bool,
|
||||||
|
// #[arg(
|
||||||
|
// long,
|
||||||
|
// default_value_t = false,
|
||||||
|
// help = "Use this if the service is HTTPS"
|
||||||
|
// )]
|
||||||
|
// secure: bool,
|
||||||
|
// #[arg(
|
||||||
|
// long,
|
||||||
|
// help = "The What To Do Service that can be used to add access control."
|
||||||
|
// )]
|
||||||
|
// this will be the id52 of the identity server that should be consulted
|
||||||
|
// what_to_do: Option<String>,
|
||||||
|
},
|
||||||
|
#[clap(about = "Browse a kulfi site.")]
|
||||||
|
Browse {
|
||||||
|
#[arg(help = "The Kulfi URL to browse. Should look like kulfi://<id52>/<path>")]
|
||||||
|
url: String,
|
||||||
|
},
|
||||||
|
#[clap(about = "Expose TCP Service on kulfi.")]
|
||||||
|
Tcp {
|
||||||
|
port: u16,
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
default_value = "127.0.0.1",
|
||||||
|
help = "Host serving the TCP service."
|
||||||
|
)]
|
||||||
|
host: String,
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
help = "Make the exposed service public. Anyone will be able to access."
|
||||||
|
)]
|
||||||
|
public: bool,
|
||||||
|
},
|
||||||
|
#[clap(
|
||||||
|
about = "Run an http server that forwards requests to the given id52 taken from the HOST header"
|
||||||
|
)]
|
||||||
|
HttpBridge {
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
short('t'),
|
||||||
|
help = "The id52 to which this bridge will forward incoming HTTP request. By default it forwards to every id52."
|
||||||
|
)]
|
||||||
|
proxy_target: Option<String>,
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
short('p'),
|
||||||
|
help = "The port on which this bridge will listen for incoming HTTP requests. If you pass 0, it will bind to a random port.",
|
||||||
|
default_value = "0"
|
||||||
|
)]
|
||||||
|
port: u16,
|
||||||
|
},
|
||||||
|
#[clap(about = "Run a TCP server that forwards incoming requests to the given id52.")]
|
||||||
|
TcpBridge {
|
||||||
|
#[arg(help = "The id52 to which this bridge will forward incoming TCP request.")]
|
||||||
|
proxy_target: String,
|
||||||
|
#[arg(
|
||||||
|
help = "The port on which this bridge will listen for incoming TCP requests. If you pass 0, it will bind to a random port.",
|
||||||
|
default_value = "0"
|
||||||
|
)]
|
||||||
|
port: u16,
|
||||||
|
},
|
||||||
|
#[clap(about = "Expose a folder to kulfi network")]
|
||||||
|
Folder {
|
||||||
|
#[arg(help = "The folder to expose.")]
|
||||||
|
path: String,
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
default_value = "kulfi.site",
|
||||||
|
help = "Use this for the HTTP bridge. To run an HTTP bridge, use `malai http-bridge`",
|
||||||
|
env = "MALAI_HTTP_BRIDGE"
|
||||||
|
)]
|
||||||
|
bridge: String,
|
||||||
|
#[arg(long, help = "Make the folder public. Anyone will be able to access.")]
|
||||||
|
public: bool,
|
||||||
|
},
|
||||||
|
#[clap(about = "Run all the services")]
|
||||||
|
Run {
|
||||||
|
#[arg(long, help = "Malai Home", env = "MALAI_HOME")]
|
||||||
|
home: Option<String>,
|
||||||
|
},
|
||||||
|
#[clap(about = "Run an iroh remote server that handles requests from http-proxy.")]
|
||||||
|
HttpProxyRemote {
|
||||||
|
#[arg(long, help = "Make the proxy public. Anyone will be able to access.")]
|
||||||
|
public: bool,
|
||||||
|
},
|
||||||
|
#[clap(about = "Run a http proxy server that forwards incoming requests to http-proxy-remote.")]
|
||||||
|
HttpProxy {
|
||||||
|
#[arg(help = "The id52 of remote to which this http proxy will forward request to.")]
|
||||||
|
remote: String,
|
||||||
|
#[arg(
|
||||||
|
help = "The port on which this proxy will listen for incoming TCP requests. If you pass 0, it will bind to a random port.",
|
||||||
|
default_value = "0"
|
||||||
|
)]
|
||||||
|
port: u16,
|
||||||
|
},
|
||||||
|
#[clap(about = "Generate a new identity.")]
|
||||||
|
Keygen {
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
short,
|
||||||
|
num_args=0..=1,
|
||||||
|
//default_missing_value=kulfi_utils::SECRET_KEY_FILE,
|
||||||
|
help = "The file where the private key of the identity will be stored. If not provided, the private key will be printed to stdout."
|
||||||
|
)]
|
||||||
|
file: Option<String>,
|
||||||
|
},
|
||||||
|
}
|
||||||
284
__crypto/bc1-btc-address/Cargo.lock
generated
Normal file
284
__crypto/bc1-btc-address/Cargo.lock
generated
Normal file
@@ -0,0 +1,284 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "arrayvec"
|
||||||
|
version = "0.7.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base58ck"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2c8d66485a3a2ea485c1913c4572ce0256067a5377ac8c75c4960e1cda98605f"
|
||||||
|
dependencies = [
|
||||||
|
"bitcoin-internals",
|
||||||
|
"bitcoin_hashes",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bc1-btc-address"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"bitcoin",
|
||||||
|
"hex",
|
||||||
|
"rand",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bech32"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitcoin"
|
||||||
|
version = "0.32.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ad8929a18b8e33ea6b3c09297b687baaa71fb1b97353243a3f1029fad5c59c5b"
|
||||||
|
dependencies = [
|
||||||
|
"base58ck",
|
||||||
|
"bech32",
|
||||||
|
"bitcoin-internals",
|
||||||
|
"bitcoin-io",
|
||||||
|
"bitcoin-units",
|
||||||
|
"bitcoin_hashes",
|
||||||
|
"hex-conservative",
|
||||||
|
"hex_lit",
|
||||||
|
"secp256k1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitcoin-internals"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "30bdbe14aa07b06e6cfeffc529a1f099e5fbe249524f8125358604df99a4bed2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitcoin-io"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0b47c4ab7a93edb0c7198c5535ed9b52b63095f4e9b45279c6736cec4b856baf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitcoin-units"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5285c8bcaa25876d07f37e3d30c303f2609179716e11d688f51e8f1fe70063e2"
|
||||||
|
dependencies = [
|
||||||
|
"bitcoin-internals",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitcoin_hashes"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16"
|
||||||
|
dependencies = [
|
||||||
|
"bitcoin-io",
|
||||||
|
"hex-conservative",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "2.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.2.27"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc"
|
||||||
|
dependencies = [
|
||||||
|
"shlex",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"r-efi",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hex"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hex-conservative"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd"
|
||||||
|
dependencies = [
|
||||||
|
"arrayvec",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hex_lit"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.174"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||||
|
dependencies = [
|
||||||
|
"zerocopy",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.95"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.40"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "r-efi"
|
||||||
|
version = "5.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
|
||||||
|
dependencies = [
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.9.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "secp256k1"
|
||||||
|
version = "0.29.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113"
|
||||||
|
dependencies = [
|
||||||
|
"bitcoin_hashes",
|
||||||
|
"secp256k1-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "secp256k1-sys"
|
||||||
|
version = "0.10.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shlex"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.104"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.14.2+wasi-0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
|
||||||
|
dependencies = [
|
||||||
|
"wit-bindgen-rt",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wit-bindgen-rt"
|
||||||
|
version = "0.39.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy"
|
||||||
|
version = "0.8.26"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f"
|
||||||
|
dependencies = [
|
||||||
|
"zerocopy-derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy-derive"
|
||||||
|
version = "0.8.26"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
9
__crypto/bc1-btc-address/Cargo.toml
Normal file
9
__crypto/bc1-btc-address/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[package]
|
||||||
|
name = "bc1-btc-address"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
bitcoin = "0.32.6"
|
||||||
|
hex = "0.4.3"
|
||||||
|
rand = "0.9.1"
|
||||||
29
__crypto/bc1-btc-address/src/main.rs
Normal file
29
__crypto/bc1-btc-address/src/main.rs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
use bitcoin::key::Secp256k1;
|
||||||
|
use bitcoin::{Address, CompressedPublicKey, Network, PrivateKey};
|
||||||
|
use rand::RngCore;
|
||||||
|
|
||||||
|
// generate btc address:
|
||||||
|
// https://coinb.in/#newSegWit
|
||||||
|
fn main() {
|
||||||
|
let secp = Secp256k1::new();
|
||||||
|
let mut sk_bytes = [0u8; 32];
|
||||||
|
rand::rng().fill_bytes(&mut sk_bytes);
|
||||||
|
let secret_key = PrivateKey::from_slice(&sk_bytes, Network::Bitcoin).unwrap();
|
||||||
|
|
||||||
|
// let secret_key = PrivateKey::from_wif("L2HajtedHgDT16o3Er8L8tyRrPNbXkeBK69vhGi7K9eK4Yg3dJuj").unwrap();
|
||||||
|
|
||||||
|
let public_key = secret_key.public_key(&secp);
|
||||||
|
let compress_public_key = CompressedPublicKey::try_from(public_key).unwrap();
|
||||||
|
|
||||||
|
// 构造 P2WPKH 地址 (bc1 开头)
|
||||||
|
let address = Address::p2wpkh(&compress_public_key, Network::Bitcoin);
|
||||||
|
let address = address.to_string();
|
||||||
|
|
||||||
|
println!("Private Key (WIF): {}", secret_key.to_wif());
|
||||||
|
println!("Public Key: {}", public_key);
|
||||||
|
println!(
|
||||||
|
"Public Key: {}",
|
||||||
|
hex::encode(&public_key.inner.serialize_uncompressed())
|
||||||
|
);
|
||||||
|
println!("SegWit Address (bc1): {}", address);
|
||||||
|
}
|
||||||
258
__crypto/ml-kem-demo/Cargo.lock
generated
Normal file
258
__crypto/ml-kem-demo/Cargo.lock
generated
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base64"
|
||||||
|
version = "0.22.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "block-buffer"
|
||||||
|
version = "0.10.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cpufeatures"
|
||||||
|
version = "0.2.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crypto-common"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
"typenum",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "digest"
|
||||||
|
version = "0.10.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||||
|
dependencies = [
|
||||||
|
"block-buffer",
|
||||||
|
"crypto-common",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "generic-array"
|
||||||
|
version = "0.14.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||||
|
dependencies = [
|
||||||
|
"typenum",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.2.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hybrid-array"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f2d35805454dc9f8662a98d6d61886ffe26bd465f5960e0e55345c70d5c0d2a9"
|
||||||
|
dependencies = [
|
||||||
|
"typenum",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "keccak"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654"
|
||||||
|
dependencies = [
|
||||||
|
"cpufeatures",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kem"
|
||||||
|
version = "0.3.0-pre.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b8645470337db67b01a7f966decf7d0bafedbae74147d33e641c67a91df239f"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core",
|
||||||
|
"zeroize",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.176"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ml-kem"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "97befee0c869cb56f3118f49d0f9bb68c9e3f380dec23c1100aedc4ec3ba239a"
|
||||||
|
dependencies = [
|
||||||
|
"hybrid-array",
|
||||||
|
"kem",
|
||||||
|
"rand_core",
|
||||||
|
"sha3",
|
||||||
|
"zeroize",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ml-kem-demo"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"base64",
|
||||||
|
"ml-kem",
|
||||||
|
"rand",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||||
|
dependencies = [
|
||||||
|
"zerocopy",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.101"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.40"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.8.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sha3"
|
||||||
|
version = "0.10.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60"
|
||||||
|
dependencies = [
|
||||||
|
"digest",
|
||||||
|
"keccak",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.106"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typenum"
|
||||||
|
version = "1.18.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version_check"
|
||||||
|
version = "0.9.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.11.1+wasi-snapshot-preview1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy"
|
||||||
|
version = "0.8.27"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c"
|
||||||
|
dependencies = [
|
||||||
|
"zerocopy-derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy-derive"
|
||||||
|
version = "0.8.27"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zeroize"
|
||||||
|
version = "1.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
|
||||||
9
__crypto/ml-kem-demo/Cargo.toml
Normal file
9
__crypto/ml-kem-demo/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[package]
|
||||||
|
name = "ml-kem-demo"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
base64 = "0.22.1"
|
||||||
|
ml-kem = { version = "0.2.1", features = ["zeroize"] }
|
||||||
|
rand = "0.8"
|
||||||
31
__crypto/ml-kem-demo/src/main.rs
Normal file
31
__crypto/ml-kem-demo/src/main.rs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
use base64::Engine;
|
||||||
|
use base64::engine::general_purpose::STANDARD;
|
||||||
|
use ml_kem::kem::Encapsulate;
|
||||||
|
use ml_kem::{Encoded, EncodedSizeUser, KemCore, MlKem768};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let ek_bytes = STANDARD.decode("fZKrgJTGZYMogAO0u8XI/skLXXCx/hCmQjKdEGGaBitoBWCrbaw\
|
||||||
|
+t7nAT7G8lexlEdwGJrdwNuBVJFZOEnxH9Fu2e7kZrAA0EWZThrhrlCQb7SKSJ3MKP9jGeNA2igU/cXhQj9qSaWzNqplMffhuZHjBAT\
|
||||||
|
Nxglk6IwBcUnNpgEit0dYJgsxsMkfD8AzOaHKm4ybKwzJtYBN6nREl/OZE9CvDtVmZx+wkE1JwWuJJzLqdHWvJ4lyFq2YRUnxtpACKp\
|
||||||
|
xAkVfOzRuqlPUDJijwAc1UvXaFDLydJ/kcKiAorUfQtUoVJ8hkGK8OED3B15NxfJsRwt1kLhEgk89lD6GGhRRFmU8WQHBuX0pppe5A5\
|
||||||
|
BEm148Gv82c+KUUXSAcIFTFMg+UyPDKCaPFu5XBfyvM5RveXuyBFs/IF47BTmKfMVVOPXuh/SIZCONsBAOZgoneexKp8NyjMsVc8kWC\
|
||||||
|
OCVc+2sIcKjIElmRtjDFK9vooRVwGXppfPcV2vMeUk5IMF7aGnDdjkdGm1/oYkPqnvesi5bIpL+kGj9EPDibIPAS4AUQajgNNioRErB\
|
||||||
|
mxAdlZHWpXD+ixmbJp4geG7gJ3OsbBhmmBtJuPTcZeSLOg3HVtQTwyhxd1WjcMh1eqp0i5bDF/0Zin8dcqE0JRmTBj4MTAEbs1xNe1+\
|
||||||
|
xCZB3tnviVOU9d5uSpF6MNmdVWFiYmJJFYyeiJIOWmL1Och79S565dhxxO+ndd2DHVIuTaBW3cu4WSn9AlMqAcPvMxPAYcY7kFcOjc/\
|
||||||
|
PvYI4+oIfGgLaCcFNWcZUCBKz2Qi1zYqSjYYTrnJQVGClpOaGpdXi0zDYvagA2ZSDzNZS6oki6ZeimU0YzQDlRirNPx6ARSgdJU7WgA\
|
||||||
|
SpUNen0QLcoa7iwTDwGeEkHMt2OhUmqdv8bUNJ7YjpJuHOKuMX2C6fJslY5pyP5FJNVE7BugCSdSU1rxOKcHN0iiQSEgd8BU8hkZmof\
|
||||||
|
GahyzPgABI1cJjViMb/cgoiRtrsZuzBWDCVjog8mx7ulYhkszM9ghookGbHHwx/abBbRcTr1HIl0ursSCJPoZT3UWFRNgvVuA7gMQVJ\
|
||||||
|
FxxiFBOxOuHrMTABhVdpPCpNYvEgWRC+Skj3XhZRWovTLuDWPazRMe31iWVirBWTUIeIEEiRsvBPXMW3Ne1gsVwDFEOiaxp5SOAnAGK\
|
||||||
|
mkg/8LIRTHA0LbpBDEjEK+VllQeCIaUJk9g2FxlgatuqcDgIY2KH2NZapIOiRyZYs8shb2JJIRAWqcwRNIBL7ZwBOpafsyJc3BS4YSY\
|
||||||
|
ErVdAOOZe8/G9mcrNwOKzkkPFDUsb+eBEdHIr4bCUGGyinLkGskkXb1Gl8FCbTOGU04ZZtqhFI6eP5Stb7MiY7ywRhiOvokduQTLN26\
|
||||||
|
CsRJa579VOqdeSsNjFI6lxMhgwaxGaHcwWiGBDSbGGcyskujyPebYl+UlhDXGGVHYfZStkj8Sm84KGWqaq9BSQmIgU8oCj7SRMTGC3c\
|
||||||
|
dmjK5QiTGV+LEZKWwpQ9+GU5TIrTqImmeBj+dpGoPFmbliytiKbH53ZsFCfVNMqOvJ24IxdfgWNpBmrChnYmLQ=").unwrap();
|
||||||
|
|
||||||
|
let e: Encoded<<MlKem768 as KemCore>::EncapsulationKey> =
|
||||||
|
ek_bytes.as_slice().try_into().unwrap();
|
||||||
|
let ek = <MlKem768 as KemCore>::EncapsulationKey::from_bytes(&e);
|
||||||
|
let mut rng = rand::rngs::OsRng;
|
||||||
|
let k = ek.encapsulate(&mut rng).unwrap();
|
||||||
|
println!("{}", STANDARD.encode(k.0.as_slice()));
|
||||||
|
println!("Shared secret: {}", STANDARD.encode(k.1.as_slice()));
|
||||||
|
}
|
||||||
257
__crypto/okta-bcrypt-issue/Cargo.lock
generated
Normal file
257
__crypto/okta-bcrypt-issue/Cargo.lock
generated
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base64"
|
||||||
|
version = "0.22.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bcrypt"
|
||||||
|
version = "0.17.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "92758ad6077e4c76a6cadbce5005f666df70d4f13b19976b1a8062eef880040f"
|
||||||
|
dependencies = [
|
||||||
|
"base64",
|
||||||
|
"blowfish",
|
||||||
|
"getrandom",
|
||||||
|
"subtle",
|
||||||
|
"zeroize",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "2.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "blowfish"
|
||||||
|
version = "0.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e412e2cd0f2b2d93e02543ceae7917b3c70331573df19ee046bcbc35e45e87d7"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
"cipher",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "byteorder"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cipher"
|
||||||
|
version = "0.4.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
|
||||||
|
dependencies = [
|
||||||
|
"crypto-common",
|
||||||
|
"inout",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crypto-common"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
"typenum",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "generic-array"
|
||||||
|
version = "0.14.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||||
|
dependencies = [
|
||||||
|
"typenum",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"r-efi",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "inout"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.174"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "okta-bcrypt-issue"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"base64",
|
||||||
|
"bcrypt",
|
||||||
|
"rand",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||||
|
dependencies = [
|
||||||
|
"zerocopy",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.95"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.40"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "r-efi"
|
||||||
|
version = "5.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
|
||||||
|
dependencies = [
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.9.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "subtle"
|
||||||
|
version = "2.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.104"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typenum"
|
||||||
|
version = "1.18.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version_check"
|
||||||
|
version = "0.9.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.14.2+wasi-0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
|
||||||
|
dependencies = [
|
||||||
|
"wit-bindgen-rt",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wit-bindgen-rt"
|
||||||
|
version = "0.39.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy"
|
||||||
|
version = "0.8.26"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f"
|
||||||
|
dependencies = [
|
||||||
|
"zerocopy-derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy-derive"
|
||||||
|
version = "0.8.26"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zeroize"
|
||||||
|
version = "1.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
|
||||||
9
__crypto/okta-bcrypt-issue/Cargo.toml
Normal file
9
__crypto/okta-bcrypt-issue/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[package]
|
||||||
|
name = "okta-bcrypt-issue"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
base64 = "0.22.1"
|
||||||
|
bcrypt = "0.17.0"
|
||||||
|
rand = "0.9.1"
|
||||||
33
__crypto/okta-bcrypt-issue/src/main.rs
Normal file
33
__crypto/okta-bcrypt-issue/src/main.rs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
use rand::RngCore;
|
||||||
|
use base64::{Engine as _, engine::general_purpose::URL_SAFE};
|
||||||
|
use std::error::Error;
|
||||||
|
|
||||||
|
fn random_string(length: usize) -> String {
|
||||||
|
let mut bytes = vec![0u8; length];
|
||||||
|
rand::rng().fill_bytes(&mut bytes);
|
||||||
|
URL_SAFE.encode(&bytes)[..length].to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://n0rdy.foo/posts/20250121/okta-bcrypt-lessons-for-better-apis/
|
||||||
|
fn main() -> Result<(), Box<dyn Error>> {
|
||||||
|
// 18 + 55 + 1 = 74, so above 72 characters' limit of BCrypt
|
||||||
|
let user_id = random_string(18);
|
||||||
|
let username = random_string(55);
|
||||||
|
let password = "super-duper-secure-password";
|
||||||
|
|
||||||
|
let combined_string = format!("{}:{}:{}", user_id, username, password);
|
||||||
|
let combined_hash = bcrypt::hash(combined_string.as_bytes(), bcrypt::DEFAULT_COST)?;
|
||||||
|
|
||||||
|
// let's try to break it
|
||||||
|
let wrong_password = "wrong-password";
|
||||||
|
let wrong_combined_string = format!("{}:{}:{}", user_id, username, wrong_password);
|
||||||
|
|
||||||
|
match bcrypt::verify(wrong_combined_string.as_bytes(), &combined_hash) {
|
||||||
|
Ok(true) => println!("Password is correct"),
|
||||||
|
Ok(false) => println!("Password is incorrect"),
|
||||||
|
Err(e) => println!("{}", e),
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
108
__crypto/orion-demo/Cargo.lock
generated
Normal file
108
__crypto/orion-demo/Cargo.lock
generated
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "2.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ct-codecs"
|
||||||
|
version = "1.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b10589d1a5e400d61f9f38f12f884cfd080ff345de8f17efda36fe0e4a02aa8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fiat-crypto"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "64cd1e32ddd350061ae6edb1b082d7c54915b5c672c389143b9a63403a109f24"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"r-efi",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hex"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.174"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "orion"
|
||||||
|
version = "0.17.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "21b3da83b2b4cdc74ab6a556b2e7b473da046d5aa4008c0a7a3ae96b1b4aabb4"
|
||||||
|
dependencies = [
|
||||||
|
"ct-codecs",
|
||||||
|
"fiat-crypto",
|
||||||
|
"getrandom",
|
||||||
|
"subtle",
|
||||||
|
"zeroize",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "orion-demo"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"hex",
|
||||||
|
"orion",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "r-efi"
|
||||||
|
version = "5.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "subtle"
|
||||||
|
version = "2.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.14.2+wasi-0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
|
||||||
|
dependencies = [
|
||||||
|
"wit-bindgen-rt",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wit-bindgen-rt"
|
||||||
|
version = "0.39.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zeroize"
|
||||||
|
version = "1.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
|
||||||
8
__crypto/orion-demo/Cargo.toml
Normal file
8
__crypto/orion-demo/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[package]
|
||||||
|
name = "orion-demo"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
hex = "0.4.3"
|
||||||
|
orion = "0.17.11"
|
||||||
44
__crypto/orion-demo/src/main.rs
Normal file
44
__crypto/orion-demo/src/main.rs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
use orion::hazardous::ecc::x25519::key_agreement;
|
||||||
|
use orion::kex::{PrivateKey, PublicKey};
|
||||||
|
use orion::pwhash::{Password, hash_password, hash_password_verify};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let password = Password::from_slice(b"hello_world").unwrap();
|
||||||
|
let password_hash = hash_password(&password, 100, 1024).unwrap();
|
||||||
|
println!("{}", password_hash.unprotected_as_encoded());
|
||||||
|
println!("{:?}", hash_password_verify(&password_hash, &password));
|
||||||
|
|
||||||
|
println!("{}", "-".repeat(88));
|
||||||
|
|
||||||
|
let alice_sk = PrivateKey::generate();
|
||||||
|
let alice_pk = PublicKey::try_from(&alice_sk).unwrap();
|
||||||
|
|
||||||
|
let bob_sk = PrivateKey::generate();
|
||||||
|
let bob_pk = PublicKey::try_from(&bob_sk).unwrap();
|
||||||
|
|
||||||
|
let alice_shared = key_agreement(&alice_sk, &bob_pk).unwrap();
|
||||||
|
let bob_shared = key_agreement(&bob_sk, &alice_pk).unwrap();
|
||||||
|
|
||||||
|
println!("{}", hex::encode(alice_shared.unprotected_as_bytes()));
|
||||||
|
println!("{}", hex::encode(bob_shared.unprotected_as_bytes()));
|
||||||
|
|
||||||
|
println!("{}", "-".repeat(88));
|
||||||
|
|
||||||
|
let user_password = Password::from_slice(b"hello_world").unwrap();
|
||||||
|
let salt = orion::kdf::Salt::default();
|
||||||
|
let derived_key = orion::kdf::derive_key(&user_password, &salt, 3, 1 << 16, 32).unwrap();
|
||||||
|
println!(
|
||||||
|
"{} {}",
|
||||||
|
hex::encode(salt.as_ref()),
|
||||||
|
hex::encode(derived_key.unprotected_as_bytes())
|
||||||
|
);
|
||||||
|
|
||||||
|
println!("{}", "-".repeat(88));
|
||||||
|
|
||||||
|
let aead_key = orion::aead::SecretKey::generate(32).unwrap();
|
||||||
|
let ciphertext = orion::aead::seal(&aead_key, b"hello world").unwrap();
|
||||||
|
|
||||||
|
let plaintext = orion::aead::open(&aead_key, &ciphertext).unwrap();
|
||||||
|
println!("{}", hex::encode(&ciphertext));
|
||||||
|
println!("{} {}", hex::encode(&plaintext), String::from_utf8_lossy(&plaintext));
|
||||||
|
}
|
||||||
2908
__network/pingora-demo/Cargo.lock
generated
Normal file
2908
__network/pingora-demo/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
14
__network/pingora-demo/Cargo.toml
Normal file
14
__network/pingora-demo/Cargo.toml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[package]
|
||||||
|
name = "pingora-demo"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
pingora-core = "0.2"
|
||||||
|
pingora-proxy = "0.2"
|
||||||
|
tokio = { version = "1.0", features = ["full"] }
|
||||||
|
async-trait = "0.1"
|
||||||
|
mime_guess = "2.0"
|
||||||
|
headers = "0.3"
|
||||||
|
|
||||||
|
|
||||||
6
__network/pingora-demo/README.md
Normal file
6
__network/pingora-demo/README.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
> Copied from: https://mp.weixin.qq.com/s/RHSy2EeK3XTRYXtOSCO0Ug
|
||||||
|
> https://play.hatter.me/doc/showDocDetail.jssp?id=8495
|
||||||
|
|
||||||
|
|
||||||
80
__network/pingora-demo/src/main.rs
Normal file
80
__network/pingora-demo/src/main.rs
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
use async_trait::async_trait;
|
||||||
|
use headers::{ContentLength, ContentType};
|
||||||
|
use pingora_core::server::Server;
|
||||||
|
use pingora_proxy::{ProxyHttp, Session};
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::sync::Arc;
|
||||||
|
use mime_guess::from_path;
|
||||||
|
|
||||||
|
struct StaticFileServer {
|
||||||
|
root_dir: PathBuf,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl StaticFileServer {
|
||||||
|
fn new(root: impl AsRef<Path>) -> Self {
|
||||||
|
StaticFileServer {
|
||||||
|
root_dir: root.as_ref().to_path_buf(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl ProxyHttp for StaticFileServer {
|
||||||
|
async fn response_filter(&self, session: &mut Session, response: &mut pingora_http::Response) {
|
||||||
|
let path = session.req_header().uri.path();
|
||||||
|
let file_path = self.root_dir.join(&path[1..]); // 去除前导/
|
||||||
|
|
||||||
|
if let Ok(metadata) = tokio::fs::metadata(&file_path).await {
|
||||||
|
if metadata.is_file() {
|
||||||
|
if let Ok(file) = tokio::fs::read(&file_path).await {
|
||||||
|
// 设置正确的Content-Type
|
||||||
|
let mime = from_path(&file_path).first_or_octet_stream();
|
||||||
|
response.headers_mut().insert(
|
||||||
|
headers::CONTENT_TYPE,
|
||||||
|
ContentType::from(mime).to_string().parse().unwrap(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// 设置Content-Length
|
||||||
|
response.headers_mut().insert(
|
||||||
|
headers::CONTENT_LENGTH,
|
||||||
|
ContentLength(metadata.len()).to_string().parse().unwrap(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// 设置缓存头(CDN关键配置)
|
||||||
|
response.headers_mut().insert(
|
||||||
|
"cache-control",
|
||||||
|
"public, max-age=31536000".parse().unwrap(), // 1年缓存
|
||||||
|
);
|
||||||
|
|
||||||
|
*response.body_mut() = file.into();
|
||||||
|
response.set_status(200);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 文件不存在
|
||||||
|
*response.status_mut() = 404;
|
||||||
|
*response.body_mut() = b"Not Found".to_vec().into();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() {
|
||||||
|
// 1. 初始化服务器
|
||||||
|
let mut server = Server::new(Some("Static File Server")).unwrap();
|
||||||
|
server.bootstrap();
|
||||||
|
|
||||||
|
// 2. 创建文件服务(假设静态文件在./static目录)
|
||||||
|
let static_service = StaticFileServer::new("./static");
|
||||||
|
let mut service = pingora_proxy::http_proxy_service(&server.configuration, static_service);
|
||||||
|
|
||||||
|
// 3. 监听端口
|
||||||
|
service.add_tcp("0.0.0.0:8080");
|
||||||
|
|
||||||
|
// 4. 启动服务
|
||||||
|
server.add_service(service);
|
||||||
|
println!("Static file server running on :8080");
|
||||||
|
server.run_forever();
|
||||||
|
}
|
||||||
|
|
||||||
108
__security/keyring-demo/Cargo.lock
generated
Normal file
108
__security/keyring-demo/Cargo.lock
generated
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "2.9.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation"
|
||||||
|
version = "0.9.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
|
||||||
|
dependencies = [
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation"
|
||||||
|
version = "0.10.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6"
|
||||||
|
dependencies = [
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation-sys"
|
||||||
|
version = "0.8.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "keyring"
|
||||||
|
version = "3.6.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eebcc3aff044e5944a8fbaf69eb277d11986064cba30c468730e8b9909fb551c"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"security-framework 2.11.1",
|
||||||
|
"security-framework 3.4.0",
|
||||||
|
"zeroize",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "keyring-demo"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"keyring",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.175"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "security-framework"
|
||||||
|
version = "2.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"core-foundation 0.9.4",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
"security-framework-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "security-framework"
|
||||||
|
version = "3.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "60b369d18893388b345804dc0007963c99b7d665ae71d275812d828c6f089640"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"core-foundation 0.10.1",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
"security-framework-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "security-framework-sys"
|
||||||
|
version = "2.15.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0"
|
||||||
|
dependencies = [
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zeroize"
|
||||||
|
version = "1.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
|
||||||
7
__security/keyring-demo/Cargo.toml
Normal file
7
__security/keyring-demo/Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "keyring-demo"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
keyring = { version = "3.6.3", features = ["apple-native"] }
|
||||||
10
__security/keyring-demo/src/main.rs
Normal file
10
__security/keyring-demo/src/main.rs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
use keyring::{Entry, Result};
|
||||||
|
|
||||||
|
fn main() -> Result<()> {
|
||||||
|
let entry = Entry::new("my-service", "my-name")?;
|
||||||
|
entry.set_password("topS3cr3tP4$$w0rd")?;
|
||||||
|
let password = entry.get_password()?;
|
||||||
|
println!("My password is '{}'", password);
|
||||||
|
entry.delete_credential()?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
334
__serialization/serde_json/Cargo.lock
generated
334
__serialization/serde_json/Cargo.lock
generated
@@ -1,171 +1,349 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "android-tzdata"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "android_system_properties"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.0.0"
|
version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bumpalo"
|
||||||
|
version = "3.19.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.2.31"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2"
|
||||||
|
dependencies = [
|
||||||
|
"shlex",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.10"
|
version = "0.4.41"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
"android-tzdata",
|
||||||
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"iana-time-zone",
|
||||||
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
"js-sys",
|
||||||
|
"num-traits",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "core-foundation-sys"
|
||||||
|
version = "0.8.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone"
|
||||||
|
version = "0.1.63"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8"
|
||||||
|
dependencies = [
|
||||||
|
"android_system_properties",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"iana-time-zone-haiku",
|
||||||
|
"js-sys",
|
||||||
|
"log",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone-haiku"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "0.4.4"
|
version = "1.0.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "js-sys"
|
||||||
|
version = "0.3.77"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
|
||||||
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.66"
|
version = "0.2.174"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-integer"
|
name = "log"
|
||||||
version = "0.1.42"
|
version = "0.4.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||||
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
[[package]]
|
||||||
]
|
name = "memchr"
|
||||||
|
version = "2.7.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.11"
|
version = "0.2.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "once_cell"
|
||||||
version = "1.0.8"
|
version = "1.21.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.95"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.2"
|
version = "1.0.40"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "rustversion"
|
||||||
version = "0.1.56"
|
version = "1.0.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.2"
|
version = "1.0.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.104"
|
version = "1.0.219"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde-json-test"
|
name = "serde-json-test"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono",
|
||||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde",
|
||||||
"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_json",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.104"
|
version = "1.0.219"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2",
|
||||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quote",
|
||||||
"syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.44"
|
version = "1.0.142"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itoa",
|
||||||
"ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"memchr",
|
||||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ryu",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shlex"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.13"
|
version = "2.0.104"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2",
|
||||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quote",
|
||||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "unicode-ident"
|
||||||
version = "0.1.42"
|
version = "1.0.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen"
|
||||||
|
version = "0.2.100"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if",
|
||||||
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
|
"once_cell",
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustversion",
|
||||||
|
"wasm-bindgen-macro",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "wasm-bindgen-backend"
|
||||||
version = "0.2.0"
|
version = "0.2.100"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi"
|
|
||||||
version = "0.3.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bumpalo",
|
||||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi-i686-pc-windows-gnu"
|
name = "wasm-bindgen-macro"
|
||||||
version = "0.4.0"
|
version = "0.2.100"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"wasm-bindgen-macro-support",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi-x86_64-pc-windows-gnu"
|
name = "wasm-bindgen-macro-support"
|
||||||
version = "0.4.0"
|
version = "0.2.100"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"wasm-bindgen-backend",
|
||||||
|
"wasm-bindgen-shared",
|
||||||
|
]
|
||||||
|
|
||||||
[metadata]
|
[[package]]
|
||||||
"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
|
name = "wasm-bindgen-shared"
|
||||||
"checksum chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "31850b4a4d6bae316f7a09e691c944c28299298837edc0a03f755618c23cbc01"
|
version = "0.2.100"
|
||||||
"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
|
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
|
||||||
"checksum num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
|
dependencies = [
|
||||||
"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
|
"unicode-ident",
|
||||||
"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548"
|
]
|
||||||
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
|
|
||||||
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
[[package]]
|
||||||
"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8"
|
name = "windows-core"
|
||||||
"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449"
|
version = "0.61.2"
|
||||||
"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)" = "48c575e0cc52bdd09b47f330f646cf59afc586e9c4e3ccd6fc1f625b8ea1dad7"
|
checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
|
||||||
"checksum syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4ff033220a41d1a57d8125eab57bf5263783dfdcc18688b1dacc6ce9651ef8"
|
dependencies = [
|
||||||
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
|
"windows-implement",
|
||||||
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
"windows-interface",
|
||||||
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
"windows-link",
|
||||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
"windows-result",
|
||||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
"windows-strings",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-implement"
|
||||||
|
version = "0.60.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-interface"
|
||||||
|
version = "0.59.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-link"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-result"
|
||||||
|
version = "0.3.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"
|
||||||
|
dependencies = [
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-strings"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"
|
||||||
|
dependencies = [
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use serde_json::{Result, Value};
|
use serde_json::{Result, Value};
|
||||||
use chrono::{DateTime, Utc, TimeZone};
|
use chrono::{DateTime, Utc, TimeZone};
|
||||||
|
|
||||||
|
// alternative JSON for human: https://crates.io/crates/json5
|
||||||
mod my_date_format {
|
mod my_date_format {
|
||||||
use chrono::{DateTime, Utc, TimeZone};
|
use chrono::{DateTime, Utc, TimeZone};
|
||||||
use serde::{self, Deserialize, Serializer, Deserializer};
|
use serde::{self, Deserialize, Serializer, Deserializer};
|
||||||
@@ -50,6 +51,20 @@ struct TestStruct {
|
|||||||
struct TestStruct2 {
|
struct TestStruct2 {
|
||||||
test_id: i32,
|
test_id: i32,
|
||||||
test_name: String,
|
test_name: String,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
test_description: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum StringOrStringArray {
|
||||||
|
String(String),
|
||||||
|
Vec(Vec<String>),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
|
struct TestStruct3 {
|
||||||
|
sub: StringOrStringArray,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
@@ -82,7 +97,7 @@ fn main() -> Result<()> {
|
|||||||
});
|
});
|
||||||
println!("{}", &john);
|
println!("{}", &john);
|
||||||
|
|
||||||
if let Option::Some(ref mut m) = john.as_object_mut() {
|
if let Some(ref mut m) = john.as_object_mut() {
|
||||||
m.insert("test".into(), Value::Bool(true));
|
m.insert("test".into(), Value::Bool(true));
|
||||||
m.insert("test2".into(), Value::String("hello world".into()));
|
m.insert("test2".into(), Value::String("hello world".into()));
|
||||||
}
|
}
|
||||||
@@ -91,8 +106,15 @@ fn main() -> Result<()> {
|
|||||||
let test_struct2 = TestStruct2 {
|
let test_struct2 = TestStruct2 {
|
||||||
test_id: 1,
|
test_id: 1,
|
||||||
test_name: "Hatter".into(),
|
test_name: "Hatter".into(),
|
||||||
|
test_description: None,
|
||||||
};
|
};
|
||||||
println!("{}", serde_json::to_string(&test_struct2)?);
|
println!("{}", serde_json::to_string(&test_struct2)?);
|
||||||
|
|
||||||
|
println!();
|
||||||
|
let test_struct3_1: TestStruct3 = serde_json::from_str("{\"sub\": \"name\"}")?;
|
||||||
|
println!("{}", serde_json::to_string_pretty(&test_struct3_1)?);
|
||||||
|
let test_struct3_2: TestStruct3 = serde_json::from_str("{\"sub\": [\"name1\", \"name2\"]}")?;
|
||||||
|
println!("{}", serde_json::to_string_pretty(&test_struct3_2)?);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
92
__term/tui-markup-demo/Cargo.lock
generated
Normal file
92
__term/tui-markup-demo/Cargo.lock
generated
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ansi_term"
|
||||||
|
version = "0.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytecount"
|
||||||
|
version = "0.6.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.7.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "minimal-lexical"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nom"
|
||||||
|
version = "7.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
"minimal-lexical",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nom_locate"
|
||||||
|
version = "4.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e3c83c053b0713da60c5b8de47fe8e494fe3ece5267b2f23090a07a053ba8f3"
|
||||||
|
dependencies = [
|
||||||
|
"bytecount",
|
||||||
|
"memchr",
|
||||||
|
"nom",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tui-markup"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5437c754f57a2aa554adc76c607d45c4a1a8a3f86f7e261811b361872eec0b69"
|
||||||
|
dependencies = [
|
||||||
|
"ansi_term",
|
||||||
|
"nom",
|
||||||
|
"nom_locate",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tui-markup-demo"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"ansi_term",
|
||||||
|
"tui-markup",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi"
|
||||||
|
version = "0.3.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-i686-pc-windows-gnu",
|
||||||
|
"winapi-x86_64-pc-windows-gnu",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-i686-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-x86_64-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
8
__term/tui-markup-demo/Cargo.toml
Normal file
8
__term/tui-markup-demo/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[package]
|
||||||
|
name = "tui-markup-demo"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
ansi_term = "0.12.1"
|
||||||
|
tui-markup = { version = "0.5.0",features = ["ansi"] }
|
||||||
20
__term/tui-markup-demo/src/main.rs
Normal file
20
__term/tui-markup-demo/src/main.rs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
use ansi_term::{ANSIStrings, Color, Style};
|
||||||
|
use tui_markup::generator::ANSIStringsGenerator;
|
||||||
|
use tui_markup::{compile, compile_with};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// Parse markup into some final result for showing
|
||||||
|
let result = compile::<ANSIStringsGenerator>("You got a <yellow Coin>").unwrap();
|
||||||
|
// Show it
|
||||||
|
println!("{}", ANSIStrings(&result));
|
||||||
|
|
||||||
|
// With custom tag
|
||||||
|
let generator = ANSIStringsGenerator::new(|tag: &str| match tag {
|
||||||
|
"keyboard" => Some(Style::default().fg(Color::Blue).on(Color::Black).bold()),
|
||||||
|
"bold" => Some(Style::default().bold()),
|
||||||
|
"under" => Some(Style::default().underline()),
|
||||||
|
_ => None,
|
||||||
|
});
|
||||||
|
let result = compile_with("Press <keyboard Space> to <bold <under jump>>", generator).unwrap();
|
||||||
|
println!("{}", ANSIStrings(&result));
|
||||||
|
}
|
||||||
3
__wasm/rust-wasm-plugins-examples/.gitignore
vendored
Normal file
3
__wasm/rust-wasm-plugins-examples/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
target/
|
||||||
|
work/
|
||||||
|
.cargo/
|
||||||
2664
__wasm/rust-wasm-plugins-examples/Cargo.lock
generated
Normal file
2664
__wasm/rust-wasm-plugins-examples/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
8
__wasm/rust-wasm-plugins-examples/Cargo.toml
Normal file
8
__wasm/rust-wasm-plugins-examples/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[workspace]
|
||||||
|
resolver = "3"
|
||||||
|
members = ["host", "plugin"]
|
||||||
|
|
||||||
|
# This will create smaller Wasm files
|
||||||
|
[profile.release]
|
||||||
|
strip = "debuginfo"
|
||||||
|
lto = true
|
||||||
201
__wasm/rust-wasm-plugins-examples/LICENSE-APACHE
Normal file
201
__wasm/rust-wasm-plugins-examples/LICENSE-APACHE
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright {yyyy} {name of copyright owner}
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
19
__wasm/rust-wasm-plugins-examples/LICENSE-MIT
Normal file
19
__wasm/rust-wasm-plugins-examples/LICENSE-MIT
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) Individual contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
72
__wasm/rust-wasm-plugins-examples/README.md
Normal file
72
__wasm/rust-wasm-plugins-examples/README.md
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
Rust Wasm Plugins Example
|
||||||
|
=========================
|
||||||
|
|
||||||
|
> clone from: https://github.com/tliron/rust-wasm-plugins-examples
|
||||||
|
|
||||||
|
A Great Fit
|
||||||
|
-----------
|
||||||
|
|
||||||
|
You've probably heard that [Wasm](https://web.dev/explore/webassembly) (WebAssembly) can be a great way to support plugins in your application. Plugin authors can write them in any Wasm-compatible language and you're off to the races with your choice among various excellent and safe Wasm runtimes for Rust, including ones optimized for embedded environments (e.g. [wasmi](https://github.com/wasmi-labs/wasmi)).
|
||||||
|
|
||||||
|
Not So Easy
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Unfortunately, you're going to find out (in early 2025, when this is written) that examples of this often-mentioned use case are hard to come by, and that so much of the documentation is irrelevant, confusing, incomplete, or just out of date, as things have been moving quite quickly in the Wasm world.
|
||||||
|
|
||||||
|
If you've read Surma's [Rust to WebAssembly the hard way](https://surma.dev/things/rust-to-webassembly/) (highly recommended starting point!) then you might feel quite confident in your ability to build `.wasm` modules, load them into Rust, call functions in them, and expose functions to them. But the hard way becomes a dead end as you realize something quite critical: Wasm only supports the transfer of just primitive numeric types, namely integers and floats (and not even unsigned integers). This is an intentional and understandable design choice to keep Wasm lean and mean and agnostic to any specific implementation.
|
||||||
|
|
||||||
|
But this means that if you want to transfer something as basic as a string or a vector then you'll have to delve deep into the the Wasm memory model.
|
||||||
|
|
||||||
|
People have come up with various solutions for Rust, from piggy-backing on [std::ffi::CString](https://doc.rust-lang.org/std/ffi/struct.CString.html) to exposing custom malloc/free functions to the Wasm module. But not only are these solutions painful, they would obviously need to be ported to every language we want to support, each with its own string and array models. There was, and still is, a need for some kind of standard, built on top of Wasm, that would support higher-level constructs in a portable way.
|
||||||
|
|
||||||
|
The Temporary Solutions
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
It took some time for the community to rally around one. For a while, a promising proposal was Wasm Interfaces (WAI). This was [pioneered by Wasmer](https://github.com/wasmerio/wai), where the [documentation](https://docs.wasmer.io/wai) still points to it as "the" solution (early 2025). As usual in the Wasm world, even that documentation can only take you so far. None of it actually mentions hosting WAI in Rust! And it only shows importing interfaces, not exporting them, though I have managed to learn how to handle exports by delving into the WAI tooling source code. The idea behind
|
||||||
|
WAI is that you describe your interface in a [`.wai` file](https://github.com/wasmerio/wai/blob/main/WAI.md) and use tooling (e.g. macros) to generate the boilerplate code for clients and hosts, a lot like how things work with RPC protocols (e.g. protobufs).
|
||||||
|
|
||||||
|
WAI had not been widely adopted, however it does work and is also quite straightforward. We won't be using it in this example, but it's useful to be aware of its existence.
|
||||||
|
|
||||||
|
Also check out [Extism](https://extism.org/), a more comprehensive attempt to fill in the gap.
|
||||||
|
|
||||||
|
The Consensus Solution
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
But the consensus now seems to be around the [Wasm Component Model](https://component-model.bytecodealliance.org/), which expands on the WAI proposal with proper namespacing, resources, and richer custom data types. The Component Model is actually part of WASI, and indeed is being used to provide the WASI extensions. So, what's [WASI](https://wasi.dev/)? It's an initiative by the community to deliver a set of common APIs on top of Wasm for accessing streams, like files and stdout/stderr, network sockets, and eventually threads. I say "eventually" because WASI is still very much a work in progress. As of now (early 2025) we just got "preview 2" of it. Luckily, Rust can target "wasip2", meaning that it can be used to create the latest and greatest Components. Though, note that wasip2 does produce larger minimal `.wasm` files than WAI due to the inclusion of the machinery for the Component Model.
|
||||||
|
|
||||||
|
Like WAI, the Component Model relies on an interface definition file, [`.wit`](https://component-model.bytecodealliance.org/design/wit.html). And [Wasmtime](https://wasmtime.dev/) has the tooling for it! Yay! So, are we finally off to the races with our plugin system?
|
||||||
|
|
||||||
|
Not so fast. Again, finding examples and straightforward documentation is not easy. Wasmtime is a very comprehensive and performative implementation, but it's also designed by committee and has a lot of contributors. And due to the fast-moving nature of these things, what you find might not represent what is actually going on or what you should be using.
|
||||||
|
|
||||||
|
Finally We Get to the Point
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
All that to say, that's why I created this repository. It's intended to be a minimal and straightforward example of how to build plugins in Rust (as Components) and how to host them in your application using Wasmtime and its WIT tooling. Well, at least for early 2025... As of now it does not demonstrate the more advanced features of WIT, such as custom data types, but I might add those in the future.
|
||||||
|
|
||||||
|
How to Build and Run
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
There are two crates here, a plugin, which builds into a wasip2 `.wasm`, and a host, which can be built into any Rust target architecure.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
rustup target add wasm32-wasip2
|
||||||
|
git clone https://github.com/tliron/rust-wasm-plugins-examples.git
|
||||||
|
cd rust-wasm-plugins-examples
|
||||||
|
./run.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Things to See
|
||||||
|
-------------
|
||||||
|
|
||||||
|
* [Rust to WebAssembly the hard way](https://surma.dev/things/rust-to-webassembly/) by Surma
|
||||||
|
* [Plugins with Rust and WASI Preview 2](https://benw.is/posts/plugins-with-rust-and-wasi) by Ben Wishovich
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
Like much of the Rust ecosystem, licensed under your choice of either of
|
||||||
|
|
||||||
|
* [Apache License, Version 2.0](LICENSE-APACHE)
|
||||||
|
* [MIT license](LICENSE-MIT)
|
||||||
|
|
||||||
|
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// Note that names *cannot* use underscores, but *can* use dashes
|
||||||
|
// (In Rust the dashes are converted to underscores, as usual)
|
||||||
|
// They also can't use numeric digits for some reason!
|
||||||
|
|
||||||
|
// A package can include more than one "world"
|
||||||
|
// (=component, or plugin type for us),
|
||||||
|
|
||||||
|
package acme:plugins@1.0.0;
|
||||||
|
|
||||||
|
// This is what the host will expose to our plugins
|
||||||
|
interface host {
|
||||||
|
log: func(message: string);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is what our plugins will expose to the host
|
||||||
|
interface prettify-plugin {
|
||||||
|
prettify: func(content: string) -> string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We can create additional worlds per plugin type
|
||||||
|
// You can import/export more than one interface
|
||||||
|
// (as well as individual functions, types, and resources)
|
||||||
|
world prettify {
|
||||||
|
import host;
|
||||||
|
export prettify-plugin;
|
||||||
|
}
|
||||||
22
__wasm/rust-wasm-plugins-examples/host/Cargo.toml
Normal file
22
__wasm/rust-wasm-plugins-examples/host/Cargo.toml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
[package]
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
name = "host"
|
||||||
|
description = "Rust Wasm Plugins Example"
|
||||||
|
version = "0.0.1"
|
||||||
|
rust-version = "1.84"
|
||||||
|
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
repository = "https://github.com/tliron/rust-wasm-plugins-example"
|
||||||
|
documentation = "https://github.com/tliron/rust-wasm-plugins-example"
|
||||||
|
authors = ["Tal Liron"]
|
||||||
|
|
||||||
|
readme = "../README.md"
|
||||||
|
|
||||||
|
categories = ["wasm"] # https://crates.io/category_slugs
|
||||||
|
keywords = ["wasm", "wasi", "wit", "wasmtime", "examples"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow = "1.0.97"
|
||||||
|
wasmtime = "31.0.0"
|
||||||
|
wasmtime-wasi = "31.0.0"
|
||||||
3
__wasm/rust-wasm-plugins-examples/host/src/bindings.rs
Normal file
3
__wasm/rust-wasm-plugins-examples/host/src/bindings.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
|
wasmtime::component::bindgen!(in "../assets/wit/acme-plugins.wit");
|
||||||
41
__wasm/rust-wasm-plugins-examples/host/src/host.rs
Normal file
41
__wasm/rust-wasm-plugins-examples/host/src/host.rs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
use super::bindings::acme::plugins::host;
|
||||||
|
|
||||||
|
use wasmtime_wasi::{IoView, ResourceTable, WasiCtx, WasiCtxBuilder, WasiView};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Host
|
||||||
|
//
|
||||||
|
|
||||||
|
/// Plugins host.
|
||||||
|
pub struct Host {
|
||||||
|
wasi: WasiCtx,
|
||||||
|
resources: ResourceTable,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Host {
|
||||||
|
/// Constructor.
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let wasi = WasiCtxBuilder::new().inherit_stdout().build();
|
||||||
|
Self { wasi, resources: ResourceTable::new() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We need to implement WasiView for wasmtime_wasi::add_to_linker_sync
|
||||||
|
impl WasiView for Host {
|
||||||
|
fn ctx(&mut self) -> &mut WasiCtx {
|
||||||
|
&mut self.wasi
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IoView for Host {
|
||||||
|
fn table(&mut self) -> &mut ResourceTable {
|
||||||
|
&mut self.resources
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Our exposed Host functions
|
||||||
|
impl host::Host for Host {
|
||||||
|
fn log(&mut self, message: String) {
|
||||||
|
println!("log: {}", message);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
__wasm/rust-wasm-plugins-examples/host/src/main.rs
Normal file
11
__wasm/rust-wasm-plugins-examples/host/src/main.rs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
mod bindings;
|
||||||
|
mod host;
|
||||||
|
mod prettify;
|
||||||
|
|
||||||
|
use prettify::*;
|
||||||
|
|
||||||
|
pub fn main() {
|
||||||
|
let mut prettify = Prettify::new("target/wasm32-wasip2/release/plugin.wasm").unwrap();
|
||||||
|
let r = prettify.prettify("We will prettify this with a plugin").unwrap();
|
||||||
|
println!("{}", r);
|
||||||
|
}
|
||||||
55
__wasm/rust-wasm-plugins-examples/host/src/prettify.rs
Normal file
55
__wasm/rust-wasm-plugins-examples/host/src/prettify.rs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
use super::{bindings, host::*};
|
||||||
|
|
||||||
|
use {
|
||||||
|
anyhow::Context,
|
||||||
|
std::path,
|
||||||
|
wasmtime::{component::*, Engine, Store},
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prettify
|
||||||
|
//
|
||||||
|
|
||||||
|
/// Prettify plugin.
|
||||||
|
pub struct Prettify {
|
||||||
|
store: Store<Host>,
|
||||||
|
prettify: bindings::Prettify,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wasmtime uses Anyhow for most of its errors
|
||||||
|
// But you could potentially wrap it in your own "PluginError" or similar using .map_err
|
||||||
|
// For this example we used .context
|
||||||
|
|
||||||
|
impl Prettify {
|
||||||
|
/// Constructor.
|
||||||
|
pub fn new<PathT>(module: PathT) -> Result<Self, anyhow::Error>
|
||||||
|
where
|
||||||
|
PathT: AsRef<path::Path>,
|
||||||
|
{
|
||||||
|
let engine = Engine::default();
|
||||||
|
|
||||||
|
// Component
|
||||||
|
let component = Component::from_file(&engine, module).context("load component")?;
|
||||||
|
|
||||||
|
// Linker
|
||||||
|
let mut linker = Linker::new(&engine);
|
||||||
|
wasmtime_wasi::add_to_linker_sync(&mut linker).context("link WASI")?;
|
||||||
|
bindings::Prettify::add_to_linker(&mut linker, |state: &mut Host| state).context("link plugin host")?;
|
||||||
|
|
||||||
|
// Store
|
||||||
|
let mut store = Store::new(&engine, Host::new());
|
||||||
|
|
||||||
|
// Bindings
|
||||||
|
let prettify =
|
||||||
|
bindings::Prettify::instantiate(&mut store, &component, &linker).context("instantiate bindings")?;
|
||||||
|
|
||||||
|
Ok(Self { store, prettify })
|
||||||
|
}
|
||||||
|
|
||||||
|
// We'll create convenience wrappers to make calling functions ergonomic:
|
||||||
|
|
||||||
|
/// Prettify.
|
||||||
|
pub fn prettify(&mut self, name: &str) -> Result<String, anyhow::Error> {
|
||||||
|
self.prettify.acme_plugins_prettify_plugin().call_prettify(&mut self.store, name)
|
||||||
|
}
|
||||||
|
}
|
||||||
23
__wasm/rust-wasm-plugins-examples/plugin/Cargo.toml
Normal file
23
__wasm/rust-wasm-plugins-examples/plugin/Cargo.toml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
[package]
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
name = "plugin"
|
||||||
|
description = "Rust Wasm Plugins Example"
|
||||||
|
version = "0.0.1"
|
||||||
|
rust-version = "1.84"
|
||||||
|
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
repository = "https://github.com/tliron/rust-wasm-plugins-example"
|
||||||
|
documentation = "https://github.com/tliron/rust-wasm-plugins-example"
|
||||||
|
authors = ["Tal Liron"]
|
||||||
|
|
||||||
|
readme = "../README.md"
|
||||||
|
|
||||||
|
categories = ["wasm"]
|
||||||
|
keywords = ["wasm", "wasi", "wit", "wasmtime", "examples"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
wit-bindgen = "0.41.0"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
crate-type = ["cdylib"]
|
||||||
8
__wasm/rust-wasm-plugins-examples/plugin/src/bindings.rs
Normal file
8
__wasm/rust-wasm-plugins-examples/plugin/src/bindings.rs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// Note that we are using the full notation of the macro in order
|
||||||
|
// to add some options that allow the bindings to live in this independent file
|
||||||
|
|
||||||
|
wit_bindgen::generate!({
|
||||||
|
path: "../assets/wit/acme-plugins.wit",
|
||||||
|
default_bindings_module: "crate::bindings",
|
||||||
|
pub_export_macro: true,
|
||||||
|
});
|
||||||
2
__wasm/rust-wasm-plugins-examples/plugin/src/lib.rs
Normal file
2
__wasm/rust-wasm-plugins-examples/plugin/src/lib.rs
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
mod bindings;
|
||||||
|
mod quote_prettify;
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
use super::bindings::{acme::plugins::host, export, exports::acme::plugins::prettify_plugin};
|
||||||
|
|
||||||
|
// This is our implementation of the "prettify" plugin type
|
||||||
|
// (=WIT world)
|
||||||
|
|
||||||
|
// We shall make the content pretty by quoting all words
|
||||||
|
|
||||||
|
// Gorgeous!
|
||||||
|
|
||||||
|
pub struct QuotePrettifyPlugin;
|
||||||
|
|
||||||
|
export!(QuotePrettifyPlugin);
|
||||||
|
|
||||||
|
impl prettify_plugin::Guest for QuotePrettifyPlugin {
|
||||||
|
fn prettify(content: String) -> String {
|
||||||
|
host::log("thank you for using the quote prettify plugin!");
|
||||||
|
let words = content.split(" ");
|
||||||
|
let words: Vec<String> = words.map(|word| format!("{:?}", word)).collect();
|
||||||
|
words.join(" ")
|
||||||
|
}
|
||||||
|
}
|
||||||
4
__wasm/rust-wasm-plugins-examples/run.sh
Executable file
4
__wasm/rust-wasm-plugins-examples/run.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cargo build --package=plugin --target=wasm32-wasip2 --release
|
||||||
|
cargo run --package=host
|
||||||
2
__wasm/rust-wasm-plugins-examples/rustfmt.toml
Normal file
2
__wasm/rust-wasm-plugins-examples/rustfmt.toml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
max_width = 120
|
||||||
|
use_small_heuristics = "Max"
|
||||||
Reference in New Issue
Block a user