mauth-client

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2025 License: BSD-2-Clause

README

Client library used to ease integration with the MAuth server.

It defines the following calls:

  • Version - Report the server's API version. Always an integer. Not SemVer.
  • AccountExists - Report whether an account exists.
  • AccountList - List of all account names.
  • AddAccount - Create a new account.
  • RemoveAccount - Delete an account.
  • ChangePassword - Change an account's password.
  • Authenticate - Authenticate an account by password. Returns a session token.
  • VerifySession - Verify that a given session token is recognized as a valid session with the server.

Installation:

go get github.com/mikattack/mauth_client

Example usage:

package main

import (
  "log/slog"
  "os"

  "github.com/mikattack/mauth-client/mauth-client"
)

func main() {
  client, err := mauth_client.New("/path/to/socket")
  if err != nil {
    slog.Error("failed to connect to server", "error", err)
    os.Exit(1)
  }

  account := "ephemeral"
  password := "ephemeral-password"

  token, err := client.Authenticate(account, password)
  if err != nil {
    slog.Error("authentication failed", "error", err)
    os.Exit(1)
  }

  if err = client.VerifySession(token); err != nil {
    slog.Error("invalid session", "error", err)
    os.Exit(1)
  }

  slog.Info("authenticated session established")
}

Directories

Path Synopsis
mauth_client implements a client for communicating with an MAuth server.
mauth_client implements a client for communicating with an MAuth server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL