loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: modernize import (#7170)

Since go1.24 this is available in the standard library, error values were added to the API. We simply continue to panic on error.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7170
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>

authored by

Gusted
Gusted
and committed by
Gusted
a479fef4 7c05c8fa

+8 -7
+8 -7
modules/keying/keying.go
··· 16 16 package keying 17 17 18 18 import ( 19 + "crypto/hkdf" 19 20 "crypto/rand" 20 21 "crypto/sha256" 21 22 "encoding/binary" 22 23 23 24 "golang.org/x/crypto/chacha20poly1305" 24 - "golang.org/x/crypto/hkdf" 25 25 ) 26 26 27 27 var ( ··· 41 41 // Set the main IKM for this module. 42 42 func Init(ikm []byte) { 43 43 // Salt is intentionally left empty, it's not useful to Forgejo's use case. 44 - prk = hkdf.Extract(hash, ikm, nil) 44 + var err error 45 + prk, err = hkdf.Extract(hash, ikm, nil) 46 + if err != nil { 47 + panic(err) 48 + } 45 49 } 46 50 47 51 // Specifies the context for which a subkey should be derived for. ··· 62 66 panic("keying: not initialized") 63 67 } 64 68 65 - r := hkdf.Expand(hash, prk, []byte(context)) 66 - 67 - key := make([]byte, aeadKeySize) 68 - // This should never return an error, but if it does, panic. 69 - if n, err := r.Read(key); err != nil || n != aeadKeySize { 69 + key, err := hkdf.Expand(hash, prk, string(context), aeadKeySize) 70 + if err != nil { 70 71 panic(err) 71 72 } 72 73