origin-accounts 0.2.0

Account management for Origin: several accounts per connector, credentials kept out of the database.
Documentation

origin-accounts

Account management for Origin: several accounts per connector, credentials kept out of the database.

Part of Origin, a Rust/Tauri platform for building desktop applications from a shared set of domain crates. See the workspace documentation for how the pieces fit together, and ARCHITECTURE.md for the rules this crate follows.

Example

use origin_accounts::{AccountService, AccountStore};
use origin_auth::{TokenSet, TokenStore};
use origin_domain::ConnectorId;

let accounts = AccountService::new(
    AccountStore::new(storage.clone(), clock.clone()),
    TokenStore::new(secrets.clone()),
    events.clone(),
    storage.clone(),
    clock.clone(),
);

// `tokens` normally comes from AuthorizationFlow::exchange().
let account = accounts
    .connect(&ConnectorId::new("github"), "octocat", &tokens)
    .await?;

let all = accounts.list().await?;
accounts.disconnect(&account.id).await?;

Stability

Pre-1.0 (0.2.0). Public types, enums and field sets may still change between minor versions; pin an exact version if that matters to you.