Reog and implement sqlite
This commit is contained in:
parent
30cdf2c7e7
commit
61aa1be730
9 changed files with 223 additions and 76 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue