---
title: "key(for:)"
framework: cryptotokenkit
role: symbol
role_heading: Instance Method
path: "cryptotokenkit/tktoken/configuration-swift.class/key(for:)"
---

# key(for:)

Returns a key from the keychain with the object identifier you specify.

## Declaration

```swift
func key(for objectID: TKToken.ObjectID) throws -> TKTokenKeychainKey
```

## Parameters

- `objectID`: The identifier for the key within the keychain.

## Return Value

Return Value The key that the keychain stores.

## Discussion

Discussion If the key the objectID specifies isn’t found, the system fills the error with TKError.Code.objectNotFound.

## See Also

### Retrieving Keys and Certificates

- [keychainItems](cryptotokenkit/tktoken/configuration-swift.class/keychainitems.md)
- [certificate(for:)](cryptotokenkit/tktoken/configuration-swift.class/certificate(for:).md)
