Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK: Correctly encode auth header, and ser/de Credentials #68

Merged
merged 2 commits into from
Jul 13, 2023

Commits on Jul 11, 2023

  1. 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.
    gefjon committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    d21b54a View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2023

  1. 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.
    gefjon committed Jul 12, 2023
    Configuration menu
    Copy the full SHA
    64337cb View commit details
    Browse the repository at this point in the history