1.17.8 (latest) 1.17.7 1.16.2 1.15.1 1.14.0 1.13.1 1.12.2 Reference documentation and code samples for the googleauth class Google::Auth::IDTokens::KeyInfo.

A public key used for verifying ID tokens.


<br />

This includes the public key data, ID, and the algorithm used for
signature verification. RSA and Elliptical Curve (EC) keys are
supported.

## Inherits

- Object

## Methods

### .from_jwk

```ruby
def self.from_jwk(jwk) -> KeyInfo
```
Create a KeyInfo from a single JWK, which may be given as either a
hash or an unparsed JSON string.
**Parameter**

- **jwk** (Hash, String) --- The JWK specification.
**Returns**

- ([KeyInfo](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-IDTokens-KeyInfo.md.txt))
**Raises**

- ([Google::Auth::IDTokens::KeySourceError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-IDTokens-KeySourceError.md.txt)) --- If the key could not be extracted from the JWK due to invalid type, malformed JSON, or invalid key data.

### .from_jwk_set

```ruby
def self.from_jwk_set(jwk_set) -> Array<KeyInfo>
```
Create an array of KeyInfo from a JWK Set, which may be given as
either a hash or an unparsed JSON string.
**Parameter**

- **jwk_set** (Hash, String) --- The JWK Set specification.
**Returns**

- (Array\<[KeyInfo](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-IDTokens-KeyInfo.md.txt)\>)
**Raises**

- ([Google::Auth::IDTokens::KeySourceError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-IDTokens-KeySourceError.md.txt)) --- If a key could not be extracted from the JWK Set, or if the set contains no keys.

### #algorithm

```ruby
def algorithm() -> String
```
The signature algorithm. (normally `RS256` or `ES256`)
**Returns**

- (String)

### #id

```ruby
def id() -> String
```
The key ID.
**Returns**

- (String)

### #initialize

```ruby
def initialize(id: nil, key: nil, algorithm: nil) -> KeyInfo
```
Create a public key info structure.
**Parameters**

- **id** (String) *(defaults to: nil)* --- The key ID.
- **key** (OpenSSL::PKey::RSA, OpenSSL::PKey::EC) *(defaults to: nil)* --- The key itself.
- **algorithm** (String) *(defaults to: nil)* --- The algorithm (normally `RS256` or `ES256`)
**Returns**

- ([KeyInfo](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-IDTokens-KeyInfo.md.txt)) --- a new instance of KeyInfo

### #key

```ruby
def key() -> OpenSSL::PKey::RSA, OpenSSL::PKey::EC
```
The key itself.
**Returns**

- (OpenSSL::PKey::RSA, OpenSSL::PKey::EC)