2022-02-09 11:15:00 +01:00
|
|
|
package steward
|
2022-02-09 14:59:40 +01:00
|
|
|
|
2022-04-04 10:29:14 +02:00
|
|
|
import "sync"
|
|
|
|
|
2022-02-09 14:59:40 +01:00
|
|
|
type signatureBase32 string
|
|
|
|
type argsString string
|
|
|
|
type centralAuth struct {
|
2022-04-04 10:29:14 +02:00
|
|
|
schema map[Node]map[argsString]signatureBase32
|
|
|
|
nodePublicKeys nodePublicKeys
|
|
|
|
configuration *Configuration
|
2022-02-09 14:59:40 +01:00
|
|
|
}
|
|
|
|
|
2022-04-04 10:29:14 +02:00
|
|
|
func newCentralAuth(configuration *Configuration) *centralAuth {
|
2022-02-09 14:59:40 +01:00
|
|
|
a := centralAuth{
|
2022-04-04 10:29:14 +02:00
|
|
|
schema: make(map[Node]map[argsString]signatureBase32),
|
|
|
|
nodePublicKeys: *newNodePublicKeys(),
|
|
|
|
configuration: configuration,
|
2022-02-09 14:59:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return &a
|
|
|
|
}
|
2022-04-04 10:29:14 +02:00
|
|
|
|
|
|
|
type nodePublicKeys struct {
|
|
|
|
mu sync.Mutex
|
|
|
|
keyMap map[Node]string
|
|
|
|
}
|
|
|
|
|
|
|
|
func newNodePublicKeys() *nodePublicKeys {
|
|
|
|
n := nodePublicKeys{
|
|
|
|
keyMap: make(map[Node]string),
|
|
|
|
}
|
|
|
|
|
|
|
|
return &n
|
|
|
|
}
|