From 263c0ca44bfd681235ec269424827ce041c08ab5 Mon Sep 17 00:00:00 2001
From: oxalica <oxalicc@pm.me>
Date: Sat, 31 Aug 2024 22:39:09 -0400
Subject: [PATCH] Fix typos

---
 blahd/config.example.toml | 4 ++--
 blahd/docs/webapi.yaml    | 2 +-
 blahd/src/config.rs       | 2 +-
 blahd/src/main.rs         | 6 +++---
 pages/main.js             | 6 +++---
 src/types.rs              | 2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/blahd/config.example.toml b/blahd/config.example.toml
index 80a9855..4ec676b 100644
--- a/blahd/config.example.toml
+++ b/blahd/config.example.toml
@@ -29,5 +29,5 @@ max_request_len = 4096
 # Maximum length of a single event queue.
 event_queue_len = 1024
 
-# The maximum timestamp tolerence in seconds for request validation.
-timestamp_tolerence_secs = 90
+# The maximum timestamp tolerance in seconds for request validation.
+timestamp_tolerance_secs = 90
diff --git a/blahd/docs/webapi.yaml b/blahd/docs/webapi.yaml
index f252d13..c666bf9 100644
--- a/blahd/docs/webapi.yaml
+++ b/blahd/docs/webapi.yaml
@@ -75,7 +75,7 @@ paths:
       description: |
         Return chat items in reversed time order, up to PAGE_LEN items.
         The last (oldest) chat id can be used as query parameter for the next
-        GET, to repeatly fetch full history.
+        GET, to repeatedly fetch full history.
       headers:
         Authorization:
           description: Proof of membership for private rooms.
diff --git a/blahd/src/config.rs b/blahd/src/config.rs
index 8b05e42..f6cbbeb 100644
--- a/blahd/src/config.rs
+++ b/blahd/src/config.rs
@@ -34,7 +34,7 @@ pub struct ServerConfig {
     pub event_queue_len: usize,
 
     #[serde_inline_default(90)]
-    pub timestamp_tolerence_secs: u64,
+    pub timestamp_tolerance_secs: u64,
 }
 
 impl Config {
diff --git a/blahd/src/main.rs b/blahd/src/main.rs
index 2b9221f..392657e 100644
--- a/blahd/src/main.rs
+++ b/blahd/src/main.rs
@@ -103,7 +103,7 @@ impl AppState {
             conn: Mutex::new(conn),
             room_listeners: Mutex::new(HashMap::new()),
             used_nonces: Mutex::new(ExpiringSet::new(Duration::from_secs(
-                config.server.timestamp_tolerence_secs,
+                config.server.timestamp_tolerance_secs,
             ))),
 
             config,
@@ -123,7 +123,7 @@ impl AppState {
             .expect("after UNIX epoch")
             .as_secs()
             .abs_diff(data.signee.timestamp);
-        if timestamp_diff > self.config.server.timestamp_tolerence_secs {
+        if timestamp_diff > self.config.server.timestamp_tolerance_secs {
             return Err(error_response!(
                 StatusCode::BAD_REQUEST,
                 "invalid_timestamp",
@@ -160,7 +160,7 @@ async fn main_async(st: AppState) -> Result<()> {
         .route("/room/:ruuid/item", get(room_get_item).post(room_post_item))
         .route("/room/:ruuid/admin", post(room_admin))
         .with_state(st.clone())
-        // NB. This comes at last (outmost layer), so inner errors will still be wraped with
+        // NB. This comes at last (outmost layer), so inner errors will still be wrapped with
         // correct CORS headers.
         .layer(tower_http::limit::RequestBodyLimitLayer::new(
             st.config.server.max_request_len,
diff --git a/pages/main.js b/pages/main.js
index 6e614e0..55db477 100644
--- a/pages/main.js
+++ b/pages/main.js
@@ -90,10 +90,10 @@ async function generateKeypair() {
     joinRoomBtn.disabled = false;
 
     try {
-        const ser = (k) => crypto.subtle.exportKey('jwk', k);
+        const serialize = (k) => crypto.subtle.exportKey('jwk', k);
         localStorage.setItem('keypair', JSON.stringify({
-            publicKey: await ser(keypair.publicKey),
-            privateKey: await ser(keypair.privateKey),
+            publicKey: await serialize(keypair.publicKey),
+            privateKey: await serialize(keypair.privateKey),
         }));
     } catch (e) {
         console.error(e);
diff --git a/src/types.rs b/src/types.rs
index 4279345..4a4005e 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -68,7 +68,7 @@ impl<T: Serialize> WithSig<T> {
 
     /// Verify `sig` is valid for `signee`.
     ///
-    /// Note that this does nott check validity of timestamp and other data.
+    /// Note that this does not check validity of timestamp and other data.
     pub fn verify(&self) -> Result<(), SignatureError> {
         let canonical_signee = serde_jcs::to_vec(&self.signee).expect("serialization cannot fail");
         let sig = Signature::from_bytes(&self.sig);