feat(SNM): Install `waku exportHandshake` command

This commit is contained in:
Emil Ivanichkov 2024-03-21 18:52:21 +02:00 committed by Emil Ivanichkov
parent 8164d042e6
commit 81a6da009a
2 changed files with 12 additions and 2 deletions

View File

@ -81,6 +81,12 @@ proc doWakuPairing(config: StatusNodeManagerConfig,
waitFor wakuPair(wakuClient, wakuPairRequestData)
proc doWakuHandshakeExport(config: StatusNodeManagerConfig,
wakuClient: var RestClientRef) =
let requestData =
WakuExportHandshakeRequestData(exportFile: $config.handshakeFile)
waitFor wakuExportHandshake(wakuClient, requestData)
proc doWakuCommand(config: StatusNodeManagerConfig, rng: ref HmacDrbgContext) =
var wakuClient = RestClientRef.new(initTAddress(config.restAddress,
config.restPort))
@ -88,7 +94,7 @@ proc doWakuCommand(config: StatusNodeManagerConfig, rng: ref HmacDrbgContext) =
of WakuCommand.pair:
doWakuPairing(config, rng, wakuClient)
of WakuCommand.exportHandshake:
discard
doWakuHandshakeExport(config, wakuClient)
when isMainModule:
setupLogLevel(LogLevel.NOTICE)

View File

@ -12,6 +12,7 @@ export
defaultSNMRestPort, defaultAdminListenAddress,
parseCmdArg, completeCmdArg, `/`
const wakuHandshakeDataFilename* = "handshake_data.json"
type
SNMStartUpCmd* {.pure.} = enum
@ -104,7 +105,10 @@ type
name: "pubsub-topic" .}: PubsubTopic
of WakuCommand.exportHandshake:
discard
handshakeFile* {.
desc: "The file to export the waku handshake result to"
defaultValue: config.defaultDataDir() / "waku" / wakuHandshakeDataFilename
name: "handshake-file" .}: OutFile
proc defaultDataDir*[Conf](config: Conf): string =
let dataDir = when defined(windows):