mirror of
https://github.com/Blah-IM/blahrs.git
synced 2025-05-01 08:41:09 +00:00
Fix typos
This commit is contained in:
parent
42a778bef2
commit
263c0ca44b
6 changed files with 11 additions and 11 deletions
|
@ -29,5 +29,5 @@ max_request_len = 4096
|
||||||
# Maximum length of a single event queue.
|
# Maximum length of a single event queue.
|
||||||
event_queue_len = 1024
|
event_queue_len = 1024
|
||||||
|
|
||||||
# The maximum timestamp tolerence in seconds for request validation.
|
# The maximum timestamp tolerance in seconds for request validation.
|
||||||
timestamp_tolerence_secs = 90
|
timestamp_tolerance_secs = 90
|
||||||
|
|
|
@ -75,7 +75,7 @@ paths:
|
||||||
description: |
|
description: |
|
||||||
Return chat items in reversed time order, up to PAGE_LEN items.
|
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
|
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:
|
headers:
|
||||||
Authorization:
|
Authorization:
|
||||||
description: Proof of membership for private rooms.
|
description: Proof of membership for private rooms.
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub struct ServerConfig {
|
||||||
pub event_queue_len: usize,
|
pub event_queue_len: usize,
|
||||||
|
|
||||||
#[serde_inline_default(90)]
|
#[serde_inline_default(90)]
|
||||||
pub timestamp_tolerence_secs: u64,
|
pub timestamp_tolerance_secs: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
|
|
|
@ -103,7 +103,7 @@ impl AppState {
|
||||||
conn: Mutex::new(conn),
|
conn: Mutex::new(conn),
|
||||||
room_listeners: Mutex::new(HashMap::new()),
|
room_listeners: Mutex::new(HashMap::new()),
|
||||||
used_nonces: Mutex::new(ExpiringSet::new(Duration::from_secs(
|
used_nonces: Mutex::new(ExpiringSet::new(Duration::from_secs(
|
||||||
config.server.timestamp_tolerence_secs,
|
config.server.timestamp_tolerance_secs,
|
||||||
))),
|
))),
|
||||||
|
|
||||||
config,
|
config,
|
||||||
|
@ -123,7 +123,7 @@ impl AppState {
|
||||||
.expect("after UNIX epoch")
|
.expect("after UNIX epoch")
|
||||||
.as_secs()
|
.as_secs()
|
||||||
.abs_diff(data.signee.timestamp);
|
.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!(
|
return Err(error_response!(
|
||||||
StatusCode::BAD_REQUEST,
|
StatusCode::BAD_REQUEST,
|
||||||
"invalid_timestamp",
|
"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/item", get(room_get_item).post(room_post_item))
|
||||||
.route("/room/:ruuid/admin", post(room_admin))
|
.route("/room/:ruuid/admin", post(room_admin))
|
||||||
.with_state(st.clone())
|
.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.
|
// correct CORS headers.
|
||||||
.layer(tower_http::limit::RequestBodyLimitLayer::new(
|
.layer(tower_http::limit::RequestBodyLimitLayer::new(
|
||||||
st.config.server.max_request_len,
|
st.config.server.max_request_len,
|
||||||
|
|
|
@ -90,10 +90,10 @@ async function generateKeypair() {
|
||||||
joinRoomBtn.disabled = false;
|
joinRoomBtn.disabled = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const ser = (k) => crypto.subtle.exportKey('jwk', k);
|
const serialize = (k) => crypto.subtle.exportKey('jwk', k);
|
||||||
localStorage.setItem('keypair', JSON.stringify({
|
localStorage.setItem('keypair', JSON.stringify({
|
||||||
publicKey: await ser(keypair.publicKey),
|
publicKey: await serialize(keypair.publicKey),
|
||||||
privateKey: await ser(keypair.privateKey),
|
privateKey: await serialize(keypair.privateKey),
|
||||||
}));
|
}));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|
|
@ -68,7 +68,7 @@ impl<T: Serialize> WithSig<T> {
|
||||||
|
|
||||||
/// Verify `sig` is valid for `signee`.
|
/// 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> {
|
pub fn verify(&self) -> Result<(), SignatureError> {
|
||||||
let canonical_signee = serde_jcs::to_vec(&self.signee).expect("serialization cannot fail");
|
let canonical_signee = serde_jcs::to_vec(&self.signee).expect("serialization cannot fail");
|
||||||
let sig = Signature::from_bytes(&self.sig);
|
let sig = Signature::from_bytes(&self.sig);
|
||||||
|
|
Loading…
Add table
Reference in a new issue