mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 22:24:02 +03:00
Updates for go 1.18
This commit is contained in:
@@ -29,17 +29,17 @@ func (r *NonceRequest) Bytes() []byte {
|
||||
|
||||
// NewNonceRequest builds new none request based on proxy secret.
|
||||
func NewNonceRequest(proxySecret []byte) (*NonceRequest, error) {
|
||||
nonce := make([]byte, 16)
|
||||
keySelector := make([]byte, 4)
|
||||
cryptoTS := make([]byte, 4)
|
||||
nonce := make([]byte, 16) // nolint: gomnd
|
||||
keySelector := make([]byte, 4) // nolint: gomnd
|
||||
cryptoTS := make([]byte, 4) // nolint: gomnd
|
||||
|
||||
if _, err := rand.Read(nonce); err != nil {
|
||||
return nil, fmt.Errorf("cannot generate nonce: %w", err)
|
||||
}
|
||||
|
||||
copy(keySelector, proxySecret)
|
||||
|
||||
timestamp := time.Now().Truncate(time.Second).Unix() % 4294967296 // 256 ^ 4 - do not know how to name
|
||||
// 256 ^ 4 - do not know how to name
|
||||
timestamp := time.Now().Truncate(time.Second).Unix() % 4294967296 // nolint: gomnd
|
||||
binary.LittleEndian.PutUint32(cryptoTS, uint32(timestamp))
|
||||
|
||||
return &NonceRequest{
|
||||
|
||||
Reference in New Issue
Block a user