-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDK: Correctly encode auth header, and ser/de
Credentials
(#68)
* SDK: Correctly encode auth header, and ser/de `Credentials` Prior to this commit, the Rust SDK incorrectly encoded a `Token` passed to `connect`, making it impossible to re-connect an existing user. (Shows what I get for never testing that.) With this commit, auth tokens are correctly base64-encoded in an `Authorization: Basic` header with the username `token`, which allows re-connecting as an existing user. Also, it was difficult to re-use `Credentials` from the Rust SDK, as: - they were opaque types with non-exported members - they did not implement any serialization / deserialization This commit makes `token.string` and `identity.bytes` public fields, and implements SATN `Serialize` and `Deserialize` for `Identity`, `Token` and `Credentials`, allowing clients to save their credentials for re-use, e.g. to a file. * SDK: Handful of small changes - `subscribe_owned` accepts `Vec<String>`; behaves like `subscribe`. - While developing `letrs`, a demo game, we needed to generate query strings at runtime, and passing them to `subscribe` would have involved an unergonomic dance of taking references which would then be converted to owned containers by the SDK. `subscribe_owned` eliminates that, allowing client authors to construct a set of queries at runtime and pass it directly to the SDK, without intervening referencies and copies. - Docstrings for `subscribe` and `subscribe_owned`. - Methods on `Identity` and `Token` for converting to/from strings and byte-vectors. - Removed long-forgotten `println` within `connect` which wrote the computed URI to stdout.
- Loading branch information
Showing
8 changed files
with
148 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ log = "0.4" | |
futures-channel = "0.3" | ||
anymap = "0.12" | ||
im = "15.1" | ||
base64 = "0.21" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters