Powered by AppSignal & Oban Pro

Domain Documentation

livebooks/livebook.livemd

Domain Documentation

Mix.install([
  {:kino, "~> 0.12.0"}
])

Domain Sensocto.Accounts

Class Diagram

classDiagram
    class Token {
        UUID id
        String jti
        String purpose
        Map extra_data
        store_confirmation_changes(String token, Map extra_data, String purpose)
        get_confirmation_changes(String jti)
        read_expired()
        read()
        expired()
        get_token(String token, String jti, String purpose)
        revoked?(String token, String jti)
        revoke_token(String token, Map extra_data)
        store_token(String token, Map extra_data, String purpose)
        expunge_expired()
    }
    class User {
        UUID id
        CiString email
        confirm(String confirm, CiString email)
        read()
        get_by_subject(String subject)
        get_by_email(CiString email)
        sign_in_with_magic_link(String token)
        request_magic_link(CiString email)
        change_password(String current_password, String password, String password_confirmation)
        sign_in_with_password(CiString email, String password)
        sign_in_with_token(String token)
        register_with_password(CiString email, String password, String password_confirmation)
        request_password_reset_token(CiString email)
        reset_password_with_token(String reset_token, String password, String password_confirmation)
    }

ER Diagram

erDiagram
    Token {
        UUID id
        String jti
        String purpose
        Map extra_data
    }
    User {
        UUID id
        CiString email
    }

Resources

Token

Attributes

Name Type Description
created_at UtcDatetimeUsec
id UUID
jti String
subject String
expires_at UtcDatetime
purpose String
extra_data Map
inserted_at UtcDatetimeUsec
updated_at UtcDatetimeUsec

Actions

Name Type Input Description
store_confirmation_changes create
  • token String
  • extra_data Map attribute
  • purpose String attribute
get_confirmation_changes read
  • jti String
read_expired read
    read read
      expired read
        Look up all expired tokens.
        get_token read
        • token String
        • jti String
        • purpose String
        Look up a token by JTI or token, and an optional purpose.
        revoked? action
        • token String
        • jti String
        Returns true if a revocation token is found for the provided token
        revoke_token create
        • token String
        • extra_data Map attribute
        Revoke a token. Creates a revocation token corresponding to the provided token.
        store_token create
        • token String
        • extra_data Map attribute
        • purpose String attribute
        Stores a token used for the provided purpose.
        expunge_expired destroy
          Deletes expired tokens.

          User

          Attributes

          Name Type Description
          confirmed_at UtcDatetimeUsec
          id UUID
          email CiString
          hashed_password String

          Actions

          Name Type Input Description
          confirm update
          • confirm String
          • email CiString attribute
          read read
            get_by_subject read
            • subject String
            Get a user by the subject claim in a JWT
            get_by_email read
            • email CiString
            Looks up a user by their email
            sign_in_with_magic_link create
            • token String The token from the magic link that was sent to the user
            Sign in or register a user with magic link.
            request_magic_link action
            • email CiString
            change_password update
            • current_password String
            • password String
            • password_confirmation String
            sign_in_with_password read
            • email CiString The email to use for retrieving the user.
            • password String The password to check for the matching user.
            Attempt to sign in using a email and password.
            sign_in_with_token read
            • token String The short-lived sign in token.
            Attempt to sign in using a short-lived sign in token.
            register_with_password create
            • email CiString
            • password String The proposed password for the user, in plain text.
            • password_confirmation String The proposed password for the user (again), in plain text.
            Register a new user with a email and password.
            request_password_reset_token action
            • email CiString
            Send password reset instructions to a user if they exist.
            reset_password_with_token update
            • reset_token String
            • password String The proposed password for the user, in plain text.
            • password_confirmation String The proposed password for the user (again), in plain text.
            require Kino.RPC
            node = :node@localhost
            Node.set_cookie(node, String.to_atom(System.fetch_env!("LB_ERL_COOKIE")))
            
            Kino.RPC.eval_string(node, ~S"Sensocto.Accounts.User.default_short_name()", file: __ENV__.file)