Skip to content

Commit 47262e3

Browse files
committed
chore(crypto-js): Improve documentation, and do a little clean up.
1 parent 46c1816 commit 47262e3

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

src/requests.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ pub struct KeysUploadRequest {
3838

3939
/// A JSON-encoded string containing the rest of the payload: `device_keys`,
4040
/// `one_time_keys`, `fallback_keys`.
41+
///
42+
/// It represents the body of the HTTP request.
4143
#[wasm_bindgen(readonly)]
4244
pub body: JsString,
4345
}
@@ -72,6 +74,8 @@ pub struct KeysQueryRequest {
7274

7375
/// A JSON-encoded string containing the rest of the payload: `timeout`,
7476
/// `device_keys`, `token`.
77+
///
78+
/// It represents the body of the HTTP request.
7579
#[wasm_bindgen(readonly)]
7680
pub body: JsString,
7781
}
@@ -107,6 +111,8 @@ pub struct KeysClaimRequest {
107111

108112
/// A JSON-encoded string containing the rest of the payload: `timeout`,
109113
/// `one_time_keys`.
114+
///
115+
/// It represents the body of the HTTP request.
110116
#[wasm_bindgen(readonly)]
111117
pub body: JsString,
112118
}
@@ -149,6 +155,8 @@ pub struct ToDeviceRequest {
149155
pub txn_id: JsString,
150156

151157
/// A JSON-encoded string containing the rest of the payload: `messages`.
158+
///
159+
/// It represents the body of the HTTP request.
152160
#[wasm_bindgen(readonly)]
153161
pub body: JsString,
154162
}
@@ -187,6 +195,8 @@ pub struct SignatureUploadRequest {
187195
pub id: Option<JsString>,
188196

189197
/// A JSON-encoded string containing the rest of the payload: `signed_keys`.
198+
///
199+
/// It represents the body of the HTTP request.
190200
#[wasm_bindgen(readonly)]
191201
pub body: JsString,
192202
}
@@ -271,6 +281,8 @@ pub struct KeysBackupRequest {
271281
pub id: Option<JsString>,
272282

273283
/// A JSON-encoded string containing the rest of the payload: `rooms`.
284+
///
285+
/// It represents the body of the HTTP request.
274286
#[wasm_bindgen(readonly)]
275287
pub body: JsString,
276288
}
@@ -304,6 +316,8 @@ pub struct SigningKeysUploadRequest {
304316

305317
/// A JSON-encoded string containing the rest of the payload: `master_key`,
306318
/// `self_signing_key`, `user_signing_key`.
319+
///
320+
/// It represents the body of the HTTP request.
307321
#[wasm_bindgen(readonly)]
308322
pub body: JsString,
309323
}
@@ -376,15 +390,6 @@ macro_rules! request {
376390
request!(@__field_type as $field_type ; request = $request, field_name = $field_name)
377391
};
378392

379-
/*
380-
( @__field $field_name:ident : $field_mapper:block ; request = $request:expr ) => {
381-
{
382-
let mapper = $field_mapper;
383-
mapper($request)
384-
}
385-
};
386-
*/
387-
388393
( @__field_type as string ; request = $request:expr, field_name = $field_name:ident ) => {
389394
$request.$field_name.to_string().into()
390395
};

tests/machine.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ describe(OlmMachine.name, () => {
9999
test('can drop/close', async () => {
100100
m = await machine();
101101
m.close();
102-
})
102+
});
103103

104104
test('can drop/close with a store', async () => {
105105
let store_name = 'temporary';
@@ -133,7 +133,7 @@ describe(OlmMachine.name, () => {
133133
deleting.onerror = () => { throw new Error('failed to remove the database (error)') };
134134
deleting.onblocked = () => { throw new Error('failed to remove the database (blocked)') };
135135
}
136-
})
136+
});
137137

138138
test('can read user ID', async () => {
139139
expect((await machine()).userId.toString()).toStrictEqual(user.toString());
@@ -200,7 +200,7 @@ describe(OlmMachine.name, () => {
200200
expect(outgoingRequests[0].type).toStrictEqual(RequestType.KeysUpload);
201201
expect(outgoingRequests[0].body).toBeDefined();
202202

203-
const body = JSON.parse(outgoingRequests[0].body)
203+
const body = JSON.parse(outgoingRequests[0].body);
204204
expect(body.device_keys).toBeDefined();
205205
expect(body.one_time_keys).toBeDefined();
206206
}

0 commit comments

Comments
 (0)