| Internet-Draft | TOTP Offline Time and Viewed Records | November 2026 |
| Rigopoulos | Expires 3 June 2027 | [Page] |
This document updates RFC 6238. It specifies two optional, backwards-compatible mechanisms for the Time-Based One-Time Password (TOTP) algorithm. It specifies an Offline Time Source profile in which the prover derives Unix time from a local clock that has no network dependency, together with a declared maximum drift rate and a method for measuring that rate against a trusted reference. It also specifies an append-only viewed record written on the prover when a TOTP value is displayed or copied, and optional verifier behaviour that uses that record to reject or flag an OTP accepted at a time- step the device never recorded as viewed. This revision adds an optional Reference Device role, guidance for new hardware including offline crypto wallets, an optional binding of a viewed record to the action or transaction for which the code was displayed, and test results from a local simulation of verifier behaviour. The TOTP value itself is computed exactly as in RFC 6238. A viewed record detects unviewed or wrong-step OTPs; it does not prevent acceptance unless the verifier checks the record. This document is Experimental.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 3 June 2027.¶
Copyright (c) 2026 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document.¶
This document specifies an update to [RFC6238], which defines TOTP as an extension of the HMAC-based One-Time Password (HOTP) algorithm in [RFC4226]. The moving factor in RFC 6238 is a time-step counter¶
T = floor((Current Unix time - T0) / X)¶
with a default time-step size X of 30 seconds and a default origin T0 of 0 (the Unix epoch). Requirement R1 in Section 3 of [RFC6238] says the prover and the verifier MUST know or be able to derive the current Unix time. It does not say how that time is obtained, and it does not require or forbid a network time source.¶
Section 5.2 of [RFC6238] observes that a validation system does not know the client's exact timestamp when an OTP was generated. It says a verifier SHOULD set a policy for an acceptable delay window, RECOMMENDS that at most one time-step is allowed as the network delay, and requires that, after a successful validation, the verifier MUST NOT accept the same OTP again. Section 6 RECOMMENDS a limit on clock drift and a resynchronisation procedure. Neither section specifies a clock implementation, and neither defines a record on the prover of when a code was displayed or copied.¶
In common deployment a verifier accepts the previous, current, and next step (a "+/- 1" window). Under that policy, three different codes can be valid at once and a given code remains acceptable for 90 seconds. The one-time-use rule in Section 5.2 applies only at that verifier and only after it has already accepted that OTP. It does not block a different adjacent-step code, and it cannot show whether a code in the window was ever viewed on the device.¶
This document specifies the following additions to [RFC6238]:¶
The TOTP calculation is unchanged. Provers and verifiers that implement only [RFC6238] remain interoperable with implementations of this document. This document is Experimental because the time-source profile, the record format, the optional verifier check, the Reference Device role, and the optional transaction binding need implementation and operational experience, including privacy and deployment practice, before any later revision is considered.¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
An implementation that claims the Offline Time Source profile defined here MUST derive the "Current Unix time" used in Section 4.2 of [RFC6238] from a local clock, with no network protocol required to compute T or the TOTP value. The profile does not change X, T0, the hash function, the digit count, or the truncation of [RFC6238].¶
This document does not specify a particular clock part or product. Any local real-time clock, including a temperature-compensated crystal oscillator or a similar time source, may be used if it meets the declared D_max and the measurement method in Section 4.3.¶
An implementation of this profile MUST declare a maximum drift rate D_max in ppm. D_max is a bound on the absolute fractional frequency error of the local clock relative to a trusted reference after the clock has been set. The declaration MUST state the temperature range over which D_max applies. A figure quoted for a narrower range (for example 0 degrees C to +40 degrees C) MUST NOT be used as D_max outside that range. Under a constant-rate model, the time in days for the accumulated offset to reach a threshold of S seconds is¶
t_days = S / (|D_max| * 10^-6) / 86400¶
Implementations SHOULD NOT declare a D_max greater than 20 ppm. A tighter class (for example 2 ppm) MAY be declared if the measurement method supports it. The values 2 ppm and 20 ppm are model classes for illustration and default policy; they are not measurements of any particular device. A declared class of 2 ppm does not mean that the clock has no drift. Even at 2 ppm, under the constant-rate model, the accumulated offset reaches one default time-step (30 seconds) in about 174 days, as calculated below.¶
At 20 ppm, the model reaches a 15-second offset in 8.681 days and a 30-second offset (one default time-step) in 17.361 days. At 2 ppm those intervals are 86.806 days and 173.611 days. Any nonzero offset of at most one time-step already requires a verifier window of +/- 1 if the prover's current code is to be accepted at every phase of the step. The moment the offset exceeds X seconds, a window of +/- 2 is required. Implementations SHOULD set or compare the local clock against a trusted reference often enough that the expected offset remains at most one time-step, given the declared D_max.¶
When the local clock is first set, and whenever the measured offset exceeds a configured threshold, the clock MUST be set from a trusted reference. That threshold SHOULD be no greater than one time-step X. The trusted reference MAY be a network time protocol, a satellite time source, or another local reference of known quality, including a Reference Device as specified in Section 4.6. Use of a network protocol to set the clock does not remove the requirement that ordinary TOTP generation under this profile proceed without a network dependency.¶
Re-synchronisation means that the device's Unix time is checked against a trusted reference and, if required, set from that reference. It does not generate, rotate, or replace the shared TOTP secret. A new shared secret is obtained only by a separate enrolment or re-enrolment procedure.¶
If the accumulated offset is larger than the verifier's accepted window, automatic resynchronisation as described in Section 6 of [RFC6238] may not be sufficient. In that case an additional authentication measure SHOULD be used before the clock is set, as already recommended in that section.¶
An implementation that claims a D_max MUST be able to demonstrate it by the following method, or by a method of equal or greater rigour.¶
This method is a laboratory or operational check of a clock class. It is not a substitute for a published measurement of a specific shipped device.¶
The Offline Time Source profile applies to a device that is built, or later upgraded, with a local real-time clock that can keep time without a network, meets a declared D_max over a stated temperature range, and can be measured as in Section 4.3. Typical qualifying clocks include a battery-backed RTC or a crystal oscillator with temperature compensation (for example a TCXO RTC). The profile is a requirement that new designs MAY adopt. This document makes no claim that any existing commercial product already meets it.¶
A device that has no independent local real-time clock, and that obtains Unix time from a host operating system or from the host on each use, MUST NOT claim the Offline Time Source profile. Such a device MAY still implement the viewed record in Section 5, because that record does not depend on the source of time.¶
Offline crypto wallets and similar tokens are a natural application of the profile: a wallet that never touches a network still needs a trustworthy local time-step in order to compute TOTP, and a declared D_max gives a verifier a stated reason to keep a narrow window. Existing wallet models that take time from a host, and that have no qualifying RTC, would not meet the profile unless upgraded. The viewed record, and the optional transaction binding in Section 5.4, can be adopted independently of the clock source and are therefore available to current hardware as well.¶
An example microcontroller and RTC combination that could be used for laboratory evaluation is described in Section 12. That description is an example only. It is not a measurement under Section 4.3, and it is not a statement about any shipping product.¶
A battery-backed implementation of this profile SHOULD report the status of the clock's backup supply (for example a low-battery indication or a measured backup voltage) to the user or to a managing application. When the backup supply is low, missing, or otherwise indicated as insufficient, the implementation MUST treat the local clock as untrusted until the clock has been set again from a trusted reference as in Section 4.2. Codes MAY still be generated in that state, but an implementation that claims the profile MUST NOT present them as satisfying the declared D_max.¶
Battery life MAY be estimated from the cell's datasheet capacity and the RTC's timekeeping current, taking into account self-discharge and any additional current drawn by the module. This document does not publish a battery-life figure for any cell or module. An implementer who publishes such a figure MUST cite the capacity and current values used and the conditions under which they apply.¶
Battery life and calendar age are not measures of clock accuracy. They MUST NOT be used to rank a device as a trusted time reference; see Section 4.6.4.¶
A deployment MAY use a standalone Reference Device as the "local reference of known quality" permitted by Section 4.2. The role is optional. Ordinary TOTP generation under the Offline Time Source profile remains possible without one, provided the prover's own clock has been set from some trusted reference and remains within the configured offset threshold.¶
A Reference Device keeps a local clock of higher quality than the provers that rely on it and issues signed time messages to those provers over a local link. Suitable clock classes include a GPS-disciplined oscillator, a radio-controlled clock, or a temperature-controlled crystal that is itself periodically checked against a trusted time source. This document does not specify a particular part.¶
The local link MAY be Bluetooth, NFC, USB, or a local network. The profile still requires that generating a TOTP value does not depend on a network protocol; a prover may remain offline between syncs.¶
A time message from a Reference Device MUST contain at least the following fields, and the signature or MAC MUST cover all of them:¶
The message MUST be authenticated so that a prover can detect forgery or alteration. The authentication key or public key is provisioned to the prover by an authenticated procedure that is out of scope of this document. The concrete encoding and the signature or MAC algorithm are agreed at provisioning. A JSON [RFC8259] object is a suitable illustrative encoding:¶
{
"v": 1,
"ref_unix": 1764547200,
"d_max_ppm": 2,
"d_max_temp": "0C..+40C",
"last_sync_unix": 1764460800,
"last_sync_source": "gnss",
"alg": "Ed25519",
"sig": "...hex..."
}
¶
The example is illustrative. It is not a test vector, and the signature value is omitted.¶
When a prover receives an authentic time message, it MUST compute the offset as device Unix time minus the reference Unix time carried in the message, and it SHOULD log that offset, the reference identifier, and the time of comparison. The prover MUST NOT reset its clock from the message unless the absolute offset exceeds the configured threshold, which SHOULD be no greater than one time-step X, as already required in Section 4.2. If the offset is larger than the verifier's accepted window, the additional authentication measure in Section 4.2 still applies before the clock is set.¶
A prover MUST ignore a message that fails authentication, and SHOULD ignore a message whose claimed last-sync time is older than a configured limit or whose declared D_max is worse than the prover will accept.¶
If more than one candidate reference is available, a prover SHOULD prefer the candidate with the tighter declared D_max and, if those are equal, the more recent authenticated last trusted sync. A prover MUST NOT rank references by battery life, by advertised remaining capacity, or by the age or "newness" of the device. Those properties do not measure frequency error, and a newer or longer-lived clock can still be unset, poorly characterised, or tampered with.¶
Provers MUST NOT treat one another as trusted references merely because they implement this profile. Unauthenticated peer-to-peer copying of time, including a policy of following whichever peer reports the longest battery life, is a tamper-propagation risk: a single wrong or compromised clock can move the others (see Section 13).¶
A software application MAY provide the passage through which a prover obtains a signed time message from a Reference Device or from another trusted reference, for example over USB or another local link, without itself being the clock source. The author's Last Viewed software is one such application that could provide that sync path. This document does not claim that any particular software release already implements the path, and it makes no claim about the clock specifications of any hardware used with that software.¶
When a TOTP value is displayed or copied, a prover that implements viewed records MUST append a record for the corresponding time-step T. Records MUST be append-only: an implementation MUST NOT alter or delete an earlier record except as part of a documented, integrity- preserving rotation or expiry policy. The plaintext OTP MUST NOT be stored in the record; a truncated keyed digest is stored instead.¶
Each record contains at least the following fields:¶
The viewed-code digest is:¶
HMAC-SHA-256(K,
"TOTP-VIEWED" || 0x00 || uint64be(T) || ASCII(code))
¶
where K is the shared TOTP secret, uint64be(T) is T as an 8-octet big-endian unsigned integer, and ASCII(code) is the exact decimal digit string of the viewed OTP, including leading zeros. The ASCII label is the 11-octet string %x54.4F.54.50.2D.56.49.45.57.45.44.¶
The covering MAC, when the action field is absent, is:¶
HMAC-SHA-256(K,
"TOTP-VIEWED-MAC" || 0x00 || uint64be(seq) ||
uint64be(T) || ASCII(viewed) || uint8(digits) ||
ASCII(alg) || digest_octets)
¶
The ASCII label is the 15-octet string %x54.4F.54.50.2D.56.49.45.57.45.44.2D.4D.41.43. digest_octets is the 8-octet value encoded by the digest field, not its hexadecimal representation. The mac field MUST NOT be included in its own input.¶
When the action field is present, the covering MAC is the same construction with the action octets appended:¶
HMAC-SHA-256(K,
"TOTP-VIEWED-MAC" || 0x00 || uint64be(seq) ||
uint64be(T) || ASCII(viewed) || uint8(digits) ||
ASCII(alg) || digest_octets || 0x00 || action_octets)
¶
where action_octets is the raw octet string encoded by the action field, not its hexadecimal representation. The additional 0x00 separator is omitted when the action field is absent, so an unextended record has the same MAC as in version -00.¶
An optional account or issuer label MAY be stored locally; implementations that export records SHOULD consider the privacy implications in Section 14.¶
A log MAY be represented as a JSON [RFC8259] array of objects. The following example is the first Appendix B test time (Unix time 59) with the 8-digit SHA-1 TOTP of [RFC6238]:¶
{
"v": 1,
"seq": 1,
"T": 1,
"viewed": "1970-01-01T00:00:59Z",
"digits": 8,
"alg": "SHA1",
"digest": "6cd61375889ffa0b",
"mac": "44e256b21a8a649325bc0e411e049f45"
}
¶
The same record MAY be represented in CBOR [RFC8949]. In diagnostic notation:¶
{
"v": 1,
"seq": 1,
"T": 1,
"viewed": "1970-01-01T00:00:59Z",
"digits": 8,
"alg": "SHA1",
"digest": h'6CD61375889FFA0B',
"mac": h'44E256B21A8A649325BC0E411E049F45'
}
¶
Interoperable exchange SHOULD use the JSON representation unless both sides have agreed to CBOR. This document does not register a media type (see Section 15).¶
The viewed record defined above covers a time-step. It does not, by itself, distinguish one use of a viewed code from another use of the same code. The simulation in Section 10 showed that when a code had been recorded as viewed, enforce mode still accepted the first submission of that code, including a submission that beat the user, and that a non-atomic verifier could accept the same viewed code from ten parallel clients. Those cases are the gap that this optional extension is specified to close, under the conditions stated below.¶
A prover and a verifier MAY agree a policy in which each viewed record also carries an action identifier for the action or transaction the code was displayed to authorise. Typical contents are a verifier-supplied challenge or session identifier, or a digest of transaction fields such as the amount and destination. Related challenge-response work, in which transaction details enter the OTP calculation itself, is specified for HOTP in the OATH Challenge-Response Algorithm (OCRA) [RFC6287]. This extension does not change the TOTP value; the identifier is carried in the viewed record, not mixed into the OTP.¶
When a digest is used, it is RECOMMENDED that action be the lowercase hexadecimal encoding of the leftmost 16 octets of SHA-256 over a canonical UTF-8 encoding of the agreed transaction fields. A verifier-supplied challenge is encoded as lowercase hexadecimal of the challenge octets. Plaintext amounts, destinations, or account identifiers SHOULD NOT be placed in an exported record (see Section 14).¶
When this policy is in force, a verifier in enforce mode MUST reject an OTP unless an authenticated viewed record covers the accepted time-step and the action field matches the action being authorised. A record without an action field MUST be treated as not covering that action. The effect is that a code which remains valid across a +/- 1 window cannot authorise a second, different transaction or session. A relay of a viewed code to a different login or payment, and a first use of an intercepted code against a different action than the one that was displayed, are therefore rejected.¶
This extension does not prevent the first submission of a viewed code against the same action or challenge that was displayed, for example a shoulder-surf of a code already bound to that payment or login. The Section 5.2 rule in [RFC6238], applied atomically as in Section 6.4, remains the control that stops a second acceptance of that same (OTP, action) pair at that verifier.¶
Transaction binding is an explicit, mutually agreed policy, like enforce mode. A verifier that has not agreed the policy MUST ignore a present action field for acceptance, and MUST still recompute the covering MAC with the field included if it is present, so that a bound record is not mistaken for an unbound one.¶
Support for viewed records on the verifier is OPTIONAL. A verifier that does not implement this section MUST continue to validate TOTP values as specified in [RFC6238]. When this section is implemented, two modes are defined.¶
In audit mode the verifier validates the OTP as in [RFC6238], including the Section 5.2 rule that the same OTP MUST NOT be accepted a second time after success. Independently, it obtains viewed records (at the time of validation, or later) and MUST flag an accepted OTP whose accepted time-step has no matching viewed record on the prover, or whose accepted time-step differs from the step or steps recorded as viewed for that authentication attempt.¶
Audit mode detects unviewed or wrong-step acceptances after the fact. It does not, by itself, prevent acceptance.¶
In enforce mode the verifier, at validation time, additionally requires one or more viewed records covering the accepted time-step. If it accepts an OTP at step S (including a match in a delay or resynchronisation window), and no viewed record with T = S is presented and authenticated, it MUST reject the OTP.¶
Under a common +/- 1 window, a user who viewed only step T can still submit the current-step code. Codes for T-1 and T+1, which would otherwise be acceptable as different OTPs, are rejected unless they too were recorded as viewed. This narrows the effective window for unviewed neighbour steps without changing how the TOTP value is computed. It does not detect a copy of a code that was recorded as viewed (for example a shoulder-surf of the displayed OTP), unless the optional transaction-binding policy in Section 5.4 applies and the copy is presented for a different action.¶
How records are carried to the verifier is out of scope of the TOTP calculation. An implementation MAY send records together with the OTP, export them later for audit, or compare them on a local management path. When records are sent, the mac field SHOULD be present, and the verifier MUST recompute the digest and the mac using the shared secret before relying on the record. A record with an invalid mac MUST be ignored for enforcement and MUST be flagged in audit mode.¶
The rule in Section 5.2 of [RFC6238] that the same OTP MUST NOT be accepted a second time after success is effective only if the check that the OTP has not already been used, and the update that records the use, are performed atomically with respect to concurrent validations of the same OTP at that verifier.¶
A verifier that implements this document MUST apply that check and update as a single critical section (for example under a lock, or as an atomic compare-and-set on the stored last-used step). The simulation in Section 10 showed that a check-then-update implementation, under a forced race of ten parallel submissions of a viewed code, accepted all ten, and that enforce mode did not close that race, because the viewed record was authentic for the same step on every attempt. Transaction binding does not remove this requirement for two submissions of the same (OTP, action) pair.¶
Later tests (Section 11) showed that, with a pause between check and update of 0.5 ms or more, a non-atomic verifier accepted the same code more than once in every one of 200 trials with 100 parallel clients, and that enforce mode on a non-atomic verifier still accepted a viewed code up to 100 times. An atomic update accepted exactly one submission in every trial.¶
For the same secret K, origin T0, time-step X, hash algorithm, digit count, and Unix time, an implementation of this document MUST produce the same TOTP value as [RFC6238]. The Offline Time Source profile and the viewed record do not alter that value.¶
A prover that implements this document can be validated by a verifier that implements only [RFC6238]. A verifier that implements this document can validate a prover that implements only [RFC6238], provided it does not require enforce mode. Enforce mode, and the transaction-binding policy of Section 5.4, are therefore explicit, mutually agreed policies, not a silent change to TOTP.¶
The following vectors use the Appendix B test token of [RFC6238]: the ASCII shared secret "12345678901234567890", X = 30, T0 = 0, and HMAC- SHA-1. The 8-digit TOTP values MUST match Table 1 of that RFC. The 6-digit values are the same truncated integer reduced modulo 10^6, included because six-digit codes are widely deployed. The digest and mac fields were generated offline from the constructions in Section 5.1. The "viewed" timestamp is the UTC instant equal to the listed Unix time, as if the code were viewed at the moment it was generated. Sequence numbers run from 1 to 6 in table order. These vectors do not include the optional action field.¶
Table 1 lists the TOTP values. Table 2 lists the viewed records for the 8-digit codes. Table 3 lists the digest and mac for the corresponding 6-digit codes, using the same seq, T, and viewed timestamp, with digits = 6.¶
| Unix time | UTC | T (hex) | TOTP (8) | TOTP (6) |
|---|---|---|---|---|
| 59 | 1970-01-01T00:00:59Z | 0000000000000001 | 94287082 | 287082 |
| 1111111109 | 2005-03-18T01:58:29Z | 00000000023523EC | 07081804 | 081804 |
| 1111111111 | 2005-03-18T01:58:31Z | 00000000023523ED | 14050471 | 050471 |
| 1234567890 | 2009-02-13T23:31:30Z | 000000000273EF07 | 89005924 | 005924 |
| 2000000000 | 2033-05-18T03:33:20Z | 0000000003F940AA | 69279037 | 279037 |
| 20000000000 | 2603-10-11T11:33:20Z | 0000000027BC86AA | 65353130 | 353130 |
| seq | T | digest | mac |
|---|---|---|---|
| 1 | 1 | 6cd61375889ffa0b | 44e256b21a8a649325bc0e411e049f45 |
| 2 | 37037036 | edbcdf5108fb06f7 | 260c2e3d63510828b3714e034c9d383a |
| 3 | 37037037 | 473efb3fb6e79bec | c1ddec49506f8e556386f0cff4d7ba46 |
| 4 | 41152263 | 7da5aebe378d6144 | dc673ac6fc03c3ceee2058b029a6a2c5 |
| 5 | 66666666 | b20352a510905140 | e3c595af1a3906af6511edbdf0574fde |
| 6 | 666666666 | ecbac0e7cbf5f3ec | e19efccee63a8278db61ff4c08b7570c |
| seq | T | digest | mac |
|---|---|---|---|
| 1 | 1 | 40fdf812c2d8d342 | 100b1728be424e2f42a8005fff2b3035 |
| 2 | 37037036 | e85015ba83d941d4 | 459e24a8f390cd8352482e4c1ea395f6 |
| 3 | 37037037 | 49631a5028eda401 | 7335e0efb752ac3c6caf9ecbb52c864a |
| 4 | 41152263 | 37577bdb0a361084 | 194204acbbcb0ef8b4b3add75b1a9e68 |
| 5 | 66666666 | 14be20c848413dc4 | 4dcffc240108b425f856c794dd11d9d6 |
| 6 | 666666666 | a88648e1600b3dce | 4b636bbe283295ded27b896100e1ec59 |
The figures in this section come from a reproducible model and simulation run offline (networking disabled) on 30 November 2026, with seed 20261130 and 200000 Monte Carlo trials. They are labelled as exact arithmetic, a constant-rate clock model, or a simulation with stated assumptions. They are not measurements of a particular product or of a carrier network. The run also confirmed that all six SHA-1 8-digit Appendix B test values of [RFC6238] matched. A later, separate simulation of verifier behaviour is reported in Section 10.¶
Exact acceptance-window arithmetic, with X = 30 seconds:¶
Constant-rate isolated clock model (exact), time to a 15-second and 30-second offset:¶
Relative drift between an offline issuer or verifier and an offline device is |r_device - r_verifier| ppm. An NTP-synced server is modelled as 0 ppm against true time. If both offline clocks drift at 2 ppm in the same direction, the relative rate is 0 and they do not force a wider window. If they drift at 2 ppm in opposite directions, the relative rate is 4 ppm and they reach a 15-second offset in 43.403 days, which is sooner than a 2 ppm device against an NTP- synced server (86.806 days). An offline issuer is therefore more accurate only when the two clocks are closely matched.¶
A network-sync simulation assumed a daily healthy residual of Normal(0, 0.020 s) and, independently, bad jumps as a Poisson process with a mean of 2 events per year, each Uniform(15, 90) seconds in magnitude and random in sign, over 2000 traces of 50 years. No healthy-only trace exceeded 15 seconds. With jumps, the median time to the first offset of 15 seconds or more was 121 days (mean 177.81; analytic mean wait for the first jump is 182.62 days). These assumptions are not measured carrier data.¶
Replay simulations used a +/- 1 window and the following delay assumptions, which are not measured user behaviour: the view falls uniformly in the current step; the typist submits after Uniform(2, 12) s; a fast attacker submits after Uniform(0.5, 5) s; a slower attacker after Uniform(5, 25) s.¶
The measurable improvement is therefore detection of unviewed or wrong-step OTPs, and prevention only when the verifier implements enforce mode. The record does not, by itself, prevent acceptance, and it does not identify a copy of a code that was viewed.¶
This section reports a later local simulation of verifier behaviour, run offline on 30 November 2026 against the mechanisms in this document. The TOTP generator was checked first against the SHA-1, SHA-256, and SHA-512 8-digit Appendix B test values of [RFC6238] and against the 6-digit values and viewed-record digest and mac fields in Section 8. All of those vectors matched. The simulation used the Appendix B SHA-1 test token, 6-digit codes, X = 30, T0 = 0, a +/- 1 window, and Unix time 1111111111 (T = 37037037). It compared a plain RFC 6238 verifier, audit mode, and enforce mode. The Section 5.2 one-time-use rule was implemented in two ways: a naive check-then-update path, exercised with real threads and a barrier so that every thread passed the unused-step check before any thread updated (a forced race), and an atomic path in which the check and the update ran under a lock. The code is in the author's possession and can be made public. The run did not contact any live authentication service, and the numbers below are not measurements of a particular deployed verifier.¶
In the first scenario a user viewed C(T) and an attacker who intercepted that code submitted it from 10 parallel clients. The viewed record was authentic and covered T.¶
| Verifier | Accepted | Rejected | Flagged |
|---|---|---|---|
| RFC 6238 naive (forced race) | 10 | 0 | 0 |
| RFC 6238 atomic | 1 | 9 | 0 |
| Audit naive (forced race) | 10 | 0 | 0 |
| Audit atomic | 1 | 9 | 0 |
| Enforce naive (forced race) | 10 | 0 | 0 |
| Enforce atomic | 1 | 9 | 0 |
The nine rejections on the atomic rows are the Section 5.2 rule of [RFC6238], not the viewed-record check. Enforce mode did not close the forced race.¶
In the second scenario the device had viewed only T, and the attacker submitted the computed neighbour codes C(T-1) and C(T+1) in sequence.¶
| Verifier | Accepted | Rejected | Flagged |
|---|---|---|---|
| RFC 6238 atomic | 2 | 0 | 0 |
| Audit atomic | 2 | 0 | 2 |
| Enforce atomic | 0 | 2 | 0 |
The probability that N unique random 6-digit guesses hit at least one of k valid codes, without replacement, is 1 - C(10^6 - k, N) / C(10^6, N). The table below is that exact combinatorics; it is not a live guessing run against a verifier. A Monte Carlo of 20000 trials, N = 1000, seed 20261130, against the two unviewed neighbour codes, observed a hit rate of 0.00195, compared with the exact value 1.999000999001e-3. Because enforce mode rejected computed neighbour codes when those steps were not viewed, a correct guess of only C(T-1) or C(T+1) would also be rejected, and the remaining target, if T was viewed, is C(T) alone.¶
| N | P(2 unviewed neighbours) | P(any of 3 window codes) | P(C(T) only, enforce) |
|---|---|---|---|
| 1 | 2.000000000000e-6 | 3.000000000000e-6 | 1.000000000000e-6 |
| 10 | 1.999990999991e-5 | 2.999973000045e-5 | 1.000000000000e-5 |
| 100 | 1.999900999901e-4 | 2.999703009405e-4 | 1.000000000000e-4 |
| 1000 | 1.999000999001e-3 | 2.997003994008e-3 | 1.000000000000e-3 |
| 10000 | 1.990000990001e-2 | 2.970102940305e-2 | 1.000000000000e-2 |
| 100000 | 1.900000900001e-1 | 2.710002430004e-1 | 1.000000000000e-1 |
In the third scenario the attacker did not have the shared secret and submitted C(T-1) with a viewed record for T-1 whose digest and mac were computed under the wrong key. No authentic record was presented.¶
| Verifier | Accepted | Rejected | Flagged |
|---|---|---|---|
| RFC 6238 atomic | 1 | 0 | 0 |
| Audit atomic | 1 | 0 | 1 |
| Enforce atomic | 0 | 1 | 0 |
In the fourth scenario C(T) was submitted twice, with the authentic viewed record both times. Every verifier accepted the first submission and rejected the second (1 accepted, 1 rejected, 0 flagged). That rejection is the Section 5.2 rule of [RFC6238], which this document keeps; the viewed-record check was not what rejected the replay.¶
In the fifth scenario an attacker who held the shared secret computed C(T+1) and a valid covering MAC for step T+1. The device itself never viewed T+1. Every verifier, including enforce mode, accepted the attempt (1 accepted, 0 rejected, 0 flagged).¶
In the sixth scenario the user viewed C(T), the attacker submitted that code first, and the user submitted it afterwards. Every verifier accepted the attacker and rejected the user (1 accepted, 1 rejected, 0 flagged). Audit mode did not flag the attacker's accept, because the record covered T.¶
What the simulation showed the draft stops, in enforce mode only:¶
What it detects only, in audit mode, without changing acceptance: unviewed neighbour-step accepts, and an accept that carried a bad mac. Audit mode did not change accepted or rejected counts relative to RFC 6238 in any scenario that was run.¶
What it does not stop:¶
The optional transaction-binding extension in Section 5.4 was specified to close the first of those gaps when each authorisation has a distinct action or challenge. It was not itself part of the simulation, and this section does not report results for it.¶
This section reports two further sets of tests run on 30 November 2026. They test the one-time-use rule and the viewed-record check under parallel load. They do not measure any deployed service.¶
In the live runs a local test login site, listening only on the loopback address, verified standard TOTP (HMAC-SHA-1, six digits, X = 30 seconds, +/- 1 window) from a commercially available authenticator application. For each run the author supplied the code currently displayed by that application, and N clients submitted that same code at the same time. The "naive" verifier checked that the step was unused, paused for a deliberate 150 ms, and then recorded the step, so the race was made reliable on purpose. The "atomic" verifier performed the check and the update as one operation. The deliberate pause means these runs show what a non-atomic verifier can do, and do not show how often real servers have such a gap. An authenticator application of this kind does not write viewed records, so enforce mode was not exercised in the live runs.¶
| Verifier | Clients | Accepted | Rejected |
|---|---|---|---|
| Naive | 10 | 10 | 0 |
| Naive | 50 | 50 | 0 |
| Naive | 100 (run 1) | 100 | 0 |
| Naive | 100 (run 2) | 100 | 0 |
| Atomic | 10 (run 1) | 1 | 9 |
| Atomic | 10 (run 2) | 1 | 9 |
| Atomic | 50 | 1 | 49 |
| Atomic | 100 (run 1) | 1 | 99 |
| Atomic | 100 (run 2) | 1 | 99 |
Two further runs are excluded and are disclosed here for completeness. One atomic run of 10 clients rejected all ten because a stale code from an earlier run had been submitted. One naive run of 50 clients had connection resets because the test server's listen backlog was too small; the backlog was raised and the run was repeated with the results shown. Both naive and atomic verifiers also accepted codes from the adjacent steps inside the +/- 1 window, as [RFC6238] permits.¶
The pressure test ran in-process, with no network, against the verifier of Section 10, using a throwaway key, a fixed clock, 100 parallel clients released together by a barrier, and 200 trials per row. In the first part, a pause was inserted between the unused-step check and the update, and 100 clients submitted the same code.¶
| Pause | Trials with more than one accept | Accepted per trial (min / median / max) |
|---|---|---|
| none | 0 of 200 | 1 / 1 / 1 |
| 0.5 ms | 200 of 200 | 5 / 22 / 54 |
| 1 ms | 200 of 200 | 8 / 47 / 76 |
| 2 ms | 200 of 200 | 24 / 94.5 / 100 |
| 5 ms | 200 of 200 | 91 / 100 / 100 |
| 20 ms | 200 of 200 | 100 / 100 / 100 |
| Atomic control (20 ms pause ignored) | 0 of 200 | 1 / 1 / 1 |
The row with no pause is an artefact of how the interpreter schedules threads, which ran the check and the update without switching, and it is not evidence that a real verifier is safe at zero gap. Any pause of 0.5 ms or more allowed duplicate acceptance in every trial. Database round trips and remote calls commonly exceed that.¶
In the second part, enforce mode was run with 100 clients, 200 trials per row.¶
| Submission | Verifier | Accepted per trial |
|---|---|---|
| Viewed code with its authentic record | atomic | 1 in 200 of 200 trials |
| Viewed code with its authentic record | non-atomic, 2 ms pause | median 100 (minimum 21) |
| Viewed code with its authentic record | non-atomic, 20 ms pause | 100 |
| Unviewed neighbour codes C(T-1) and C(T+1), no record | atomic | 0 in 200 of 200 trials |
| Current code, no record | atomic | 0 in 200 of 200 trials |
| Current code with a record for a different step | atomic | 0 in 200 of 200 trials |
| Current code with a record forged under a wrong key | atomic | 0 in 200 of 200 trials |
| 1 viewed submission and 99 unviewed submissions of the same code | atomic | exactly 1 in 200 of 200 trials |
Enforce mode rejected every unviewed, wrong-step and forged-record submission in every trial under this load. It did not prevent concurrent acceptance of a genuinely viewed code on a non-atomic verifier, which is why Section 6.4 requires an atomic update. The tests used one machine and the author's own verifier implementation. They do not test a relay of a code that was viewed and then copied; that case is described in Section 13.¶
This section is to be removed before publishing as an RFC.¶
This section records the status of known implementations of the mechanism defined in this document at the time of posting, following [RFC7942]. It is to be removed before publication as an RFC.¶
Last Viewed is a trademark of YPS Services LLC.¶
The following combination is described only as an example of a microcontroller and a TCXO RTC that could be used to evaluate the Offline Time Source profile in a laboratory. It is not a Last Viewed product, it is not a claim that Last Viewed includes or qualifies this hardware, and it has not been measured under Section 4.3. Module layout, charging circuitry, and even the identity of the RTC and EEPROM ICs vary between vendors and MUST be verified on the board in hand.¶
The microcontroller example is a Raspberry Pi Pico H, Raspberry Pi order code SC0917 (also listed by some vendors as RP-SC0917), an RP2040 board with pre-soldered headers [PICO-DS]. The Pico H recommended operating conditions in that datasheet are a minimum of -20 degrees C and a maximum of +85 degrees C including self-heating, with a recommended maximum ambient of 70 degrees C. The Pico's own oscillator is not a battery-backed real-time clock and is not, by itself, a basis for claiming this profile. A qualifying local RTC would be added over I2C or a similar bus.¶
The RTC example is an Analog Devices / Maxim Integrated DS3231, an I2C RTC with an integrated TCXO and crystal [DS3231]. Figures in this paragraph are taken from the Maxim Integrated DS3231 datasheet, document 19-5170, Revision 10, March 2015. A later Analog Devices reprint, if any, has not been checked for this revision and SHOULD be verified by implementers. Headline accuracy in that datasheet is +/-2 ppm from 0 degrees C to +40 degrees C and +/-3.5 ppm from -40 degrees C to +85 degrees C. The frequency stability table, with the aging-offset register at 00h, is more specific: for the commercial device (DS3231S, 0 degrees C to +70 degrees C) the bound is +/-2 ppm from 0 degrees C to +40 degrees C and +/-3.5 ppm from above +40 degrees C to +70 degrees C; for the industrial device (DS3231SN, -40 degrees C to +85 degrees C) the bound is +/-3.5 ppm from -40 degrees C to below 0 degrees C, +/-2 ppm from 0 degrees C to +40 degrees C, and +/-3.5 ppm from above +40 degrees C to +85 degrees C. A declared D_max that uses the +/-2 ppm figure MUST state that it applies only over 0 degrees C to +40 degrees C. Crystal aging in the same table, after reflow and marked "not production tested", is +/-1.0 ppm for the first year and +/-5.0 ppm over 0-10 years; a declared D_max for a long service interval needs to take aging into account as well as the temperature-stability figure. Timekeeping battery current IBATT, with EOSC = 0, BBSQW = 0, EN32kHz = 1, and the I2C pins idle, is typically 0.84 microamperes and at most 3.0 microamperes at VBAT = 3.63 V, and typically 1.0 microamperes and at most 3.5 microamperes at VBAT = 5.5 V. A short temperature-conversion current IBATTC of at most 575 microamperes at VBAT = 3.63 V (650 microamperes at 5.5 V) is specified separately; the datasheet's IBATT maximum is the figure to use for average timekeeping budget. This document does not convert those currents into a battery-life in years; life is estimated from the cell datasheet's capacity and from IBATT, and any such estimate is to be verified for the cell and module used.¶
Typical inexpensive "DS3231 Precision Memory" modules sold for use with Arduino or Raspberry Pi boards also carry a 32-kbit I2C EEPROM, commonly an AT24C32 or compatible part, which can store viewed records on the device. The presence, type, and capacity of that EEPROM are properties of the module, not of the DS3231, and are to be verified on the board in hand. Many such modules also include a crude charging path (often a resistor and a diode) aimed at a rechargeable LIR2032 cell. That path can damage a non-rechargeable CR2032. An implementer MUST use a cell type the module is actually designed for, or MUST disable the charging path, and MUST NOT assume that the Analog DS3231 datasheet specifies this module circuitry. Whether a particular board has the path, and whether the IC is a genuine DS3231 rather than a substitute with a looser accuracy class, is to be verified.¶
The security of the TOTP value remains that of [RFC6238] and [RFC4226]. This section considers only the additions in this document.¶
The viewed record detects; it does not prevent, unless the verifier implements enforce mode and actually receives an authentic record at validation time. Audit mode is a retrospective control. A deployment that only stores records on the prover, and never compares them, does not change the attack surface of [RFC6238].¶
This document assumes that the displayed OTP is visible only to the user. Where an observer or interceptor can copy an OTP while it is displayed, the viewed record for that OTP is genuine and a verifier in enforce mode accepts whichever party submits it first. This document does not claim to prevent that. It does ensure that the OTP is accepted once, and the rejection of the legitimate user's own attempt is then a visible collision rather than a silent second acceptance. The parallel-client runs in Section 11 model an interceptor on purpose, as a worst-case stress test, and are not the expected condition.¶
A shoulder-surf or other copy of an OTP that the prover did record as viewed is not distinguishable, from the record alone, from the user's own use of that OTP. The simulation in Section 10 confirmed that enforce mode accepted the first submission of a viewed code, including a submission that arrived before the user's. The optional transaction-binding extension in Section 5.4 is intended to reject a copy that is presented for a different action or session; it does not reject the first use of a correctly bound record for the same action. The Section 5.2 rule in [RFC6238] remains the control that stops the same OTP being accepted twice at that verifier after a first success.¶
That one-time-use rule MUST be applied atomically, as required in Section 6.4. A check-then-update implementation can accept several concurrent submissions of the same OTP. The simulation forced that race and observed ten accepts out of ten, including in enforce mode. Transaction binding does not remove the requirement for submissions of the same (OTP, action) pair.¶
Record tampering: an attacker who can append or alter records without K cannot forge a valid digest or mac. An attacker who has K can forge records and TOTP values; protection of K is therefore essential and is out of scope of this document, as it is of [RFC6238]. The simulation confirmed that an attacker who held K and forged both a neighbour-step code and a covering MAC was accepted in enforce mode. Implementations SHOULD treat a record with a missing or invalid mac as unauthenticated. Sequence numbers detect gaps but do not, by themselves, prove that a missing view did not occur on a different device that shares K.¶
Clock tampering: an attacker who can set the prover's local clock can shift T and the viewed timestamp. The Offline Time Source profile reduces dependence on a network time protocol and on sudden network time jumps, but it does not prevent physical or software attacks on the local clock. A low or missing backup supply MUST be treated as making the clock untrusted until resynchronisation, as in Section 4.5. Setting the clock SHOULD require an additional authentication measure when the offset is large, as in Section 6 of [RFC6238] and in Section 4.2. Verifiers SHOULD NOT widen the acceptance window beyond what Section 5.2 of [RFC6238] recommends without understanding the added exposure (more simultaneously valid codes and a longer acceptance period for each code).¶
Reference Device compromise: an attacker who can issue authentic signed time messages, because they hold the Reference Device's signing key or have replaced the device, can shift the clocks of provers that trust it. Mitigation is the same additional authentication measure for large offsets, plus the ranking and freshness rules in Section 4.6.4, and protection of the provisioning of the reference's public or MAC key. Unauthenticated peer-to-peer time copy, including following a peer with a longer reported battery life, can propagate a single compromised or wrong clock and MUST NOT be used as a trusted reference.¶
Shared-secret storage, provisioning, and the design of any particular hardware token are out of scope. Keys SHOULD still be generated and protected as recommended in [RFC6238].¶
A viewed record is a log of authentication activity: it shows that a particular account's OTP was displayed or copied at a particular local time. An action identifier can additionally associate that event with a transaction or session. Implementations SHOULD keep records on the prover by default, export them only with user or administrator action, and retain them only as long as needed for the agreed audit or enforce policy. Account labels and other identifiers SHOULD be omitted from exported records unless required. When transaction binding is used, exported records SHOULD carry a digest or a verifier-supplied challenge, not plaintext amounts, destinations, or account numbers. Verifiers that receive records SHOULD apply the same retention limits as for other authentication logs. See also [RFC6973].¶
This document has no IANA actions.¶
This document builds on [RFC6238] by D. M'Raihi, S. Machani, M. Pei, and J. Rydell, and on [RFC4226] by D. M'Raihi, M. Bellare, F. Hoornaert, D. Naccache, and O. Ranen. Errors of interpretation remain the author's.¶