/
main.go
664 lines (593 loc) · 18.7 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
// genconfig.go - Meson config generation.
// Copyright (C) 2020 Hashcloak.
// genconfig.go - Katzenpost self contained test network.
// Copyright (C) 2017 Yawning Angel, David Stainton.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"path/filepath"
"time"
"github.com/BurntSushi/toml"
currencyConf "github.com/hashcloak/Meson-plugin/pkg/config"
kConfig "github.com/hashcloak/Meson/katzenmint/config"
sConfig "github.com/hashcloak/Meson/server/config"
"github.com/katzenpost/core/crypto/ecdh"
"github.com/katzenpost/core/crypto/eddsa"
"github.com/katzenpost/core/crypto/rand"
"github.com/tendermint/tendermint/crypto/tmhash"
"github.com/tendermint/tendermint/light"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
cfg "github.com/tendermint/tendermint/config"
tmos "github.com/tendermint/tendermint/libs/os"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/privval"
"github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
)
const (
basePort = 30000
nrNodes = 6
nrProviders = 2
minimumNodesPerLayer = 2
nValidators = 4
dirPerm = 0700
initialHeight = 0
keyType = types.ABCIPubKeyTypeEd25519
)
var currencyList = []*currencyConf.Config{
¤cyConf.Config{
Ticker: "gor",
RPCUser: "rpcuser",
RPCPass: "rpcpassword",
RPCURL: "https://goerli.hashcloak.com",
},
¤cyConf.Config{
Ticker: "tbnb",
RPCUser: "rpcuser",
RPCPass: "rpcpassword",
RPCURL: "https://tbinance.hashcloak.com",
},
¤cyConf.Config{
Ticker: "rin",
RPCUser: "rpcuser",
RPCPass: "rpcpassword",
RPCURL: "https://rinkeby.hashcloak.com",
},
}
type katzenpost struct {
goBinDir string
baseDir string
outputDir string
authAddress string
currency int
mainnet bool
authPubIdentity string
nodeConfigs []*sConfig.Config
lastPort uint16
nodeIdx int
providerIdx int
recipients map[string]*ecdh.PublicKey
nrProviders int
nrNodes int
nValidators int
trustOptions light.TrustOptions
chainID string
onlyMixNode bool
onlyProviderNode bool
onlyValidatorNode bool
publicIPAddress string
nameOfSingleNode string
}
func (s *katzenpost) genProviderConfig(name string) (cfg *sConfig.Config, err error) {
cfg, err = s.genMixNodeConfig(name)
cfg.Server.Identifier = name
cfg.Server.IsProvider = true
cfg.Management = new(sConfig.Management)
cfg.Management.Enable = true
cfg.Provider = new(sConfig.Provider)
loopCfg := new(sConfig.Kaetzchen)
loopCfg.Capability = "loop"
loopCfg.Endpoint = "+loop"
cfg.Provider.Kaetzchen = append(cfg.Provider.Kaetzchen, loopCfg)
/*
keysvrCfg := new(sConfig.Kaetzchen)
keysvrCfg.Capability = "keyserver"
keysvrCfg.Endpoint = "+keyserver"
cfg.Provider.Kaetzchen = append(cfg.Provider.Kaetzchen, keysvrCfg)
*/
cfg.Provider.EnableUserRegistrationHTTP = true
userRegistrationPort := 10000 + s.lastPort
cfg.Provider.UserRegistrationHTTPAddresses = []string{fmt.Sprintf("0.0.0.0:%d", userRegistrationPort)}
cfg.Provider.AdvertiseUserRegistrationHTTPAddresses = []string{fmt.Sprintf("http://%s:%d", s.publicIPAddress, userRegistrationPort)}
// Plugin configs
// echo server
pluginConf := make(map[string]interface{})
pluginConf["log_dir"] = filepath.Join(s.baseDir, name)
pluginConf["log_level"] = cfg.Logging.Level
echoPlugin := sConfig.CBORPluginKaetzchen{
Disable: false,
Capability: "echo",
Endpoint: "+echo",
Command: s.goBinDir + "/echo_server",
MaxConcurrency: 1,
Config: pluginConf,
}
cfg.Provider.CBORPluginKaetzchen = append(cfg.Provider.CBORPluginKaetzchen, &echoPlugin)
// panda serever
pluginConf = make(map[string]interface{})
pluginConf["log_dir"] = filepath.Join(s.baseDir, name)
pluginConf["log_level"] = cfg.Logging.Level
pluginConf["fileStore"] = filepath.Join(s.baseDir, name, "/panda.storage")
pandaPlugin := sConfig.CBORPluginKaetzchen{
Disable: false,
Capability: "panda",
Endpoint: "+panda",
Command: s.goBinDir + "/panda_server",
MaxConcurrency: 1,
Config: pluginConf,
}
cfg.Provider.CBORPluginKaetzchen = append(cfg.Provider.CBORPluginKaetzchen, &pandaPlugin)
// memspool
pluginConf = make(map[string]interface{})
// leaving this one out until it can be proven that it won't crash the spool plugin
pluginConf["log_dir"] = filepath.Join(s.baseDir, name)
pluginConf["data_store"] = filepath.Join(s.baseDir, name, "/memspool.storage")
spoolPlugin := sConfig.CBORPluginKaetzchen{
Disable: false,
Capability: "spool",
Endpoint: "+spool",
Command: s.goBinDir + "/memspool",
MaxConcurrency: 1,
Config: pluginConf,
}
cfg.Provider.CBORPluginKaetzchen = append(cfg.Provider.CBORPluginKaetzchen, &spoolPlugin)
// Meson
curConf := currencyList[s.currency]
s.currency++
if s.currency >= len(currencyList) {
s.currency = 0
}
curConf.LogDir = filepath.Join(s.baseDir, name)
curConf.LogLevel = cfg.Logging.Level
pluginConf = make(map[string]interface{})
pluginConf["f"] = filepath.Join(s.baseDir, name, "/currency.toml")
pluginConf["log_dir"] = filepath.Join(s.baseDir, name)
pluginConf["log_level"] = cfg.Logging.Level
mesonPlugin := sConfig.CBORPluginKaetzchen{
Disable: false,
Capability: curConf.Ticker,
Endpoint: "+" + curConf.Ticker,
Command: s.goBinDir + "/Meson",
MaxConcurrency: 1,
Config: pluginConf,
}
cfg.Provider.CBORPluginKaetzchen = append(cfg.Provider.CBORPluginKaetzchen, &mesonPlugin)
// generate currency.toml
_ = os.Mkdir(filepath.Join(s.outputDir, identifier(cfg)), dirPerm)
fileName := filepath.Join(
s.outputDir, identifier(cfg), "currency.toml",
)
f, err := os.Create(fileName)
if err != nil {
return nil, err
}
defer f.Close()
// Serialize the descriptor.
enc := toml.NewEncoder(f)
err = enc.Encode(curConf)
if err != nil {
return nil, err
}
return cfg, cfg.FixupAndValidate()
}
func (s *katzenpost) genMixNodeConfig(name string) (cfg *sConfig.Config, err error) {
priv := filepath.Join(s.outputDir, name, "identity.private.pem")
public := filepath.Join(s.outputDir, name, "identity.public.pem")
_, err = eddsa.Load(priv, public, rand.Reader)
if err != nil {
return nil, err
}
cfg = new(sConfig.Config)
// PKI section
cfg.PKI = &sConfig.PKI{
Voting: &sConfig.Voting{
ChainID: s.chainID,
TrustOptions: s.trustOptions,
PrimaryAddress: s.authAddress,
WitnessesAddresses: []string{s.authAddress},
DatabaseName: fmt.Sprintf("%s-db", name),
DatabaseDir: filepath.Join(s.outputDir, name),
RPCAddress: s.authAddress,
},
}
// Server section.
cfg.Server = new(sConfig.Server)
cfg.Server.Identifier = name
cfg.Server.Addresses = []string{
fmt.Sprintf("0.0.0.0:%d", s.lastPort),
// fmt.Sprintf(s.publicIPAddress+":%d", s.lastPort)
}
cfg.Server.AltAddresses = map[string][]string{
"tcp4": {
fmt.Sprintf(s.publicIPAddress+":%d", s.lastPort),
},
}
cfg.Server.OnlyAdvertiseAltAddresses = true
cfg.Server.DataDir = filepath.Join(s.baseDir, name)
cfg.Server.IsProvider = false
_ = os.Mkdir(cfg.Server.DataDir, dirPerm)
// Debug section.
cfg.Debug = new(sConfig.Debug)
cfg.Debug.DisableRateLimit = true
cfg.Debug.SendDecoyTraffic = false
// This needs to be 1 because during runtime the default
// value of this is the number of cores of the computer.
// In docker this number is 1 but if one runs this script
// on a personal computer the value becomes much more than
// what docker is capable of handling. Take a look at:
// https://github.com/katzenpost/server/blob/master/config/config.go#L261
cfg.Debug.NumSphinxWorkers = 1
cfg.Debug.ConnectTimeout = 120000 // 2 mins
cfg.Debug.HandshakeTimeout = 600000
// Logging section.
cfg.Logging = new(sConfig.Logging)
cfg.Logging.File = "katzenpost.log"
cfg.Logging.Level = "DEBUG"
return cfg, cfg.FixupAndValidate()
}
func (s *katzenpost) genNodeConfig(isProvider bool) error {
var err error
var cfg *sConfig.Config
var name string
if isProvider {
name = fmt.Sprintf("provider-%d", s.providerIdx)
} else {
name = fmt.Sprintf("node-%d", s.nodeIdx)
}
if s.nameOfSingleNode != "" {
name = s.nameOfSingleNode
}
_ = os.Mkdir(filepath.Join(s.outputDir, name), dirPerm)
if isProvider {
cfg, err = s.genProviderConfig(name)
if err != nil {
return err
}
s.providerIdx++
} else {
cfg, err = s.genMixNodeConfig(name)
if err != nil {
return err
}
s.nodeIdx++
}
s.nodeConfigs = append(s.nodeConfigs, cfg)
s.lastPort++
return nil
}
func (s *katzenpost) fetchKatzenmintInfo() error {
c, err := rpchttp.New(s.authAddress, "/websocket")
if err != nil {
return err
}
info, err := c.ABCIInfo(context.Background())
if err != nil {
return err
}
genesis, err := c.Genesis(context.Background())
if err != nil {
return err
}
blockHeight := info.Response.LastBlockHeight
block, err := c.Block(context.Background(), &blockHeight)
if err != nil {
return err
}
if block == nil {
return fmt.Errorf("couldn't find block: %d", blockHeight)
}
s.chainID = genesis.Genesis.ChainID
s.trustOptions = light.TrustOptions{
Period: 10 * time.Minute,
Height: blockHeight,
Hash: block.BlockID.Hash,
}
return nil
}
func (s *katzenpost) generateVotingMixnetConfigs() {
if s.authAddress != "" {
if err := s.fetchKatzenmintInfo(); err != nil {
log.Fatalf("fetchKatzenmintInfo failed: %s", err)
}
}
s.generateValidatorNodesOfMixnet()
s.generateProviderNodesOfMixnet()
s.generateNodesOfMixnet()
}
func (s *katzenpost) generateValidatorNodesOfMixnet() {
// Generate the katzenmint configs.
if s.authAddress == "" {
for i := 0; i < s.nValidators; i++ {
if err := s.genValidatorConfig(i); err != nil {
log.Fatalf("Failed to generate katzenmint config: %v", err)
}
}
}
}
func (s *katzenpost) generateProviderNodesOfMixnet() {
// Generate the provider configs.
for i := 0; i < s.nrProviders; i++ {
if err := s.genNodeConfig(true); err != nil {
log.Fatalf("Failed to generate provider config: %v", err)
}
}
}
func (s *katzenpost) generateNodesOfMixnet() {
// Generate the node configs.
for i := 0; i < s.nrNodes; i++ {
if err := s.genNodeConfig(false); err != nil {
log.Fatalf("Failed to generate node config: %v", err)
}
}
}
func (s *katzenpost) genValidatorConfig(index int) error {
tmConfig := cfg.DefaultConfig()
genVals := make([]types.GenesisValidator, s.nValidators)
for i := 0; i < s.nValidators; i++ {
nodeDirName := fmt.Sprintf("auth-%d", i)
nodeDir := filepath.Join(s.outputDir, nodeDirName)
tmConfig.SetRoot(nodeDir)
if !s.mainnet {
tmConfig.P2P.AllowDuplicateIP = true
}
tmConfig.Moniker = nodeDirName
err := os.MkdirAll(filepath.Join(nodeDir, "config"), dirPerm)
if err != nil {
_ = os.RemoveAll(nodeDir)
return err
}
err = os.MkdirAll(filepath.Join(nodeDir, "data"), dirPerm)
if err != nil {
_ = os.RemoveAll(nodeDir)
return err
}
if err := initFilesWithConfig(tmConfig); err != nil {
return err
}
pvKeyFile := filepath.Join(nodeDir, tmConfig.BaseConfig.PrivValidatorKey)
pvStateFile := filepath.Join(nodeDir, tmConfig.BaseConfig.PrivValidatorState)
pv := privval.LoadFilePV(pvKeyFile, pvStateFile)
pubKey, err := pv.GetPubKey()
if err != nil {
return fmt.Errorf("can't get pubkey: %w", err)
}
genVals[i] = types.GenesisValidator{
Address: pubKey.Address(),
PubKey: pubKey,
Power: 1,
Name: nodeDirName,
}
}
// Generate genesis doc from generated validators
chainID := "chain-" + tmrand.Str(6)
genDoc := &types.GenesisDoc{
ChainID: chainID,
GenesisTime: tmtime.Now(),
InitialHeight: initialHeight,
Validators: genVals,
ConsensusParams: types.DefaultConsensusParams(),
}
// Write genesis file.
for i := 0; i < s.nValidators; i++ {
nodeDirName := fmt.Sprintf("auth-%d", i)
nodeDir := filepath.Join(s.outputDir, nodeDirName)
if err := genDoc.SaveAs(filepath.Join(nodeDir, tmConfig.BaseConfig.Genesis)); err != nil {
_ = os.RemoveAll(nodeDir)
return err
}
}
// Overwrite default config.
for i := 0; i < s.nValidators; i++ {
nodeDirName := fmt.Sprintf("auth-%d", i)
nodeDir := filepath.Join(s.outputDir, nodeDirName)
cfgPath := filepath.Join(nodeDir, "config", "config.toml")
cfg.WriteConfigFile(cfgPath, tmConfig)
katConfig := kConfig.DefaultConfig()
katConfig.DBPath = filepath.Join(nodeDir, "kdata")
katConfig.TendermintConfigPath = cfgPath
if err := kConfig.WriteConfigFile(filepath.Join(s.outputDir, nodeDirName, "katzenmint.toml"), katConfig); err != nil {
_ = os.RemoveAll(nodeDir)
return err
}
}
log.Printf("initialized katzenmint of %v", index)
s.chainID = chainID
s.trustOptions = light.TrustOptions{
Period: 1,
Height: 1,
Hash: make([]byte, tmhash.Size),
}
s.authAddress = tmConfig.RPC.ListenAddress
return nil
}
func initFilesWithConfig(config *cfg.Config) error {
// private validator
privValKeyFile := config.PrivValidatorKeyFile()
privValStateFile := config.PrivValidatorStateFile()
var pv *privval.FilePV
if !tmos.FileExists(privValKeyFile) {
pv = privval.GenFilePV(privValKeyFile, privValStateFile)
pv.Save()
}
nodeKeyFile := config.NodeKeyFile()
if !tmos.FileExists(nodeKeyFile) {
if _, err := p2p.LoadOrGenNodeKey(nodeKeyFile); err != nil {
return err
}
}
// genesis file
genFile := config.GenesisFile()
if !tmos.FileExists(genFile) {
genDoc := types.GenesisDoc{
ChainID: fmt.Sprintf("test-chain-%v", tmrand.Str(6)),
GenesisTime: tmtime.Now(),
ConsensusParams: types.DefaultConsensusParams(),
}
pubKey, err := pv.GetPubKey()
if err != nil {
return fmt.Errorf("can't get pubkey: %w", err)
}
genDoc.Validators = []types.GenesisValidator{{
Address: pubKey.Address(),
PubKey: pubKey,
Power: 10,
}}
if err := genDoc.SaveAs(genFile); err != nil {
return err
}
}
return nil
}
func main() {
var err error
nrNodes := flag.Int("n", nrNodes, "Number of mixes.")
nrProviders := flag.Int("p", nrProviders, "Number of providers.")
nValidators := flag.Int("v", nValidators, "Number of katzenmint validators.")
authAddress := flag.String("a", "", "Katzenmint JSONRPC URI (when set this value, application will fetch PKI info from remote server).")
goBinDir := flag.String("g", "/go/bin", "Path to golang bin.")
baseDir := flag.String("b", "/conf", "Path to for DataDir in the config files.")
outputDir := flag.String("o", "./output", "Output path of the generate config files.")
mixNodeOnly := flag.Bool("node", false, "Only generate a mix node config.")
providerNodeOnly := flag.Bool("provider", false, "Only generate a provider node config.")
validatorNodeOnly := flag.Bool("validator", false, "Only generate a validator config.")
mainnet := flag.Bool("mainnet", false, "Only generate mainnet config.")
publicIPAddress := flag.String("ipv4", "127.0.0.1", "The public ipv4 address of the single node.")
name := flag.String("name", "", "The name of the node.")
authPubIdentity := flag.String("authID", "", "Authority public ID.")
flag.Parse()
s := &katzenpost{
lastPort: basePort + 1,
recipients: make(map[string]*ecdh.PublicKey),
}
outDir, err := filepath.Abs(*outputDir)
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(-1)
}
s.outputDir = outDir
s.goBinDir = *goBinDir
s.baseDir = *baseDir
err = os.Mkdir(s.outputDir, dirPerm)
if err != nil && err.(*os.PathError).Err.Error() != "file exists" {
fmt.Fprintf(os.Stderr, "Failed to create output directory: %v\n", err)
os.Exit(-1)
}
s.authAddress = *authAddress
s.nrProviders = *nrProviders
s.nrNodes = *nrNodes
s.nValidators = *nValidators
s.onlyMixNode = *mixNodeOnly
s.onlyProviderNode = *providerNodeOnly
s.onlyValidatorNode = *validatorNodeOnly
s.mainnet = *mainnet
s.publicIPAddress = *publicIPAddress
s.nameOfSingleNode = *name
s.authPubIdentity = *authPubIdentity
if s.onlyValidatorNode {
s.generateValidatorNodesOfMixnet()
} else if s.onlyMixNode || s.onlyProviderNode {
if s.onlyMixNode && s.onlyProviderNode {
fmt.Fprintf(os.Stderr, "Please specify one of either -node or -provider config\n")
os.Exit(-1)
}
if s.nameOfSingleNode == "" {
fmt.Fprintf(os.Stderr, "Name not provided to provide a name with the -name flag\n")
os.Exit(-1)
}
if s.authPubIdentity == "" {
fmt.Fprintf(os.Stderr, "Need to provide an authority identity\n")
os.Exit(-1)
}
if s.authAddress == "" {
fmt.Fprintf(os.Stderr, "Need to provide an katzenmint server\n")
os.Exit(-1)
}
if err := s.fetchKatzenmintInfo(); err != nil {
log.Fatalf("fetchKatzenmintInfo failed: %s", err)
}
if s.onlyProviderNode {
s.generateProviderNodesOfMixnet()
} else {
s.generateNodesOfMixnet()
}
} else {
s.generateVotingMixnetConfigs()
}
// probably save directly in generate function
for _, v := range s.nodeConfigs {
if err := saveCfg(outDir, v); err != nil {
log.Fatalf("%s", err)
}
}
}
func configName(cfg interface{}) string {
switch cfg.(type) {
case *sConfig.Config:
return "katzenpost.toml"
default:
log.Fatalf("identifier() passed unexpected type")
return ""
}
}
func identifier(cfg interface{}) string {
switch cfg := cfg.(type) {
case *sConfig.Config:
return cfg.Server.Identifier
default:
log.Fatalf("identifier() passed unexpected type")
return ""
}
}
func saveCfg(outputDir string, cfg interface{}) error {
_ = os.Mkdir(filepath.Join(outputDir, identifier(cfg)), dirPerm)
fileName := filepath.Join(
outputDir, identifier(cfg), configName(cfg),
)
log.Printf("saveCfg of %s", fileName)
f, err := os.Create(fileName)
if err != nil {
return err
}
defer f.Close()
// Serialize the descriptor.
enc := toml.NewEncoder(f)
return enc.Encode(cfg)
}
// links between mix and providers
// func (s *katzenpost) spk(a *sConfig.Config) *eddsa.PublicKey {
// priv := filepath.Join(s.outputDir, a.Server.Identifier, "identity.private.pem")
// public := filepath.Join(s.outputDir, a.Server.Identifier, "identity.public.pem")
// idKey, err := eddsa.Load(priv, public, rand.Reader)
// if err != nil {
// panic(err)
// }
// return idKey.PublicKey()
// }