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.
If you cache the public key set for a service account, we recommend that you update the cache every 15 minutes. User-managed keys can be added and removed at any time, so it is important to update the cache frequently. For Google-managed keys, Google will publish a key at least 6 hours before it is first used for signing and will keep publishing it for at least 6 hours after it was last used for signing.
Public keys for all service accounts are also published at the OAuth2 Service Account API.
- Available extensions
Constructors
-
ServiceAccountKey({String? name, ServiceAccountPrivateKeyType? privateKeyType, List<
int> ? privateKeyData, Timestamp? validAfterTime, Timestamp? validBeforeTime, List<int> ? publicKeyData, ServiceAccountKeyAlgorithm? keyAlgorithm, ServiceAccountKeyOrigin? keyOrigin, ListServiceAccountKeysRequest_KeyType? keyType, bool? disabled}) -
factory
-
ServiceAccountKey.fromBuffer(List<
int> data, [ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) -
factory
- ServiceAccountKey.fromJson(String json, [ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY])
-
factory
Properties
- disabled ↔ bool
-
The key status.
getter/setter pair
- hashCode → int
-
Calculates a hash code based on the contents of the protobuf.
no setterinherited
- info_ → BuilderInfo
-
no setter
- isFrozen → bool
-
Returns
trueif this message is marked read-only. Otherwisefalse.no setterinherited - keyAlgorithm ↔ ServiceAccountKeyAlgorithm
-
Specifies the algorithm (and possibly key size) for the key.
getter/setter pair
- keyOrigin ↔ ServiceAccountKeyOrigin
-
The key origin.
getter/setter pair
- keyType ↔ ListServiceAccountKeysRequest_KeyType
-
The key type.
getter/setter pair
- name ↔ String
-
The resource name of the service account key in the following format
projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}.getter/setter pair -
privateKeyData
↔ List<
int> -
The private key data. Only provided in
CreateServiceAccountKeyresponses. 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.getter/setter pair - privateKeyType ↔ ServiceAccountPrivateKeyType
-
The output format for the private key.
Only provided in
CreateServiceAccountKeyresponses, not inGetServiceAccountKeyorListServiceAccountKeyresponses.getter/setter pair -
publicKeyData
↔ List<
int> -
The public key data. Only provided in
GetServiceAccountKeyresponses.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unknownFields → UnknownFieldSet
-
no setterinherited
- validAfterTime ↔ Timestamp
-
The key can be used after this timestamp.
getter/setter pair
- validBeforeTime ↔ Timestamp
-
The key can be used before this timestamp.
For system-managed key pairs, this timestamp is the end time for the
private key signing operation. The public key could still be used
for verification for a few hours after this time.
getter/setter pair
Methods
-
addExtension(
Extension extension, Object? value) → void -
Adds an extension field value to a repeated field.
inherited
-
check(
) → void -
Throws a StateError if the message has required fields without a value.
inherited
-
clear(
) → void -
Clears all data that was set in this message.
inherited
-
clearDisabled(
) → void -
clearExtension(
Extension extension) → void -
Clears an extension field and also removes the extension.
inherited
-
clearField(
int tagNumber) → void -
Clears the contents of a given field.
inherited
-
clearKeyAlgorithm(
) → void -
clearKeyOrigin(
) → void -
clearKeyType(
) → void -
clearName(
) → void -
clearPrivateKeyData(
) → void -
clearPrivateKeyType(
) → void -
clearPublicKeyData(
) → void -
clearValidAfterTime(
) → void -
clearValidBeforeTime(
) → void -
clone(
) → ServiceAccountKey - Creates a deep copy of the fields in this message. (The generated code uses mergeFromMessage.)
-
copyWith(
void updates(ServiceAccountKey)) → ServiceAccountKey -
Apply
updatesto a copy of this message. -
createEmptyInstance(
) → ServiceAccountKey - Creates an empty instance of the same message type as this.
-
deepCopy(
) → T -
Available on T, provided by the GeneratedMessageGenericExtensions extension
Returns a writable deep copy of this message. -
ensureValidAfterTime(
) → Timestamp -
ensureValidBeforeTime(
) → Timestamp -
extensionsAreInitialized(
) → bool -
inherited
-
freeze(
) → GeneratedMessage -
Make this message read-only.
inherited
-
getDefaultForField(
int tagNumber) → dynamic -
Returns the default value for the given field.
inherited
-
getExtension(
Extension extension) → dynamic -
Returns the value of
extension.inherited -
getField(
int tagNumber) → dynamic -
Returns the value of the field associated with
tagNumber, or the default value if it is not set.inherited -
getFieldOrNull(
int tagNumber) → dynamic -
Returns the value of a field, ignoring any defaults.
inherited
-
getTagNumber(
String fieldName) → int? -
inherited
-
hasDisabled(
) → bool -
hasExtension(
Extension extension) → bool -
Returns
trueif a value ofextensionis present.inherited -
hasField(
int tagNumber) → bool -
Whether this message has a field associated with
tagNumber.inherited -
hasKeyAlgorithm(
) → bool -
hasKeyOrigin(
) → bool -
hasKeyType(
) → bool -
hasName(
) → bool -
hasPrivateKeyData(
) → bool -
hasPrivateKeyType(
) → bool -
hasPublicKeyData(
) → bool -
hasRequiredFields(
) → bool -
Whether the message has required fields.
inherited
-
hasValidAfterTime(
) → bool -
hasValidBeforeTime(
) → bool -
isInitialized(
) → bool -
Whether all required fields in the message and embedded messages are set.
inherited
-
mergeFromBuffer(
List< int> input, [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) → void -
Merges serialized protocol buffer data into this message.
inherited
-
mergeFromCodedBufferReader(
CodedBufferReader input, [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) → void -
Same as
mergeFromBuffer, but takes aCodedBufferReaderinput.inherited -
mergeFromJson(
String data, [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) → void -
Merges field values from
data, a JSON object, encoded as described byGeneratedMessage.writeToJson.inherited -
mergeFromJsonMap(
Map< String, dynamic> json, [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) → void -
Merges field values from a JSON object represented as a Dart map.
inherited
-
mergeFromMessage(
GeneratedMessage other) → void -
Merges the contents of the
otherinto this message.inherited -
mergeFromProto3Json(
Object? json, {TypeRegistry typeRegistry = const TypeRegistry.empty(), bool ignoreUnknownFields = false, bool supportNamesWithUnderscores = true, bool permissiveEnums = false}) → void -
Merges field values from
json, a JSON object using proto3 encoding.inherited -
mergeUnknownFields(
UnknownFieldSet unknownFieldSet) → void -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rebuild(
void updates(T)) → T -
Available on T, provided by the GeneratedMessageGenericExtensions extension
Applyupdatesto a copy of this message. -
setExtension(
Extension extension, Object value) → void -
Sets the value of a non-repeated extension field to
value.inherited -
setField(
int tagNumber, Object value) → void -
Sets the value of a field by its
tagNumber.inherited -
toBuilder(
) → GeneratedMessage -
Creates a writable, shallow copy of this message.
inherited
-
toDebugString(
) → String -
Returns a String representation of this message.
inherited
-
toProto3Json(
{TypeRegistry typeRegistry = const TypeRegistry.empty()}) → Object? -
Returns an Object representing Proto3 JSON serialization of
this.inherited -
toString(
) → String -
Returns a String representation of this message.
inherited
-
writeToBuffer(
) → Uint8List -
Serialize the message as the protobuf binary format.
inherited
-
writeToCodedBufferWriter(
CodedBufferWriter output) → void -
Same as
writeToBuffer, but serializes to the givenCodedBufferWriter.inherited -
writeToJson(
) → String -
Returns a JSON string that encodes this message.
inherited
-
writeToJsonMap(
) → Map< String, dynamic> -
Returns the JSON encoding of this message as a Dart Map.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
create(
) → ServiceAccountKey -
createRepeated(
) → PbList< ServiceAccountKey> -
getDefault(
) → ServiceAccountKey