Class: AuthResource#

Defined in: sdk-js/src/v4/resources/auth.ts:14

client.auth.* — JWT exchange for the REST API.

The aggregator's POST /auth:exchange takes (ownerAddress, signature, message) and returns a JWT bound to the EOA. The SDK keeps the JWT on the shared transport so subsequent requests carry it as a Bearer token automatically.

Constructors#

Constructor#

new AuthResource(transport: Transport): AuthResource;

Defined in: sdk-js/src/v4/resources/auth.ts:15

Parameters#

ParameterType
transportTransport

Returns#

AuthResource

Methods#

exchange()#

exchange(req: object): Promise<{
  token: string;
  expiresAt: string;
  subject?: string;
}>;

Defined in: sdk-js/src/v4/resources/auth.ts:23

POST /auth:exchange — verify an EIP-191 signature and stash the returned JWT on the transport. Returns the raw response so callers can persist the token externally (browser localStorage, keychain, etc.).

Parameters#

ParameterTypeDescription
req{ ownerAddress: string; signature: string; message: string; }-
req.ownerAddressstring-
req.signaturestringDescription EIP-191 personal_sign signature of message.
req.messagestringDescription The plain-text message that was signed. Must use the canonical format with the EigenLayer registration chain ID (NOT the workflow target chain). SDKs generate this locally.

Returns#

Promise<{ token: string; expiresAt: string; subject?: string; }>


exchangeWithKey()#

exchangeWithKey(privateKey: string, opts?: object): Promise<{
  token: string;
  expiresAt: string;
  subject?: string;
}>;

Defined in: sdk-js/src/v4/resources/auth.ts:42

Convenience wrapper: sign the canonical message with a private key, exchange it, and return the JWT. The exchanged token is stashed on the transport. Designed for Node tooling — browser callers should use buildAuthMessage + a wallet's personal_sign and then call exchange() directly.

Parameters#

ParameterType
privateKeystring
opts?{ ownerAddress?: string; chainId?: number; version?: string; }
opts.ownerAddress?string
opts.chainId?number
opts.version?string

Returns#

Promise<{ token: string; expiresAt: string; subject?: string; }>


clear()#

clear(): void;

Defined in: sdk-js/src/v4/resources/auth.ts:58

Forget the currently-stored JWT. Future requests fall back to anonymous and most endpoints will return 401.

Returns#

void