fix: remove unused functions flagged by golangci-lint

Remove signJWT (replaced by signJWTWithKID) and ecdsaPublicKeyToJWK
(dead code from JWE implementation) to pass CI lint checks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Shankar
2026-04-02 17:07:52 -04:00
parent cf632c0af4
commit d0f5fd2dcd
2 changed files with 0 additions and 46 deletions
-36
View File
@@ -201,42 +201,6 @@ func jwkToECDSA(jwk *jwkEC) (*ecdsa.PrivateKey, error) {
return key, nil
}
// ecdsaPublicKeyToJWK converts an ECDSA public key to a JWK map for JWT header embedding.
func ecdsaPublicKeyToJWK(key *ecdsa.PublicKey) map[string]string {
var crv string
var size int
switch key.Curve {
case elliptic.P256():
crv = "P-256"
size = 32
case elliptic.P384():
crv = "P-384"
size = 48
case elliptic.P521():
crv = "P-521"
size = 66
default:
crv = "unknown"
size = 32
}
xBytes := key.X.Bytes()
yBytes := key.Y.Bytes()
// Pad to fixed size
xPadded := make([]byte, size)
yPadded := make([]byte, size)
copy(xPadded[size-len(xBytes):], xBytes)
copy(yPadded[size-len(yBytes):], yBytes)
return map[string]string{
"kty": "EC",
"crv": crv,
"x": base64.RawURLEncoding.EncodeToString(xPadded),
"y": base64.RawURLEncoding.EncodeToString(yPadded),
}
}
// aesKeyUnwrap implements AES Key Unwrap per RFC 3394.
func aesKeyUnwrap(kek, ciphertext []byte) ([]byte, error) {
if len(ciphertext)%8 != 0 || len(ciphertext) < 24 {
@@ -435,16 +435,6 @@ func signJWTWithKID(claims map[string]interface{}, key *ecdsa.PrivateKey, kid st
return signJWTRaw(claims, key, header)
}
// signJWT creates a minimal ES256 JWT from the given claims (no kid).
func signJWT(claims map[string]interface{}, key *ecdsa.PrivateKey) (string, error) {
header := map[string]string{
"alg": "ES256",
"typ": "JWT",
}
return signJWTRaw(claims, key, header)
}
// signJWTRaw creates an ES256 JWT from the given claims and header.
func signJWTRaw(claims map[string]interface{}, key *ecdsa.PrivateKey, header map[string]string) (string, error) {