mirror of
https://github.com/MeshCore-Beacon/beacon-server.git
synced 2026-09-02 17:33:47 +00:00
add default keys w/public
allows default keys and future extra keys from config maybe add some other live decoding or something too, store hashtag channel keys in the db?
This commit is contained in:
@@ -3,13 +3,23 @@
|
||||
// Future: add a DB-backed fallback that checks the channel_keys table.
|
||||
package keystore
|
||||
|
||||
import "encoding/hex"
|
||||
import (
|
||||
"encoding/hex"
|
||||
"maps"
|
||||
)
|
||||
|
||||
type MapKeyStore struct {
|
||||
keys map[string][]byte // channel hash hex string → key bytes
|
||||
}
|
||||
|
||||
func NewMapKeyStore(keys map[string][]byte) *MapKeyStore {
|
||||
var defaultKeys = map[string][]byte{
|
||||
"11": {0x8b, 0x33, 0x87, 0xe9, 0xc5, 0xcd, 0xea, 0x6a, 0xc9, 0xe5, 0xed, 0xba, 0xa1, 0x15, 0xcd, 0x72}, // public channel
|
||||
}
|
||||
|
||||
func NewMapKeyStore(extra map[string][]byte) *MapKeyStore {
|
||||
keys := make(map[string][]byte)
|
||||
maps.Copy(keys, defaultKeys)
|
||||
maps.Copy(keys, extra)
|
||||
return &MapKeyStore{keys}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user