@lgriffin/esi.ts - EVE Online ESI API Client - v12.3.0
    Preparing search index...

    Keeps one valid SSO token per character on top of a pluggable ITokenStorage, refreshing ahead of expiry, coalescing concurrent refreshes, persisting rotated refresh tokens, and recording revocations so SSO is not hammered with a dead refresh token.

    Index
    • Exchange an authorization code and store the resulting token under the character it belongs to. An existing token for that character is replaced; storage never holds two entries for one character.

      Parameters

      Returns Promise<StoredToken>

      TokenVerificationError with verifyTokens on, when the access token fails verification; nothing is stored

    • Import tokens obtained elsewhere (a previous library version, another tool, a migration). The character identity is decoded from the access token; expiresIn is in seconds and defaults to the JWT exp claim.

      Parameters

      • token: { accessToken: string; refreshToken: string; expiresIn?: number }

      Returns Promise<StoredToken>

      TokenVerificationError with verifyTokens on, when the access token fails verification (an expired access token included); nothing is stored

    • True when the stored token grants every listed scope.

      Parameters

      • characterId: number
      • scopes: readonly string[]

      Returns Promise<boolean>

    • A usable access token for the character. With autoRefresh on, a token inside the refresh skew is refreshed first.

      Parameters

      • characterId: number

      Returns Promise<string>

      CharacterNotFoundError when no token is stored

      TokenRevokedError when the character's refresh token is revoked

    • Refresh a character's token through SSO regardless of expiry. Concurrent calls for the same character share one SSO request.

      Parameters

      • characterId: number

      Returns Promise<StoredToken>

    • The character as an Identity for esi.as() on the shared runtime (@lgriffin/esi.ts/client). Before each request the view gets the stored token, refreshed first when it is stale; after a 401 it gets a token refreshed through SSO. Nothing is looked up until a request needs it, so an unknown character fails at the request, not here. The same object comes back for the same character, so esi.as() memoises one view per character rather than one per call.

      Parameters

      • characterId: number

      Returns Identity

    • An EsiClient whose access token and refresh provider are bound to the character. The token is validated (and refreshed if stale) first.

      Parameters

      Returns Promise<EsiClient>

      Since 11.0.0; removing it needs a future major release, and none is scheduled. Each client this returns has its own rate limiter, error budget and cache. Build one runtime with createEsi({ userAgent }) from @lgriffin/esi.ts/client and call esi.as(this.identity(characterId)) for a per-character view over it; esi.shutdown() replaces each client's shutdown(). See guides/MULTI-CHARACTER.md, "Moving from EsiTokenManager.createClient".

      // Before
      const client = await tokens.createClient(id, { userAgent });
      await client.wallet.getCharacterWallet(id);
      // After
      const esi = createEsi({ userAgent }); // once per application
      await esi.as(tokens.identity(id)).character(id).wallet.get();