Fix typos

This commit is contained in:
oxalica 2024-08-31 22:39:09 -04:00
parent 42a778bef2
commit 263c0ca44b
6 changed files with 11 additions and 11 deletions

View file

@ -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

View file

@ -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.

View file

@ -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 {

View file

@ -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,

View file

@ -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);

View file

@ -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);