ServiceAccountKey class

Represents a service account key.

A service account has two sets of key-pairs: user-managed, and system-managed.

User-managed key-pairs can be created and deleted by users. Users are responsible for rotating these keys periodically to ensure security of their service accounts. Users retain the private key of these key-pairs, and Google retains ONLY the public key.

System-managed keys are automatically rotated by Google, and are used for signing for a maximum of two weeks. The rotation process is probabilistic, and usage of the new key will gradually ramp up and down over the key's lifetime. We recommend caching the public key set for a service account for no more than 24 hours to ensure you have access to the latest keys.

Public keys for all service accounts are also published at the OAuth2 Service Account API.


ServiceAccountKey.fromJson(Map _json)


keyAlgorithm ↔ String
Specifies the algorithm (and possibly key size) for the key. Possible string values are: [...]
read / write
name ↔ String
The resource name of the service account key in the following format projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}.
read / write
privateKeyData ↔ String
The private key data. Only provided in CreateServiceAccountKey responses. Make sure to keep the private key data secure because it allows for the assertion of the service account identity. When base64 decoded, the private key data can be used to authenticate with Google API client libraries and with gcloud auth activate-service-account.
read / write
privateKeyDataAsBytes ↔ List<int>
read / write
privateKeyType ↔ String
The output format for the private key. Only provided in CreateServiceAccountKey responses, not in GetServiceAccountKey or ListServiceAccountKey responses. [...]
read / write
publicKeyData ↔ String
The public key data. Only provided in GetServiceAccountKey responses.
read / write
publicKeyDataAsBytes ↔ List<int>
read / write
validAfterTime ↔ String
The key can be used after this timestamp.
read / write
validBeforeTime ↔ String
The key can be used before this timestamp.
read / write
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited


toJson() → Map<String, Object>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
toString() → String
Returns a string representation of this object.


operator ==(dynamic other) → bool
The equality operator.