Skip to main content

Crate cedros_login

Crate cedros_login 

Source
Expand description

§Cedros Login Server

Authentication server library with email/password, Google OAuth, and Solana wallet sign-in.

§Features

  • Email/Password: Traditional registration and login with argon2id password hashing
  • Google OAuth: Social sign-in via Google ID token verification
  • Solana Wallet: Sign-in by signing a challenge message with an ed25519 wallet

§Usage

§Standalone Server

Run the binary directly:

cedros-login-server

§Embedded Library

Integrate into your own Axum application:

use cedros_login::{router, Config, NoopCallback};
use std::sync::Arc;

let config = Config::from_env()?;
let callback = Arc::new(NoopCallback);
let auth_router = router(config, callback);

let app = Router::new()
    .nest("/auth", auth_router)
    .layer(/* your middleware */);

Re-exports§

pub use callback::AuthCallback;
pub use callback::AuthCallbackPayload;
pub use callback::NoopCallback;
pub use config::Config;
pub use config::DatabaseConfig;
pub use config::NotificationConfig;
pub use errors::AppError;
pub use services::NotificationService;
pub use services::EmailService;
pub use services::InstantLinkEmailData;
pub use services::LogEmailService;
pub use services::NoopEmailService;
pub use services::PasswordResetEmailData;
pub use services::VerificationEmailData;
pub use storage::Storage;

Modules§

callback
Callback trait for integrating with host applications
config
Configuration management for the authentication server
errors
Error types for the authentication server
handlers
HTTP request handlers
middleware
Middleware for request processing
models
Data models for authentication
repositories
Data access layer
services
Business logic services
storage
Storage layer with support for multiple backends
utils
Utility modules

Structs§

AppState
Application state shared across all handlers

Functions§

create_hold_expiration_worker
Create a hold expiration worker for credit holds.
create_micro_batch_worker
Create a micro batch worker for SOL micro deposits.
create_router
Create the authentication router
create_withdrawal_worker
Create a withdrawal worker for Privacy Cash deposits.
router
Create the authentication router with in-memory storage.
router_with_storage
Create the authentication router with custom storage backend.

Type Aliases§

PgPool
An alias for Pool, specialized for Postgres.