Generate a random key ID on registration
This commit is contained in:
parent
949d1fc2ad
commit
09417b5147
5 changed files with 47 additions and 10 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
"github.com/common-fate/httpsig/alg_ed25519"
|
||||
"github.com/common-fate/httpsig/verifier"
|
||||
"github.com/google/uuid"
|
||||
|
||||
"crispbyte.dev/sig-auth/keydirectory"
|
||||
)
|
||||
|
@ -41,7 +42,12 @@ func (dir InMemoryDirectory) GetKey(ctx context.Context, keyId string, _ string)
|
|||
}
|
||||
|
||||
func (dir InMemoryDirectory) RegisterKey(key crypto.PublicKey, alg string, userId string) (string, error) {
|
||||
keyId := userId
|
||||
uuid, err := uuid.NewRandom()
|
||||
keyId := uuid.String()
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
dir.records[keyId] = keydirectory.KeyEntry{
|
||||
Alg: alg,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue