feat: vendor gitea 1.16.2

This commit is contained in:
2026-06-02 08:36:01 +00:00
parent 247cd60f69
commit 54798b4615
2145 changed files with 162965 additions and 126447 deletions
@@ -214,13 +214,20 @@ func (key ecdsaSingingKey) VerifyKey() any {
func (key ecdsaSingingKey) ToJWK() (map[string]string, error) {
pubKey := key.key.Public().(*ecdsa.PublicKey)
// PublicKey.Bytes returns the uncompressed SEC 1 format: 0x04 || X || Y
pubKeyBytes, err := pubKey.Bytes()
if err != nil {
return nil, err
}
coordLen := (len(pubKeyBytes) - 1) / 2
return map[string]string{
"kty": "EC",
"alg": key.SigningMethod().Alg(),
"kid": key.id,
"crv": pubKey.Params().Name,
"x": base64.RawURLEncoding.EncodeToString(pubKey.X.Bytes()),
"y": base64.RawURLEncoding.EncodeToString(pubKey.Y.Bytes()),
"x": base64.RawURLEncoding.EncodeToString(pubKeyBytes[1 : 1+coordLen]),
"y": base64.RawURLEncoding.EncodeToString(pubKeyBytes[1+coordLen:]),
}, nil
}