Module Peertube_auth.Session

PeerTube session management.

This module handles session persistence and profile management for PeerTube authentication.

Authentication Methods

type auth_method =
  1. | OAuth of {
    1. access_token : string;
    2. refresh_token : string option;
    3. client_id : string;
    4. client_secret : string;
    }

Authentication method for PeerTube.

Session Type

type t

A PeerTube session containing server URL and authentication info.

val jsont : t Jsont.t

JSON codec for sessions.

Profile Management

val default_profile : string

Default profile name.

val app_name : string

Application name (used for config directory).

val get_current_profile : Eio.Fs.dir_ty Eio.Path.t -> string

get_current_profile fs returns the name of the current profile.

val set_current_profile : Eio.Fs.dir_ty Eio.Path.t -> string -> unit

set_current_profile fs profile sets the current profile.

val list_profiles : Eio.Fs.dir_ty Eio.Path.t -> string list

list_profiles fs returns a list of all available profiles.

Session Operations

val load : Eio.Fs.dir_ty Eio.Path.t -> ?profile:string -> unit -> t option

load fs ?profile () loads a session from disk. Returns None if no session exists.

val save : Eio.Fs.dir_ty Eio.Path.t -> ?profile:string -> t -> unit

save fs ?profile session saves a session to disk.

val clear : Eio.Fs.dir_ty Eio.Path.t -> ?profile:string -> unit -> unit

clear fs ?profile () removes the session file.

val create : server_url:string -> auth:auth_method -> unit -> t

create ~server_url ~auth () creates a new session.

Session Accessors

val server_url : t -> string

server_url t returns the server URL.

val auth : t -> auth_method

auth t returns the authentication method.

val created_at : t -> string

created_at t returns the creation timestamp.

Pretty Printing

val pp : t Fmt.t

pp ppf session pretty-prints a session.