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 SecurePasswordKdfAlgoUnknown struct {
}
const SecurePasswordKdfAlgoUnknownTypeID = 0x4a8537
func (s SecurePasswordKdfAlgoUnknown ) construct () SecurePasswordKdfAlgoClass { return &s }
var (
_ bin .Encoder = &SecurePasswordKdfAlgoUnknown {}
_ bin .Decoder = &SecurePasswordKdfAlgoUnknown {}
_ bin .BareEncoder = &SecurePasswordKdfAlgoUnknown {}
_ bin .BareDecoder = &SecurePasswordKdfAlgoUnknown {}
_ SecurePasswordKdfAlgoClass = &SecurePasswordKdfAlgoUnknown {}
)
func (s *SecurePasswordKdfAlgoUnknown ) Zero () bool {
if s == nil {
return true
}
return true
}
func (s *SecurePasswordKdfAlgoUnknown ) String () string {
if s == nil {
return "SecurePasswordKdfAlgoUnknown(nil)"
}
type Alias SecurePasswordKdfAlgoUnknown
return fmt .Sprintf ("SecurePasswordKdfAlgoUnknown%+v" , Alias (*s ))
}
func (*SecurePasswordKdfAlgoUnknown ) TypeID () uint32 {
return SecurePasswordKdfAlgoUnknownTypeID
}
func (*SecurePasswordKdfAlgoUnknown ) TypeName () string {
return "securePasswordKdfAlgoUnknown"
}
func (s *SecurePasswordKdfAlgoUnknown ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "securePasswordKdfAlgoUnknown" ,
ID : SecurePasswordKdfAlgoUnknownTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {}
return typ
}
func (s *SecurePasswordKdfAlgoUnknown ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode securePasswordKdfAlgoUnknown#4a8537 as nil" )
}
b .PutID (SecurePasswordKdfAlgoUnknownTypeID )
return s .EncodeBare (b )
}
func (s *SecurePasswordKdfAlgoUnknown ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode securePasswordKdfAlgoUnknown#4a8537 as nil" )
}
return nil
}
func (s *SecurePasswordKdfAlgoUnknown ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode securePasswordKdfAlgoUnknown#4a8537 to nil" )
}
if err := b .ConsumeID (SecurePasswordKdfAlgoUnknownTypeID ); err != nil {
return fmt .Errorf ("unable to decode securePasswordKdfAlgoUnknown#4a8537: %w" , err )
}
return s .DecodeBare (b )
}
func (s *SecurePasswordKdfAlgoUnknown ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode securePasswordKdfAlgoUnknown#4a8537 to nil" )
}
return nil
}
type SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 struct {
Salt []byte
}
const SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000TypeID = 0xbbf2dda0
func (s SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 ) construct () SecurePasswordKdfAlgoClass {
return &s
}
var (
_ bin .Encoder = &SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 {}
_ bin .Decoder = &SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 {}
_ bin .BareEncoder = &SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 {}
_ bin .BareDecoder = &SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 {}
_ SecurePasswordKdfAlgoClass = &SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 {}
)
func (s *SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 ) Zero () bool {
if s == nil {
return true
}
if !(s .Salt == nil ) {
return false
}
return true
}
func (s *SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 ) String () string {
if s == nil {
return "SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000(nil)"
}
type Alias SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000
return fmt .Sprintf ("SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000%+v" , Alias (*s ))
}
func (s *SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 ) FillFrom (from interface {
GetSalt () (value []byte )
}) {
s .Salt = from .GetSalt ()
}
func (*SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 ) TypeID () uint32 {
return SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000TypeID
}
func (*SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 ) TypeName () string {
return "securePasswordKdfAlgoPBKDF2HMACSHA512iter100000"
}
func (s *SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "securePasswordKdfAlgoPBKDF2HMACSHA512iter100000" ,
ID : SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000TypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Salt" ,
SchemaName : "salt" ,
},
}
return typ
}
func (s *SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 as nil" )
}
b .PutID (SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000TypeID )
return s .EncodeBare (b )
}
func (s *SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 as nil" )
}
b .PutBytes (s .Salt )
return nil
}
func (s *SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 to nil" )
}
if err := b .ConsumeID (SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000TypeID ); err != nil {
return fmt .Errorf ("unable to decode securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0: %w" , err )
}
return s .DecodeBare (b )
}
func (s *SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0 to nil" )
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode securePasswordKdfAlgoPBKDF2HMACSHA512iter100000#bbf2dda0: field salt: %w" , err )
}
s .Salt = value
}
return nil
}
func (s *SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 ) GetSalt () (value []byte ) {
if s == nil {
return
}
return s .Salt
}
type SecurePasswordKdfAlgoSHA512 struct {
Salt []byte
}
const SecurePasswordKdfAlgoSHA512TypeID = 0x86471d92
func (s SecurePasswordKdfAlgoSHA512 ) construct () SecurePasswordKdfAlgoClass { return &s }
var (
_ bin .Encoder = &SecurePasswordKdfAlgoSHA512 {}
_ bin .Decoder = &SecurePasswordKdfAlgoSHA512 {}
_ bin .BareEncoder = &SecurePasswordKdfAlgoSHA512 {}
_ bin .BareDecoder = &SecurePasswordKdfAlgoSHA512 {}
_ SecurePasswordKdfAlgoClass = &SecurePasswordKdfAlgoSHA512 {}
)
func (s *SecurePasswordKdfAlgoSHA512 ) Zero () bool {
if s == nil {
return true
}
if !(s .Salt == nil ) {
return false
}
return true
}
func (s *SecurePasswordKdfAlgoSHA512 ) String () string {
if s == nil {
return "SecurePasswordKdfAlgoSHA512(nil)"
}
type Alias SecurePasswordKdfAlgoSHA512
return fmt .Sprintf ("SecurePasswordKdfAlgoSHA512%+v" , Alias (*s ))
}
func (s *SecurePasswordKdfAlgoSHA512 ) FillFrom (from interface {
GetSalt () (value []byte )
}) {
s .Salt = from .GetSalt ()
}
func (*SecurePasswordKdfAlgoSHA512 ) TypeID () uint32 {
return SecurePasswordKdfAlgoSHA512TypeID
}
func (*SecurePasswordKdfAlgoSHA512 ) TypeName () string {
return "securePasswordKdfAlgoSHA512"
}
func (s *SecurePasswordKdfAlgoSHA512 ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "securePasswordKdfAlgoSHA512" ,
ID : SecurePasswordKdfAlgoSHA512TypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Salt" ,
SchemaName : "salt" ,
},
}
return typ
}
func (s *SecurePasswordKdfAlgoSHA512 ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode securePasswordKdfAlgoSHA512#86471d92 as nil" )
}
b .PutID (SecurePasswordKdfAlgoSHA512TypeID )
return s .EncodeBare (b )
}
func (s *SecurePasswordKdfAlgoSHA512 ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode securePasswordKdfAlgoSHA512#86471d92 as nil" )
}
b .PutBytes (s .Salt )
return nil
}
func (s *SecurePasswordKdfAlgoSHA512 ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode securePasswordKdfAlgoSHA512#86471d92 to nil" )
}
if err := b .ConsumeID (SecurePasswordKdfAlgoSHA512TypeID ); err != nil {
return fmt .Errorf ("unable to decode securePasswordKdfAlgoSHA512#86471d92: %w" , err )
}
return s .DecodeBare (b )
}
func (s *SecurePasswordKdfAlgoSHA512 ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode securePasswordKdfAlgoSHA512#86471d92 to nil" )
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode securePasswordKdfAlgoSHA512#86471d92: field salt: %w" , err )
}
s .Salt = value
}
return nil
}
func (s *SecurePasswordKdfAlgoSHA512 ) GetSalt () (value []byte ) {
if s == nil {
return
}
return s .Salt
}
const SecurePasswordKdfAlgoClassName = "SecurePasswordKdfAlgo"
type SecurePasswordKdfAlgoClass interface {
bin .Encoder
bin .Decoder
bin .BareEncoder
bin .BareDecoder
construct () SecurePasswordKdfAlgoClass
TypeID () uint32
TypeName () string
String () string
Zero () bool
}
func DecodeSecurePasswordKdfAlgo (buf *bin .Buffer ) (SecurePasswordKdfAlgoClass , error ) {
id , err := buf .PeekID ()
if err != nil {
return nil , err
}
switch id {
case SecurePasswordKdfAlgoUnknownTypeID :
v := SecurePasswordKdfAlgoUnknown {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode SecurePasswordKdfAlgoClass: %w" , err )
}
return &v , nil
case SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000TypeID :
v := SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode SecurePasswordKdfAlgoClass: %w" , err )
}
return &v , nil
case SecurePasswordKdfAlgoSHA512TypeID :
v := SecurePasswordKdfAlgoSHA512 {}
if err := v .Decode (buf ); err != nil {
return nil , fmt .Errorf ("unable to decode SecurePasswordKdfAlgoClass: %w" , err )
}
return &v , nil
default :
return nil , fmt .Errorf ("unable to decode SecurePasswordKdfAlgoClass: %w" , bin .NewUnexpectedID (id ))
}
}
type SecurePasswordKdfAlgoBox struct {
SecurePasswordKdfAlgo SecurePasswordKdfAlgoClass
}
func (b *SecurePasswordKdfAlgoBox ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("unable to decode SecurePasswordKdfAlgoBox to nil" )
}
v , err := DecodeSecurePasswordKdfAlgo (buf )
if err != nil {
return fmt .Errorf ("unable to decode boxed value: %w" , err )
}
b .SecurePasswordKdfAlgo = v
return nil
}
func (b *SecurePasswordKdfAlgoBox ) Encode (buf *bin .Buffer ) error {
if b == nil || b .SecurePasswordKdfAlgo == nil {
return fmt .Errorf ("unable to encode SecurePasswordKdfAlgoClass as nil" )
}
return b .SecurePasswordKdfAlgo .Encode (buf )
}
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 .