Reog and implement sqlite

This commit is contained in:
cheddar 2025-02-20 20:45:49 -05:00
parent 30cdf2c7e7
commit 61aa1be730
No known key found for this signature in database
9 changed files with 223 additions and 76 deletions

View file

@ -1,9 +1,33 @@
package keydirectory
import "crypto"
import (
"crypto"
"crypto/ed25519"
"fmt"
type KeyEntry struct {
"github.com/common-fate/httpsig/alg_ed25519"
"github.com/common-fate/httpsig/verifier"
)
type keyEntry struct {
Alg string
PublicKey crypto.PublicKey
UserId string
}
func (k keyEntry) toAlg() (verifier.Algorithm, error) {
var alg verifier.Algorithm
var err error
switch k.Alg {
case "ed25519":
alg = alg_ed25519.Ed25519{
PublicKey: k.PublicKey.(ed25519.PublicKey),
Attrs: k.UserId,
}
default:
err = fmt.Errorf("unknown algoritm: %s", k.Alg)
}
return alg, err
}