Generate protobuf classes for Google Authenticator import

This commit is contained in:
Bubka 2022-05-25 09:10:34 +02:00
parent f2b7664a2f
commit 5940cbf93f
11 changed files with 692 additions and 0 deletions

View File

@ -0,0 +1,24 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: GoogleAuth.proto
namespace App\Protobuf\GPBMetadata;
class GoogleAuth
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
$pool->internalAddGeneratedFile(hex2bin(
"0af5050a10476f6f676c65417574682e70726f746f12176170702e50726f746f6275662e476f6f676c654175746822bf050a075061796c6f616412460a0e6f74705f706172616d657465727318012003280b322e2e6170702e50726f746f6275662e476f6f676c65417574682e5061796c6f61642e4f7470506172616d6574657273120f0a0776657273696f6e18022001280512120a0a62617463685f73697a6518032001280512130a0b62617463685f696e64657818042001280512100a0862617463685f69641805200128051a82020a0d4f7470506172616d6574657273120e0a0673656372657418012001280c120c0a046e616d65180220012809120e0a06697373756572180320012809123d0a09616c676f726974686d18042001280e322a2e6170702e50726f746f6275662e476f6f676c65417574682e5061796c6f61642e416c676f726974686d123b0a0664696769747318052001280e322b2e6170702e50726f746f6275662e476f6f676c65417574682e5061796c6f61642e4469676974436f756e7412360a047479706518062001280e32282e6170702e50726f746f6275662e476f6f676c65417574682e5061796c6f61642e4f747054797065120f0a07636f756e74657218072001280322790a09416c676f726974686d12190a15414c474f524954484d5f554e535045434946494544100012120a0e414c474f524954484d5f53484131100112140a10414c474f524954484d5f534841323536100212140a10414c474f524954484d5f534841353132100312110a0d414c474f524954484d5f4d4435100422550a0a4469676974436f756e74121b0a1744494749545f434f554e545f554e535045434946494544100012130a0f44494749545f434f554e545f534958100112150a1144494749545f434f554e545f4549474854100222490a074f74705479706512180a144f54505f545950455f554e535045434946494544100012110a0d4f54505f545950455f484f5450100112110a0d4f54505f545950455f544f54501002620670726f746f33"
), true);
static::$is_initialized = true;
}
}

View File

@ -0,0 +1,37 @@
syntax = "proto3";
package app.Protobuf.GoogleAuth;
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,166 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: GoogleAuth.proto
namespace App\Protobuf\GoogleAuth;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>app.Protobuf.GoogleAuth.Payload</code>
*/
class Payload extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>repeated .app.Protobuf.GoogleAuth.Payload.OtpParameters otp_parameters = 1;</code>
*/
private $otp_parameters;
/**
* Generated from protobuf field <code>int32 version = 2;</code>
*/
protected $version = 0;
/**
* Generated from protobuf field <code>int32 batch_size = 3;</code>
*/
protected $batch_size = 0;
/**
* Generated from protobuf field <code>int32 batch_index = 4;</code>
*/
protected $batch_index = 0;
/**
* Generated from protobuf field <code>int32 batch_id = 5;</code>
*/
protected $batch_id = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \App\Protobuf\GoogleAuth\Payload\OtpParameters[]|\Google\Protobuf\Internal\RepeatedField $otp_parameters
* @type int $version
* @type int $batch_size
* @type int $batch_index
* @type int $batch_id
* }
*/
public function __construct($data = NULL) {
\App\Protobuf\GPBMetadata\GoogleAuth::initOnce();
parent::__construct($data);
}
/**
* Generated from protobuf field <code>repeated .app.Protobuf.GoogleAuth.Payload.OtpParameters otp_parameters = 1;</code>
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getOtpParameters()
{
return $this->otp_parameters;
}
/**
* Generated from protobuf field <code>repeated .app.Protobuf.GoogleAuth.Payload.OtpParameters otp_parameters = 1;</code>
* @param \App\Protobuf\GoogleAuth\Payload\OtpParameters[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOtpParameters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \App\Protobuf\GoogleAuth\Payload\OtpParameters::class);
$this->otp_parameters = $arr;
return $this;
}
/**
* Generated from protobuf field <code>int32 version = 2;</code>
* @return int
*/
public function getVersion()
{
return $this->version;
}
/**
* Generated from protobuf field <code>int32 version = 2;</code>
* @param int $var
* @return $this
*/
public function setVersion($var)
{
GPBUtil::checkInt32($var);
$this->version = $var;
return $this;
}
/**
* Generated from protobuf field <code>int32 batch_size = 3;</code>
* @return int
*/
public function getBatchSize()
{
return $this->batch_size;
}
/**
* Generated from protobuf field <code>int32 batch_size = 3;</code>
* @param int $var
* @return $this
*/
public function setBatchSize($var)
{
GPBUtil::checkInt32($var);
$this->batch_size = $var;
return $this;
}
/**
* Generated from protobuf field <code>int32 batch_index = 4;</code>
* @return int
*/
public function getBatchIndex()
{
return $this->batch_index;
}
/**
* Generated from protobuf field <code>int32 batch_index = 4;</code>
* @param int $var
* @return $this
*/
public function setBatchIndex($var)
{
GPBUtil::checkInt32($var);
$this->batch_index = $var;
return $this;
}
/**
* Generated from protobuf field <code>int32 batch_id = 5;</code>
* @return int
*/
public function getBatchId()
{
return $this->batch_id;
}
/**
* Generated from protobuf field <code>int32 batch_id = 5;</code>
* @param int $var
* @return $this
*/
public function setBatchId($var)
{
GPBUtil::checkInt32($var);
$this->batch_id = $var;
return $this;
}
}

View File

@ -0,0 +1,66 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: GoogleAuth.proto
namespace App\Protobuf\GoogleAuth\Payload;
use UnexpectedValueException;
/**
* Protobuf type <code>app.Protobuf.GoogleAuth.Payload.Algorithm</code>
*/
class Algorithm
{
/**
* Generated from protobuf enum <code>ALGORITHM_UNSPECIFIED = 0;</code>
*/
const ALGORITHM_UNSPECIFIED = 0;
/**
* Generated from protobuf enum <code>ALGORITHM_SHA1 = 1;</code>
*/
const ALGORITHM_SHA1 = 1;
/**
* Generated from protobuf enum <code>ALGORITHM_SHA256 = 2;</code>
*/
const ALGORITHM_SHA256 = 2;
/**
* Generated from protobuf enum <code>ALGORITHM_SHA512 = 3;</code>
*/
const ALGORITHM_SHA512 = 3;
/**
* Generated from protobuf enum <code>ALGORITHM_MD5 = 4;</code>
*/
const ALGORITHM_MD5 = 4;
private static $valueToName = [
self::ALGORITHM_UNSPECIFIED => 'ALGORITHM_UNSPECIFIED',
self::ALGORITHM_SHA1 => 'ALGORITHM_SHA1',
self::ALGORITHM_SHA256 => 'ALGORITHM_SHA256',
self::ALGORITHM_SHA512 => 'ALGORITHM_SHA512',
self::ALGORITHM_MD5 => 'ALGORITHM_MD5',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Algorithm::class, \App\Protobuf\GoogleAuth\Payload_Algorithm::class);

View File

@ -0,0 +1,56 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: GoogleAuth.proto
namespace App\Protobuf\GoogleAuth\Payload;
use UnexpectedValueException;
/**
* Protobuf type <code>app.Protobuf.GoogleAuth.Payload.DigitCount</code>
*/
class DigitCount
{
/**
* Generated from protobuf enum <code>DIGIT_COUNT_UNSPECIFIED = 0;</code>
*/
const DIGIT_COUNT_UNSPECIFIED = 0;
/**
* Generated from protobuf enum <code>DIGIT_COUNT_SIX = 1;</code>
*/
const DIGIT_COUNT_SIX = 1;
/**
* Generated from protobuf enum <code>DIGIT_COUNT_EIGHT = 2;</code>
*/
const DIGIT_COUNT_EIGHT = 2;
private static $valueToName = [
self::DIGIT_COUNT_UNSPECIFIED => 'DIGIT_COUNT_UNSPECIFIED',
self::DIGIT_COUNT_SIX => 'DIGIT_COUNT_SIX',
self::DIGIT_COUNT_EIGHT => 'DIGIT_COUNT_EIGHT',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(DigitCount::class, \App\Protobuf\GoogleAuth\Payload_DigitCount::class);

View File

@ -0,0 +1,223 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: GoogleAuth.proto
namespace App\Protobuf\GoogleAuth\Payload;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>app.Protobuf.GoogleAuth.Payload.OtpParameters</code>
*/
class OtpParameters extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>bytes secret = 1;</code>
*/
protected $secret = '';
/**
* Generated from protobuf field <code>string name = 2;</code>
*/
protected $name = '';
/**
* Generated from protobuf field <code>string issuer = 3;</code>
*/
protected $issuer = '';
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.Algorithm algorithm = 4;</code>
*/
protected $algorithm = 0;
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.DigitCount digits = 5;</code>
*/
protected $digits = 0;
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpType type = 6;</code>
*/
protected $type = 0;
/**
* Generated from protobuf field <code>int64 counter = 7;</code>
*/
protected $counter = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $secret
* @type string $name
* @type string $issuer
* @type int $algorithm
* @type int $digits
* @type int $type
* @type int|string $counter
* }
*/
public function __construct($data = NULL) {
\App\Protobuf\GPBMetadata\GoogleAuth::initOnce();
parent::__construct($data);
}
/**
* Generated from protobuf field <code>bytes secret = 1;</code>
* @return string
*/
public function getSecret()
{
return $this->secret;
}
/**
* Generated from protobuf field <code>bytes secret = 1;</code>
* @param string $var
* @return $this
*/
public function setSecret($var)
{
GPBUtil::checkString($var, False);
$this->secret = $var;
return $this;
}
/**
* Generated from protobuf field <code>string name = 2;</code>
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Generated from protobuf field <code>string name = 2;</code>
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* Generated from protobuf field <code>string issuer = 3;</code>
* @return string
*/
public function getIssuer()
{
return $this->issuer;
}
/**
* Generated from protobuf field <code>string issuer = 3;</code>
* @param string $var
* @return $this
*/
public function setIssuer($var)
{
GPBUtil::checkString($var, True);
$this->issuer = $var;
return $this;
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.Algorithm algorithm = 4;</code>
* @return int
*/
public function getAlgorithm()
{
return $this->algorithm;
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.Algorithm algorithm = 4;</code>
* @param int $var
* @return $this
*/
public function setAlgorithm($var)
{
GPBUtil::checkEnum($var, \App\Protobuf\GoogleAuth\Payload_Algorithm::class);
$this->algorithm = $var;
return $this;
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.DigitCount digits = 5;</code>
* @return int
*/
public function getDigits()
{
return $this->digits;
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.DigitCount digits = 5;</code>
* @param int $var
* @return $this
*/
public function setDigits($var)
{
GPBUtil::checkEnum($var, \App\Protobuf\GoogleAuth\Payload_DigitCount::class);
$this->digits = $var;
return $this;
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpType type = 6;</code>
* @return int
*/
public function getType()
{
return $this->type;
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpType type = 6;</code>
* @param int $var
* @return $this
*/
public function setType($var)
{
GPBUtil::checkEnum($var, \App\Protobuf\GoogleAuth\Payload_OtpType::class);
$this->type = $var;
return $this;
}
/**
* Generated from protobuf field <code>int64 counter = 7;</code>
* @return int|string
*/
public function getCounter()
{
return $this->counter;
}
/**
* Generated from protobuf field <code>int64 counter = 7;</code>
* @param int|string $var
* @return $this
*/
public function setCounter($var)
{
GPBUtil::checkInt64($var);
$this->counter = $var;
return $this;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(OtpParameters::class, \App\Protobuf\GoogleAuth\Payload_OtpParameters::class);

View File

@ -0,0 +1,56 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: GoogleAuth.proto
namespace App\Protobuf\GoogleAuth\Payload;
use UnexpectedValueException;
/**
* Protobuf type <code>app.Protobuf.GoogleAuth.Payload.OtpType</code>
*/
class OtpType
{
/**
* Generated from protobuf enum <code>OTP_TYPE_UNSPECIFIED = 0;</code>
*/
const OTP_TYPE_UNSPECIFIED = 0;
/**
* Generated from protobuf enum <code>OTP_TYPE_HOTP = 1;</code>
*/
const OTP_TYPE_HOTP = 1;
/**
* Generated from protobuf enum <code>OTP_TYPE_TOTP = 2;</code>
*/
const OTP_TYPE_TOTP = 2;
private static $valueToName = [
self::OTP_TYPE_UNSPECIFIED => 'OTP_TYPE_UNSPECIFIED',
self::OTP_TYPE_HOTP => 'OTP_TYPE_HOTP',
self::OTP_TYPE_TOTP => 'OTP_TYPE_TOTP',
];
public static function name($value)
{
if (!isset(self::$valueToName[$value])) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no name defined for value %s', __CLASS__, $value));
}
return self::$valueToName[$value];
}
public static function value($name)
{
$const = __CLASS__ . '::' . strtoupper($name);
if (!defined($const)) {
throw new UnexpectedValueException(sprintf(
'Enum %s has no value defined for name %s', __CLASS__, $name));
}
return constant($const);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(OtpType::class, \App\Protobuf\GoogleAuth\Payload_OtpType::class);

View File

@ -0,0 +1,16 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: GoogleAuth.proto
namespace App\Protobuf\GoogleAuth;
if (false) {
/**
* This class is deprecated. Use App\Protobuf\GoogleAuth\Payload\Algorithm instead.
* @deprecated
*/
class Payload_Algorithm {}
}
class_exists(Payload\Algorithm::class);
@trigger_error('App\Protobuf\GoogleAuth\Payload_Algorithm is deprecated and will be removed in the next major release. Use App\Protobuf\GoogleAuth\Payload\Algorithm instead', E_USER_DEPRECATED);

View File

@ -0,0 +1,16 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: GoogleAuth.proto
namespace App\Protobuf\GoogleAuth;
if (false) {
/**
* This class is deprecated. Use App\Protobuf\GoogleAuth\Payload\DigitCount instead.
* @deprecated
*/
class Payload_DigitCount {}
}
class_exists(Payload\DigitCount::class);
@trigger_error('App\Protobuf\GoogleAuth\Payload_DigitCount is deprecated and will be removed in the next major release. Use App\Protobuf\GoogleAuth\Payload\DigitCount instead', E_USER_DEPRECATED);

View File

@ -0,0 +1,16 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: GoogleAuth.proto
namespace App\Protobuf\GoogleAuth;
if (false) {
/**
* This class is deprecated. Use App\Protobuf\GoogleAuth\Payload\OtpParameters instead.
* @deprecated
*/
class Payload_OtpParameters {}
}
class_exists(Payload\OtpParameters::class);
@trigger_error('App\Protobuf\GoogleAuth\Payload_OtpParameters is deprecated and will be removed in the next major release. Use App\Protobuf\GoogleAuth\Payload\OtpParameters instead', E_USER_DEPRECATED);

View File

@ -0,0 +1,16 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: GoogleAuth.proto
namespace App\Protobuf\GoogleAuth;
if (false) {
/**
* This class is deprecated. Use App\Protobuf\GoogleAuth\Payload\OtpType instead.
* @deprecated
*/
class Payload_OtpType {}
}
class_exists(Payload\OtpType::class);
@trigger_error('App\Protobuf\GoogleAuth\Payload_OtpType is deprecated and will be removed in the next major release. Use App\Protobuf\GoogleAuth\Payload\OtpType instead', E_USER_DEPRECATED);