Skip to main content
@fast-auth-near/browser-sdk is the framework-agnostic NEAR Auth SDK. It exposes three classes — FastAuthClient to log users in and hand you a signer, FastAuthSigner to derive keys and build NEAR actions, and FastAuthSignature to turn a raw MPC signature into transaction-ready bytes. Use it in vanilla JS, Vue, Svelte, Angular, or any web app that is not React. Pair it with a platform provider — the JavaScript provider runs the Auth0 flow in the browser. The SDK itself only depends on the IFastAuthProvider interface from @shared/core, so the same client code works regardless of which provider you construct.

FastAuthClient

Log in, log out, and obtain an initialized signer.

FastAuthSigner

Derive keys, build actions, and submit transactions.

FastAuthSignature

Decode an MPC signature and recover its bytes.

Installation

near-api-js is a peer dependency — the SDK uses it for the NEAR Connection, transaction types, and RPC calls. You also need one provider package; on the web that is @fast-auth-near/javascript-provider.
New to NEAR Auth? Start with the quickstart for a copy-pasteable integration, then come back here for the full method surface.

Quick start

Construct a provider, hand it to a FastAuthClient, log the user in, and get a signer. Everything after login flows through the signer.
main.ts
Contract ids live in Resources. Testnet uses fast-auth.testnet and the MPC signer v1.signer-prod.testnet; mainnet uses fast-auth.near and v1.signer.

FastAuthClient

The main entry point. FastAuthClient is a generic class that delegates authentication to the provider you pass in and produces a ready-to-use FastAuthSigner once the user is logged in.

Constructor

FastAuthClientOptions is the same shape the signer consumes:

Methods

getSigner() throws a FastAuthClientError with code USER_NOT_LOGGED_IN if the user is not authenticated. Call it only after login() resolves, or guard it with the provider’s isLoggedIn().
client.ts
Because the client is generic over P, login and logout inherit the exact parameter types of your provider. With the JavaScript provider, login(options?, forceSelectAccount?) — see the JavaScript provider reference.

FastAuthSigner

The signer is where the NEAR-facing work happens: deriving the user’s public key, building create_account and sign actions, requesting signatures through the provider, and submitting signed transactions to the network.
You normally obtain a signer from client.getSigner(), which constructs it and calls init() for you. Constructing one by hand takes the same three arguments as the client and requires an explicit init().

init

Retrieves the user’s derivation path from the provider (via provider.getPath()) and stores it on the signer. Must run before any other methodgetSigner() calls it automatically, so you only call it yourself when you construct a FastAuthSigner directly.

Account management

createAccount parameters: getPublicKey parameters:
account.ts

Requesting a signature

These two methods forward to the provider, which drives the user through Auth0 and embeds the encoded transaction into the JWT the guard contract verifies on-chain. Their parameters are inferred from your provider’s implementation.
With the web provider, requesting a signature typically triggers a popup or redirect to Auth0. Persist any application state you need to survive a full-page redirect before calling these methods.
getSignatureRequest() resolves to a GetSignatureRequestResponse, which wraps the SignatureRequest alongside the resolved user:

Signing and submission

createSignAction parameters: sendTransaction parameters:
sign.ts

FastAuthSignature

A thin wrapper around the raw payload the MPC network returns. It decodes a base64 result and recovers the signature bytes in the exact format sendTransaction needs, for either curve.

Methods

sendTransaction calls recover(algorithm) for you, so you rarely invoke it directly — pass the FastAuthSignature straight into sendTransaction. Call recover() yourself only when you need the raw bytes.
signature.ts
Recovery is algorithm-specific. Pass the same algorithm to recover() / sendTransaction() that the account’s key was derived with — an unsupported value throws a signature error.

The Algorithm type

The SDK’s client-facing algorithm type is:
It appears on getPublicKey, createAccount options, sendTransaction, and FastAuthSignature.recover, and it defaults to "ed25519" everywhere it is optional.
The on-chain SignatureRequest.algorithm uses a distinct MPCContractAlgorithm = "secp256k1" | "eddsa" | "ecdsa" — that is the value the NEAR Auth contract’s sign method receives. createSignAction defaults it to "eddsa". Read more in How it works.

End-to-end example

Putting the three classes together: log in, derive a key, request a signature, then decode and broadcast the result.
full-flow.ts

Next steps

JavaScript provider

The Auth0 adapter you pair with this SDK — login, redirect vs popup, and signature requests.

Core types

IFastAuthProvider, SignatureRequest, User, and the shared type surface.

Sign transactions

The full signing guide, including relayer-sponsored gasless flows.

How it works

From Auth0 JWT to on-chain verification to MPC signature.

Resources

Deployed contract ids, RPC endpoints, and network config.

SDKs overview

How the SDKs and providers compose across web and mobile.