Compare commits

..

2 Commits

Author SHA1 Message Date
Elias Schneider
e486dbd771 release: 0.42.1 2025-03-18 23:03:50 +01:00
Elias Schneider
f7e36a422e fix: kid not added to JWTs 2025-03-18 23:03:34 +01:00
4 changed files with 19 additions and 7 deletions

View File

@@ -1 +1 @@
0.42.0
0.42.1

View File

@@ -1,3 +1,10 @@
## [](https://github.com/pocket-id/pocket-id/compare/v0.42.0...v) (2025-03-18)
### Bug Fixes
* kid not added to JWTs ([f7e36a4](https://github.com/pocket-id/pocket-id/commit/f7e36a422ea6b5327360c9a13308ae408ff7fffe))
## [](https://github.com/pocket-id/pocket-id/compare/v0.41.0...v) (2025-03-18)

View File

@@ -25,14 +25,14 @@ import (
)
const (
// Path in the data/keys folder where the key is stored
// PrivateKeyFile is the path in the data/keys folder where the key is stored
// This is a JSON file containing a key encoded as JWK
PrivateKeyFile = "jwt_private_key.json"
// Size, in bits, of the RSA key to generate if none is found
// RsaKeySize is the size, in bits, of the RSA key to generate if none is found
RsaKeySize = 2048
// Usage for the private keys, for the "use" property
// KeyUsageSigning is the usage for the private keys, for the "use" property
KeyUsageSigning = "sig"
)
@@ -142,9 +142,15 @@ func (s *JwtService) SetKey(privateKey jwk.Key) error {
return fmt.Errorf("private key is not valid: %w", err)
}
// Set the private key in the object
// Set the private key and key id in the object
s.privateKey = privateKey
keyId, ok := privateKey.KeyID()
if !ok {
return errors.New("key object does not contain a key ID")
}
s.keyId = keyId
// Create and encode a JWKS containing the public key
publicKey, err := s.GetPublicJWK()
if err != nil {
@@ -424,7 +430,6 @@ func SaveKeyJWK(key jwk.Key, path string) error {
}
// generateRandomKeyID generates a random key ID.
// It is used for newly-generated keys
func generateRandomKeyID() (string, error) {
buf := make([]byte, 8)
_, err := io.ReadFull(rand.Reader, buf)

View File

@@ -1,6 +1,6 @@
{
"name": "pocket-id-frontend",
"version": "0.42.0",
"version": "0.42.1",
"private": true,
"type": "module",
"scripts": {