Add lox-wasm and lox-utils READMEs and other fmt fixes
This commit is contained in:
parent
02df29a249
commit
fdde186c92
|
@ -42,7 +42,7 @@ impl DB {
|
|||
|
||||
// If roll_back_date is empty, opens the most recent entry in the lox database or if none exists, creates a
|
||||
// new database. If roll_back_date is not empty, use the specified date to roll back to a previous lox-context
|
||||
// either exactly the entry at the roll_back_date or within 24 hours from thhe roll_back_date.
|
||||
// either exactly the entry at the roll_back_date or within 24 hours from the roll_back_date.
|
||||
pub fn open_new_or_existing_db(
|
||||
db_config: DbConfig,
|
||||
roll_back_date: Option<String>,
|
||||
|
|
|
@ -326,7 +326,8 @@ async fn main() {
|
|||
});
|
||||
|
||||
let (tx, rx) = mpsc::channel(32);
|
||||
let rdsys_request_handler = spawn(async { rdsys_request_creator(config.rtype, tx, kill_stream).await });
|
||||
let rdsys_request_handler =
|
||||
spawn(async { rdsys_request_creator(config.rtype, tx, kill_stream).await });
|
||||
|
||||
let rdsys_resource_receiver =
|
||||
spawn(async { rdsys_bridge_parser(rdsys_tx, rx, kill_parser).await });
|
||||
|
|
|
@ -113,7 +113,6 @@ impl IssuerPrivKey {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct IssuerPubKey {
|
||||
X: Vec<RistrettoPoint>,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# lox-wasm
|
||||
|
||||
wasm bindings for the lox crate: https://git-crysp.uwaterloo.ca/iang/lox
|
||||
wasm bindings for Lox client requests and response handling. These bindings are compatible with the endpoints in the [`lox-distributor`'s](../../lox-distributor/) [`request_handler`](../../lox-distributor/src/request_handler.rs).
|
||||
|
||||
# Dependencies
|
||||
|
||||
|
@ -14,12 +14,9 @@ cargo install wasm-pack
|
|||
wasm-pack build --target web
|
||||
```
|
||||
|
||||
# Testing
|
||||
# Testing Locally
|
||||
|
||||
|
||||
### Testing Locally
|
||||
|
||||
The provided `index.html` file can be used for testing the lox bindings. First, follow the instructions to [run a lox server](https://gitlab.torproject.org/cohosh/lox-server).
|
||||
The provided `index.html` file can be used for testing the lox bindings. First, follow the instructions to [run the lox-distributor](../../lox-distributor/README.md).
|
||||
|
||||
Then, spin up a simple local webserver in the current directory:
|
||||
```
|
||||
|
@ -27,3 +24,7 @@ python3 -m http.server 8000
|
|||
```
|
||||
|
||||
Next, open the dev console in your browser and navigate to `http://localhost:8000`.
|
||||
|
||||
### Note
|
||||
|
||||
Although all Lox protocols are implemented, they will not all work with the existing [`index.js`](index.js) and the `lox-distributor`'s `request_handler`. This is because varying time intervals must pass between successful requests for certain Lox credentials. To fully test whether or not the full set of Lox credentials are working as intended (while rejecting patience as an acceptable method), the agreed upon time between the client and server must be artificially accelerated in tandem to the required future date after each relevant request so credentials can be validated. An earlier version of the `lox-distributor`: [`lox-server`](https://gitlab.torproject.org/cohosh/lox-server/-/blob/main/src/main.rs) includes some server side examples of how to accomplish this on the server side and the `lox-wasm` crate can be edited to artificially increase the time as shown [here](https://gitlab.torproject.org/tpo/anti-censorship/lox/-/blob/73c3ef872878b295d84cddc51320d476d6fbcb7f/crates/lox-wasm/src/lib.rs#L102).
|
||||
|
|
|
@ -9,6 +9,7 @@ use lox_library::scalar_u32;
|
|||
use std::panic;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
// Returns today's Julian date as a u32 value
|
||||
fn today() -> u32 {
|
||||
let naive_now = Utc::now().date_naive();
|
||||
JulianDay::from(naive_now).inner().try_into().unwrap()
|
||||
|
@ -45,6 +46,8 @@ pub fn set_panic_hook() {
|
|||
panic::set_hook(Box::new(console_error_panic_hook::hook));
|
||||
}
|
||||
|
||||
// Receives an invite and prepares an open_invite request, returning the
|
||||
// Request and State
|
||||
#[wasm_bindgen]
|
||||
pub fn open_invite(invite: &[u8]) -> Result<String, JsValue> {
|
||||
log(&format!("Using invite: {:?}", invite));
|
||||
|
|
Loading…
Reference in New Issue