Update .proto message description & regenerate classes

This commit is contained in:
Bubka 2025-03-09 18:22:12 +01:00
parent 46c1131b10
commit 24b626fb4f
27 changed files with 893 additions and 130 deletions

Binary file not shown.

View File

@ -0,0 +1,186 @@
<?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>optional int32 batch_index = 4;</code>
*/
protected $batch_index = null;
/**
* Generated from protobuf field <code>optional int32 batch_id = 5;</code>
*/
protected $batch_id = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type array<\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 array<\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>optional int32 batch_index = 4;</code>
* @return int
*/
public function getBatchIndex()
{
return isset($this->batch_index) ? $this->batch_index : 0;
}
public function hasBatchIndex()
{
return isset($this->batch_index);
}
public function clearBatchIndex()
{
unset($this->batch_index);
}
/**
* Generated from protobuf field <code>optional 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>optional int32 batch_id = 5;</code>
* @return int
*/
public function getBatchId()
{
return isset($this->batch_id) ? $this->batch_id : 0;
}
public function hasBatchId()
{
return isset($this->batch_id);
}
public function clearBatchId()
{
unset($this->batch_id);
}
/**
* Generated from protobuf field <code>optional 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,270 @@
<?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.OtpParameters.Algorithm algorithm = 4;</code>
*/
protected $algorithm = 0;
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.DigitCount digits = 5;</code>
*/
protected $digits = 0;
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.OtpType type = 6;</code>
*/
protected $type = 0;
/**
* Generated from protobuf field <code>optional int32 counter = 7;</code>
*/
protected $counter = null;
/**
* Generated from protobuf field <code>optional .google.protobuf.Any period = 8;</code>
*/
protected $period = null;
/**
* 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 $counter
* @type \Google\Protobuf\Any $period
* }
*/
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.OtpParameters.Algorithm algorithm = 4;</code>
* @return int
*/
public function getAlgorithm()
{
return $this->algorithm;
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.Algorithm algorithm = 4;</code>
* @param int $var
* @return $this
*/
public function setAlgorithm($var)
{
GPBUtil::checkEnum($var, \App\Protobuf\GoogleAuth\Payload\OtpParameters\Algorithm::class);
$this->algorithm = $var;
return $this;
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.DigitCount digits = 5;</code>
* @return int
*/
public function getDigits()
{
return $this->digits;
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.DigitCount digits = 5;</code>
* @param int $var
* @return $this
*/
public function setDigits($var)
{
GPBUtil::checkEnum($var, \App\Protobuf\GoogleAuth\Payload\OtpParameters\DigitCount::class);
$this->digits = $var;
return $this;
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.OtpType type = 6;</code>
* @return int
*/
public function getType()
{
return $this->type;
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.OtpType type = 6;</code>
* @param int $var
* @return $this
*/
public function setType($var)
{
GPBUtil::checkEnum($var, \App\Protobuf\GoogleAuth\Payload\OtpParameters\OtpType::class);
$this->type = $var;
return $this;
}
/**
* Generated from protobuf field <code>optional int32 counter = 7;</code>
* @return int
*/
public function getCounter()
{
return isset($this->counter) ? $this->counter : 0;
}
public function hasCounter()
{
return isset($this->counter);
}
public function clearCounter()
{
unset($this->counter);
}
/**
* Generated from protobuf field <code>optional int32 counter = 7;</code>
* @param int $var
* @return $this
*/
public function setCounter($var)
{
GPBUtil::checkInt32($var);
$this->counter = $var;
return $this;
}
/**
* Generated from protobuf field <code>optional .google.protobuf.Any period = 8;</code>
* @return \Google\Protobuf\Any|null
*/
public function getPeriod()
{
return $this->period;
}
public function hasPeriod()
{
return isset($this->period);
}
public function clearPeriod()
{
unset($this->period);
}
/**
* Generated from protobuf field <code>optional .google.protobuf.Any period = 8;</code>
* @param \Google\Protobuf\Any $var
* @return $this
*/
public function setPeriod($var)
{
GPBUtil::checkMessage($var, \Google\Protobuf\Any::class);
$this->period = $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

@ -2,12 +2,12 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: GoogleAuth.proto
namespace App\Protobuf\GoogleAuth\Payload;
namespace App\Protobuf\GoogleAuth\Payload\OtpParameters;
use UnexpectedValueException;
/**
* Protobuf type <code>app.Protobuf.GoogleAuth.Payload.Algorithm</code>
* Protobuf type <code>app.Protobuf.GoogleAuth.Payload.OtpParameters.Algorithm</code>
*/
class Algorithm
{
@ -62,5 +62,5 @@ public static function value($name)
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Algorithm::class, \App\Protobuf\GoogleAuth\Payload_Algorithm::class);
class_alias(Algorithm::class, \App\Protobuf\GoogleAuth\Payload_OtpParameters_Algorithm::class);

View File

@ -2,12 +2,12 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: GoogleAuth.proto
namespace App\Protobuf\GoogleAuth\Payload;
namespace App\Protobuf\GoogleAuth\Payload\OtpParameters;
use UnexpectedValueException;
/**
* Protobuf type <code>app.Protobuf.GoogleAuth.Payload.DigitCount</code>
* Protobuf type <code>app.Protobuf.GoogleAuth.Payload.OtpParameters.DigitCount</code>
*/
class DigitCount
{
@ -52,5 +52,5 @@ public static function value($name)
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(DigitCount::class, \App\Protobuf\GoogleAuth\Payload_DigitCount::class);
class_alias(DigitCount::class, \App\Protobuf\GoogleAuth\Payload_OtpParameters_DigitCount::class);

View File

@ -2,12 +2,12 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: GoogleAuth.proto
namespace App\Protobuf\GoogleAuth\Payload;
namespace App\Protobuf\GoogleAuth\Payload\OtpParameters;
use UnexpectedValueException;
/**
* Protobuf type <code>app.Protobuf.GoogleAuth.Payload.OtpType</code>
* Protobuf type <code>app.Protobuf.GoogleAuth.Payload.OtpParameters.OtpType</code>
*/
class OtpType
{
@ -52,5 +52,5 @@ public static function value($name)
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(OtpType::class, \App\Protobuf\GoogleAuth\Payload_OtpType::class);
class_alias(OtpType::class, \App\Protobuf\GoogleAuth\Payload_OtpParameters_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\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\OtpParameters\Algorithm instead.
* @deprecated
*/
class Payload_OtpParameters_Algorithm {}
}
class_exists(Payload\OtpParameters\Algorithm::class);
@trigger_error('App\Protobuf\GoogleAuth\Payload_OtpParameters_Algorithm is deprecated and will be removed in the next major release. Use App\Protobuf\GoogleAuth\Payload\OtpParameters\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\OtpParameters\DigitCount instead.
* @deprecated
*/
class Payload_OtpParameters_DigitCount {}
}
class_exists(Payload\OtpParameters\DigitCount::class);
@trigger_error('App\Protobuf\GoogleAuth\Payload_OtpParameters_DigitCount is deprecated and will be removed in the next major release. Use App\Protobuf\GoogleAuth\Payload\OtpParameters\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\OtpType instead.
* @deprecated
*/
class Payload_OtpParameters_OtpType {}
}
class_exists(Payload\OtpParameters\OtpType::class);
@trigger_error('App\Protobuf\GoogleAuth\Payload_OtpParameters_OtpType is deprecated and will be removed in the next major release. Use App\Protobuf\GoogleAuth\Payload\OtpParameters\OtpType instead', E_USER_DEPRECATED);

View File

@ -1,38 +1,41 @@
syntax = "proto3";
import "google/protobuf/any.proto";
package app.Protobuf.GoogleAuth;
option php_metadata_namespace = "App\\Protobuf\\GPBMetadata";
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 {
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;
}
bytes secret = 1;
string name = 2;
string issuer = 3;
Algorithm algorithm = 4;
DigitCount digits = 5;
OtpType type = 6;
int64 counter = 7;
int64 period = 8;
optional int32 counter = 7;
optional google.protobuf.Any period = 8;
}
repeated OtpParameters otp_parameters = 1;
int32 version = 2;
int32 batch_size = 3;
int32 batch_index = 4;
int32 batch_id = 5;
}
optional int32 batch_index = 4;
optional int32 batch_id = 5;
}

View File

@ -26,13 +26,13 @@ class Payload extends \Google\Protobuf\Internal\Message
*/
protected $batch_size = 0;
/**
* Generated from protobuf field <code>int32 batch_index = 4;</code>
* Generated from protobuf field <code>optional int32 batch_index = 4;</code>
*/
protected $batch_index = 0;
protected $batch_index = null;
/**
* Generated from protobuf field <code>int32 batch_id = 5;</code>
* Generated from protobuf field <code>optional int32 batch_id = 5;</code>
*/
protected $batch_id = 0;
protected $batch_id = null;
/**
* Constructor.
@ -40,7 +40,7 @@ class Payload extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \App\Protobuf\GoogleAuth\Payload\OtpParameters[]|\Google\Protobuf\Internal\RepeatedField $otp_parameters
* @type array<\App\Protobuf\GoogleAuth\Payload\OtpParameters>|\Google\Protobuf\Internal\RepeatedField $otp_parameters
* @type int $version
* @type int $batch_size
* @type int $batch_index
@ -63,7 +63,7 @@ public function getOtpParameters()
/**
* 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
* @param array<\App\Protobuf\GoogleAuth\Payload\OtpParameters>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOtpParameters($var)
@ -119,16 +119,26 @@ public function setBatchSize($var)
}
/**
* Generated from protobuf field <code>int32 batch_index = 4;</code>
* Generated from protobuf field <code>optional int32 batch_index = 4;</code>
* @return int
*/
public function getBatchIndex()
{
return $this->batch_index;
return isset($this->batch_index) ? $this->batch_index : 0;
}
public function hasBatchIndex()
{
return isset($this->batch_index);
}
public function clearBatchIndex()
{
unset($this->batch_index);
}
/**
* Generated from protobuf field <code>int32 batch_index = 4;</code>
* Generated from protobuf field <code>optional int32 batch_index = 4;</code>
* @param int $var
* @return $this
*/
@ -141,16 +151,26 @@ public function setBatchIndex($var)
}
/**
* Generated from protobuf field <code>int32 batch_id = 5;</code>
* Generated from protobuf field <code>optional int32 batch_id = 5;</code>
* @return int
*/
public function getBatchId()
{
return $this->batch_id;
return isset($this->batch_id) ? $this->batch_id : 0;
}
public function hasBatchId()
{
return isset($this->batch_id);
}
public function clearBatchId()
{
unset($this->batch_id);
}
/**
* Generated from protobuf field <code>int32 batch_id = 5;</code>
* Generated from protobuf field <code>optional int32 batch_id = 5;</code>
* @param int $var
* @return $this
*/

View File

@ -26,25 +26,25 @@ class OtpParameters extends \Google\Protobuf\Internal\Message
*/
protected $issuer = '';
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.Algorithm algorithm = 4;</code>
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.Algorithm algorithm = 4;</code>
*/
protected $algorithm = 0;
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.DigitCount digits = 5;</code>
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.DigitCount digits = 5;</code>
*/
protected $digits = 0;
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpType type = 6;</code>
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.OtpType type = 6;</code>
*/
protected $type = 0;
/**
* Generated from protobuf field <code>int64 counter = 7;</code>
* Generated from protobuf field <code>optional int32 counter = 7;</code>
*/
protected $counter = 0;
protected $counter = null;
/**
* Generated from protobuf field <code>int64 period = 8;</code>
* Generated from protobuf field <code>optional .google.protobuf.Any period = 8;</code>
*/
protected $period = 0;
protected $period = null;
/**
* Constructor.
@ -58,7 +58,8 @@ class OtpParameters extends \Google\Protobuf\Internal\Message
* @type int $algorithm
* @type int $digits
* @type int $type
* @type int|string $counter
* @type int $counter
* @type \Google\Protobuf\Any $period
* }
*/
public function __construct($data = NULL) {
@ -133,7 +134,7 @@ public function setIssuer($var)
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.Algorithm algorithm = 4;</code>
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.Algorithm algorithm = 4;</code>
* @return int
*/
public function getAlgorithm()
@ -142,20 +143,20 @@ public function getAlgorithm()
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.Algorithm algorithm = 4;</code>
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.Algorithm algorithm = 4;</code>
* @param int $var
* @return $this
*/
public function setAlgorithm($var)
{
GPBUtil::checkEnum($var, \App\Protobuf\GoogleAuth\Payload_Algorithm::class);
GPBUtil::checkEnum($var, \App\Protobuf\GoogleAuth\Payload\OtpParameters\Algorithm::class);
$this->algorithm = $var;
return $this;
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.DigitCount digits = 5;</code>
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.DigitCount digits = 5;</code>
* @return int
*/
public function getDigits()
@ -164,20 +165,20 @@ public function getDigits()
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.DigitCount digits = 5;</code>
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.DigitCount digits = 5;</code>
* @param int $var
* @return $this
*/
public function setDigits($var)
{
GPBUtil::checkEnum($var, \App\Protobuf\GoogleAuth\Payload_DigitCount::class);
GPBUtil::checkEnum($var, \App\Protobuf\GoogleAuth\Payload\OtpParameters\DigitCount::class);
$this->digits = $var;
return $this;
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpType type = 6;</code>
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.OtpType type = 6;</code>
* @return int
*/
public function getType()
@ -186,57 +187,77 @@ public function getType()
}
/**
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpType type = 6;</code>
* Generated from protobuf field <code>.app.Protobuf.GoogleAuth.Payload.OtpParameters.OtpType type = 6;</code>
* @param int $var
* @return $this
*/
public function setType($var)
{
GPBUtil::checkEnum($var, \App\Protobuf\GoogleAuth\Payload_OtpType::class);
GPBUtil::checkEnum($var, \App\Protobuf\GoogleAuth\Payload\OtpParameters\OtpType::class);
$this->type = $var;
return $this;
}
/**
* Generated from protobuf field <code>int64 counter = 7;</code>
* @return int|string
* Generated from protobuf field <code>optional int32 counter = 7;</code>
* @return int
*/
public function getCounter()
{
return $this->counter;
return isset($this->counter) ? $this->counter : 0;
}
public function hasCounter()
{
return isset($this->counter);
}
public function clearCounter()
{
unset($this->counter);
}
/**
* Generated from protobuf field <code>int64 counter = 7;</code>
* @param int|string $var
* Generated from protobuf field <code>optional int32 counter = 7;</code>
* @param int $var
* @return $this
*/
public function setCounter($var)
{
GPBUtil::checkInt64($var);
GPBUtil::checkInt32($var);
$this->counter = $var;
return $this;
}
/**
* Generated from protobuf field <code>int64 period = 8;</code>
* @return int|string
* Generated from protobuf field <code>optional .google.protobuf.Any period = 8;</code>
* @return \Google\Protobuf\Any|null
*/
public function getPeriod()
{
return $this->period;
}
public function hasPeriod()
{
return isset($this->period);
}
public function clearPeriod()
{
unset($this->period);
}
/**
* Generated from protobuf field <code>int64 period = 8;</code>
* @param int|string $var
* Generated from protobuf field <code>optional .google.protobuf.Any period = 8;</code>
* @param \Google\Protobuf\Any $var
* @return $this
*/
public function setPeriod($var)
{
GPBUtil::checkInt64($var);
GPBUtil::checkMessage($var, \Google\Protobuf\Any::class);
$this->period = $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\OtpParameters;
use UnexpectedValueException;
/**
* Protobuf type <code>app.Protobuf.GoogleAuth.Payload.OtpParameters.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_OtpParameters_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\OtpParameters;
use UnexpectedValueException;
/**
* Protobuf type <code>app.Protobuf.GoogleAuth.Payload.OtpParameters.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_OtpParameters_DigitCount::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\OtpParameters;
use UnexpectedValueException;
/**
* Protobuf type <code>app.Protobuf.GoogleAuth.Payload.OtpParameters.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_OtpParameters_OtpType::class);

View File

@ -1,16 +0,0 @@
<?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

@ -1,16 +0,0 @@
<?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\Algorithm instead.
* @deprecated
*/
class Payload_OtpParameters_Algorithm {}
}
class_exists(Payload\OtpParameters\Algorithm::class);
@trigger_error('App\Protobuf\GoogleAuth\Payload_OtpParameters_Algorithm is deprecated and will be removed in the next major release. Use App\Protobuf\GoogleAuth\Payload\OtpParameters\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\OtpParameters\DigitCount instead.
* @deprecated
*/
class Payload_OtpParameters_DigitCount {}
}
class_exists(Payload\OtpParameters\DigitCount::class);
@trigger_error('App\Protobuf\GoogleAuth\Payload_OtpParameters_DigitCount is deprecated and will be removed in the next major release. Use App\Protobuf\GoogleAuth\Payload\OtpParameters\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\OtpType instead.
* @deprecated
*/
class Payload_OtpParameters_OtpType {}
}
class_exists(Payload\OtpParameters\OtpType::class);
@trigger_error('App\Protobuf\GoogleAuth\Payload_OtpParameters_OtpType is deprecated and will be removed in the next major release. Use App\Protobuf\GoogleAuth\Payload\OtpParameters\OtpType instead', E_USER_DEPRECATED);

View File

@ -1,16 +0,0 @@
<?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);

View File

@ -42,3 +42,9 @@ ## Generate the class
- Update the namespace of the moved files to match their new location
>Reference: [protocol-buffers/docs/php-generated](https://developers.google.com/protocol-buffers/docs/reference/php-generated#invocation)
command to decode an otpauth uri using protoc cli
```bash
echo "otpauth-migration://offline?data=[BASE32_ENCODED_DATA]" | sed 's/QR-Code://' | sed 's/otpauth-migration:\/\/offline?data=//' | sed -e 's/%2B/+/ig' -e 's/%2F/\//ig' -e 's/%3D/=/ig' | base64 -d | protoc --decode_raw
```

View File

@ -6,9 +6,9 @@
use App\Models\TwoFAccount;
use App\Protobuf\GAuthValueMapping;
use App\Protobuf\GoogleAuth\Payload;
use App\Protobuf\GoogleAuth\Payload\Algorithm;
use App\Protobuf\GoogleAuth\Payload\DigitCount;
use App\Protobuf\GoogleAuth\Payload\OtpType;
use App\Protobuf\GoogleAuth\Payload\OtpParameters\Algorithm;
use App\Protobuf\GoogleAuth\Payload\OtpParameters\DigitCount;
use App\Protobuf\GoogleAuth\Payload\OtpParameters\OtpType;
use Exception;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
@ -29,6 +29,21 @@ public function migrate(mixed $migrationPayload) : Collection
try {
$migrationData = base64_decode(urldecode(Str::replace('otpauth-migration://offline?data=', '', strval($migrationPayload))));
$protobuf = new Payload;
// $input = new CodedInputStream($migrationData);
// while (true) {
// $tag = $input->readTag();
// // End of input. This is a valid place to end, so return true.
// if ($tag === 0) {
// return true;
// }
// $number = GPBWire::getTagFieldNumber($tag);
// $field = $protobuf->desc->getFieldByNumber($number);
// $protobuf->parseFieldFromStream($tag, $input, $field);
// }
$protobuf->mergeFromString($migrationData);
$otpParameters = $protobuf->getOtpParameters();
} catch (Exception $ex) {

View File

@ -125,4 +125,4 @@
"php artisan ide-helper:models"
]
}
}
}

14
composer.lock generated
View File

@ -955,16 +955,16 @@
},
{
"name": "google/protobuf",
"version": "v4.28.3",
"version": "v4.30.0",
"source": {
"type": "git",
"url": "https://github.com/protocolbuffers/protobuf-php.git",
"reference": "c5c311e0f3d89928251ac5a2f0e3db283612c100"
"reference": "e1d66682f6836aa87820400f0aa07d9eb566feb6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/c5c311e0f3d89928251ac5a2f0e3db283612c100",
"reference": "c5c311e0f3d89928251ac5a2f0e3db283612c100",
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/e1d66682f6836aa87820400f0aa07d9eb566feb6",
"reference": "e1d66682f6836aa87820400f0aa07d9eb566feb6",
"shasum": ""
},
"require": {
@ -993,9 +993,9 @@
"proto"
],
"support": {
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.28.3"
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.30.0"
},
"time": "2024-10-22T22:27:17+00:00"
"time": "2025-03-04T22:54:49+00:00"
},
{
"name": "graham-campbell/result-type",
@ -10962,5 +10962,5 @@
"ext-xml": "*"
},
"platform-dev": [],
"plugin-api-version": "2.3.0"
"plugin-api-version": "2.6.0"
}