Skip to main content

firebase_installations_dart 0.1.1 copy "firebase_installations_dart: ^0.1.1" to clipboard
firebase_installations_dart: ^0.1.1 copied to clipboard

Firebase Installations for pure Dart: installation ids and auth tokens on the VM and the web.

0.1.1 #

  • The app's FirebaseOptions.apiKeyHeaders (an API key limited to an Android or Apple app) are sent with the API key with every request; androidPackage, androidCert and iosBundleId win over them. Nothing is sent by a browser build.
  • The constraint on firebase_app_dart is ^0.2.4 instead of ^0.2.3, the version this package is developed and tested with.

0.1.0 #

  • KeyValueStore: the persistent key-value storage of the installation record, with an atomic update and a changes stream.
  • MemoryKeyValueStore: a store in memory, for tests and short-lived tools.
  • FileKeyValueStore (io.dart): one file per key, atomic writes, one owning process per directory (OS lock), a private directory on Linux and macOS.
  • IndexedDbKeyValueStore (web.dart): an IndexedDB database shared by the tabs of an origin, with change announcements on a BroadcastChannel.
  • FirebaseInstallations: getId, getToken, getIdAndToken, delete, onIdChange and close; registration in the background, token refresh with less than one hour left, recovery when the server forgets the installation, markers shared between tabs, and an in-memory record when the store cannot be written.
  • One retry after 1 s on a 5xx or a transport error; a 24 h block after 400 or 403; exponential backoff after 429 and other failures.
  • A 409 on create starts a backoff window and recovers once per call with a new FID; a 3xx and a create answered 401 or 404 also feed the backoff; any other 4xx is invalid-response.
  • FirebaseInstallationsException with the codes listed in its documentation.
  • Response caps, refused redirects, a 10 s deadline per request and 60 s per call; no token, API key or request body in a log line or an error message.
  • Depends on the internal _firebase_transport_dart for bounded numbers, server text, the one-time log and the capped send, in place of copies of them.
  • An answer from another origin (a client that followed a redirect) is invalid-response with its status, without a retry, and with the transport's redirected refusal as its cause. Whatever its status, it counts as a recoverable failure in the backoff: a foreign 400 or 403 does not block for 24 h, a foreign 401 or 404 on generate does not reset the backoff, and a foreign 409 on create does not remove the record or make a new FID. A network-error cause is the transport's failure, with the request's URL and header values redacted from its text. An Error thrown by the HTTP client (StateError, TypeError, ArgumentError and the like) is now a network-error after the one retry, instead of escaping unchanged.
  • The FID is redacted from a network-error cause's text too, also where the client's message quotes only the path segment or the body field that carries it.
  • A server origin over http must be a loopback host by the shared rule: an IPv4 part with a leading zero (127.0.0.01) is refused, and every spelling of ::1 is accepted and kept as [::1].
  • InstallationsErrorCode and FirebaseInstallationsException.errorCode: the codes as an enum, with unknown for a code the package does not know.
  • FirebaseInstallations.test(...) and FileKeyValueStore.test(...) take the clock, random, delay and server-origin seams for tests.
  • KeyValueStore.changes documents that the package's stores give a broadcast stream without replay.

Breaking (unreleased API) #

The package has never been published, so these change the API of 0.1.0 before its release.

  • FirebaseInstallationsException is a sealed class with the subtypes InstallationsClientException, InstallationsBadConfigException, InstallationsThrottledException and InstallationsServiceException. httpStatus, serverStatus and serverMessage moved to InstallationsServerException (the three server subtypes) and retryAfter to InstallationsBackoffException, the sealed parent of the bad-config and throttled ones. Migration: on InstallationsBackoffException catch (e) and read e.retryAfter, or switch on the sealed family.
  • The exception constructor is gone; the package creates its exceptions and tests build them through installationsError from src/exception.dart. code and errorCode keep their values.
  • FirebaseInstallations.isClosed reports whether close() ran. A call made after close() throws a StateError instead of failing with installations-closed, which now means only a call in flight when the instance closed. A second close() returns the future of the first. Migration: catch StateError (or check isClosed) where code matched installations-closed on a call made after close(). isClosed is also true once the app is deleted, before its onDeleteApp event, and a call made then throws the StateError and closes the instance.
  • firebaseInstallationsExceptionCodes is removed. Migration: InstallationsErrorCode.values.
  • The deprecated serverOrigin, clock, random, randomBytes and delay parameters of the FirebaseInstallations constructor and runCommand and clock of the FileKeyValueStore constructor are removed. Migration: FirebaseInstallations.test and FileKeyValueStore.test.
  • FirebaseInstallations(headers: {...}) is replaced by the named parameters androidPackage, androidCert and iosBundleId; the headers getter stays and holds the same three headers under their canonical names.
  • KeyValueStore.write takes a non-null String and KeyValueStore.remove(key) removes a key. Migration: write(key, null) becomes remove(key); an implementer adds remove. update still removes the key when the transform returns null.
  • errorCode is a new member of FirebaseInstallationsException; a class that implements it must add it (the class is sealed now, so nothing outside the package can).
0
likes
160
points
0
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Firebase Installations for pure Dart: installation ids and auth tokens on the VM and the web.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#firebase #installations

License

Apache-2.0 (license)

Dependencies

_firebase_transport_dart, crypto, firebase_app_dart, http, meta, web

More

Packages that depend on firebase_installations_dart