FileSecrets class
Load authentication secrets from a JSON file.
File format:
{"username": "admin", "password": "secret123", "token": "eyJhbG..."}
With named sections:
{"production": {"username": "admin", "password": "secret123"}}
Usage:
final auth = await FileSecrets.basicAuth('secrets.json', section: 'prod');
final client = GoHttpClient(
interceptors: [AuthInterceptor(auth: auth)],
);
ponytail: only JSON format; extend with YAML / .netrc if needed.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
basicAuth(
String path, {String? section, String usernameKey = 'username', String passwordKey = 'password'}) → Future< BasicAuth> - Load a JSON file and extract BasicAuth credentials.
-
bearerToken(
String path, {String? section, String tokenKey = 'token', String headerName = 'Authorization', String headerPrefix = 'Bearer '}) → Future< FunctionAuth> -
Load a JSON file and create a FunctionAuth that sets a Bearer token
via the
Authorizationheader.