Package com.tuladb

Class Auth

java.lang.Object
com.tuladb.Auth

public final class Auth extends Object
A connection credential for MSG_AUTH: a bearer token (JWT/OIDC) or an API key that upgrades the connection's principal and role from the anonymous default. Same frame and rules as the C SDK's ledgerd_client_authenticate:
  • Field Details

    • MSG_AUTH

      public static final byte MSG_AUTH
      The engine's MSG_AUTH (0x70).
      See Also:
    • TYPE_BEARER

      public static final int TYPE_BEARER
      JWT / OIDC bearer token (WIRE_AUTH_TYPE_BEARER).
      See Also:
    • TYPE_API_KEY

      public static final int TYPE_API_KEY
      API key (WIRE_AUTH_TYPE_API_KEY).
      See Also:
    • MAX_CREDENTIAL_LEN

      public static final int MAX_CREDENTIAL_LEN
      Longest credential the client sends (the C SDK's cap).
      See Also:
  • Method Details

    • of

      public static Auth of(int type, byte[] credential)
      credential is copied.
    • apiKey

      public static Auth apiKey(byte[] key)
    • apiKey

      public static Auth apiKey(String key)
    • bearer

      public static Auth bearer(byte[] token)
    • bearer

      public static Auth bearer(String token)
    • allowInsecure

      public Auth allowInsecure(boolean allow)
      A copy that may (or may not) be sent over a non-TLS connection.
    • type

      public int type()
    • insecureAllowed

      public boolean insecureAllowed()
    • length

      public int length()
    • wipe

      public void wipe()
      Zero the credential in place.
    • toString

      public String toString()
      Overrides:
      toString in class Object