<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AuthenticationServices",
  "identifier" : "/documentation/AuthenticationServices/ASImportableCredential/TOTP",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Authentication Services"
    ],
    "preciseIdentifier" : "s:22AuthenticationServices22ASImportableCredentialO4TOTPV"
  },
  "title" : "ASImportableCredential.TOTP"
}
-->

# ASImportableCredential.TOTP

A type to represent a time-based one-time password generator (TOTP).

```
struct TOTP
```

## Overview

This type is a representation of `TOTP` as defined in the Credential Exchange Format (CXF) specification.

## Topics

### Accessing TOTP properties

[`var secret: Data`](/documentation/AuthenticationServices/ASImportableCredential/TOTP/secret)

The secret associated with this generator.

[`var period: UInt16`](/documentation/AuthenticationServices/ASImportableCredential/TOTP/period)

The period, in seconds, used by the generator to refresh codes.

[`var digits: UInt16`](/documentation/AuthenticationServices/ASImportableCredential/TOTP/digits)

The number of digits in the code used by the generator.

[`var algorithm: ASImportableCredential.TOTP.Algorithm`](/documentation/AuthenticationServices/ASImportableCredential/TOTP/algorithm-swift.property)

The algorithm used by the generator.

[`enum Algorithm`](/documentation/AuthenticationServices/ASImportableCredential/TOTP/Algorithm-swift.enum)

An enumeration of algorithm types that all importers are expected to support.

[`var issuer: String?`](/documentation/AuthenticationServices/ASImportableCredential/TOTP/issuer)

The issuer of the generator, if any.

### Initializers

[`init(secret: Data, period: UInt16, digits: UInt16, userName: String?, algorithm: ASImportableCredential.TOTP.Algorithm, issuer: String?)`](/documentation/AuthenticationServices/ASImportableCredential/TOTP/init(secret:period:digits:userName:algorithm:issuer:))

### Instance Properties

[`var userName: String?`](/documentation/AuthenticationServices/ASImportableCredential/TOTP/userName)

The user name associated with the generator. When instantiating from JSON, this property will be populated from the “username” field.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`Decodable`](/documentation/Swift/Decodable)

[`Encodable`](/documentation/Swift/Encodable)

[`Hashable`](/documentation/Swift/Hashable)

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)