Options
All
  • Public
  • Public/Protected
  • All
Menu

Class for interacting with the Jet Auth program

Hierarchy

  • Auth

Index

Constructors

  • new Auth(userAuthentication: UserAuthentication, address: PublicKey): Auth
  • Creates an instance of Auth.

    memberof

    Auth

    Parameters

    • userAuthentication: UserAuthentication
    • address: PublicKey

    Returns Auth

Properties

address: PublicKey
userAuthentication: UserAuthentication
AUTHORITY: PubkeyField = ...

Hardcoded address of the authority that can authenticate users

PROGRAM_ID: PublicKey = ...

Auth Program ID

Methods

  • approveAuthentication(authProgram: Program<AuthIdl>, authority: Keypair, user: PublicKey): Promise<Transaction>
  • Authenticate a user address. Auth.AUTHORITY must sign.

    static
    memberof

    Auth

    Parameters

    • authProgram: Program<AuthIdl>
    • authority: Keypair
    • user: PublicKey

    Returns Promise<Transaction>

  • connect(provider: default): Promise<Program<AuthIdl>>
  • Creates a connection to the authentication program.

    static
    memberof

    Auth

    Parameters

    • provider: default

    Returns Promise<Program<AuthIdl>>

  • createUserAuth(authProgram: Program<AuthIdl>, user: PublicKey, payer: PublicKey): Promise<Transaction>
  • Create a new account that can be used to identify that a wallet/address is properly authenticated to perform protected actions.

    static
    memberof

    Auth

    Parameters

    • authProgram: Program<AuthIdl>
    • user: PublicKey
    • payer: PublicKey

    Returns Promise<Transaction>

  • deriveUserAuthentication(user: PublicKey): PublicKey
  • Dervices the user authentication account from the argued public key.

    static
    memberof

    Auth

    Parameters

    • user: PublicKey

    Returns PublicKey

  • loadUserAuth(authProgram: Program<AuthIdl>, user: PublicKey): Promise<Auth>
  • Load and return the user authentication account from the argued public key.

    static
    memberof

    Auth

    Parameters

    • authProgram: Program<AuthIdl>
    • user: PublicKey

    Returns Promise<Auth>

  • useAuthAccount(authProgram?: Program<AuthIdl>, wallet?: null | PublicKey): { authAccount?: Auth; loading: boolean }
  • Load the user authentication account. The account will be fetched every 2 seconds until it has been authenticated.

    static
    memberof

    Auth

    Parameters

    • Optional authProgram: Program<AuthIdl>
    • Optional wallet: null | PublicKey

    Returns { authAccount?: Auth; loading: boolean }

    • Optional authAccount?: Auth
    • loading: boolean
  • useAuthProgram(provider: default): undefined | Program<AuthIdl>
  • Custom React hook to use the authentication program as state.

    static
    memberof

    Auth

    Parameters

    • provider: default

    Returns undefined | Program<AuthIdl>

Generated using TypeDoc