<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoTokenKit",
  "identifier" : "/documentation/CryptoTokenKit/TKTokenDriverDelegate/tokenDriver(_:tokenFor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CryptoTokenKit"
    ],
    "preciseIdentifier" : "c:objc(pl)TKTokenDriverDelegate(im)tokenDriver:tokenForConfiguration:error:"
  },
  "title" : "tokenDriver(_:tokenFor:)"
}
-->

# tokenDriver(_:tokenFor:)

Creates a new token for the configuration you specify.

```
optional func tokenDriver(_ driver: TKTokenDriver, tokenFor configuration: TKToken.Configuration) throws -> TKToken
```

## Parameters

`driver`

The token driver.

`configuration`

The configuration that identifies the token to create.

## Return Value

The created token.

## Discussion

The system invokes this method to request creation of a token instance, which the [`instanceID`](/documentation/CryptoTokenKit/TKToken/Configuration-swift.class/instanceID) property of the configuration you specify identifies.

The created token has access to its current configuration using the [`configurationData`](/documentation/CryptoTokenKit/TKToken/Configuration-swift.class/configurationData) property, which can provide token-implementation-specific additional data. The token can access keychain items this token exports with the methods [`key(for:)`](/documentation/CryptoTokenKit/TKToken/Configuration-swift.class/key(for:)) and [`certificate(for:)`](/documentation/CryptoTokenKit/TKToken/Configuration-swift.class/certificate(for:)) that the configuration provides.

> Note:
> Smart card token drivers must not implement this method.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)