RotatingBarcode

JSON 表示法
{
  "type": enum (BarcodeType),
  "renderEncoding": enum (BarcodeRenderEncoding),
  "valuePattern": string,
  "totpDetails": {
    object (TotpDetails)
  },
  "alternateText": string,
  "showCodeText": {
    object (LocalizedString)
  },
  "initialRotatingBarcodeValues": {
    object (RotatingBarcodeValues)
  }
}
字段
type

enum (BarcodeType)

此条形码的类型。

renderEncoding

enum (BarcodeRenderEncoding)

条形码的呈现编码。指定后,条形码以给定编码呈现。否则,Google 将选择最佳已知编码。

valuePattern

string

字符串编码的条形码值。此字符串支持以下替换:* {totp_value_n}:替换为 TOTP 值(请参阅 TotpDetails.parameters)。* {totp_timestamp_millis}:替换为生成条形码的时间戳(自纪元以来的毫秒数)。* {totp_timestamp_seconds}:替换为生成条形码的时间戳(自纪元起经过的秒数)。

totpDetails

object (TotpDetails)

用于评估 {totp_value_n} 替换项的详细信息。

alternateText

string

可选文本,将替换条形码下显示的默认文本。此字段适用于条形码值的人类可读等效项,在无法扫描条形码时使用。

showCodeText

object (LocalizedString)

当条形码隐藏在点击操作后时显示的可选文本。如果卡券启用了智能触碰功能,就会发生这种情况。如果未指定,则由 Google 选择默认值。

initialRotatingBarcodeValues

object (RotatingBarcodeValues)

仅限输入。注意:此功能仅适用于公交类别。一组可选的初始轮替条形码值。这样就能在对象中包含一小部分条形码。必须使用 UploadRotatingBarcodeValues 端点上传后续旋转的条形码值。

TotpDetails

基于时间的动态密码替换的配置。请参阅 https://tools.ietf.org/html/rfc6238

JSON 表示法
{
  "periodMillis": string,
  "algorithm": enum (TotpAlgorithm),
  "parameters": [
    {
      object (TotpParameters)
    }
  ]
}
字段
periodMillis

string (int64 format)

用于生成 TOTP 值的时间间隔,以毫秒为单位。

algorithm

enum (TotpAlgorithm)

用于生成动态密码的 TOTP 算法。

parameters[]

object (TotpParameters)

每个 {totp_value_*} 替换的 TOTP 参数。索引 n 处的 TotpParameters 用于 {totp_value_n} 替换。

TotpAlgorithm

枚举
TOTP_ALGORITHM_UNSPECIFIED
TOTP_SHA1 RFC 6238 中的 TOTP 算法,带 SHA1 哈希函数

TotpParameters

键和值长度的配置。请参阅 https://www.rfc-editor.org/rfc/rfc4226#section-5.3

JSON 表示法
{
  "key": string,
  "valueLength": integer
}
字段
key

string

用于生成 TOTP 值的密钥,以 Base16 字符串编码。

valueLength

integer

TOTP 值的长度(以十进制数表示)。

RotatingBarcodeValues

包含许多条形码值和开始日期/时间的载荷。

JSON 表示法
{
  "startDateTime": string,
  "values": [
    string
  ],
  "periodMillis": string
}
字段
startDateTime

string

必需。第一个条形码的生效日期/时间。系统将使用对象的 RotatingBarcodeValueInfo 上定义的 periodMillis 来旋转条形码。

这是 ISO 8601 扩展格式的日期/时间,带有偏移量。时间最高可指定到纳秒级精度。偏移可以按秒精度指定(即使 ISO 8601 中不包含偏移秒数)。

例如:

1985-04-12T23:20:50.52Z 表示世界协调时间 (UTC) 1985 年 4 月 12 日 23 时 20 分 50.52 秒。

1985-04-12T19:20:50.52-04:00 表示 1985 年 4 月 12 日 19 小时之后 20 分 50.52 秒,比世界协调时间 (UTC) 早 4 小时(与上述示例的时间相同)。如果活动地点为纽约,则此时间相当于美国东部夏令时 (EDT)。请注意,在采用夏令时的地区,偏移量会有所不同,具体取决于处于一年中的哪个时段。

values[]

string

必需。要在条形码中编码的值。必须至少提供一个值。

periodMillis

string (int64 format)

必需。每个条形码的有效期。