-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rln): init rln_keystore_generator
- Loading branch information
Showing
6 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# rln_keystore_generator | ||
|
||
TODO! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
when (NimMajor, NimMinor) < (1, 4): | ||
{.push raises: [Defect].} | ||
else: | ||
{.push raises: [].} | ||
|
||
import | ||
stew/results, | ||
chronos, | ||
confutils, | ||
confutils/defs, | ||
confutils/toml/defs as confTomlDefs, | ||
confutils/toml/std/net as confTomlNet, | ||
libp2p/crypto/crypto, | ||
libp2p/crypto/secp, | ||
libp2p/multiaddress, | ||
secp256k1 | ||
import | ||
../../waku/common/confutils/envvar/defs as confEnvvarDefs, | ||
../../waku/common/confutils/envvar/std/net as confEnvvarNet | ||
|
||
export | ||
confTomlDefs, | ||
confTomlNet, | ||
confEnvvarDefs, | ||
confEnvvarNet | ||
|
||
type | ||
RlnKeystoreGeneratorConf* = object | ||
configFile* {. | ||
desc: "Loads configuration from a TOML file (cmd-line parameters take precedence)", | ||
name: "config-file" }: Option[InputFile] | ||
|
||
execute* {. | ||
desc: "Runs the registration function on-chain. By default, a dry-run will occur", | ||
defaultValue: false, | ||
name: "execute" .}: bool | ||
|
||
## General node config | ||
rlnRelayCredPath* {. | ||
desc: "The path for peristing rln-relay credential", | ||
defaultValue: "", | ||
name: "rln-relay-cred-path" }: string | ||
|
||
rlnRelayEthClientAddress* {. | ||
desc: "WebSocket address of an Ethereum testnet client e.g., ws://localhost:8540/", | ||
defaultValue: "ws://localhost:8540/", | ||
name: "rln-relay-eth-client-address" }: string | ||
|
||
rlnRelayEthContractAddress* {. | ||
desc: "Address of membership contract on an Ethereum testnet", | ||
defaultValue: "", | ||
name: "rln-relay-eth-contract-address" }: string | ||
|
||
rlnRelayCredentialsPassword* {. | ||
desc: "Password for encrypting RLN credentials", | ||
defaultValue: "", | ||
name: "rln-relay-cred-password" }: string | ||
|
||
proc loadConfig*(T: type RlnKeystoreGeneratorConf): Result[T, string] = | ||
try: | ||
let conf = RlnKeystoreGeneratorConf.load() | ||
ok(conf) | ||
except CatchableError: | ||
err(getCurrentExceptionMsg()) | ||
except Exception: | ||
err(getCurrentExceptionMsg()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-d:chronicles_line_numbers | ||
-d:chronicles_runtime_filtering=on | ||
#-d:"chronicles_enabled_topics=GossipSub:TRACE,WakuRelay:TRACE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
when (NimMajor, NimMinor) < (1, 4): | ||
{.push raises: [Defect].} | ||
else: | ||
{.push raises: [].} | ||
|
||
import | ||
chronicles, | ||
stew/[results] | ||
|
||
import | ||
./external_config | ||
|
||
logScope: | ||
topics = "rln_keystore_generator" | ||
|
||
when isMainModule: | ||
{.pop.} | ||
let confRes = RlnKeystoreGeneratorConf.loadConfig() | ||
if confRes.isErr(): | ||
error "failure while loading the configuration", error=confRes.error() | ||
quit(1) | ||
|
||
let conf = confRes.get() | ||
|
||
debug "configuration", conf = $conf | ||
|
||
# initialize keystore | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters