Jimmy Cuadra
e64df47d23
Make SignatureMap and SignatureSet type aliases for HashMap.
2019-07-10 19:55:30 -07:00
Jimmy Cuadra
efbea86fe5
Move the constructor for key pairs out of the trait.
2019-07-10 03:53:38 -07:00
Jimmy Cuadra
f1d9eba728
Move code examples onto relevant functions/types and rewrite the crate
...
documentation to be a more general overview.
2019-07-10 01:04:38 -07:00
Jimmy Cuadra
bca31bfbd4
Add test for verifying an event.
2019-07-10 00:24:03 -07:00
Jimmy Cuadra
c7aca45094
Make all the doc examples runnable.
2019-07-10 00:17:24 -07:00
Jimmy Cuadra
490ac1c4d3
Add verify_event function.
2019-07-09 23:38:51 -07:00
Jimmy Cuadra
b85d0fc22c
Reimplement SignatureSet as a map so signatures can be efficiently looked up by key ID.
2019-07-09 17:01:57 -07:00
Jimmy Cuadra
eaeb1a66c7
Remove an unnecessary layer of JSON conversion.
2019-07-09 16:33:31 -07:00
Jimmy Cuadra
8c756141e1
Ensure key ID version contains only valid characters.
2019-07-09 16:29:45 -07:00
Jimmy Cuadra
30f830bd5e
Be more clear about the Base64 encoding of signatures and hashes.
2019-07-09 15:33:03 -07:00
Jimmy Cuadra
8c102d11bb
Update doc examples for new APIs.
2019-07-09 04:20:43 -07:00
Jimmy Cuadra
14ede0c145
Use unwrap in docs to make examples more succinct.
2019-07-09 04:06:40 -07:00
Jimmy Cuadra
152458707c
Simplify extraction of JSON object from event content.
2019-07-09 04:00:21 -07:00
Jimmy Cuadra
935407c805
Document parameters and return conditions.
2019-07-09 03:55:20 -07:00
Jimmy Cuadra
4e7bc994eb
Add a test for signing a redacted event.
2019-07-09 03:39:57 -07:00
Jimmy Cuadra
0d26b74051
Rework hash_and_sign_event
to mutate JSON.
2019-07-09 03:34:44 -07:00
Jimmy Cuadra
66f35cd12a
Update tests to verify new API.
2019-07-09 03:01:36 -07:00
Jimmy Cuadra
ad3b4401f0
Rework sign_json
to mutate the JSON the signature will be added to.
2019-07-09 02:50:37 -07:00
Jimmy Cuadra
fb222b8e82
Add entry method to SignatureMap.
2019-07-09 02:49:43 -07:00
Jimmy Cuadra
49f3208e7f
Add get and get_mut methods to SignatureMap.
2019-07-09 01:52:10 -07:00
Jimmy Cuadra
d7d098ba35
Clarify what reference hashes are used for.
2019-07-09 00:13:58 -07:00
Jimmy Cuadra
47c6de7a1b
Add hash_and_sign_event function.
2019-07-09 00:05:01 -07:00
Jimmy Cuadra
202b3ed402
Add content_hash and reference_hash functions and move all functions into a module.
2019-07-08 23:35:09 -07:00
Jimmy Cuadra
9a56e2b0a6
Add tests for canonical JSON.
2019-07-08 22:01:15 -07:00
Jimmy Cuadra
07295b11bb
Rename Signatures
SignatureMap
.
2019-07-08 21:22:17 -07:00
Jimmy Cuadra
97ee073e11
Split the library into modules.
2019-07-08 21:10:50 -07:00
Jimmy Cuadra
03fcf7281d
Use constants from base64.
2019-07-08 20:45:27 -07:00
Jimmy Cuadra
302e401a80
Remove unnecessary constructor for Ed25519Verifier
.
2019-07-08 18:53:29 -07:00
Jimmy Cuadra
6ffd73b312
Make Error::new private to the crate.
2019-07-08 18:51:15 -07:00
Jimmy Cuadra
c0d10881a2
Implement Clone
and PartialEq
for all types.
...
See https://github.com/briansmith/ring/issues/859 for background.
2019-07-08 18:47:11 -07:00
Jimmy Cuadra
e7e4d04244
Undo the change of storing FilterDefinition in a box.
...
On second thought, it doesn't make sense to change this just cause of a
clippy warning. We'll wait and see if it ever causes and real problems
before making the API less consistent just to avoid a potential space
saving issue.
2019-07-08 14:24:07 -07:00
Jimmy Cuadra
c25d76e20f
Treat deserialization failure as a validation failure.
...
If a ruma-events type fails deserialization, but the input was valid
JSON, this should be treated as a validation failure instead of a
deserialization failure. In this case, attempt to deserialize the json
into a `serde_json::Value`, and only return a deserialization error if
that fails.
2019-07-08 03:34:42 -07:00
Jimmy Cuadra
733dfa7ef3
Implement FromStr and TryFrom<&str> for content types.
2019-06-28 12:47:41 -07:00
Jimmy Cuadra
b0c1997016
Fix typo in Cargo.toml.
2019-06-24 13:02:54 -07:00
Jimmy Cuadra
065cb770af
Remove unnecessary for loops.
2019-06-22 00:21:23 -07:00
Jimmy Cuadra
a65a618930
Run rustfmt.
2019-06-21 17:18:06 -07:00
Jimmy Cuadra
db70792f03
Alphabetize struct fields.
2019-06-21 17:14:08 -07:00
Jimmy Cuadra
3bad559980
Add serialization and deserialization tests.
2019-06-21 17:00:28 -07:00
Jimmy Cuadra
e34ea05445
Skip serializing options.
2019-06-21 16:33:53 -07:00
Jimmy Cuadra
d9039db8df
Convert from JSON using impl FromStr and impl TryFrom<&'a str> rather than an inherent from_str method.
2019-06-20 22:40:14 -07:00
Jimmy Cuadra
e13acb4d7d
Fix copy/paste error.
2019-06-20 17:08:38 -07:00
Jimmy Cuadra
553d9c05cd
Add support for events with custom types.
2019-06-20 17:05:30 -07:00
Jimmy Cuadra
44a13e6515
Add span information to token streams when possible.
2019-06-19 23:50:06 -07:00
Jimmy Cuadra
52754f617c
Import Event trait in Serialize impl so event_type can be called.
2019-06-19 23:36:16 -07:00
Jimmy Cuadra
f663c79250
Remove extra commas from generated code.
2019-06-19 23:36:01 -07:00
Jimmy Cuadra
ce2a3817cf
Rename ParseError to FromStrError and add InvalidEvent.
2019-06-19 22:45:20 -07:00
Jimmy Cuadra
4423275ce2
Implement RoomEvent and StateEvent when applicable.
2019-06-19 22:40:58 -07:00
Jimmy Cuadra
be0f1d0363
Add inherent impl with from_str method.
2019-06-19 21:14:49 -07:00
Jimmy Cuadra
78e25552fb
Implement Serialize and Event.
2019-06-19 16:52:54 -07:00
Jimmy Cuadra
3b65905784
Generate content types and raw module.
2019-06-19 16:08:43 -07:00