# Cloud IoT V1 API - Class Google::Cloud::Iot::V1::DeviceCredential (v0.9.2)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [0.9.2 (latest)](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/latest/Google-Cloud-Iot-V1-DeviceCredential)
- [0.9.1](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/0.9.1/Google-Cloud-Iot-V1-DeviceCredential)
- [0.8.0](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/0.8.0/Google-Cloud-Iot-V1-DeviceCredential)
- [0.7.1](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/0.7.1/Google-Cloud-Iot-V1-DeviceCredential)
- [0.6.0](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/0.6.0/Google-Cloud-Iot-V1-DeviceCredential)
- [0.5.0](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/0.5.0/Google-Cloud-Iot-V1-DeviceCredential)
- [0.4.0](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/0.4.0/Google-Cloud-Iot-V1-DeviceCredential)
- [0.3.5](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/0.3.5/Google-Cloud-Iot-V1-DeviceCredential)
Reference documentation and code samples for the Cloud IoT V1 API class Google::Cloud::Iot::V1::DeviceCredential.

A server-stored device credential used for authentication.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #expiration_time

    def expiration_time() -> ::Google::Protobuf::Timestamp

**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/latest/Google-Protobuf-Timestamp)) --- \[Optional\] The time at which this credential becomes invalid. This credential will be ignored for new client authentication requests after this timestamp; however, it will not be automatically deleted.

### #expiration_time=

    def expiration_time=(value) -> ::Google::Protobuf::Timestamp

**Parameter**

- **value** ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/latest/Google-Protobuf-Timestamp)) --- \[Optional\] The time at which this credential becomes invalid. This credential will be ignored for new client authentication requests after this timestamp; however, it will not be automatically deleted.
**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/latest/Google-Protobuf-Timestamp)) --- \[Optional\] The time at which this credential becomes invalid. This credential will be ignored for new client authentication requests after this timestamp; however, it will not be automatically deleted.

### #public_key

    def public_key() -> ::Google::Cloud::Iot::V1::PublicKeyCredential

**Returns**

- ([::Google::Cloud::Iot::V1::PublicKeyCredential](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/latest/Google-Cloud-Iot-V1-PublicKeyCredential)) --- A public key used to verify the signature of JSON Web Tokens (JWTs). When adding a new device credential, either via device creation or via modifications, this public key credential may be required to be signed by one of the registry level certificates. More specifically, if the registry contains at least one certificate, any new device credential must be signed by one of the registry certificates. As a result, when the registry contains certificates, only X.509 certificates are accepted as device credentials. However, if the registry does not contain a certificate, self-signed certificates and public keys will be accepted. New device credentials must be different from every registry-level certificate.

### #public_key=

    def public_key=(value) -> ::Google::Cloud::Iot::V1::PublicKeyCredential

**Parameter**

- **value** ([::Google::Cloud::Iot::V1::PublicKeyCredential](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/latest/Google-Cloud-Iot-V1-PublicKeyCredential)) --- A public key used to verify the signature of JSON Web Tokens (JWTs). When adding a new device credential, either via device creation or via modifications, this public key credential may be required to be signed by one of the registry level certificates. More specifically, if the registry contains at least one certificate, any new device credential must be signed by one of the registry certificates. As a result, when the registry contains certificates, only X.509 certificates are accepted as device credentials. However, if the registry does not contain a certificate, self-signed certificates and public keys will be accepted. New device credentials must be different from every registry-level certificate.
**Returns**

- ([::Google::Cloud::Iot::V1::PublicKeyCredential](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-iot-v1/latest/Google-Cloud-Iot-V1-PublicKeyCredential)) --- A public key used to verify the signature of JSON Web Tokens (JWTs). When adding a new device credential, either via device creation or via modifications, this public key credential may be required to be signed by one of the registry level certificates. More specifically, if the registry contains at least one certificate, any new device credential must be signed by one of the registry certificates. As a result, when the registry contains certificates, only X.509 certificates are accepted as device credentials. However, if the registry does not contain a certificate, self-signed certificates and public keys will be accepted. New device credentials must be different from every registry-level certificate.