Skip to content

1.1.0

Latest

Choose a tag to compare

@ivan-magda ivan-magda released this 23 Jul 13:30
aa064da

ChatGPTAuth 1.1.0 makes the credential source easier to live with at the call site: attaching a bearer, handling a 401, and signing out are now one call each.

What's new

  • ChatGPTAuthorization carries accessToken and expiresAt, so a transport that does not speak URLRequest — a WebSocket handshake, gRPC metadata — reads the bearer and expiry directly instead of parsing headers.
  • apply(to:) stamps every credential-dependent header onto a URLRequest in place, and clears package-owned headers a rotated token no longer names.
  • authorizeRequest(_:) refreshes if needed and attaches in one call, returning the snapshot whose generation and redaction values the request now wears.
  • withAuthorization(_:) owns the whole 401 loop: attach, send, refresh and retry once on a clean 401, and latch authenticationRequired only when the verdict lands on the generation still held — a 401 whose token was rotated away beneath the request is never read as terminal.
  • reject(generation:disposition:) now reports whether the verdict was applied, so callers driving the loop themselves can tell a stale rejection from a real one.
  • logout() discards the credential through its one owner: memory first — including the retained prior pair — then the store, with a typed failure when the delete does not land.

Notes

  • ChatGPTAuthorization's initializer gained the two new fields as required parameters. Code that only consumes authorizations is unaffected.

Documentation: https://ivan-magda.github.io/swift-chatgpt-auth/documentation/chatgptauth/