package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type SecureSecretSettings struct {
SecureAlgo SecurePasswordKdfAlgoClass
SecureSecret []byte
SecureSecretID int64
}
const SecureSecretSettingsTypeID = 0x1527bcac
var (
_ bin .Encoder = &SecureSecretSettings {}
_ bin .Decoder = &SecureSecretSettings {}
_ bin .BareEncoder = &SecureSecretSettings {}
_ bin .BareDecoder = &SecureSecretSettings {}
)
func (s *SecureSecretSettings ) Zero () bool {
if s == nil {
return true
}
if !(s .SecureAlgo == nil ) {
return false
}
if !(s .SecureSecret == nil ) {
return false
}
if !(s .SecureSecretID == 0 ) {
return false
}
return true
}
func (s *SecureSecretSettings ) String () string {
if s == nil {
return "SecureSecretSettings(nil)"
}
type Alias SecureSecretSettings
return fmt .Sprintf ("SecureSecretSettings%+v" , Alias (*s ))
}
func (s *SecureSecretSettings ) FillFrom (from interface {
GetSecureAlgo () (value SecurePasswordKdfAlgoClass )
GetSecureSecret () (value []byte )
GetSecureSecretID () (value int64 )
}) {
s .SecureAlgo = from .GetSecureAlgo ()
s .SecureSecret = from .GetSecureSecret ()
s .SecureSecretID = from .GetSecureSecretID ()
}
func (*SecureSecretSettings ) TypeID () uint32 {
return SecureSecretSettingsTypeID
}
func (*SecureSecretSettings ) TypeName () string {
return "secureSecretSettings"
}
func (s *SecureSecretSettings ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "secureSecretSettings" ,
ID : SecureSecretSettingsTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "SecureAlgo" ,
SchemaName : "secure_algo" ,
},
{
Name : "SecureSecret" ,
SchemaName : "secure_secret" ,
},
{
Name : "SecureSecretID" ,
SchemaName : "secure_secret_id" ,
},
}
return typ
}
func (s *SecureSecretSettings ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode secureSecretSettings#1527bcac as nil" )
}
b .PutID (SecureSecretSettingsTypeID )
return s .EncodeBare (b )
}
func (s *SecureSecretSettings ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode secureSecretSettings#1527bcac as nil" )
}
if s .SecureAlgo == nil {
return fmt .Errorf ("unable to encode secureSecretSettings#1527bcac: field secure_algo is nil" )
}
if err := s .SecureAlgo .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode secureSecretSettings#1527bcac: field secure_algo: %w" , err )
}
b .PutBytes (s .SecureSecret )
b .PutLong (s .SecureSecretID )
return nil
}
func (s *SecureSecretSettings ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode secureSecretSettings#1527bcac to nil" )
}
if err := b .ConsumeID (SecureSecretSettingsTypeID ); err != nil {
return fmt .Errorf ("unable to decode secureSecretSettings#1527bcac: %w" , err )
}
return s .DecodeBare (b )
}
func (s *SecureSecretSettings ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode secureSecretSettings#1527bcac to nil" )
}
{
value , err := DecodeSecurePasswordKdfAlgo (b )
if err != nil {
return fmt .Errorf ("unable to decode secureSecretSettings#1527bcac: field secure_algo: %w" , err )
}
s .SecureAlgo = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode secureSecretSettings#1527bcac: field secure_secret: %w" , err )
}
s .SecureSecret = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode secureSecretSettings#1527bcac: field secure_secret_id: %w" , err )
}
s .SecureSecretID = value
}
return nil
}
func (s *SecureSecretSettings ) GetSecureAlgo () (value SecurePasswordKdfAlgoClass ) {
if s == nil {
return
}
return s .SecureAlgo
}
func (s *SecureSecretSettings ) GetSecureSecret () (value []byte ) {
if s == nil {
return
}
return s .SecureSecret
}
func (s *SecureSecretSettings ) GetSecureSecretID () (value int64 ) {
if s == nil {
return
}
return s .SecureSecretID
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .