package mtproto

import (
	// For embedding public keys.
	_ 
	

	
	
)

var (
	// publicKeys is byte blob of new keys added for PQInnerData encryption (key exchange).
	//
	// See https://github.com/telegramdesktop/tdesktop/commit/95a7ce4622dc24717dc5b95fc99599dddfd4ff6c.
	//
	// See https://github.com/tdlib/td/commit/e9e24282378fcdb3a3ce020bee4253b65ac98213.
	//go:embed _data/public_keys.pem
	publicKeys []byte

	parsedKeys struct {
		Keys []exchange.PublicKey
		Once sync.Once
	}
)

//nolint:gochecknoinits
func () {
	 := func( []byte) ([]exchange.PublicKey, error) {
		,  := crypto.ParseRSAPublicKeys()
		if  != nil {
			return nil, 
		}

		 := make([]exchange.PublicKey, 0, len())
		for ,  := range  {
			 = append(, exchange.PublicKey{
				RSA: ,
			})
		}
		return , nil
	}
	parsedKeys.Once.Do(func() {
		,  := (publicKeys)
		if  != nil {
			panic()
		}
		parsedKeys.Keys = append(parsedKeys.Keys, ...)
	})
}

// vendoredKeys parses vendored file _data/public_keys.pem as list of
// PEM-encoded public RSA keys.
//
// Most recent key list can be found on https://my.telegram.org/apps.
func () []exchange.PublicKey {
	return parsedKeys.Keys
}