mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-12 17:23:18 +03:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e486dbd771 | ||
|
|
f7e36a422e |
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pocket-id-frontend",
|
||||
"version": "0.42.0",
|
||||
"version": "0.42.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user