@devtion/devcli 1.0.5-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +118 -0
  2. package/dist/index.js +3206 -0
  3. package/dist/types/commands/auth.d.ts +25 -0
  4. package/dist/types/commands/clean.d.ts +6 -0
  5. package/dist/types/commands/contribute.d.ts +139 -0
  6. package/dist/types/commands/finalize.d.ts +51 -0
  7. package/dist/types/commands/index.d.ts +9 -0
  8. package/dist/types/commands/listCeremonies.d.ts +5 -0
  9. package/dist/types/commands/logout.d.ts +6 -0
  10. package/dist/types/commands/observe.d.ts +22 -0
  11. package/dist/types/commands/setup.d.ts +86 -0
  12. package/dist/types/commands/validate.d.ts +8 -0
  13. package/dist/types/index.d.ts +2 -0
  14. package/dist/types/lib/errors.d.ts +60 -0
  15. package/dist/types/lib/files.d.ts +64 -0
  16. package/dist/types/lib/localConfigs.d.ts +110 -0
  17. package/dist/types/lib/prompts.d.ts +104 -0
  18. package/dist/types/lib/services.d.ts +31 -0
  19. package/dist/types/lib/theme.d.ts +42 -0
  20. package/dist/types/lib/utils.d.ts +158 -0
  21. package/dist/types/types/index.d.ts +65 -0
  22. package/package.json +99 -0
  23. package/src/commands/auth.ts +194 -0
  24. package/src/commands/clean.ts +49 -0
  25. package/src/commands/contribute.ts +1090 -0
  26. package/src/commands/finalize.ts +382 -0
  27. package/src/commands/index.ts +9 -0
  28. package/src/commands/listCeremonies.ts +32 -0
  29. package/src/commands/logout.ts +67 -0
  30. package/src/commands/observe.ts +193 -0
  31. package/src/commands/setup.ts +901 -0
  32. package/src/commands/validate.ts +29 -0
  33. package/src/index.ts +66 -0
  34. package/src/lib/errors.ts +77 -0
  35. package/src/lib/files.ts +102 -0
  36. package/src/lib/localConfigs.ts +186 -0
  37. package/src/lib/prompts.ts +748 -0
  38. package/src/lib/services.ts +191 -0
  39. package/src/lib/theme.ts +45 -0
  40. package/src/lib/utils.ts +778 -0
  41. package/src/types/conf.d.ts +16 -0
  42. package/src/types/index.ts +70 -0
@@ -0,0 +1,29 @@
1
+ import { parseCeremonyFile } from "@p0tion/actions"
2
+ import { showError } from "../lib/errors.js"
3
+
4
+ /**
5
+ * Validate ceremony setup command.
6
+ */
7
+ const validate = async (cmd: { template: string, constraints?: number }) => {
8
+ try {
9
+ // parse the file and cleanup after
10
+ const parsedFile = await parseCeremonyFile(cmd.template, true)
11
+ // check whether we have a constraints option otherwise default to 1M
12
+ const constraints = cmd.constraints || 1000000
13
+ for await (const circuit of parsedFile.circuits) {
14
+ if (circuit.metadata.constraints > constraints) {
15
+ console.log(false)
16
+ process.exit(0)
17
+ }
18
+ }
19
+
20
+ console.log(true)
21
+
22
+ } catch (err: any) {
23
+ showError(`${err.toString()}`, false)
24
+ // we want to exit with a non-zero exit code
25
+ process.exit(1)
26
+ }
27
+ }
28
+
29
+ export default validate
package/src/index.ts ADDED
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { createCommand } from "commander"
4
+ import { readFileSync } from "fs"
5
+ import { dirname } from "path"
6
+ import { fileURLToPath } from "url"
7
+ import { setup, auth, contribute, observe, finalize, clean, logout, validate, listCeremonies } from "./commands/index.js"
8
+
9
+ // Get pkg info (e.g., name, version).
10
+ const packagePath = `${dirname(fileURLToPath(import.meta.url))}/..`
11
+ const { description, version, name } = JSON.parse(readFileSync(`${packagePath}/package.json`, "utf8"))
12
+ const program = createCommand()
13
+
14
+ // Entry point.
15
+ program.name(name).description(description).version(version)
16
+
17
+ // User commands.
18
+ program.command("auth").description("authenticate yourself using your Github account (OAuth 2.0)").action(auth)
19
+ program
20
+ .command("contribute")
21
+ .description("compute contributions for a Phase2 Trusted Setup ceremony circuits")
22
+ .option("-c, --ceremony <string>", "the prefix of the ceremony you want to contribute for", "")
23
+ .option("-e, --entropy <string>", "the entropy (aka toxic waste) of your contribution", "")
24
+ .action(contribute)
25
+ program
26
+ .command("clean")
27
+ .description("clean up output generated by commands from the current working directory")
28
+ .action(clean)
29
+ program
30
+ .command("list")
31
+ .description("List all ceremonies prefixes")
32
+ .action(listCeremonies)
33
+ program
34
+ .command("logout")
35
+ .description("sign out from Firebae Auth service and delete Github OAuth 2.0 token from local storage")
36
+ .action(logout)
37
+ program
38
+ .command("validate")
39
+ .description("Validate that a Ceremony Setup file is correct")
40
+ .requiredOption("-t, --template <path>", "The path to the ceremony setup template", "")
41
+ .option("-c, --constraints <number>", "The number of constraints to check against")
42
+ .action(validate)
43
+
44
+ // Only coordinator commands.
45
+ const ceremony = program.command("coordinate").description("commands for coordinating a ceremony")
46
+
47
+ ceremony
48
+ .command("setup")
49
+ .description("setup a Groth16 Phase 2 Trusted Setup ceremony for zk-SNARK circuits")
50
+ .option('-t, --template <path>', 'The path to the ceremony setup template', '')
51
+ .option('-a, --auth <string>', 'The Github OAuth 2.0 token', '')
52
+ .action(setup)
53
+
54
+ ceremony
55
+ .command("observe")
56
+ .description("observe in real-time the waiting queue of each ceremony circuit")
57
+ .action(observe)
58
+
59
+ ceremony
60
+ .command("finalize")
61
+ .description(
62
+ "finalize a Phase2 Trusted Setup ceremony by applying a beacon, exporting verification key and verifier contract"
63
+ )
64
+ .action(finalize)
65
+
66
+ program.parseAsync(process.argv)
@@ -0,0 +1,77 @@
1
+ import theme from "./theme.js"
2
+
3
+ /** Services */
4
+ export const CORE_SERVICES_ERRORS = {
5
+ FIREBASE_DEFAULT_APP_DOUBLE_CONFIG: `Wrong double default configuration for Firebase application`,
6
+ FIREBASE_TOKEN_EXPIRED_REMOVED_PERMISSIONS: `The Github authorization has failed due to lack of association between your account and the CLI`,
7
+ FIREBASE_USER_DISABLED: `The Github account has been suspended by the ceremony coordinator(s), blocking the possibility of contribution. Please, contact them to understand the motivation behind it.`,
8
+ FIREBASE_FAILED_CREDENTIALS_VERIFICATION: `Firebase cannot verify your Github credentials due to network errors. Please, try once again later.`,
9
+ FIREBASE_NETWORK_ERROR: `Unable to reach Firebase due to network erros. Please, try once again later and make sure your Internet connection is stable.`,
10
+ FIREBASE_CEREMONY_NOT_OPENED: `There are no ceremonies opened to contributions`,
11
+ FIREBASE_CEREMONY_NOT_CLOSED: `There are no ceremonies ready to finalization`,
12
+ AWS_CEREMONY_BUCKET_CREATION: `Unable to create a new bucket for the ceremony. Something went wrong during the creation. Please, repeat the process by providing a new ceremony name of the ceremony.`,
13
+ AWS_CEREMONY_BUCKET_CANNOT_DOWNLOAD_GET_PRESIGNED_URL: `Unable to download the file from the ceremony bucket. This problem could be related to failure when generating the pre-signed url. Please, we kindly ask you to terminate the current session and repeat the process.`
14
+ }
15
+
16
+ /** Github */
17
+ export const THIRD_PARTY_SERVICES_ERRORS = {
18
+ GITHUB_ACCOUNT_ASSOCIATION_REJECTED: `You have decided not to associate the CLI application with your Github account. This declination will not allow you to make a contribution to any ceremony. In case you made a mistake, you can always repeat the process and accept the association of your Github account with the CLI.`,
19
+ GITHUB_SERVER_TIMEDOUT: `Github's servers are experiencing downtime. Please, try once again later and make sure your Internet connection is stable.`,
20
+ GITHUB_GET_GITHUB_ACCOUNT_INFO: `Something went wrong while retrieving your Github account public information (handle and identifier). Please, try once again later`,
21
+ GITHUB_NOT_AUTHENTICATED: `You are unable to execute the command since you have not authorized this device with your Github account.\n${
22
+ theme.symbols.info
23
+ } Please, run the ${theme.text.bold(
24
+ "phase2cli auth"
25
+ )} command and make sure that your account meets the authentication criteria.`,
26
+ GITHUB_GIST_PUBLICATION_FAILED: `Unable to publish the public attestation as gist making the request using your authenticated Github account. Please, verify that you have allowed the 'gist' access permission during the authentication step.`
27
+ }
28
+
29
+ /** Command */
30
+ export const COMMAND_ERRORS = {
31
+ COMMAND_NOT_COORDINATOR: `Unable to execute the command. In order to perform coordinator functionality you must authenticate with an account having adeguate permissions.`,
32
+ COMMAND_ABORT_PROMPT: `The data submission process was suddenly interrupted. Your previous data has not been saved. We are sorry, you will have to repeat the process again from the beginning.`,
33
+ COMMAND_ABORT_SELECTION: `The data selection process was suddenly interrupted. Your previous data has not been saved. We are sorry, you will have to repeat the process again from the beginning.`,
34
+ COMMAND_SETUP_NO_R1CS: `Unable to retrieve R1CS files from current working directory. Please, run this command from a working directory where the R1CS files are located to continue with the setup process. We kindly ask you to run the command from an empty directory containing only the R1CS and WASM files.`,
35
+ COMMAND_SETUP_NO_WASM: `Unable to retrieve WASM files from current working directory. Please, run this command from a working directory where the WASM files are located to continue with the setup process. We kindly ask you to run the command from an empty directory containing only the WASM and R1CS files.`,
36
+ COMMAND_SETUP_MISMATCH_R1CS_WASM: `The folder contains more R1CS files than WASM files (or vice versa). Please, run this command from a working directory where each R1CS is paired with its corresponding file WASM.`,
37
+ COMMAND_SETUP_DOWNLOAD_PTAU: `Unable to download Powers of Tau file from Hermez Cryptography Phase 1 Trusted Setup. Possible causes may involve an error while making the request (be sure to have a stable internet connection). Please, we kindly ask you to terminate the current session and repeat the process.`,
38
+ COMMAND_SETUP_ABORT: `You chose to abort the setup process.`,
39
+ COMMAND_CONTRIBUTE_NO_OPENED_CEREMONIES: `Unfortunately, there is no ceremony for which you can make a contribution at this time. Please, try again later.`,
40
+ COMMAND_CONTRIBUTE_NO_PARTICIPANT_DATA: `Unable to retrieve your data as ceremony participant. Please, terminate the current session and try again later. If the error persists, please contact the ceremony coordinator.`,
41
+ COMMAND_CONTRIBUTE_WRONG_OPTION_CEREMONY: `The ceremony name you provided does not exist or belongs to a ceremony not yet open. Please, double-check your option and retry.`,
42
+ COMMAND_CONTRIBUTE_NO_CURRENT_CONTRIBUTOR_DATA: `Unable to retrieve current circuit contributor information. Please, terminate the current session and try again later. If the error persists, please contact the ceremony coordinator.`,
43
+ COMMAND_CONTRIBUTE_NO_CURRENT_CONTRIBUTOR_CONTRIBUTION: `Unable to retrieve circuit last contribution information. This could happen due to a timeout or some errors while writing the information on the database.`,
44
+ COMMAND_CONTRIBUTE_WRONG_CURRENT_CONTRIBUTOR_CONTRIBUTION_STEP: `Something went wrong when progressing the contribution step of the current circuit contributor. If the error persists, please contact the ceremony coordinator.`,
45
+ COMMAND_CONTRIBUTE_NO_CIRCUIT_DATA: `Unable to retrieve circuit data from the ceremony. Please, terminate the current session and try again later. If the error persists, please contact the ceremony coordinator.`,
46
+ COMMAND_CONTRIBUTE_NO_ACTIVE_TIMEOUT_DATA: `Unable to retrieve your active timeout data. This problem could be related to failure to write timeout data to the database. If the error persists, please contact the ceremony coordinator.`,
47
+ COMMAND_CONTRIBUTE_NO_UNIQUE_ACTIVE_TIMEOUTS: `The number of active timeouts is different from one. This problem could be related to failure to update timeout document in the database. If the error persists, please contact the ceremony coordinator.`,
48
+ COMMAND_CONTRIBUTE_FINALIZE_NO_TRANSCRIPT_CONTRIBUTION_HASH_MATCH: `Unable to retrieve contribution hash from transcript. Possible causes may involve an error while using the logger or unexpected file descriptor termination. Please, terminate the current session and repeat the process.`,
49
+ COMMAND_FINALIZED_NO_CLOSED_CEREMONIES: `Unfortunately, there is no ceremony closed and ready for finalization. Please, try again later.`,
50
+ COMMAND_FINALIZED_NOT_READY_FOR_FINALIZATION: `You are not ready for ceremony finalization. This could happen because the ceremony does not appear closed or you do not have completed every circuit contributions. If the error persists, please contact the operator to check the server logs.`
51
+ }
52
+
53
+ /** Config */
54
+ export const CONFIG_ERRORS = {
55
+ CONFIG_GITHUB_ERROR: `Configuration error. The Github client id environment variable has not been configured correctly.`,
56
+ CONFIG_FIREBASE_ERROR: `Configuration error. The Firebase environment variable has not been configured correctly`,
57
+ CONFIG_OTHER_ERROR: `Configuration error. One or more config environment variable has not been configured correctly`
58
+ }
59
+
60
+ /** Generic */
61
+ export const GENERIC_ERRORS = {
62
+ GENERIC_ERROR_RETRIEVING_DATA: `Something went wrong when retrieving the data from the database`,
63
+ GENERIC_COUNTDOWN_EXPIRATION: `Your time to carry out the action has expired`
64
+ }
65
+
66
+ /**
67
+ * Print an error string and gracefully terminate the process.
68
+ * @param err <string> - the error string to be shown.
69
+ * @param doExit <boolean> - when true the function terminate the process; otherwise not.
70
+ */
71
+ export const showError = (err: string, doExit: boolean) => {
72
+ // Print the error.
73
+ console.error(`${theme.symbols.error} ${err}`)
74
+
75
+ // Terminate the process.
76
+ if (doExit) process.exit(1)
77
+ }
@@ -0,0 +1,102 @@
1
+ import fs, { Dirent, Stats } from "fs"
2
+ import path from "path"
3
+ import { fileURLToPath } from "url"
4
+
5
+ /**
6
+ * Check a directory path.
7
+ * @param directoryPath <string> - the local path of the directory.
8
+ * @returns <boolean> true if the directory at given path exists, otherwise false.
9
+ */
10
+ export const directoryExists = (directoryPath: string): boolean => fs.existsSync(directoryPath)
11
+
12
+ /**
13
+ * Write a new file locally.
14
+ * @param localFilePath <string> - the local path of the file.
15
+ * @param data <Buffer> - the content to be written inside the file.
16
+ */
17
+ export const writeFile = (localFilePath: string, data: Buffer): void => fs.writeFileSync(localFilePath, data)
18
+
19
+ /**
20
+ * Read a new file from local folder.
21
+ * @param localFilePath <string> - the local path of the file.
22
+ */
23
+ export const readFile = (localFilePath: string): string => fs.readFileSync(localFilePath, "utf-8")
24
+
25
+ /**
26
+ * Get back the statistics of the provided file.
27
+ * @param localFilePath <string> - the local path of the file.
28
+ * @returns <Stats> - the metadata of the file.
29
+ */
30
+ export const getFileStats = (localFilePath: string): Stats => fs.statSync(localFilePath)
31
+
32
+ /**
33
+ * Return the sub-paths for each file stored in the given directory.
34
+ * @param directoryLocalPath <string> - the local path of the directory.
35
+ * @returns <Promise<Array<Dirent>>> - the list of sub-paths of the files contained inside the directory.
36
+ */
37
+ export const getDirFilesSubPaths = async (directoryLocalPath: string): Promise<Array<Dirent>> => {
38
+ // Get Dirent sub paths for folders and files.
39
+ const subPaths = await fs.promises.readdir(directoryLocalPath, { withFileTypes: true })
40
+
41
+ // Return Dirent sub paths for files only.
42
+ return subPaths.filter((dirent: Dirent) => dirent.isFile())
43
+ }
44
+
45
+ /**
46
+ * Filter all files in a directory by returning only those that match the given extension.
47
+ * @param directoryLocalPath <string> - the local path of the directory.
48
+ * @param fileExtension <string> - the file extension.
49
+ * @returns <Promise<Array<Dirent>>> - return the filenames of the file that match the given extension, if any
50
+ */
51
+ export const filterDirectoryFilesByExtension = async (
52
+ directoryLocalPath: string,
53
+ fileExtension: string
54
+ ): Promise<Array<Dirent>> => {
55
+ // Get the sub paths for each file stored in the given directory.
56
+ const cwdFiles = await getDirFilesSubPaths(directoryLocalPath)
57
+ // Filter by extension.
58
+ return cwdFiles.filter((file: Dirent) => file.name.includes(fileExtension))
59
+ }
60
+
61
+ /**
62
+ * Delete a directory specified at a given path.
63
+ * @param directoryLocalPath <string> - the local path of the directory.
64
+ */
65
+ export const deleteDir = (directoryLocalPath: string): void => {
66
+ fs.rmSync(directoryLocalPath, { recursive: true, force: true })
67
+ }
68
+
69
+ /**
70
+ * Clean a directory specified at a given path.
71
+ * @param directoryLocalPath <string> - the local path of the directory.
72
+ */
73
+ export const cleanDir = (directoryLocalPath: string): void => {
74
+ deleteDir(directoryLocalPath)
75
+ fs.mkdirSync(directoryLocalPath)
76
+ }
77
+
78
+ /**
79
+ * Create a new directory in a specified path if not exist in that path.
80
+ * @param directoryLocalPath <string> - the local path of the directory.
81
+ */
82
+ export const checkAndMakeNewDirectoryIfNonexistent = (directoryLocalPath: string): void => {
83
+ if (!directoryExists(directoryLocalPath)) fs.mkdirSync(directoryLocalPath)
84
+ }
85
+
86
+ /**
87
+ * Write data a local JSON file at a given path.
88
+ * @param localFilePath <string> - the local path of the file.
89
+ * @param data <JSON> - the JSON content to be written inside the file.
90
+ */
91
+ export const writeLocalJsonFile = (filePath: string, data: JSON) => {
92
+ fs.writeFileSync(filePath, JSON.stringify(data), "utf-8")
93
+ }
94
+
95
+ /**
96
+ * Return the local current project directory name.
97
+ * @returns <string> - the local project (e.g., dist/) directory name.
98
+ */
99
+ export const getLocalDirname = (): string => {
100
+ const filename = fileURLToPath(import.meta.url)
101
+ return path.dirname(filename)
102
+ }
@@ -0,0 +1,186 @@
1
+ import { commonTerms } from "@p0tion/actions"
2
+ import Conf from "conf"
3
+ import { dirname } from "path"
4
+ import { readFileSync } from "fs"
5
+ import { fileURLToPath } from "url"
6
+
7
+ // Get npm package name.
8
+ const packagePath = `${dirname(fileURLToPath(import.meta.url))}/..`
9
+ const { name } = JSON.parse(
10
+ readFileSync(
11
+ packagePath.includes(`src/lib/`) ? `${packagePath}/../package.json` : `${packagePath}/package.json`,
12
+ "utf8"
13
+ )
14
+ )
15
+
16
+ /**
17
+ * Local Storage.
18
+ * @dev The CLI implementation use the Conf package to create a local storage
19
+ * in the user device (`.config/@p0tion/phase2cli-nodejs/config.json` path) to store the access token.
20
+ */
21
+ const config = new Conf({
22
+ projectName: name,
23
+ schema: {
24
+ accessToken: {
25
+ type: "string",
26
+ default: ""
27
+ }
28
+ }
29
+ })
30
+
31
+ /**
32
+ * Local Paths.
33
+ * @dev definition of the paths to the local folders containing the CLI-generated artifacts.
34
+ */
35
+ const outputLocalFolderPath = `./${commonTerms.foldersAndPathsTerms.output}`
36
+ const setupLocalFolderPath = `${outputLocalFolderPath}/${commonTerms.foldersAndPathsTerms.setup}`
37
+ const contributeLocalFolderPath = `${outputLocalFolderPath}/${commonTerms.foldersAndPathsTerms.contribute}`
38
+ const finalizeLocalFolderPath = `${outputLocalFolderPath}/${commonTerms.foldersAndPathsTerms.finalize}`
39
+ const potLocalFolderPath = `${setupLocalFolderPath}/${commonTerms.foldersAndPathsTerms.pot}`
40
+ const zkeysLocalFolderPath = `${setupLocalFolderPath}/${commonTerms.foldersAndPathsTerms.zkeys}`
41
+ const wasmLocalFolderPath = `${setupLocalFolderPath}/${commonTerms.foldersAndPathsTerms.wasm}`
42
+ const contributionsLocalFolderPath = `${contributeLocalFolderPath}/${commonTerms.foldersAndPathsTerms.zkeys}`
43
+ const contributionTranscriptsLocalFolderPath = `${contributeLocalFolderPath}/${commonTerms.foldersAndPathsTerms.transcripts}`
44
+ const attestationLocalFolderPath = `${contributeLocalFolderPath}/${commonTerms.foldersAndPathsTerms.attestation}`
45
+ const finalZkeysLocalFolderPath = `${finalizeLocalFolderPath}/${commonTerms.foldersAndPathsTerms.zkeys}`
46
+ const finalPotLocalFolderPath = `${finalizeLocalFolderPath}/${commonTerms.foldersAndPathsTerms.pot}`
47
+ const finalTranscriptsLocalFolderPath = `${finalizeLocalFolderPath}/${commonTerms.foldersAndPathsTerms.transcripts}`
48
+ const finalAttestationsLocalFolderPath = `${finalizeLocalFolderPath}/${commonTerms.foldersAndPathsTerms.attestation}`
49
+ const verificationKeysLocalFolderPath = `${finalizeLocalFolderPath}/${commonTerms.foldersAndPathsTerms.vkeys}`
50
+ const verifierContractsLocalFolderPath = `${finalizeLocalFolderPath}/${commonTerms.foldersAndPathsTerms.verifiers}`
51
+
52
+ export const localPaths = {
53
+ output: outputLocalFolderPath,
54
+ setup: setupLocalFolderPath,
55
+ contribute: contributeLocalFolderPath,
56
+ finalize: finalizeLocalFolderPath,
57
+ pot: potLocalFolderPath,
58
+ zkeys: zkeysLocalFolderPath,
59
+ wasm: wasmLocalFolderPath,
60
+ contributions: contributionsLocalFolderPath,
61
+ transcripts: contributionTranscriptsLocalFolderPath,
62
+ attestations: attestationLocalFolderPath,
63
+ finalZkeys: finalZkeysLocalFolderPath,
64
+ finalPot: finalPotLocalFolderPath,
65
+ finalTranscripts: finalTranscriptsLocalFolderPath,
66
+ finalAttestations: finalAttestationsLocalFolderPath,
67
+ verificationKeys: verificationKeysLocalFolderPath,
68
+ verifierContracts: verifierContractsLocalFolderPath
69
+ }
70
+
71
+ /**
72
+ * Return the access token, if present.
73
+ * @returns <string | undefined> - the access token if present, otherwise undefined.
74
+ */
75
+ export const getLocalAccessToken = (): string | unknown => config.get("accessToken")
76
+
77
+ /**
78
+ * Check if the access token exists in the local storage.
79
+ * @returns <boolean>
80
+ */
81
+ export const checkLocalAccessToken = (): boolean => config.has("accessToken") && !!config.get("accessToken")
82
+
83
+ /**
84
+ * Set the access token.
85
+ * @param token <string> - the access token to be stored.
86
+ */
87
+ export const setLocalAccessToken = (token: string) => config.set("accessToken", token)
88
+
89
+ /**
90
+ * Delete the stored access token.
91
+ */
92
+ export const deleteLocalAccessToken = () => config.delete("accessToken")
93
+
94
+ /**
95
+ * Get the complete local file path.
96
+ * @param cwd <string> - the current working directory path.
97
+ * @param completeFilename <string> - the complete filename of the file (name.ext).
98
+ * @returns <string> - the complete local path to the file.
99
+ */
100
+ export const getCWDFilePath = (cwd: string, completeFilename: string): string => `${cwd}/${completeFilename}`
101
+
102
+ /**
103
+ * Get the complete PoT file path.
104
+ * @param completeFilename <string> - the complete filename of the file (name.ext).
105
+ * @returns <string> - the complete PoT path to the file.
106
+ */
107
+ export const getPotLocalFilePath = (completeFilename: string): string => `${potLocalFolderPath}/${completeFilename}`
108
+
109
+ /**
110
+ * Get the complete zKey file path.
111
+ * @param completeFilename <string> - the complete filename of the file (name.ext).
112
+ * @returns <string> - the complete zKey path to the file.
113
+ */
114
+ export const getZkeyLocalFilePath = (completeFilename: string): string => `${zkeysLocalFolderPath}/${completeFilename}`
115
+
116
+ /**
117
+ * Get the complete contribution file path.
118
+ * @param completeFilename <string> - the complete filename of the file (name.ext).
119
+ * @returns <string> - the complete contribution path to the file.
120
+ */
121
+ export const getContributionLocalFilePath = (completeFilename: string): string =>
122
+ `${contributionsLocalFolderPath}/${completeFilename}`
123
+
124
+ /**
125
+ * Get the contribution attestation file path.
126
+ * @param completeFilename <string> - the complete filename of the file (name.ext).
127
+ * @returns <string> - the the contribution attestation path to the file.
128
+ */
129
+ export const getAttestationLocalFilePath = (completeFilename: string): string =>
130
+ `${attestationLocalFolderPath}/${completeFilename}`
131
+
132
+ /**
133
+ * Get the transcript file path.
134
+ * @param completeFilename <string> - the complete filename of the file (name.ext).
135
+ * @returns <string> - the the transcript path to the file.
136
+ */
137
+ export const getTranscriptLocalFilePath = (completeFilename: string): string =>
138
+ `${contributionTranscriptsLocalFolderPath}/${completeFilename}`
139
+
140
+ /**
141
+ * Get the complete final zKey file path.
142
+ * @param completeFilename <string> - the complete filename of the file (name.ext).
143
+ * @returns <string> - the complete final zKey path to the file.
144
+ */
145
+ export const getFinalZkeyLocalFilePath = (completeFilename: string): string =>
146
+ `${finalZkeysLocalFolderPath}/${completeFilename}`
147
+
148
+ /**
149
+ * Get the complete final PoT file path.
150
+ * @param completeFilename <string> - the complete filename of the file (name.ext).
151
+ * @returns <string> - the complete final PoT path to the file.
152
+ */
153
+ export const getFinalPotLocalFilePath = (completeFilename: string): string =>
154
+ `${finalPotLocalFolderPath}/${completeFilename}`
155
+
156
+ /**
157
+ * Get the complete verification key file path.
158
+ * @param completeFilename <string> - the complete filename of the file (name.ext).
159
+ * @returns <string> - the complete final verification key path to the file.
160
+ */
161
+ export const getVerificationKeyLocalFilePath = (completeFilename: string): string =>
162
+ `${verificationKeysLocalFolderPath}/${completeFilename}`
163
+
164
+ /**
165
+ * Get the complete verifier contract file path.
166
+ * @param completeFilename <string> - the complete filename of the file (name.ext).
167
+ * @returns <string> - the complete final verifier contract path to the file.
168
+ */
169
+ export const getVerifierContractLocalFilePath = (completeFilename: string): string =>
170
+ `${verifierContractsLocalFolderPath}/${completeFilename}`
171
+
172
+ /**
173
+ * Get the complete final attestation file path.
174
+ * @param completeFilename <string> - the complete filename of the file (name.ext).
175
+ * @returns <string> - the complete final final attestation path to the file.
176
+ */
177
+ export const getFinalAttestationLocalFilePath = (completeFilename: string): string =>
178
+ `${finalAttestationsLocalFolderPath}/${completeFilename}`
179
+
180
+ /**
181
+ * Get the final transcript file path.
182
+ * @param completeFilename <string> - the complete filename of the file (name.ext).
183
+ * @returns <string> - the the final transcript path to the file.
184
+ */
185
+ export const getFinalTranscriptLocalFilePath = (completeFilename: string): string =>
186
+ `${finalTranscriptsLocalFolderPath}/${completeFilename}`