From 94d41d20a66f6f97110c046bd0769ce5bd70e6a4 Mon Sep 17 00:00:00 2001 From: Daisuke Maki Date: Tue, 21 Nov 2023 21:32:55 +0900 Subject: [PATCH] appease linter --- jwk/okp.go | 2 +- jwk/symmetric.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/jwk/okp.go b/jwk/okp.go index 77a3576eb..2bbbc7041 100644 --- a/jwk/okp.go +++ b/jwk/okp.go @@ -139,7 +139,7 @@ func buildOKPPrivateKey(alg jwa.EllipticCurveAlgorithm, xbuf []byte, dbuf []byte } // This is half baked. I think it will blow up if we used ecdh.* keys and/or x25519 keys -func okpJWKToRaw(key Key, hint interface{}) (interface{}, error) { +func okpJWKToRaw(key Key, _ interface{} /* this is unused because this is half baked */) (interface{}, error) { switch key := key.(type) { case *okpPrivateKey: key.mu.RLock() diff --git a/jwk/symmetric.go b/jwk/symmetric.go index e58f17920..1df7c6c15 100644 --- a/jwk/symmetric.go +++ b/jwk/symmetric.go @@ -28,6 +28,9 @@ func (k *symmetricKey) FromRaw(rawKey []byte) error { func octetSeqToRaw(key Key, hint interface{}) (interface{}, error) { switch key := key.(type) { case *symmetricKey: + if _, ok := hint.([]byte); !ok { + return nil, fmt.Errorf(`invalid destination object type %T for symmetric key: %w`, hint, ContinueError()) + } key.mu.RLock() defer key.mu.RUnlock() octets := make([]byte, len(key.octets))