First working version

This commit is contained in:
2021-11-25 17:55:49 +08:00
commit 7f899a57a8
23 changed files with 1628 additions and 0 deletions

View File

@@ -0,0 +1,109 @@
from base64 import (
b32encode,
b64decode,
)
from collections.abc import Generator
from typing import (
Any,
Dict,
List,
Union,
)
from urllib.parse import (
ParseResult,
parse_qs,
quote,
urlencode,
urlparse,
)
from .otpauth_enums import (
Algorithm,
DigitCount,
OtpType,
)
from .otpauth_migration_pb2 import Payload
SCHEME = 'otpauth-migration'
HOSTNAME = 'offline'
PAYLOAD_MARK = 'data'
EXAMPLE_PAYLOAD = 'CjEKCkhlbGxvId6tvu8SGEV4YW1wbGU6YWxpY2VAZ29vZ2xlLmNvbRoHRXhhbXBsZTAC'
EXAMPLE_MIGRATION = f'{SCHEME}://{HOSTNAME}?{PAYLOAD_MARK}={EXAMPLE_PAYLOAD}'
def is_migration_incorrect(
*,
parsed_url: ParseResult,
parsed_qs: Dict[str, Any],
) -> bool:
return (
parsed_url.scheme != SCHEME
or parsed_url.hostname != HOSTNAME
or PAYLOAD_MARK not in parsed_qs
or not isinstance(parsed_qs[PAYLOAD_MARK], list)
)
def decoded_data(data: List[str]) -> Generator:
for data_item in data:
yield b64decode(data_item)
def decode_secret(secret: bytes) -> str:
return str(b32encode(secret), 'utf-8').replace('=', '')
def get_url_params(otp: Payload.OtpParameters) -> str:
params: dict[str, Union[str, int]] = {}
if otp.algorithm:
params.update(algorithm=Algorithm.get(otp.algorithm, ''))
if otp.digits:
params.update(digits=DigitCount.get(otp.digits, ''))
if otp.issuer:
params.update(issuer=otp.issuer)
if otp.secret:
otp_secret = decode_secret(otp.secret)
params.update(secret=otp_secret)
return urlencode(params)
def get_otpauth_url(otp: Payload.OtpParameters) -> str:
otp_type = OtpType.get(otp.type, '')
otp_name = quote(otp.name)
otp_params = get_url_params(otp)
return f'otpauth://{otp_type}/{otp_name}?{otp_params}'
def validate_migration(migration: str) -> list:
url: ParseResult = urlparse(migration)
qs: Dict[str, Any] = parse_qs(url.query)
return qs[PAYLOAD_MARK]
def decoder(migration_data: list) -> list:
"""Convert Google Authenticator data to plain otpauth links"""
result = []
for payload in decoded_data(data=migration_data):
migration_payload = Payload()
migration_payload.ParseFromString(payload)
for otp_item in migration_payload.otp_parameters:
result.append(get_otpauth_url(otp_item))
return result
def start_decode_migration(migration_code: str) -> list:
payload_list = validate_migration(migration_code)
results = decoder(payload_list)
return results
if __name__ == "__main__":
start_decode_migration("otpauth-migration://offline?data=CkAKFFUlyp7lQLXJnL8Oc5%2BjVRVCEIMPEhpHb29nbGU6cHVha2Foa2luQGdtYWlsLmNvbRoGR29vZ2xlIAEoATACCj0KFEMSL8awHj%2BEFzX2cODi9rNgfvPFEhdHb29nbGU6a2Foa2luQGdtYWlsLmNvbRoGR29vZ2xlIAEoATACCi8KEBdHlsAmppdFyWD18FyPcQkSDXNhbXVlbEBhcG9sbG8aBmFwb2xsbyABKAEwAgouChQpi9Btg%2BHoQJj6tilYEsOef%2BSkiRIQc2FtdWVsQGFwaHJvZGl0ZSABKAEwAgo1ChDnUjGxj%2BJmsJJxdcrbBNpqEhBzYW11ZWxAc2FtdWVscHVhGglzYW11ZWxwdWEgASgBMAIKUAoUihAclMtkwYi3NfvbkHcHmgAi2yESJmdpdGxhYi5jb206Z2l0bGFiLmNvbV9rYWhraW5AZ21haWwuY29tGgpnaXRsYWIuY29tIAEoATACCioKCsaExzWrYHtcsLoSDkdpdEh1Yjp0ZWxib29uGgZHaXRIdWIgASgBMAIKbwooyfRfWMXsY%2B%2B%2FVvZKl9ypsl1VLAZrOPmyr3AsGxeCOuTHmGdGpt4OyBIoQW1hem9uIFdlYiBTZXJ2aWNlczp0ZWxib29uQDI2Nzk5NDAyOTgxMBoTQW1hem9uIFdlYiBTZXJ2aWNlcyABKAEwAgp%2FCiieutAtJJdKrtOMVznsVaMbvrpM%2FNvwURQSChMpPzgI2PlVshsoRk3QEjhBbWF6b24gV2ViIFNlcnZpY2VzOnJvb3QtYWNjb3VudC1tZmEtZGV2aWNlQDI2Nzk5NDAyOTgxMBoTQW1hem9uIFdlYiBTZXJ2aWNlcyABKAEwAgozCgr2b4%2BKdfJzdo%2ByEhRzYW11ZWxAd2F0Y2h0b3dyLmNvbRoJTWljcm9zb2Z0IAEoATACEAEYAiAAKKessZb6%2F%2F%2F%2F%2FwE%3D")

View File

@@ -0,0 +1,37 @@
syntax = "proto3";
package otpauth_migration;
message Payload {
enum Algorithm {
ALGORITHM_UNSPECIFIED = 0;
ALGORITHM_SHA1 = 1;
ALGORITHM_SHA256 = 2;
ALGORITHM_SHA512 = 3;
ALGORITHM_MD5 = 4;
}
enum DigitCount {
DIGIT_COUNT_UNSPECIFIED = 0;
DIGIT_COUNT_SIX = 1;
DIGIT_COUNT_EIGHT = 2;
}
enum OtpType {
OTP_TYPE_UNSPECIFIED = 0;
OTP_TYPE_HOTP = 1;
OTP_TYPE_TOTP = 2;
}
message OtpParameters {
bytes secret = 1;
string name = 2;
string issuer = 3;
Algorithm algorithm = 4;
DigitCount digits = 5;
OtpType type = 6;
int64 counter = 7;
}
repeated OtpParameters otp_parameters = 1;
int32 version = 2;
int32 batch_size = 3;
int32 batch_index = 4;
int32 batch_id = 5;
}

View File

@@ -0,0 +1,19 @@
from typing import Mapping
Algorithm: Mapping[int, str] = {
1: 'SHA1',
2: 'SHA256',
3: 'SHA512',
4: 'MD5',
}
DigitCount: Mapping[int, str] = {
1: '6',
2: '8',
}
OtpType: Mapping[int, str] = {
1: 'hotp',
2: 'totp',
}

View File

@@ -0,0 +1,290 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: otpauth-migration.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='otpauth-migration.proto',
package='otpauth_migration',
syntax='proto3',
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x17otpauth-migration.proto\x12\x11otpauth_migration\"\xa7\x05\n\x07Payload\x12@\n\x0eotp_parameters\x18\x01 \x03(\x0b\x32(.otpauth_migration.Payload.OtpParameters\x12\x0f\n\x07version\x18\x02 \x01(\x05\x12\x12\n\nbatch_size\x18\x03 \x01(\x05\x12\x13\n\x0b\x62\x61tch_index\x18\x04 \x01(\x05\x12\x10\n\x08\x62\x61tch_id\x18\x05 \x01(\x05\x1a\xf0\x01\n\rOtpParameters\x12\x0e\n\x06secret\x18\x01 \x01(\x0c\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0e\n\x06issuer\x18\x03 \x01(\t\x12\x37\n\talgorithm\x18\x04 \x01(\x0e\x32$.otpauth_migration.Payload.Algorithm\x12\x35\n\x06\x64igits\x18\x05 \x01(\x0e\x32%.otpauth_migration.Payload.DigitCount\x12\x30\n\x04type\x18\x06 \x01(\x0e\x32\".otpauth_migration.Payload.OtpType\x12\x0f\n\x07\x63ounter\x18\x07 \x01(\x03\"y\n\tAlgorithm\x12\x19\n\x15\x41LGORITHM_UNSPECIFIED\x10\x00\x12\x12\n\x0e\x41LGORITHM_SHA1\x10\x01\x12\x14\n\x10\x41LGORITHM_SHA256\x10\x02\x12\x14\n\x10\x41LGORITHM_SHA512\x10\x03\x12\x11\n\rALGORITHM_MD5\x10\x04\"U\n\nDigitCount\x12\x1b\n\x17\x44IGIT_COUNT_UNSPECIFIED\x10\x00\x12\x13\n\x0f\x44IGIT_COUNT_SIX\x10\x01\x12\x15\n\x11\x44IGIT_COUNT_EIGHT\x10\x02\"I\n\x07OtpType\x12\x18\n\x14OTP_TYPE_UNSPECIFIED\x10\x00\x12\x11\n\rOTP_TYPE_HOTP\x10\x01\x12\x11\n\rOTP_TYPE_TOTP\x10\x02\x62\x06proto3'
)
_PAYLOAD_ALGORITHM = _descriptor.EnumDescriptor(
name='Algorithm',
full_name='otpauth_migration.Payload.Algorithm',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='ALGORITHM_UNSPECIFIED', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ALGORITHM_SHA1', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ALGORITHM_SHA256', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ALGORITHM_SHA512', index=3, number=3,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ALGORITHM_MD5', index=4, number=4,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=447,
serialized_end=568,
)
_sym_db.RegisterEnumDescriptor(_PAYLOAD_ALGORITHM)
_PAYLOAD_DIGITCOUNT = _descriptor.EnumDescriptor(
name='DigitCount',
full_name='otpauth_migration.Payload.DigitCount',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='DIGIT_COUNT_UNSPECIFIED', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='DIGIT_COUNT_SIX', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='DIGIT_COUNT_EIGHT', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=570,
serialized_end=655,
)
_sym_db.RegisterEnumDescriptor(_PAYLOAD_DIGITCOUNT)
_PAYLOAD_OTPTYPE = _descriptor.EnumDescriptor(
name='OtpType',
full_name='otpauth_migration.Payload.OtpType',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='OTP_TYPE_UNSPECIFIED', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='OTP_TYPE_HOTP', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='OTP_TYPE_TOTP', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=657,
serialized_end=730,
)
_sym_db.RegisterEnumDescriptor(_PAYLOAD_OTPTYPE)
_PAYLOAD_OTPPARAMETERS = _descriptor.Descriptor(
name='OtpParameters',
full_name='otpauth_migration.Payload.OtpParameters',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='secret', full_name='otpauth_migration.Payload.OtpParameters.secret', index=0,
number=1, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=b"",
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='name', full_name='otpauth_migration.Payload.OtpParameters.name', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='issuer', full_name='otpauth_migration.Payload.OtpParameters.issuer', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='algorithm', full_name='otpauth_migration.Payload.OtpParameters.algorithm', index=3,
number=4, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='digits', full_name='otpauth_migration.Payload.OtpParameters.digits', index=4,
number=5, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='type', full_name='otpauth_migration.Payload.OtpParameters.type', index=5,
number=6, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='counter', full_name='otpauth_migration.Payload.OtpParameters.counter', index=6,
number=7, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=205,
serialized_end=445,
)
_PAYLOAD = _descriptor.Descriptor(
name='Payload',
full_name='otpauth_migration.Payload',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='otp_parameters', full_name='otpauth_migration.Payload.otp_parameters', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='version', full_name='otpauth_migration.Payload.version', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='batch_size', full_name='otpauth_migration.Payload.batch_size', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='batch_index', full_name='otpauth_migration.Payload.batch_index', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='batch_id', full_name='otpauth_migration.Payload.batch_id', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[_PAYLOAD_OTPPARAMETERS, ],
enum_types=[
_PAYLOAD_ALGORITHM,
_PAYLOAD_DIGITCOUNT,
_PAYLOAD_OTPTYPE,
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=51,
serialized_end=730,
)
_PAYLOAD_OTPPARAMETERS.fields_by_name['algorithm'].enum_type = _PAYLOAD_ALGORITHM
_PAYLOAD_OTPPARAMETERS.fields_by_name['digits'].enum_type = _PAYLOAD_DIGITCOUNT
_PAYLOAD_OTPPARAMETERS.fields_by_name['type'].enum_type = _PAYLOAD_OTPTYPE
_PAYLOAD_OTPPARAMETERS.containing_type = _PAYLOAD
_PAYLOAD.fields_by_name['otp_parameters'].message_type = _PAYLOAD_OTPPARAMETERS
_PAYLOAD_ALGORITHM.containing_type = _PAYLOAD
_PAYLOAD_DIGITCOUNT.containing_type = _PAYLOAD
_PAYLOAD_OTPTYPE.containing_type = _PAYLOAD
DESCRIPTOR.message_types_by_name['Payload'] = _PAYLOAD
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Payload = _reflection.GeneratedProtocolMessageType('Payload', (_message.Message,), {
'OtpParameters' : _reflection.GeneratedProtocolMessageType('OtpParameters', (_message.Message,), {
'DESCRIPTOR' : _PAYLOAD_OTPPARAMETERS,
'__module__' : 'otpauth_migration_pb2'
# @@protoc_insertion_point(class_scope:otpauth_migration.Payload.OtpParameters)
})
,
'DESCRIPTOR' : _PAYLOAD,
'__module__' : 'otpauth_migration_pb2'
# @@protoc_insertion_point(class_scope:otpauth_migration.Payload)
})
_sym_db.RegisterMessage(Payload)
_sym_db.RegisterMessage(Payload.OtpParameters)
# @@protoc_insertion_point(module_scope)

View File

@@ -0,0 +1,111 @@
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.containers
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import typing
import typing_extensions
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ...
class Payload(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor = ...
class Algorithm(metaclass=_Algorithm):
V = typing.NewType('V', builtins.int)
ALGORITHM_UNSPECIFIED = Payload.Algorithm.V(0)
ALGORITHM_SHA1 = Payload.Algorithm.V(1)
ALGORITHM_SHA256 = Payload.Algorithm.V(2)
ALGORITHM_SHA512 = Payload.Algorithm.V(3)
ALGORITHM_MD5 = Payload.Algorithm.V(4)
class _Algorithm(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[Algorithm.V], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ...
ALGORITHM_UNSPECIFIED = Payload.Algorithm.V(0)
ALGORITHM_SHA1 = Payload.Algorithm.V(1)
ALGORITHM_SHA256 = Payload.Algorithm.V(2)
ALGORITHM_SHA512 = Payload.Algorithm.V(3)
ALGORITHM_MD5 = Payload.Algorithm.V(4)
class DigitCount(metaclass=_DigitCount):
V = typing.NewType('V', builtins.int)
DIGIT_COUNT_UNSPECIFIED = Payload.DigitCount.V(0)
DIGIT_COUNT_SIX = Payload.DigitCount.V(1)
DIGIT_COUNT_EIGHT = Payload.DigitCount.V(2)
class _DigitCount(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[DigitCount.V], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ...
DIGIT_COUNT_UNSPECIFIED = Payload.DigitCount.V(0)
DIGIT_COUNT_SIX = Payload.DigitCount.V(1)
DIGIT_COUNT_EIGHT = Payload.DigitCount.V(2)
class OtpType(metaclass=_OtpType):
V = typing.NewType('V', builtins.int)
OTP_TYPE_UNSPECIFIED = Payload.OtpType.V(0)
OTP_TYPE_HOTP = Payload.OtpType.V(1)
OTP_TYPE_TOTP = Payload.OtpType.V(2)
class _OtpType(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[OtpType.V], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor = ...
OTP_TYPE_UNSPECIFIED = Payload.OtpType.V(0)
OTP_TYPE_HOTP = Payload.OtpType.V(1)
OTP_TYPE_TOTP = Payload.OtpType.V(2)
class OtpParameters(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor = ...
SECRET_FIELD_NUMBER: builtins.int
NAME_FIELD_NUMBER: builtins.int
ISSUER_FIELD_NUMBER: builtins.int
ALGORITHM_FIELD_NUMBER: builtins.int
DIGITS_FIELD_NUMBER: builtins.int
TYPE_FIELD_NUMBER: builtins.int
COUNTER_FIELD_NUMBER: builtins.int
secret: builtins.bytes = ...
name: typing.Text = ...
issuer: typing.Text = ...
algorithm: global___Payload.Algorithm.V = ...
digits: global___Payload.DigitCount.V = ...
type: global___Payload.OtpType.V = ...
counter: builtins.int = ...
def __init__(self,
*,
secret : builtins.bytes = ...,
name : typing.Text = ...,
issuer : typing.Text = ...,
algorithm : global___Payload.Algorithm.V = ...,
digits : global___Payload.DigitCount.V = ...,
type : global___Payload.OtpType.V = ...,
counter : builtins.int = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal[u"algorithm",b"algorithm",u"counter",b"counter",u"digits",b"digits",u"issuer",b"issuer",u"name",b"name",u"secret",b"secret",u"type",b"type"]) -> None: ...
OTP_PARAMETERS_FIELD_NUMBER: builtins.int
VERSION_FIELD_NUMBER: builtins.int
BATCH_SIZE_FIELD_NUMBER: builtins.int
BATCH_INDEX_FIELD_NUMBER: builtins.int
BATCH_ID_FIELD_NUMBER: builtins.int
version: builtins.int = ...
batch_size: builtins.int = ...
batch_index: builtins.int = ...
batch_id: builtins.int = ...
@property
def otp_parameters(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Payload.OtpParameters]: ...
def __init__(self,
*,
otp_parameters : typing.Optional[typing.Iterable[global___Payload.OtpParameters]] = ...,
version : builtins.int = ...,
batch_size : builtins.int = ...,
batch_index : builtins.int = ...,
batch_id : builtins.int = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal[u"batch_id",b"batch_id",u"batch_index",b"batch_index",u"batch_size",b"batch_size",u"otp_parameters",b"otp_parameters",u"version",b"version"]) -> None: ...
global___Payload = Payload