backblaze-labs/b2-action - v1.1.0
    Preparing search index...

    Function buildClient

    • Build an authorized B2Client.

      Steps:

      1. Construct the client with userAgent: 'b2-github-action/<version>'. The SDK preserves its own b2-sdk-typescript/ and @backblaze-labs/b2-sdk tokens before ours so Backblaze server-side logs see both attribution layers.
      2. await client.authorize(). This is one-shot for the lifetime of the action invocation. B2 auth tokens carry a 24h TTL; typical GitHub Actions runs finish well inside that window. If a long-running job outlives the token, the SDK transparently re-authorizes on the next 401, so the action layer does not need its own refresh loop.
      3. Use an AccountInfo wrapper that masks each account authorization token as it is stored, including SDK-driven reauthorization after token expiry. The post-authorize mask is kept as a fallback in case a future SDK version bypasses the wrapper for initial authorization.

      The transport parameter is only used by tests (the SDK's B2Simulator provides one). Production callers leave it undefined to use the SDK's default FetchTransport with its built-in SSRF guard.

      Parameters

      Returns Promise<AuthorizedClient>