Expand description
beyondigital-auth-sdk — external SDK for auth_service (tokio).
Quickstart:
ⓘ
let client = beyondigital_auth_sdk::Client::new("https://auth.beyondigital.in")
.with_client_id("my-app")
.with_redirect_uri("https://myapp.com/auth/callback");
let url = client.authorization_url(&challenge, opts)?;
let tokens = client.exchange_code(&code, &verifier, opts).await?;
let verifier = beyondigital_auth_sdk::create_verifier("https://auth.beyondigital.in", "https://api.myapp.com");
let user = verifier.verify(&tokens.access_token).await?;Re-exports§
pub use client::AuthorizationUrlOpts;pub use client::Client;pub use client::ClientAuthMethod;pub use client::DeviceAuthorizationOpts;pub use client::IntrospectionResponse;pub use client::OidcMetadata;pub use client::PushedAuthorizationOpts;pub use client::TokenExchangeOpts;pub use client::TokenOpts;pub use client::TokenResponse;pub use client::TokenType;pub use client::UserInfoResponse;pub use client_assertion::create_client_assertion;pub use client_assertion::import_client_assertion_key;pub use client_assertion::ClientAssertionKey;pub use client_assertion::ClientAssertionOptions;pub use client_assertion::CLIENT_ASSERTION_TYPE;pub use client_assertion::DEFAULT_CLIENT_ASSERTION_LIFETIME_SECONDS;pub use client_assertion::MAX_CLIENT_ASSERTION_LIFETIME_SECONDS;pub use dpop::assert_dpop_supported;pub use dpop::create_dpop_proof;pub use dpop::dpop_access_token_hash;pub use dpop::dpop_htu;pub use dpop::dpop_thumbprint;pub use dpop::generate_dpop_key;pub use dpop::import_dpop_key;pub use dpop::DpopKey;pub use dpop::DpopProofParams;pub use dpop::DpopRequest;pub use dpop::DpopSession;pub use dpop::HttpReply;pub use error::AuthError;pub use flows::poll_for_device_token;pub use flows::pushed_request_params;pub use flows::CancelToken;pub use flows::ClockFn;pub use flows::DeviceAuthorization;pub use flows::DevicePollOptions;pub use flows::PushedAuthorization;pub use flows::SleepFn;pub use flows::DEFAULT_DEVICE_INTERVAL_SECONDS;pub use flows::DEVICE_CODE_GRANT;pub use flows::SLOW_DOWN_STEP_SECONDS;pub use flows::TOKEN_EXCHANGE_GRANT;pub use flows::TOKEN_TYPE_ACCESS_TOKEN;pub use jwt::create_multi_issuer_verifier;pub use jwt::create_verifier;pub use jwt::generate_code_challenge;pub use jwt::generate_code_verifier;pub use jwt::Claims;pub use jwt::ConsumeJti;pub use jwt::CurrentUser;pub use jwt::IssuerConfig;pub use jwt::LogoutTokenOptions;pub use jwt::MultiIssuerVerifier;pub use jwt::Verifier;pub use jwt::DEFAULT_MIN_FETCH_INTERVAL;pub use logout::build_end_session_url;pub use logout::check_logout_claims;pub use logout::is_logout_typ;pub use logout::EndSessionParams;pub use logout::LogoutFailure;pub use logout::LogoutToken;pub use logout::LogoutTokenError;pub use logout::BACKCHANNEL_LOGOUT_EVENT;pub use logout::DEFAULT_LOGOUT_TOKEN_MAX_AGE_SECONDS;pub use logout::LOGOUT_TOKEN_FUTURE_SECONDS;pub use otp::AuthenticatedUser;pub use otp::OtpClient;pub use otp::OtpIdentityResponse;pub use otp::OtpSessionBinding;pub use otp::OtpSessionCancellation;pub use otp::OtpSessionReceipt;pub use otp::OtpVerificationResponse;pub use otp::ResourceProposal;pub use otp::ResourceRegistration;pub use otp::ResourceStatus;pub use otp::SaasClient;pub use otp::ServerOtpClient;pub use policy::is_at_jwt_typ;pub use policy::validate_claims;pub use policy::TokenPurpose;pub use policy::ValidationPolicy;
Modules§
- api
- A typed client for the service’s public and management HTTP API (WP-21 R-21.1).
- client
- Async OAuth client for auth_service (tokio).
- client_
assertion private_key_jwtclient authentication (RFC 7523 section 2.2, OIDC Core section 9).- dpop
- DPoP (RFC 9449): sender-constraining access and refresh tokens with a key the client holds.
- error
- flows
- Protocol pieces behind the client: the device flow poll loop (RFC 8628), token exchange constants (RFC 8693) and the pushed authorization request body and answer (RFC 9126).
- jwk
- JWKS → PEM + kid helper. Ports
src/crypto/jwk.rs. - jwt
- JWT verification via JWKS with TTL cache + bounded kid-miss refresh.
Mirrors
src/crypto/jwt.rs(RS256, exp/iat/type, kid header), theValidationPolicysurface fromcrate::policy, and the RFC 9068 §2.1at+jwtJOSE typ check auth_service mints on every access token (WP-03b). - logout
- Logout: the RP-initiated logout URL (OIDC RP-Initiated Logout 1.0) and the claim rules for back-channel logout tokens (OIDC Back-Channel Logout 1.0, sections 2.4 and 2.6).
- otp
- OTP + SaaS checkout helpers — mirrors src/routes/otp.rs + src/routes/saas.rs
- policy
- Purpose-bound claim validation — a faithful port of auth_service’s
crypto/jwt.rsValidationPolicy/TokenPurpose/validate_claimsso consumers apply exactly the contract the issuer enforces.
Enums§
- Private
KeyInput - Where a private key comes from.
- Signing
Algorithm - A JOSE signing algorithm the service verifies for client-side proofs.
Constants§
- MIN_
RSA_ BITS - The smallest RSA modulus accepted (the service’s own floor).