@devtion/devcli 0.0.0-09f6b45 → 0.0.0-0fb27d7

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.
package/dist/index.js CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  /**
4
4
  * @module @p0tion/phase2cli
5
- * @version 1.1.0
5
+ * @version 1.1.1
6
6
  * @file All-in-one interactive command-line for interfacing with zkSNARK Phase 2 Trusted Setup ceremonies
7
7
  * @copyright Ethereum Foundation 2022
8
8
  * @license MIT
9
9
  * @see [Github]{@link https://github.com/privacy-scaling-explorations/p0tion}
10
10
  */
11
11
  import { createCommand } from 'commander';
12
- import fs, { readFileSync, createWriteStream, renameSync } from 'fs';
13
- import { dirname } from 'path';
12
+ import fs, { readFileSync, createWriteStream, existsSync, renameSync } from 'fs';
13
+ import path, { dirname } from 'path';
14
14
  import { fileURLToPath } from 'url';
15
- import { zKey } from 'snarkjs';
15
+ import { zKey, groth16 } from 'snarkjs';
16
16
  import boxen from 'boxen';
17
17
  import { pipeline } from 'node:stream';
18
18
  import { promisify } from 'node:util';
@@ -22,7 +22,7 @@ import fetch from '@adobe/node-fetch-retry';
22
22
  import { request } from '@octokit/request';
23
23
  import { SingleBar, Presets } from 'cli-progress';
24
24
  import dotenv from 'dotenv';
25
- import { GithubAuthProvider, getAuth, signOut } from 'firebase/auth';
25
+ import { GithubAuthProvider, signInWithCustomToken, getAuth, signOut } from 'firebase/auth';
26
26
  import { getDiskInfoSync } from 'node-disk-info';
27
27
  import ora from 'ora';
28
28
  import { Timer } from 'timer-node';
@@ -36,6 +36,9 @@ import figlet from 'figlet';
36
36
  import { createOAuthDeviceAuth } from '@octokit/auth-oauth-device';
37
37
  import clipboard from 'clipboardy';
38
38
  import open from 'open';
39
+ import { Identity } from '@semaphore-protocol/identity';
40
+ import { httpsCallable } from 'firebase/functions';
41
+ import { ApiSdk } from '@bandada/api-sdk';
39
42
  import { Timestamp, onSnapshot } from 'firebase/firestore';
40
43
  import readline from 'readline';
41
44
 
@@ -97,7 +100,7 @@ const CORE_SERVICES_ERRORS = {
97
100
  FIREBASE_TOKEN_EXPIRED_REMOVED_PERMISSIONS: `The Github authorization has failed due to lack of association between your account and the CLI`,
98
101
  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.`,
99
102
  FIREBASE_FAILED_CREDENTIALS_VERIFICATION: `Firebase cannot verify your Github credentials due to network errors. Please, try once again later.`,
100
- FIREBASE_NETWORK_ERROR: `Unable to reach Firebase due to network erros. Please, try once again later and make sure your Internet connection is stable.`,
103
+ FIREBASE_NETWORK_ERROR: `Unable to reach Firebase due to network errors. Please, try once again later and make sure your Internet connection is stable.`,
101
104
  FIREBASE_CEREMONY_NOT_OPENED: `There are no ceremonies opened to contributions`,
102
105
  FIREBASE_CEREMONY_NOT_CLOSED: `There are no ceremonies ready to finalization`,
103
106
  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.`,
@@ -250,6 +253,10 @@ const config = new Conf({
250
253
  accessToken: {
251
254
  type: "string",
252
255
  default: ""
256
+ },
257
+ bandadaIdentity: {
258
+ type: "string",
259
+ default: ""
253
260
  }
254
261
  }
255
262
  });
@@ -310,6 +317,25 @@ const setLocalAccessToken = (token) => config.set("accessToken", token);
310
317
  * Delete the stored access token.
311
318
  */
312
319
  const deleteLocalAccessToken = () => config.delete("accessToken");
320
+ /**
321
+ * Return the Bandada identity, if present.
322
+ * @returns <string | undefined> - the Bandada identity if present, otherwise undefined.
323
+ */
324
+ const getLocalBandadaIdentity = () => config.get("bandadaIdentity");
325
+ /**
326
+ * Check if the Bandada identity exists in the local storage.
327
+ * @returns <boolean>
328
+ */
329
+ const checkLocalBandadaIdentity = () => config.has("bandadaIdentity") && !!config.get("bandadaIdentity");
330
+ /**
331
+ * Set the Bandada identity.
332
+ * @param identity <string> - the Bandada identity to be stored.
333
+ */
334
+ const setLocalBandadaIdentity = (identity) => config.set("bandadaIdentity", identity);
335
+ /**
336
+ * Delete the stored Bandada identity.
337
+ */
338
+ const deleteLocalBandadaIdentity = () => config.delete("bandadaIdentity");
313
339
  /**
314
340
  * Get the complete local file path.
315
341
  * @param cwd <string> - the current working directory path.
@@ -420,7 +446,7 @@ const getGithubAuthenticatedUserGists = async (githubToken, params) => {
420
446
  headers: {
421
447
  authorization: `token ${githubToken}`
422
448
  },
423
- per_page: params.perPage,
449
+ per_page: params.perPage, // max items per page = 100.
424
450
  page: params.page
425
451
  });
426
452
  if (response && response.status === 200)
@@ -468,8 +494,9 @@ const getPublicAttestationGist = async (githubToken, publicAttestationFilename)
468
494
  * @returns <string> - the third-party provider handle of the user.
469
495
  */
470
496
  const getUserHandleFromProviderUserId = (providerUserId) => {
471
- if (providerUserId.indexOf("-") === -1)
472
- showError(THIRD_PARTY_SERVICES_ERRORS.GITHUB_GET_GITHUB_ACCOUNT_INFO, true);
497
+ if (providerUserId.indexOf("-") === -1) {
498
+ return providerUserId;
499
+ }
473
500
  return providerUserId.split("-")[0];
474
501
  };
475
502
  /**
@@ -1560,16 +1587,27 @@ const checkAuth = async (firebaseApp) => {
1560
1587
  showError(THIRD_PARTY_SERVICES_ERRORS.GITHUB_NOT_AUTHENTICATED, true);
1561
1588
  // Retrieve local access token.
1562
1589
  const token = String(getLocalAccessToken());
1563
- // Get credentials.
1564
- const credentials = exchangeGithubTokenForCredentials(token);
1565
- // Sign in to Firebase using credentials.
1566
- await signInToFirebase(firebaseApp, credentials);
1590
+ let providerUserId;
1591
+ let username;
1592
+ const isLocalBandadaIdentityStored = checkLocalBandadaIdentity();
1593
+ if (isLocalBandadaIdentityStored) {
1594
+ const userCredentials = await signInWithCustomToken(getAuth(), token);
1595
+ providerUserId = userCredentials.user.uid;
1596
+ username = providerUserId;
1597
+ }
1598
+ else {
1599
+ // Get credentials.
1600
+ const credentials = exchangeGithubTokenForCredentials(token);
1601
+ // Sign in to Firebase using credentials.
1602
+ await signInToFirebase(firebaseApp, credentials);
1603
+ // Get Github unique identifier (handle-id).
1604
+ providerUserId = await getGithubProviderUserId(String(token));
1605
+ username = getUserHandleFromProviderUserId(providerUserId);
1606
+ }
1567
1607
  // Get current authenticated user.
1568
1608
  const user = getCurrentFirebaseAuthUser(firebaseApp);
1569
- // Get Github unique identifier (handle-id).
1570
- const providerUserId = await getGithubProviderUserId(String(token));
1571
1609
  // Greet the user.
1572
- console.log(`Greetings, @${theme.text.bold(getUserHandleFromProviderUserId(providerUserId))} ${theme.emojis.wave}\n`);
1610
+ console.log(`Greetings, @${theme.text.bold(username)} ${theme.emojis.wave}\n`);
1573
1611
  return {
1574
1612
  user,
1575
1613
  token,
@@ -1891,12 +1929,20 @@ const setup = async (cmd) => {
1891
1929
  // 3. generate the zKey
1892
1930
  const spinner = customSpinner(`Generating genesis zKey for circuit ${theme.text.bold(circuit.name)}...`, `clock`);
1893
1931
  spinner.start();
1894
- await zKey.newZKey(r1csLocalPathAndFileName, getPotLocalFilePath(circuit.files.potFilename), zkeyLocalPathAndFileName, undefined);
1895
- spinner.succeed(`Generation of the genesis zKey for citcui ${theme.text.bold(circuit.name)} completed successfully`);
1932
+ if (existsSync(zkeyLocalPathAndFileName)) {
1933
+ spinner.succeed(`The genesis zKey for circuit ${theme.text.bold(circuit.name)} is already present on disk`);
1934
+ }
1935
+ else {
1936
+ await zKey.newZKey(r1csLocalPathAndFileName, getPotLocalFilePath(circuit.files.potFilename), zkeyLocalPathAndFileName, undefined);
1937
+ spinner.succeed(`Generation of the genesis zKey for circuit ${theme.text.bold(circuit.name)} completed successfully`);
1938
+ }
1939
+ const hashSpinner = customSpinner(`Calculating hashes for circuit ${theme.text.bold(circuit.name)}...`, `clock`);
1940
+ hashSpinner.start();
1896
1941
  // 4. calculate the hashes
1897
1942
  const wasmBlake2bHash = await blake512FromPath(wasmLocalPathAndFileName);
1898
1943
  const potBlake2bHash = await blake512FromPath(getPotLocalFilePath(circuit.files.potFilename));
1899
1944
  const initialZkeyBlake2bHash = await blake512FromPath(zkeyLocalPathAndFileName);
1945
+ hashSpinner.succeed(`Hashes for circuit ${theme.text.bold(circuit.name)} calculated successfully`);
1900
1946
  // 5. upload the artifacts
1901
1947
  // Upload zKey to Storage.
1902
1948
  await handleCircuitArtifactUploadToStorage(firebaseFunctions, bucketName, circuit.files.initialZkeyStoragePath, zkeyLocalPathAndFileName, circuit.files.initialZkeyFilename);
@@ -2217,6 +2263,91 @@ const auth = async () => {
2217
2263
  terminate(providerUserId);
2218
2264
  };
2219
2265
 
2266
+ const { BANDADA_API_URL } = process.env;
2267
+ const bandadaApi = new ApiSdk(BANDADA_API_URL);
2268
+ const addMemberToGroup = async (groupId, dashboardUrl, identity) => {
2269
+ const commitment = identity.commitment.toString();
2270
+ const group = await bandadaApi.getGroup(groupId);
2271
+ const providerName = group.credentials.id.split("_")[0].toLowerCase();
2272
+ // 6. open a new window with the url:
2273
+ const url = `${dashboardUrl}credentials?group=${groupId}&member=${commitment}&provider=${providerName}`;
2274
+ console.log(`${theme.text.bold(`Verification URL:`)} ${theme.text.underlined(url)}`);
2275
+ open(url);
2276
+ const { confirmation } = await askForConfirmation("Did you join the Bandada group in the browser?");
2277
+ if (!confirmation)
2278
+ showError("You must join the Bandada group to continue the login process", true);
2279
+ };
2280
+ const isGroupMember = async (groupId, identity) => {
2281
+ const commitment = identity.commitment.toString();
2282
+ const isMember = await bandadaApi.isGroupMember(groupId, commitment);
2283
+ return isMember;
2284
+ };
2285
+
2286
+ const { BANDADA_DASHBOARD_URL, BANDADA_GROUP_ID } = process.env;
2287
+ const authBandada = async () => {
2288
+ const { firebaseFunctions } = await bootstrapCommandExecutionAndServices();
2289
+ const spinner = customSpinner(`Checking identity string for Semaphore...`, `clock`);
2290
+ spinner.start();
2291
+ // 1. check if _identity string exists in local storage
2292
+ let identityString;
2293
+ const isIdentityStringStored = checkLocalBandadaIdentity();
2294
+ if (isIdentityStringStored) {
2295
+ identityString = getLocalBandadaIdentity();
2296
+ spinner.succeed(`Identity seed found\n`);
2297
+ }
2298
+ else {
2299
+ spinner.warn(`Identity seed not found\n`);
2300
+ // 2. generate a random _identity string and save it in local storage
2301
+ const { seed } = await prompts({
2302
+ type: "text",
2303
+ name: "seed",
2304
+ message: theme.text.bold(`Enter a secret string to use as your identity seed in Semaphore:`),
2305
+ initial: false
2306
+ });
2307
+ identityString = seed;
2308
+ setLocalBandadaIdentity(identityString);
2309
+ }
2310
+ // 3. create a semaphore identity with _identity string as a seed
2311
+ const identity = new Identity(identityString);
2312
+ // 4. check if the user is a member of the group
2313
+ console.log(`Checking Bandada membership...`);
2314
+ const isMember = await isGroupMember(BANDADA_GROUP_ID, identity);
2315
+ if (!isMember) {
2316
+ await addMemberToGroup(BANDADA_GROUP_ID, BANDADA_DASHBOARD_URL, identity);
2317
+ }
2318
+ // 5. generate a proof that the user owns the commitment.
2319
+ spinner.text = `Generating proof of identity...`;
2320
+ spinner.start();
2321
+ // publicSignals = [hash(externalNullifier, identityNullifier), commitment]
2322
+ const { proof, publicSignals } = await groth16.fullProve({
2323
+ identityTrapdoor: identity.trapdoor,
2324
+ identityNullifier: identity.nullifier,
2325
+ externalNullifier: BANDADA_GROUP_ID
2326
+ }, path.join(path.resolve(), "/public/mini-semaphore.wasm"), path.join(path.resolve(), "/public/mini-semaphore.zkey"));
2327
+ spinner.succeed(`Proof generated.\n`);
2328
+ spinner.text = `Sending proof to verification...`;
2329
+ spinner.start();
2330
+ // 6. send proof to a cloud function that verifies it and checks membership
2331
+ const cf = httpsCallable(firebaseFunctions, commonTerms.cloudFunctionsNames.bandadaValidateProof);
2332
+ const result = await cf({
2333
+ proof,
2334
+ publicSignals
2335
+ });
2336
+ const { valid, token, message } = result.data;
2337
+ if (!valid) {
2338
+ showError(message, true);
2339
+ }
2340
+ spinner.succeed(`Proof verified.\n`);
2341
+ spinner.text = `Authenticating...`;
2342
+ spinner.start();
2343
+ // 7. Auth to p0tion firebase
2344
+ const userCredentials = await signInWithCustomToken(getAuth(), token);
2345
+ setLocalAccessToken(token);
2346
+ spinner.succeed(`Authenticated as ${theme.text.bold(userCredentials.user.uid)}.`);
2347
+ console.log(`\n${theme.symbols.warning} You can always log out by running the ${theme.text.bold(`phase2cli logout`)} command`);
2348
+ process.exit(0);
2349
+ };
2350
+
2220
2351
  /**
2221
2352
  * Return the verification result for latest contribution.
2222
2353
  * @param firestoreDatabase <Firestore> - the Firestore service instance associated to the current Firebase application.
@@ -2408,8 +2539,12 @@ const handlePublicAttestation = async (firestoreDatabase, circuits, ceremonyId,
2408
2539
  // Write public attestation locally.
2409
2540
  writeFile(getAttestationLocalFilePath(`${ceremonyPrefix}_${commonTerms.foldersAndPathsTerms.attestation}.log`), Buffer.from(publicAttestation));
2410
2541
  await sleep(1000); // workaround for file descriptor unexpected close.
2411
- const gistUrl = await publishGist(participantAccessToken, publicAttestation, ceremonyName, ceremonyPrefix);
2412
- console.log(`\n${theme.symbols.info} Your public attestation has been successfully posted as Github Gist (${theme.text.bold(theme.text.underlined(gistUrl))})`);
2542
+ let gistUrl = "";
2543
+ const isBandada = checkLocalBandadaIdentity();
2544
+ if (!isBandada) {
2545
+ gistUrl = await publishGist(participantAccessToken, publicAttestation, ceremonyName, ceremonyPrefix);
2546
+ console.log(`\n${theme.symbols.info} Your public attestation has been successfully posted as Github Gist (${theme.text.bold(theme.text.underlined(gistUrl))})`);
2547
+ }
2413
2548
  // Prepare a ready-to-share tweet.
2414
2549
  await handleTweetGeneration(ceremonyName, gistUrl);
2415
2550
  };
@@ -2723,7 +2858,7 @@ const contribute = async (opt) => {
2723
2858
  const userDoc = await getDocumentById(firestoreDatabase, commonTerms.collections.users.name, user.uid);
2724
2859
  const userData = userDoc.data();
2725
2860
  if (!userData) {
2726
- spinner.fail(`Unfortunately we could not find a user document with your information. This likely means that you did not pass the GitHub reputation checks and therefore are not elegible to contribute to any ceremony. If you believe you pass the requirements, it might be possible that your profile is private and we were not able to fetch your real statistics, in this case please consider making your profile public for the duration of the contribution. Please contact the coordinator if you believe this to be an error.`);
2861
+ spinner.fail(`Unfortunately we could not find a user document with your information. This likely means that you did not pass the GitHub reputation checks and therefore are not eligible to contribute to any ceremony. If you believe you pass the requirements, it might be possible that your profile is private and we were not able to fetch your real statistics, in this case please consider making your profile public for the duration of the contribution. Please contact the coordinator if you believe this to be an error.`);
2727
2862
  process.exit(0);
2728
2863
  }
2729
2864
  // Check the user's current participant readiness for contribution status (eligible, already contributed, timed out).
@@ -2923,7 +3058,7 @@ const handleVerificationKey = async (cloudFunctions, bucketName, finalZkeyLocalF
2923
3058
  spinner.text = "Writing verification key...";
2924
3059
  // Write the verification key locally.
2925
3060
  writeLocalJsonFile(verificationKeyLocalFilePath, vKey);
2926
- await sleep(3000); // workaound for file descriptor.
3061
+ await sleep(3000); // workaround for file descriptor.
2927
3062
  // Upload verification key to storage.
2928
3063
  await multiPartUpload(cloudFunctions, bucketName, verificationKeyStorageFilePath, verificationKeyLocalFilePath, Number(process.env.CONFIG_STREAM_CHUNK_SIZE_IN_MB));
2929
3064
  spinner.succeed(`Verification key correctly saved on storage`);
@@ -2949,7 +3084,7 @@ const handleVerifierSmartContract = async (cloudFunctions, bucketName, finalZkey
2949
3084
  spinner.text = `Writing verifier smart contract...`;
2950
3085
  // Write the verification key locally.
2951
3086
  writeFile(verifierContractLocalFilePath, verifierCode);
2952
- await sleep(3000); // workaound for file descriptor.
3087
+ await sleep(3000); // workaround for file descriptor.
2953
3088
  // Upload verifier smart contract to storage.
2954
3089
  await multiPartUpload(cloudFunctions, bucketName, verifierContractStorageFilePath, verifierContractLocalFilePath, Number(process.env.CONFIG_STREAM_CHUNK_SIZE_IN_MB));
2955
3090
  spinner.succeed(`Verifier smart contract correctly saved on storage`);
@@ -2975,7 +3110,7 @@ const handleVerifierSmartContract = async (cloudFunctions, bucketName, finalZkey
2975
3110
  const handleCircuitFinalization = async (cloudFunctions, firestoreDatabase, ceremony, circuit, participant, beacon, coordinatorIdentifier, circuitsLength) => {
2976
3111
  // Step (1).
2977
3112
  await handleStartOrResumeContribution(cloudFunctions, firestoreDatabase, ceremony, circuit, participant, computeSHA256ToHex(beacon), coordinatorIdentifier, true, circuitsLength);
2978
- await sleep(2000); // workaound for descriptors.
3113
+ await sleep(2000); // workaround for descriptors.
2979
3114
  // Extract data.
2980
3115
  const { prefix: circuitPrefix } = circuit.data;
2981
3116
  const { prefix: ceremonyPrefix } = ceremony.data;
@@ -3125,6 +3260,7 @@ const logout = async () => {
3125
3260
  await signOut(auth);
3126
3261
  // Delete local token.
3127
3262
  deleteLocalAccessToken();
3263
+ deleteLocalBandadaIdentity();
3128
3264
  await sleep(3000); // ~3s.
3129
3265
  spinner.stop();
3130
3266
  console.log(`${theme.symbols.success} Logout successfully completed`);
@@ -3194,6 +3330,10 @@ const program = createCommand();
3194
3330
  program.name(name).description(description).version(version);
3195
3331
  // User commands.
3196
3332
  program.command("auth").description("authenticate yourself using your Github account (OAuth 2.0)").action(auth);
3333
+ program
3334
+ .command("auth-bandada")
3335
+ .description("authenticate yourself in a privacy-perserving manner using Bandada")
3336
+ .action(authBandada);
3197
3337
  program
3198
3338
  .command("contribute")
3199
3339
  .description("compute contributions for a Phase2 Trusted Setup ceremony circuits")
@@ -0,0 +1,2 @@
1
+ declare const authBandada: () => Promise<never>;
2
+ export default authBandada;
@@ -1,5 +1,6 @@
1
1
  export { default as setup } from "./setup.js";
2
2
  export { default as auth } from "./auth.js";
3
+ export { default as authBandada } from "./authBandada.js";
3
4
  export { default as contribute } from "./contribute.js";
4
5
  export { default as observe } from "./observe.js";
5
6
  export { default as finalize } from "./finalize.js";
@@ -0,0 +1,6 @@
1
+ import { GroupResponse } from "@bandada/api-sdk";
2
+ import { Identity } from "@semaphore-protocol/identity";
3
+ export declare const getGroup: (groupId: string) => Promise<GroupResponse | null>;
4
+ export declare const getMembersOfGroup: (groupId: string) => Promise<string[] | null>;
5
+ export declare const addMemberToGroup: (groupId: string, dashboardUrl: string, identity: Identity) => Promise<void>;
6
+ export declare const isGroupMember: (groupId: string, identity: Identity) => Promise<boolean>;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { Dirent, Stats } from "fs";
3
4
  /**
4
5
  * Check a directory path.
@@ -35,6 +35,25 @@ export declare const setLocalAccessToken: (token: string) => void;
35
35
  * Delete the stored access token.
36
36
  */
37
37
  export declare const deleteLocalAccessToken: () => void;
38
+ /**
39
+ * Return the Bandada identity, if present.
40
+ * @returns <string | undefined> - the Bandada identity if present, otherwise undefined.
41
+ */
42
+ export declare const getLocalBandadaIdentity: () => string | unknown;
43
+ /**
44
+ * Check if the Bandada identity exists in the local storage.
45
+ * @returns <boolean>
46
+ */
47
+ export declare const checkLocalBandadaIdentity: () => boolean;
48
+ /**
49
+ * Set the Bandada identity.
50
+ * @param identity <string> - the Bandada identity to be stored.
51
+ */
52
+ export declare const setLocalBandadaIdentity: (identity: string) => void;
53
+ /**
54
+ * Delete the stored Bandada identity.
55
+ */
56
+ export declare const deleteLocalBandadaIdentity: () => void;
38
57
  /**
39
58
  * Get the complete local file path.
40
59
  * @param cwd <string> - the current working directory path.
@@ -63,3 +63,15 @@ export type GithubGistFile = {
63
63
  raw_url: string;
64
64
  size: number;
65
65
  };
66
+ /**
67
+ * Define the return object of the function that verifies the Bandada membership and proof.
68
+ * @typedef {Object} VerifiedBandadaResponse
69
+ * @property {boolean} valid - true if the proof is valid and the user is a member of the group; otherwise false.
70
+ * @property {string} message - a message describing the result of the verification.
71
+ * @property {string} token - the custom access token.
72
+ */
73
+ export type VerifiedBandadaResponse = {
74
+ valid: boolean;
75
+ message: string;
76
+ token: string;
77
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@devtion/devcli",
3
3
  "type": "module",
4
- "version": "0.0.0-09f6b45",
4
+ "version": "0.0.0-0fb27d7",
5
5
  "description": "All-in-one interactive command-line for interfacing with zkSNARK Phase 2 Trusted Setup ceremonies",
6
6
  "repository": "git@github.com:privacy-scaling-explorations/p0tion.git",
7
7
  "homepage": "https://github.com/privacy-scaling-explorations/p0tion",
@@ -34,6 +34,7 @@
34
34
  "build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
35
35
  "start": "ts-node --esm ./src/index.ts",
36
36
  "auth": "yarn start auth",
37
+ "auth:bandada": "yarn start auth-bandada",
37
38
  "contribute": "yarn start contribute",
38
39
  "clean": "yarn start clean",
39
40
  "list": "yarn start list",
@@ -65,10 +66,12 @@
65
66
  "dependencies": {
66
67
  "@adobe/node-fetch-retry": "^2.2.0",
67
68
  "@aws-sdk/client-s3": "^3.329.0",
69
+ "@bandada/api-sdk": "^1.0.0-beta.1",
68
70
  "@devtion/actions": "latest",
69
71
  "@octokit/auth-oauth-app": "^5.0.5",
70
72
  "@octokit/auth-oauth-device": "^4.0.4",
71
73
  "@octokit/request": "^6.2.3",
74
+ "@semaphore-protocol/identity": "^3.15.1",
72
75
  "blakejs": "^1.2.1",
73
76
  "boxen": "^7.1.0",
74
77
  "chalk": "^5.2.0",
@@ -78,6 +81,7 @@
78
81
  "commander": "^10.0.1",
79
82
  "conf": "^11.0.1",
80
83
  "dotenv": "^16.0.3",
84
+ "ethers": "^6.9.0",
81
85
  "figlet": "^1.6.0",
82
86
  "firebase": "^9.21.0",
83
87
  "log-symbols": "^5.1.0",
@@ -90,12 +94,12 @@
90
94
  "prompts": "^2.4.2",
91
95
  "rimraf": "^5.0.0",
92
96
  "rollup": "^3.21.6",
93
- "snarkjs": "^0.6.11",
97
+ "snarkjs": "0.7.3",
94
98
  "timer-node": "^5.0.7",
95
99
  "winston": "^3.8.2"
96
100
  },
97
101
  "publishConfig": {
98
102
  "access": "public"
99
103
  },
100
- "gitHead": "c6b2cf678456f66e3540d6baf29f1eec13bb8631"
104
+ "gitHead": "a6302783a12ff8bbeaa18c90a9ad2eac7b2e4c6a"
101
105
  }
@@ -0,0 +1,99 @@
1
+ import { Identity } from "@semaphore-protocol/identity"
2
+
3
+ import { commonTerms } from "@devtion/actions"
4
+ import { httpsCallable } from "firebase/functions"
5
+ import { groth16 } from "snarkjs"
6
+ import path from "path"
7
+ import { getAuth, signInWithCustomToken } from "firebase/auth"
8
+ import theme from "../lib/theme.js"
9
+ import { customSpinner } from "../lib/utils.js"
10
+ import { VerifiedBandadaResponse } from "../types/index.js"
11
+ import { showError } from "../lib/errors.js"
12
+ import { bootstrapCommandExecutionAndServices } from "../lib/services.js"
13
+ import { addMemberToGroup, isGroupMember } from "../lib/bandada.js"
14
+ import {
15
+ checkLocalBandadaIdentity,
16
+ getLocalBandadaIdentity,
17
+ setLocalAccessToken,
18
+ setLocalBandadaIdentity
19
+ } from "../lib/localConfigs.js"
20
+ import prompts from "prompts"
21
+
22
+ const { BANDADA_DASHBOARD_URL, BANDADA_GROUP_ID } = process.env
23
+
24
+ const authBandada = async () => {
25
+ const { firebaseFunctions } = await bootstrapCommandExecutionAndServices()
26
+ const spinner = customSpinner(`Checking identity string for Semaphore...`, `clock`)
27
+ spinner.start()
28
+ // 1. check if _identity string exists in local storage
29
+ let identityString: string | unknown
30
+ const isIdentityStringStored = checkLocalBandadaIdentity()
31
+ if (isIdentityStringStored) {
32
+ identityString = getLocalBandadaIdentity()
33
+ spinner.succeed(`Identity seed found\n`)
34
+ } else {
35
+ spinner.warn(`Identity seed not found\n`)
36
+ // 2. generate a random _identity string and save it in local storage
37
+ const { seed } = await prompts({
38
+ type: "text",
39
+ name: "seed",
40
+ message: theme.text.bold(`Enter a secret string to use as your identity seed in Semaphore:`),
41
+ initial: false
42
+ })
43
+ identityString = seed as string
44
+ setLocalBandadaIdentity(identityString as string)
45
+ }
46
+ // 3. create a semaphore identity with _identity string as a seed
47
+ const identity = new Identity(identityString as string)
48
+
49
+ // 4. check if the user is a member of the group
50
+ console.log(`Checking Bandada membership...`)
51
+ const isMember = await isGroupMember(BANDADA_GROUP_ID, identity)
52
+ if (!isMember) {
53
+ await addMemberToGroup(BANDADA_GROUP_ID, BANDADA_DASHBOARD_URL, identity)
54
+ }
55
+
56
+ // 5. generate a proof that the user owns the commitment.
57
+ spinner.text = `Generating proof of identity...`
58
+ spinner.start()
59
+ // publicSignals = [hash(externalNullifier, identityNullifier), commitment]
60
+ const { proof, publicSignals } = await groth16.fullProve(
61
+ {
62
+ identityTrapdoor: identity.trapdoor,
63
+ identityNullifier: identity.nullifier,
64
+ externalNullifier: BANDADA_GROUP_ID
65
+ },
66
+ path.join(path.resolve(), "/public/mini-semaphore.wasm"),
67
+ path.join(path.resolve(), "/public/mini-semaphore.zkey")
68
+ )
69
+ spinner.succeed(`Proof generated.\n`)
70
+ spinner.text = `Sending proof to verification...`
71
+ spinner.start()
72
+ // 6. send proof to a cloud function that verifies it and checks membership
73
+ const cf = httpsCallable(firebaseFunctions, commonTerms.cloudFunctionsNames.bandadaValidateProof)
74
+ const result = await cf({
75
+ proof,
76
+ publicSignals
77
+ })
78
+ const { valid, token, message } = result.data as VerifiedBandadaResponse
79
+ if (!valid) {
80
+ showError(message, true)
81
+ }
82
+ spinner.succeed(`Proof verified.\n`)
83
+ spinner.text = `Authenticating...`
84
+ spinner.start()
85
+ // 7. Auth to p0tion firebase
86
+ const userCredentials = await signInWithCustomToken(getAuth(), token)
87
+ setLocalAccessToken(token)
88
+ spinner.succeed(`Authenticated as ${theme.text.bold(userCredentials.user.uid)}.`)
89
+
90
+ console.log(
91
+ `\n${theme.symbols.warning} You can always log out by running the ${theme.text.bold(
92
+ `phase2cli logout`
93
+ )} command`
94
+ )
95
+
96
+ process.exit(0)
97
+ }
98
+
99
+ export default authBandada
@@ -41,7 +41,7 @@ import {
41
41
  } from "../lib/utils.js"
42
42
  import { COMMAND_ERRORS, showError } from "../lib/errors.js"
43
43
  import { authWithToken, bootstrapCommandExecutionAndServices, checkAuth } from "../lib/services.js"
44
- import { getAttestationLocalFilePath, localPaths } from "../lib/localConfigs.js"
44
+ import { checkLocalBandadaIdentity, getAttestationLocalFilePath, localPaths } from "../lib/localConfigs.js"
45
45
  import theme from "../lib/theme.js"
46
46
  import { checkAndMakeNewDirectoryIfNonexistent, writeFile } from "../lib/files.js"
47
47
 
@@ -419,14 +419,19 @@ export const handlePublicAttestation = async (
419
419
 
420
420
  await sleep(1000) // workaround for file descriptor unexpected close.
421
421
 
422
- const gistUrl = await publishGist(participantAccessToken, publicAttestation, ceremonyName, ceremonyPrefix)
423
-
424
- console.log(
425
- `\n${theme.symbols.info} Your public attestation has been successfully posted as Github Gist (${theme.text.bold(
426
- theme.text.underlined(gistUrl)
427
- )})`
428
- )
422
+ let gistUrl = ""
423
+ const isBandada = checkLocalBandadaIdentity()
424
+ if (!isBandada) {
425
+ gistUrl = await publishGist(participantAccessToken, publicAttestation, ceremonyName, ceremonyPrefix)
429
426
 
427
+ console.log(
428
+ `\n${
429
+ theme.symbols.info
430
+ } Your public attestation has been successfully posted as Github Gist (${theme.text.bold(
431
+ theme.text.underlined(gistUrl)
432
+ )})`
433
+ )
434
+ }
430
435
  // Prepare a ready-to-share tweet.
431
436
  await handleTweetGeneration(ceremonyName, gistUrl)
432
437
  }
@@ -952,7 +957,7 @@ const contribute = async (opt: any) => {
952
957
  const userData = userDoc.data()
953
958
  if (!userData) {
954
959
  spinner.fail(
955
- `Unfortunately we could not find a user document with your information. This likely means that you did not pass the GitHub reputation checks and therefore are not elegible to contribute to any ceremony. If you believe you pass the requirements, it might be possible that your profile is private and we were not able to fetch your real statistics, in this case please consider making your profile public for the duration of the contribution. Please contact the coordinator if you believe this to be an error.`
960
+ `Unfortunately we could not find a user document with your information. This likely means that you did not pass the GitHub reputation checks and therefore are not eligible to contribute to any ceremony. If you believe you pass the requirements, it might be possible that your profile is private and we were not able to fetch your real statistics, in this case please consider making your profile public for the duration of the contribution. Please contact the coordinator if you believe this to be an error.`
956
961
  )
957
962
  process.exit(0)
958
963
  }
@@ -74,7 +74,7 @@ export const handleVerificationKey = async (
74
74
  // Write the verification key locally.
75
75
  writeLocalJsonFile(verificationKeyLocalFilePath, vKey)
76
76
 
77
- await sleep(3000) // workaound for file descriptor.
77
+ await sleep(3000) // workaround for file descriptor.
78
78
 
79
79
  // Upload verification key to storage.
80
80
  await multiPartUpload(
@@ -122,7 +122,7 @@ export const handleVerifierSmartContract = async (
122
122
  // Write the verification key locally.
123
123
  writeFile(verifierContractLocalFilePath, verifierCode)
124
124
 
125
- await sleep(3000) // workaound for file descriptor.
125
+ await sleep(3000) // workaround for file descriptor.
126
126
 
127
127
  // Upload verifier smart contract to storage.
128
128
  await multiPartUpload(
@@ -177,7 +177,7 @@ export const handleCircuitFinalization = async (
177
177
  circuitsLength
178
178
  )
179
179
 
180
- await sleep(2000) // workaound for descriptors.
180
+ await sleep(2000) // workaround for descriptors.
181
181
 
182
182
  // Extract data.
183
183
  const { prefix: circuitPrefix } = circuit.data
@@ -1,5 +1,6 @@
1
1
  export { default as setup } from "./setup.js"
2
2
  export { default as auth } from "./auth.js"
3
+ export { default as authBandada } from "./authBandada.js"
3
4
  export { default as contribute } from "./contribute.js"
4
5
  export { default as observe } from "./observe.js"
5
6
  export { default as finalize } from "./finalize.js"
@@ -6,7 +6,7 @@ import { showError } from "../lib/errors.js"
6
6
  import { askForConfirmation } from "../lib/prompts.js"
7
7
  import { customSpinner, sleep, terminate } from "../lib/utils.js"
8
8
  import theme from "../lib/theme.js"
9
- import { deleteLocalAccessToken } from "../lib/localConfigs.js"
9
+ import { deleteLocalAccessToken, deleteLocalBandadaIdentity } from "../lib/localConfigs.js"
10
10
 
11
11
  /**
12
12
  * Logout command.
@@ -53,6 +53,7 @@ const logout = async () => {
53
53
 
54
54
  // Delete local token.
55
55
  deleteLocalAccessToken()
56
+ deleteLocalBandadaIdentity()
56
57
 
57
58
  await sleep(3000) // ~3s.
58
59
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { zKey } from "snarkjs"
4
4
  import boxen from "boxen"
5
- import { createWriteStream, Dirent, renameSync } from "fs"
5
+ import { createWriteStream, Dirent, renameSync, existsSync } from "fs"
6
6
  import { pipeline } from "node:stream"
7
7
  import { promisify } from "node:util"
8
8
  import fetch from "node-fetch"
@@ -537,20 +537,33 @@ const setup = async (cmd: { template?: string; auth?: string }) => {
537
537
  `clock`
538
538
  )
539
539
  spinner.start()
540
- await zKey.newZKey(
541
- r1csLocalPathAndFileName,
542
- getPotLocalFilePath(circuit.files.potFilename),
543
- zkeyLocalPathAndFileName,
544
- undefined
545
- )
546
- spinner.succeed(
547
- `Generation of the genesis zKey for citcui ${theme.text.bold(circuit.name)} completed successfully`
548
- )
549
540
 
541
+ if (existsSync(zkeyLocalPathAndFileName)) {
542
+ spinner.succeed(
543
+ `The genesis zKey for circuit ${theme.text.bold(circuit.name)} is already present on disk`
544
+ )
545
+ } else {
546
+ await zKey.newZKey(
547
+ r1csLocalPathAndFileName,
548
+ getPotLocalFilePath(circuit.files.potFilename),
549
+ zkeyLocalPathAndFileName,
550
+ undefined
551
+ )
552
+ spinner.succeed(
553
+ `Generation of the genesis zKey for circuit ${theme.text.bold(circuit.name)} completed successfully`
554
+ )
555
+ }
556
+
557
+ const hashSpinner = customSpinner(
558
+ `Calculating hashes for circuit ${theme.text.bold(circuit.name)}...`,
559
+ `clock`
560
+ )
561
+ hashSpinner.start()
550
562
  // 4. calculate the hashes
551
563
  const wasmBlake2bHash = await blake512FromPath(wasmLocalPathAndFileName)
552
564
  const potBlake2bHash = await blake512FromPath(getPotLocalFilePath(circuit.files.potFilename))
553
565
  const initialZkeyBlake2bHash = await blake512FromPath(zkeyLocalPathAndFileName)
566
+ hashSpinner.succeed(`Hashes for circuit ${theme.text.bold(circuit.name)} calculated successfully`)
554
567
 
555
568
  // 5. upload the artifacts
556
569
 
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ import { fileURLToPath } from "url"
7
7
  import {
8
8
  setup,
9
9
  auth,
10
+ authBandada,
10
11
  contribute,
11
12
  observe,
12
13
  finalize,
@@ -26,6 +27,10 @@ program.name(name).description(description).version(version)
26
27
 
27
28
  // User commands.
28
29
  program.command("auth").description("authenticate yourself using your Github account (OAuth 2.0)").action(auth)
30
+ program
31
+ .command("auth-bandada")
32
+ .description("authenticate yourself in a privacy-perserving manner using Bandada")
33
+ .action(authBandada)
29
34
  program
30
35
  .command("contribute")
31
36
  .description("compute contributions for a Phase2 Trusted Setup ceremony circuits")
@@ -0,0 +1,51 @@
1
+ import { ApiSdk, GroupResponse } from "@bandada/api-sdk"
2
+ import { Identity } from "@semaphore-protocol/identity"
3
+ import open from "open"
4
+
5
+ import { askForConfirmation } from "../lib/prompts.js"
6
+ import { showError } from "./errors.js"
7
+ import theme from "../lib/theme.js"
8
+
9
+ const { BANDADA_API_URL } = process.env
10
+
11
+ const bandadaApi = new ApiSdk(BANDADA_API_URL)
12
+
13
+ export const getGroup = async (groupId: string): Promise<GroupResponse | null> => {
14
+ try {
15
+ const group = await bandadaApi.getGroup(groupId)
16
+ return group
17
+ } catch (error: any) {
18
+ showError(`Bandada getGroup error: ${error}`, true)
19
+ return null
20
+ }
21
+ }
22
+
23
+ export const getMembersOfGroup = async (groupId: string): Promise<string[] | null> => {
24
+ try {
25
+ const group = await bandadaApi.getGroup(groupId)
26
+ return group.members
27
+ } catch (error: any) {
28
+ showError(`Bandada getMembersOfGroup error: ${error}`, true)
29
+ return null
30
+ }
31
+ }
32
+
33
+ export const addMemberToGroup = async (groupId: string, dashboardUrl: string, identity: Identity) => {
34
+ const commitment = identity.commitment.toString()
35
+ const group = await bandadaApi.getGroup(groupId)
36
+ const providerName = group.credentials.id.split("_")[0].toLowerCase()
37
+
38
+ // 6. open a new window with the url:
39
+ const url = `${dashboardUrl}credentials?group=${groupId}&member=${commitment}&provider=${providerName}`
40
+ console.log(`${theme.text.bold(`Verification URL:`)} ${theme.text.underlined(url)}`)
41
+ open(url)
42
+
43
+ const { confirmation } = await askForConfirmation("Did you join the Bandada group in the browser?")
44
+ if (!confirmation) showError("You must join the Bandada group to continue the login process", true)
45
+ }
46
+
47
+ export const isGroupMember = async (groupId: string, identity: Identity): Promise<boolean> => {
48
+ const commitment = identity.commitment.toString()
49
+ const isMember: boolean = await bandadaApi.isGroupMember(groupId, commitment)
50
+ return isMember
51
+ }
package/src/lib/errors.ts CHANGED
@@ -6,7 +6,7 @@ export const CORE_SERVICES_ERRORS = {
6
6
  FIREBASE_TOKEN_EXPIRED_REMOVED_PERMISSIONS: `The Github authorization has failed due to lack of association between your account and the CLI`,
7
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
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.`,
9
+ FIREBASE_NETWORK_ERROR: `Unable to reach Firebase due to network errors. Please, try once again later and make sure your Internet connection is stable.`,
10
10
  FIREBASE_CEREMONY_NOT_OPENED: `There are no ceremonies opened to contributions`,
11
11
  FIREBASE_CEREMONY_NOT_CLOSED: `There are no ceremonies ready to finalization`,
12
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.`,
@@ -24,6 +24,10 @@ const config = new Conf({
24
24
  accessToken: {
25
25
  type: "string",
26
26
  default: ""
27
+ },
28
+ bandadaIdentity: {
29
+ type: "string",
30
+ default: ""
27
31
  }
28
32
  }
29
33
  })
@@ -91,6 +95,29 @@ export const setLocalAccessToken = (token: string) => config.set("accessToken",
91
95
  */
92
96
  export const deleteLocalAccessToken = () => config.delete("accessToken")
93
97
 
98
+ /**
99
+ * Return the Bandada identity, if present.
100
+ * @returns <string | undefined> - the Bandada identity if present, otherwise undefined.
101
+ */
102
+ export const getLocalBandadaIdentity = (): string | unknown => config.get("bandadaIdentity")
103
+
104
+ /**
105
+ * Check if the Bandada identity exists in the local storage.
106
+ * @returns <boolean>
107
+ */
108
+ export const checkLocalBandadaIdentity = (): boolean => config.has("bandadaIdentity") && !!config.get("bandadaIdentity")
109
+
110
+ /**
111
+ * Set the Bandada identity.
112
+ * @param identity <string> - the Bandada identity to be stored.
113
+ */
114
+ export const setLocalBandadaIdentity = (identity: string) => config.set("bandadaIdentity", identity)
115
+
116
+ /**
117
+ * Delete the stored Bandada identity.
118
+ */
119
+ export const deleteLocalBandadaIdentity = () => config.delete("bandadaIdentity")
120
+
94
121
  /**
95
122
  * Get the complete local file path.
96
123
  * @param cwd <string> - the current working directory path.
@@ -6,13 +6,18 @@ import {
6
6
  import clear from "clear"
7
7
  import figlet from "figlet"
8
8
  import { FirebaseApp } from "firebase/app"
9
- import { OAuthCredential } from "firebase/auth"
9
+ import { OAuthCredential, getAuth, signInWithCustomToken } from "firebase/auth"
10
10
  import dotenv from "dotenv"
11
11
  import { fileURLToPath } from "url"
12
12
  import { dirname } from "path"
13
13
  import { AuthUser } from "../types/index.js"
14
14
  import { CONFIG_ERRORS, CORE_SERVICES_ERRORS, showError, THIRD_PARTY_SERVICES_ERRORS } from "./errors.js"
15
- import { checkLocalAccessToken, deleteLocalAccessToken, getLocalAccessToken } from "./localConfigs.js"
15
+ import {
16
+ checkLocalAccessToken,
17
+ checkLocalBandadaIdentity,
18
+ deleteLocalAccessToken,
19
+ getLocalAccessToken
20
+ } from "./localConfigs.js"
16
21
  import theme from "./theme.js"
17
22
  import { exchangeGithubTokenForCredentials, getGithubProviderUserId, getUserHandleFromProviderUserId } from "./utils.js"
18
23
 
@@ -164,22 +169,30 @@ export const checkAuth = async (firebaseApp: FirebaseApp): Promise<AuthUser> =>
164
169
  // Retrieve local access token.
165
170
  const token = String(getLocalAccessToken())
166
171
 
167
- // Get credentials.
168
- const credentials = exchangeGithubTokenForCredentials(token)
169
-
170
- // Sign in to Firebase using credentials.
171
- await signInToFirebase(firebaseApp, credentials)
172
+ let providerUserId: string
173
+ let username: string
174
+ const isLocalBandadaIdentityStored = checkLocalBandadaIdentity()
175
+ if (isLocalBandadaIdentityStored) {
176
+ const userCredentials = await signInWithCustomToken(getAuth(), token)
177
+ providerUserId = userCredentials.user.uid
178
+ username = providerUserId
179
+ } else {
180
+ // Get credentials.
181
+ const credentials = exchangeGithubTokenForCredentials(token)
182
+
183
+ // Sign in to Firebase using credentials.
184
+ await signInToFirebase(firebaseApp, credentials)
185
+
186
+ // Get Github unique identifier (handle-id).
187
+ providerUserId = await getGithubProviderUserId(String(token))
188
+ username = getUserHandleFromProviderUserId(providerUserId)
189
+ }
172
190
 
173
191
  // Get current authenticated user.
174
192
  const user = getCurrentFirebaseAuthUser(firebaseApp)
175
193
 
176
- // Get Github unique identifier (handle-id).
177
- const providerUserId = await getGithubProviderUserId(String(token))
178
-
179
194
  // Greet the user.
180
- console.log(
181
- `Greetings, @${theme.text.bold(getUserHandleFromProviderUserId(providerUserId))} ${theme.emojis.wave}\n`
182
- )
195
+ console.log(`Greetings, @${theme.text.bold(username)} ${theme.emojis.wave}\n`)
183
196
 
184
197
  return {
185
198
  user,
package/src/lib/utils.ts CHANGED
@@ -155,7 +155,9 @@ export const getPublicAttestationGist = async (
155
155
  * @returns <string> - the third-party provider handle of the user.
156
156
  */
157
157
  export const getUserHandleFromProviderUserId = (providerUserId: string): string => {
158
- if (providerUserId.indexOf("-") === -1) showError(THIRD_PARTY_SERVICES_ERRORS.GITHUB_GET_GITHUB_ACCOUNT_INFO, true)
158
+ if (providerUserId.indexOf("-") === -1) {
159
+ return providerUserId
160
+ }
159
161
 
160
162
  return providerUserId.split("-")[0]
161
163
  }
@@ -68,3 +68,16 @@ export type GithubGistFile = {
68
68
  raw_url: string
69
69
  size: number
70
70
  }
71
+
72
+ /**
73
+ * Define the return object of the function that verifies the Bandada membership and proof.
74
+ * @typedef {Object} VerifiedBandadaResponse
75
+ * @property {boolean} valid - true if the proof is valid and the user is a member of the group; otherwise false.
76
+ * @property {string} message - a message describing the result of the verification.
77
+ * @property {string} token - the custom access token.
78
+ */
79
+ export type VerifiedBandadaResponse = {
80
+ valid: boolean
81
+ message: string
82
+ token: string
83
+ }