@devtion/actions 0.0.0-7e983e3
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/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/index.mjs +2608 -0
- package/dist/index.node.js +2714 -0
- package/dist/types/hardhat.config.d.ts +6 -0
- package/dist/types/hardhat.config.d.ts.map +1 -0
- package/dist/types/src/helpers/authentication.d.ts +21 -0
- package/dist/types/src/helpers/authentication.d.ts.map +1 -0
- package/dist/types/src/helpers/constants.d.ts +194 -0
- package/dist/types/src/helpers/constants.d.ts.map +1 -0
- package/dist/types/src/helpers/contracts.d.ts +57 -0
- package/dist/types/src/helpers/contracts.d.ts.map +1 -0
- package/dist/types/src/helpers/crypto.d.ts +27 -0
- package/dist/types/src/helpers/crypto.d.ts.map +1 -0
- package/dist/types/src/helpers/database.d.ts +105 -0
- package/dist/types/src/helpers/database.d.ts.map +1 -0
- package/dist/types/src/helpers/functions.d.ts +145 -0
- package/dist/types/src/helpers/functions.d.ts.map +1 -0
- package/dist/types/src/helpers/security.d.ts +10 -0
- package/dist/types/src/helpers/security.d.ts.map +1 -0
- package/dist/types/src/helpers/services.d.ts +38 -0
- package/dist/types/src/helpers/services.d.ts.map +1 -0
- package/dist/types/src/helpers/storage.d.ts +121 -0
- package/dist/types/src/helpers/storage.d.ts.map +1 -0
- package/dist/types/src/helpers/tasks.d.ts +2 -0
- package/dist/types/src/helpers/tasks.d.ts.map +1 -0
- package/dist/types/src/helpers/utils.d.ts +139 -0
- package/dist/types/src/helpers/utils.d.ts.map +1 -0
- package/dist/types/src/helpers/verification.d.ts +95 -0
- package/dist/types/src/helpers/verification.d.ts.map +1 -0
- package/dist/types/src/helpers/vm.d.ts +112 -0
- package/dist/types/src/helpers/vm.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +15 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/types/enums.d.ts +133 -0
- package/dist/types/src/types/enums.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +603 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/package.json +87 -0
- package/src/helpers/authentication.ts +37 -0
- package/src/helpers/constants.ts +312 -0
- package/src/helpers/contracts.ts +268 -0
- package/src/helpers/crypto.ts +55 -0
- package/src/helpers/database.ts +221 -0
- package/src/helpers/functions.ts +438 -0
- package/src/helpers/security.ts +86 -0
- package/src/helpers/services.ts +83 -0
- package/src/helpers/storage.ts +329 -0
- package/src/helpers/tasks.ts +56 -0
- package/src/helpers/utils.ts +743 -0
- package/src/helpers/verification.ts +354 -0
- package/src/helpers/vm.ts +392 -0
- package/src/index.ts +162 -0
- package/src/types/enums.ts +141 -0
- package/src/types/index.ts +650 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hardhat.config.d.ts","sourceRoot":"","sources":["../../hardhat.config.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAA;AAClC,OAAO,qBAAqB,CAAA;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,QAAA,MAAM,MAAM,EAAE,iBAMb,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { User, OAuthCredential } from "firebase/auth";
|
|
2
|
+
import { FirebaseApp } from "firebase/app";
|
|
3
|
+
/**
|
|
4
|
+
* Sign in w/ OAuth 2.0 token.
|
|
5
|
+
* @param firebaseApp <FirebaseApp> - the configured instance of the Firebase App in use.
|
|
6
|
+
* @param credentials <OAuthCredential> - the OAuth credential generated from token exchange.
|
|
7
|
+
*/
|
|
8
|
+
export declare const signInToFirebaseWithCredentials: (firebaseApp: FirebaseApp, credentials: OAuthCredential) => Promise<import("@firebase/auth").UserCredential>;
|
|
9
|
+
/**
|
|
10
|
+
* Return the current authenticated user in the given Firebase Application.
|
|
11
|
+
* @param firebaseApp <FirebaseApp> - the configured instance of the Firebase App in use.
|
|
12
|
+
* @returns <User> - the object containing the data about the current authenticated user in the given Firebase application.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getCurrentFirebaseAuthUser: (firebaseApp: FirebaseApp) => User;
|
|
15
|
+
/**
|
|
16
|
+
* Check if the user can claim to be a coordinator.
|
|
17
|
+
* @param user <User> - the user to be checked.
|
|
18
|
+
* @returns Promise<boolean> - true if the user is a coordinator, false otherwise.
|
|
19
|
+
*/
|
|
20
|
+
export declare const isCoordinator: (user: User) => Promise<boolean>;
|
|
21
|
+
//# sourceMappingURL=authentication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../../../src/helpers/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiD,eAAe,EAAE,MAAM,eAAe,CAAA;AACpG,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,gBAAuB,WAAW,eAAe,eAAe,qDAC1C,CAAA;AAElE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,gBAAiB,WAAW,KAAG,IASrE,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAgB,IAAI,qBAI7C,CAAA"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
export declare const potFileDownloadMainUrl = "https://hermez.s3-eu-west-1.amazonaws.com/";
|
|
2
|
+
export declare const potFilenameTemplate = "powersOfTau28_hez_final_";
|
|
3
|
+
export declare const genesisZkeyIndex = "00000";
|
|
4
|
+
export declare const numExpIterations = 10;
|
|
5
|
+
export declare const solidityVersion = "0.8.0";
|
|
6
|
+
export declare const finalContributionIndex = "final";
|
|
7
|
+
export declare const verificationKeyAcronym = "vkey";
|
|
8
|
+
export declare const verifierSmartContractAcronym = "verifier";
|
|
9
|
+
export declare const ec2InstanceTag = "p0tionec2instance";
|
|
10
|
+
export declare const vmBootstrapScriptFilename = "bootstrap.sh";
|
|
11
|
+
/**
|
|
12
|
+
* Define the supported VM configuration types.
|
|
13
|
+
* @dev the VM configurations can be retrieved at https://aws.amazon.com/ec2/instance-types/
|
|
14
|
+
* The on-demand prices for the configurations can be retrieved at https://aws.amazon.com/ec2/pricing/on-demand/.
|
|
15
|
+
* @notice the price has to be intended as on-demand hourly billing usage for Linux OS
|
|
16
|
+
* VMs located in the us-east-1 region expressed in USD.
|
|
17
|
+
*/
|
|
18
|
+
export declare const vmConfigurationTypes: {
|
|
19
|
+
t3_large: {
|
|
20
|
+
type: string;
|
|
21
|
+
ram: number;
|
|
22
|
+
vcpu: number;
|
|
23
|
+
pricePerHour: number;
|
|
24
|
+
};
|
|
25
|
+
t3_2xlarge: {
|
|
26
|
+
type: string;
|
|
27
|
+
ram: number;
|
|
28
|
+
vcpu: number;
|
|
29
|
+
pricePerHour: number;
|
|
30
|
+
};
|
|
31
|
+
c5_9xlarge: {
|
|
32
|
+
type: string;
|
|
33
|
+
ram: number;
|
|
34
|
+
vcpu: number;
|
|
35
|
+
pricePerHour: number;
|
|
36
|
+
};
|
|
37
|
+
c5_18xlarge: {
|
|
38
|
+
type: string;
|
|
39
|
+
ram: number;
|
|
40
|
+
vcpu: number;
|
|
41
|
+
pricePerHour: number;
|
|
42
|
+
};
|
|
43
|
+
c5a_8xlarge: {
|
|
44
|
+
type: string;
|
|
45
|
+
ram: number;
|
|
46
|
+
vcpu: number;
|
|
47
|
+
pricePerHour: number;
|
|
48
|
+
};
|
|
49
|
+
c6id_32xlarge: {
|
|
50
|
+
type: string;
|
|
51
|
+
ram: number;
|
|
52
|
+
vcpu: number;
|
|
53
|
+
pricePerHour: number;
|
|
54
|
+
};
|
|
55
|
+
m6a_32xlarge: {
|
|
56
|
+
type: string;
|
|
57
|
+
ram: number;
|
|
58
|
+
vcpu: number;
|
|
59
|
+
pricePerHour: number;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Define the PPoT Trusted Setup ceremony output powers of tau files size (in GB).
|
|
64
|
+
* @dev the powers of tau files can be retrieved at https://github.com/weijiekoh/perpetualpowersoftau
|
|
65
|
+
*/
|
|
66
|
+
export declare const powersOfTauFiles: {
|
|
67
|
+
ref: string;
|
|
68
|
+
size: number;
|
|
69
|
+
}[];
|
|
70
|
+
/**
|
|
71
|
+
* Commonly used terms.
|
|
72
|
+
* @dev useful for creating paths, references to collections and queries, object properties, folder names, and so on.
|
|
73
|
+
*/
|
|
74
|
+
export declare const commonTerms: {
|
|
75
|
+
collections: {
|
|
76
|
+
users: {
|
|
77
|
+
name: string;
|
|
78
|
+
fields: {
|
|
79
|
+
creationTime: string;
|
|
80
|
+
displayName: string;
|
|
81
|
+
email: string;
|
|
82
|
+
emailVerified: string;
|
|
83
|
+
lastSignInTime: string;
|
|
84
|
+
lastUpdated: string;
|
|
85
|
+
name: string;
|
|
86
|
+
photoURL: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
participants: {
|
|
90
|
+
name: string;
|
|
91
|
+
fields: {
|
|
92
|
+
contributionProgress: string;
|
|
93
|
+
contributionStartedAt: string;
|
|
94
|
+
contributionStep: string;
|
|
95
|
+
contributions: string;
|
|
96
|
+
lastUpdated: string;
|
|
97
|
+
status: string;
|
|
98
|
+
verificationStartedAt: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
ceremonies: {
|
|
102
|
+
name: string;
|
|
103
|
+
fields: {
|
|
104
|
+
coordinatorId: string;
|
|
105
|
+
description: string;
|
|
106
|
+
endDate: string;
|
|
107
|
+
lastUpdated: string;
|
|
108
|
+
penalty: string;
|
|
109
|
+
prefix: string;
|
|
110
|
+
startDate: string;
|
|
111
|
+
state: string;
|
|
112
|
+
timeoutType: string;
|
|
113
|
+
title: string;
|
|
114
|
+
type: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
circuits: {
|
|
118
|
+
name: string;
|
|
119
|
+
fields: {
|
|
120
|
+
avgTimings: string;
|
|
121
|
+
compiler: string;
|
|
122
|
+
description: string;
|
|
123
|
+
files: string;
|
|
124
|
+
lastUpdated: string;
|
|
125
|
+
metadata: string;
|
|
126
|
+
name: string;
|
|
127
|
+
prefix: string;
|
|
128
|
+
sequencePosition: string;
|
|
129
|
+
template: string;
|
|
130
|
+
timeoutMaxContributionWaitingTime: string;
|
|
131
|
+
waitingQueue: string;
|
|
132
|
+
zKeySizeInBytes: string;
|
|
133
|
+
verification: string;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
contributions: {
|
|
137
|
+
name: string;
|
|
138
|
+
fields: {
|
|
139
|
+
contributionComputationTime: string;
|
|
140
|
+
files: string;
|
|
141
|
+
lastUpdated: string;
|
|
142
|
+
participantId: string;
|
|
143
|
+
valid: string;
|
|
144
|
+
verificationComputationTime: string;
|
|
145
|
+
zkeyIndex: string;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
timeouts: {
|
|
149
|
+
name: string;
|
|
150
|
+
fields: {
|
|
151
|
+
type: string;
|
|
152
|
+
startDate: string;
|
|
153
|
+
endDate: string;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
foldersAndPathsTerms: {
|
|
158
|
+
output: string;
|
|
159
|
+
setup: string;
|
|
160
|
+
contribute: string;
|
|
161
|
+
finalize: string;
|
|
162
|
+
pot: string;
|
|
163
|
+
zkeys: string;
|
|
164
|
+
wasm: string;
|
|
165
|
+
vkeys: string;
|
|
166
|
+
metadata: string;
|
|
167
|
+
transcripts: string;
|
|
168
|
+
attestation: string;
|
|
169
|
+
verifiers: string;
|
|
170
|
+
};
|
|
171
|
+
cloudFunctionsNames: {
|
|
172
|
+
setupCeremony: string;
|
|
173
|
+
checkParticipantForCeremony: string;
|
|
174
|
+
progressToNextCircuitForContribution: string;
|
|
175
|
+
resumeContributionAfterTimeoutExpiration: string;
|
|
176
|
+
createBucket: string;
|
|
177
|
+
generateGetObjectPreSignedUrl: string;
|
|
178
|
+
progressToNextContributionStep: string;
|
|
179
|
+
permanentlyStoreCurrentContributionTimeAndHash: string;
|
|
180
|
+
startMultiPartUpload: string;
|
|
181
|
+
temporaryStoreCurrentContributionMultiPartUploadId: string;
|
|
182
|
+
temporaryStoreCurrentContributionUploadedChunkData: string;
|
|
183
|
+
generatePreSignedUrlsParts: string;
|
|
184
|
+
completeMultiPartUpload: string;
|
|
185
|
+
checkIfObjectExist: string;
|
|
186
|
+
verifyContribution: string;
|
|
187
|
+
checkAndPrepareCoordinatorForFinalization: string;
|
|
188
|
+
finalizeCircuit: string;
|
|
189
|
+
finalizeCeremony: string;
|
|
190
|
+
downloadCircuitArtifacts: string;
|
|
191
|
+
transferObject: string;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/helpers/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,sBAAsB,+CAA+C,CAAA;AAElF,eAAO,MAAM,mBAAmB,6BAA6B,CAAA;AAE7D,eAAO,MAAM,gBAAgB,UAAU,CAAA;AAEvC,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAElC,eAAO,MAAM,eAAe,UAAU,CAAA;AAEtC,eAAO,MAAM,sBAAsB,UAAU,CAAA;AAE7C,eAAO,MAAM,sBAAsB,SAAS,CAAA;AAE5C,eAAO,MAAM,4BAA4B,aAAa,CAAA;AAEtD,eAAO,MAAM,cAAc,sBAAsB,CAAA;AAEjD,eAAO,MAAM,yBAAyB,iBAAiB,CAAA;AAEvD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ChC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;GA6G5B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuHvB,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Contract, Signer } from "ethers";
|
|
2
|
+
import { Firestore } from "firebase/firestore";
|
|
3
|
+
import { Functions } from "firebase/functions";
|
|
4
|
+
/**
|
|
5
|
+
* Formats part of a GROTH16 SNARK proof
|
|
6
|
+
* @link adapted from SNARKJS p256 function
|
|
7
|
+
* @param proofPart <any> a part of a proof to be formatted
|
|
8
|
+
* @returns <string> the formatted proof part
|
|
9
|
+
*/
|
|
10
|
+
export declare const p256: (proofPart: any) => any;
|
|
11
|
+
/**
|
|
12
|
+
* This function formats the calldata for Solidity
|
|
13
|
+
* @link adapted from SNARKJS formatSolidityCalldata function
|
|
14
|
+
* @dev this function is supposed to be called with
|
|
15
|
+
* @dev the output of generateGROTH16Proof
|
|
16
|
+
* @param circuitInput <string[]> Inputs to the circuit
|
|
17
|
+
* @param _proof <object> Proof
|
|
18
|
+
* @returns <SolidityCalldata> The calldata formatted for Solidity
|
|
19
|
+
*/
|
|
20
|
+
export declare const formatSolidityCalldata: (circuitInput: string[], _proof: any) => any;
|
|
21
|
+
/**
|
|
22
|
+
* Verify a GROTH16 SNARK proof on chain
|
|
23
|
+
* @param contract <Contract> The contract instance
|
|
24
|
+
* @param proof <SolidityCalldata> The calldata formatted for Solidity
|
|
25
|
+
* @returns <Promise<boolean>> Whether the proof is valid or not
|
|
26
|
+
*/
|
|
27
|
+
export declare const verifyGROTH16ProofOnChain: (contract: any, proof: any) => Promise<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* Compiles a contract given a path
|
|
30
|
+
* @param contractPath <string> path to the verifier contract
|
|
31
|
+
* @returns <Promise<any>> the compiled contract
|
|
32
|
+
*/
|
|
33
|
+
export declare const compileContract: (contractPath: string) => Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* Deploy the verifier contract
|
|
36
|
+
* @param contractFactory <ContractFactory> The contract factory
|
|
37
|
+
* @returns <Promise<Contract>> The contract instance
|
|
38
|
+
*/
|
|
39
|
+
export declare const deployVerifierContract: (contractPath: string, signer: Signer) => Promise<Contract>;
|
|
40
|
+
/**
|
|
41
|
+
* Verify a ceremony validity
|
|
42
|
+
* 1. Download all artifacts
|
|
43
|
+
* 2. Verify that the zkeys are valid
|
|
44
|
+
* 3. Extract the verifier and the vKey
|
|
45
|
+
* 4. Generate a proof and verify it locally
|
|
46
|
+
* 5. Deploy Verifier contract and verify the proof on-chain
|
|
47
|
+
* @param functions <Functions> firebase functions instance
|
|
48
|
+
* @param firestore <Firestore> firebase firestore instance
|
|
49
|
+
* @param ceremonyPrefix <string> ceremony prefix
|
|
50
|
+
* @param outputDirectory <string> output directory where to store the ceremony artifacts
|
|
51
|
+
* @param circuitInputsPath <string> path to the circuit inputs file
|
|
52
|
+
* @param verifierTemplatePath <string> path to the verifier template file
|
|
53
|
+
* @param signer <Signer> signer for contract interaction
|
|
54
|
+
* @param logger <any> logger for printing snarkjs output
|
|
55
|
+
*/
|
|
56
|
+
export declare const verifyCeremony: (functions: Functions, firestore: Firestore, ceremonyPrefix: string, outputDirectory: string, circuitInputsPath: string, verifierTemplatePath: string, signer: Signer, logger?: any) => Promise<void>;
|
|
57
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../../src/helpers/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAmB,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE1D,OAAO,EAAE,SAAS,EAAS,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAgB9C;;;;;GAKG;AACH,eAAO,MAAM,IAAI,cAAe,GAAG,QAKlC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,iBAAkB,MAAM,EAAE,UAAU,GAAG,KAAG,GAwB5E,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,aAAoB,GAAG,SAAS,GAAG,KAAG,QAAQ,OAAO,CAG1F,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,iBAAwB,MAAM,KAAG,QAAQ,GAAG,CA6BvE,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,iBAAwB,MAAM,UAAU,MAAM,KAAG,QAAQ,QAAQ,CAOnG,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,cACZ,SAAS,aACT,SAAS,kBACJ,MAAM,mBACL,MAAM,qBACJ,MAAM,wBACH,MAAM,UACpB,MAAM,WACL,GAAG,KACb,QAAQ,IAAI,CAkHd,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
/**
|
|
3
|
+
* Converts Uint8Array to hexadecimal string.
|
|
4
|
+
* @param buffer arbritrary length of data
|
|
5
|
+
* @returns hexadecimal string
|
|
6
|
+
*/
|
|
7
|
+
export declare const toHex: (buffer: Uint8Array) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Get 512 bit blake hash of the contents of given path.
|
|
10
|
+
* @param data buffer or hexadecimal string
|
|
11
|
+
* @returns 64 byte hexadecimal string
|
|
12
|
+
*/
|
|
13
|
+
export declare const blake512FromPath: (path: fs.PathLike) => Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Return the SHA256 hash (HEX format) of a given value
|
|
16
|
+
* @param value <string> - the value to be hashed.
|
|
17
|
+
* @returns <string> - the HEX format of the SHA256 hash of the given value
|
|
18
|
+
*/
|
|
19
|
+
export declare const computeSHA256ToHex: (value: string) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Helper function that can be used to compare whether two files' hashes are equal or not.
|
|
22
|
+
* @param path1 <string> Path to the first file.
|
|
23
|
+
* @param path2 <string> Path to the second file.
|
|
24
|
+
* @returns <Promise<boolean>> Whether the files are equal or not.
|
|
25
|
+
*/
|
|
26
|
+
export declare const compareHashes: (path1: string, path2: string) => Promise<boolean>;
|
|
27
|
+
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../../src/helpers/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AASnB;;;;GAIG;AACH,eAAO,MAAM,KAAK,WAAY,UAAU,KAAG,MAAoD,CAAA;AAE/F;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,SAAgB,GAAG,QAAQ,KAAG,QAAQ,MAAM,CAaxE,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,UAAW,MAAM,KAAG,MAAiE,CAAA;AAEpH;;;;;GAKG;AACH,eAAO,MAAM,aAAa,UAAiB,MAAM,SAAS,MAAM,KAAG,QAAQ,OAAO,CAKjF,CAAA"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { DocumentData, DocumentSnapshot, Firestore, QueryConstraint, QueryDocumentSnapshot, QuerySnapshot } from "firebase/firestore";
|
|
2
|
+
import { FirebaseDocumentInfo } from "../types/index";
|
|
3
|
+
/**
|
|
4
|
+
* Get participants collection path for database reference.
|
|
5
|
+
* @notice all participants related documents are store under `ceremonies/<ceremonyId>/participants` collection path.
|
|
6
|
+
* nb. This is a rule that must be satisfied. This is NOT an optional convention.
|
|
7
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
8
|
+
* @returns <string> - the participants collection path.
|
|
9
|
+
*/
|
|
10
|
+
export declare const getParticipantsCollectionPath: (ceremonyId: string) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Get circuits collection path for database reference.
|
|
13
|
+
* @notice all circuits related documents are store under `ceremonies/<ceremonyId>/circuits` collection path.
|
|
14
|
+
* nb. This is a rule that must be satisfied. This is NOT an optional convention.
|
|
15
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
16
|
+
* @returns <string> - the participants collection path.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getCircuitsCollectionPath: (ceremonyId: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Get contributions collection path for database reference.
|
|
21
|
+
* @notice all contributions related documents are store under `ceremonies/<ceremonyId>/circuits/<circuitId>/contributions` collection path.
|
|
22
|
+
* nb. This is a rule that must be satisfied. This is NOT an optional convention.
|
|
23
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
24
|
+
* @param circuitId <string> - the unique identifier of the circuit.
|
|
25
|
+
* @returns <string> - the contributions collection path.
|
|
26
|
+
*/
|
|
27
|
+
export declare const getContributionsCollectionPath: (ceremonyId: string, circuitId: string) => string;
|
|
28
|
+
/**
|
|
29
|
+
* Get timeouts collection path for database reference.
|
|
30
|
+
* @notice all timeouts related documents are store under `ceremonies/<ceremonyId>/participants/<participantId>/timeouts` collection path.
|
|
31
|
+
* nb. This is a rule that must be satisfied. This is NOT an optional convention.
|
|
32
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
33
|
+
* @param participantId <string> - the unique identifier of the participant.
|
|
34
|
+
* @returns <string> - the timeouts collection path.
|
|
35
|
+
*/
|
|
36
|
+
export declare const getTimeoutsCollectionPath: (ceremonyId: string, participantId: string) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Helper for query a collection based on certain constraints.
|
|
39
|
+
* @param firestoreDatabase <Firestore> - the Firestore service instance associated to the current Firebase application.
|
|
40
|
+
* @param collection <string> - the name of the collection.
|
|
41
|
+
* @param queryConstraints <Array<QueryConstraint>> - a sequence of where conditions.
|
|
42
|
+
* @returns <Promise<QuerySnapshot<DocumentData>>> - return the matching documents (if any).
|
|
43
|
+
*/
|
|
44
|
+
export declare const queryCollection: (firestoreDatabase: Firestore, collection: string, queryConstraints: Array<QueryConstraint>) => Promise<QuerySnapshot<DocumentData>>;
|
|
45
|
+
/**
|
|
46
|
+
* Helper for obtaining uid and data for query document snapshots.
|
|
47
|
+
* @param queryDocSnap <Array<QueryDocumentSnapshot>> - the array of query document snapshot to be converted.
|
|
48
|
+
* @returns Array<FirebaseDocumentInfo>
|
|
49
|
+
*/
|
|
50
|
+
export declare const fromQueryToFirebaseDocumentInfo: (queryDocSnap: Array<QueryDocumentSnapshot>) => Array<FirebaseDocumentInfo>;
|
|
51
|
+
/**
|
|
52
|
+
* Fetch for all documents in a collection.
|
|
53
|
+
* @param firestoreDatabase <Firestore> - the Firestore service instance associated to the current Firebase application.
|
|
54
|
+
* @param collection <string> - the name of the collection.
|
|
55
|
+
* @returns <Promise<Array<QueryDocumentSnapshot<DocumentData>>>> - return all documents (if any).
|
|
56
|
+
*/
|
|
57
|
+
export declare const getAllCollectionDocs: (firestoreDatabase: Firestore, collection: string) => Promise<Array<QueryDocumentSnapshot<DocumentData>>>;
|
|
58
|
+
/**
|
|
59
|
+
* Get a specific document from database.
|
|
60
|
+
* @param firestoreDatabase <Firestore> - the Firestore service instance associated to the current Firebase application.
|
|
61
|
+
* @param collection <string> - the name of the collection.
|
|
62
|
+
* @param documentId <string> - the unique identifier of the document in the collection.
|
|
63
|
+
* @returns <Promise<DocumentSnapshot<DocumentData>>> - return the document from Firestore.
|
|
64
|
+
*/
|
|
65
|
+
export declare const getDocumentById: (firestoreDatabase: Firestore, collection: string, documentId: string) => Promise<DocumentSnapshot<DocumentData>>;
|
|
66
|
+
/**
|
|
67
|
+
* Query for opened ceremonies.
|
|
68
|
+
* @param firestoreDatabase <Firestore> - the Firestore service instance associated to the current Firebase application.
|
|
69
|
+
* @returns <Promise<Array<FirebaseDocumentInfo>>>
|
|
70
|
+
*/
|
|
71
|
+
export declare const getOpenedCeremonies: (firestoreDatabase: Firestore) => Promise<Array<FirebaseDocumentInfo>>;
|
|
72
|
+
/**
|
|
73
|
+
* Query for ceremony circuits.
|
|
74
|
+
* @notice the order by sequence position is fundamental to maintain parallelism among contributions for different circuits.
|
|
75
|
+
* @param firestoreDatabase <Firestore> - the Firestore service instance associated to the current Firebase application.
|
|
76
|
+
* @param ceremonyId <string> - the ceremony unique identifier.
|
|
77
|
+
* @returns Promise<Array<FirebaseDocumentInfo>> - the ceremony' circuits documents ordered by sequence position.
|
|
78
|
+
*/
|
|
79
|
+
export declare const getCeremonyCircuits: (firestoreDatabase: Firestore, ceremonyId: string) => Promise<Array<FirebaseDocumentInfo>>;
|
|
80
|
+
/**
|
|
81
|
+
* Query for a specific ceremony' circuit contribution from a given contributor (if any).
|
|
82
|
+
* @notice if the caller is a coordinator, there could be more than one contribution (= the one from finalization applies to this criteria).
|
|
83
|
+
* @param firestoreDatabase <Firestore> - the Firestore service instance associated to the current Firebase application.
|
|
84
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
85
|
+
* @param circuitId <string> - the unique identifier of the circuit.
|
|
86
|
+
* @param participantId <string> - the unique identifier of the participant.
|
|
87
|
+
* @returns <Promise<Array<FirebaseDocumentInfo>>> - the document info about the circuit contributions from contributor.
|
|
88
|
+
*/
|
|
89
|
+
export declare const getCircuitContributionsFromContributor: (firestoreDatabase: Firestore, ceremonyId: string, circuitId: string, participantId: string) => Promise<Array<FirebaseDocumentInfo>>;
|
|
90
|
+
/**
|
|
91
|
+
* Query for the active timeout from given participant for a given ceremony (if any).
|
|
92
|
+
* @param ceremonyId <string> - the identifier of the ceremony.
|
|
93
|
+
* @param participantId <string> - the identifier of the participant.
|
|
94
|
+
* @returns <Promise<Array<FirebaseDocumentInfo>>> - the document info about the current active participant timeout.
|
|
95
|
+
*/
|
|
96
|
+
export declare const getCurrentActiveParticipantTimeout: (firestoreDatabase: Firestore, ceremonyId: string, participantId: string) => Promise<Array<FirebaseDocumentInfo>>;
|
|
97
|
+
/**
|
|
98
|
+
* Query for the closed ceremonies.
|
|
99
|
+
* @notice a ceremony is closed when the period for receiving new contributions has ended.
|
|
100
|
+
* @dev when the ceremony is closed it becomes ready for finalization.
|
|
101
|
+
* @param firestoreDatabase <Firestore> - the Firestore service instance associated to the current Firebase application.
|
|
102
|
+
* @returns <Promise<Array<FirebaseDocumentInfo>>> - the list of closed ceremonies.
|
|
103
|
+
*/
|
|
104
|
+
export declare const getClosedCeremonies: (firestoreDatabase: Firestore) => Promise<Array<FirebaseDocumentInfo>>;
|
|
105
|
+
//# sourceMappingURL=database.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../../src/helpers/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,YAAY,EACZ,gBAAgB,EAChB,SAAS,EAIT,eAAe,EACf,qBAAqB,EACrB,aAAa,EAGhB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAGrD;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,eAAgB,MAAM,KAAG,MACwC,CAAA;AAE3G;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,eAAgB,MAAM,KAAG,MACwC,CAAA;AAEvG;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,eAAgB,MAAM,aAAa,MAAM,KAAG,MACkB,CAAA;AAEzG;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,eAAgB,MAAM,iBAAiB,MAAM,KAAG,MACsB,CAAA;AAE5G;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,sBACL,SAAS,cAChB,MAAM,oBACA,MAAM,eAAe,CAAC,KACzC,QAAQ,cAAc,YAAY,CAAC,CAQrC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,iBAC1B,MAAM,qBAAqB,CAAC,KAC3C,MAAM,oBAAoB,CAKtB,CAAA;AAEP;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,sBACV,SAAS,cAChB,MAAM,KACnB,QAAQ,MAAM,sBAAsB,YAAY,CAAC,CAAC,CACiB,CAAA;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,sBACL,SAAS,cAChB,MAAM,cACN,MAAM,KACnB,QAAQ,iBAAiB,YAAY,CAAC,CAIxC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,sBAA6B,SAAS,KAAG,QAAQ,MAAM,oBAAoB,CAAC,CAW3G,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,sBACT,SAAS,cAChB,MAAM,KACnB,QAAQ,MAAM,oBAAoB,CAAC,CAG6E,CAAA;AAEnH;;;;;;;;GAQG;AACH,eAAO,MAAM,sCAAsC,sBAC5B,SAAS,cAChB,MAAM,aACP,MAAM,iBACF,MAAM,KACtB,QAAQ,MAAM,oBAAoB,CAAC,CAQrC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kCAAkC,sBACxB,SAAS,cAChB,MAAM,iBACH,MAAM,KACtB,QAAQ,MAAM,oBAAoB,CAAC,CAQrC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,sBAA6B,SAAS,KAAG,QAAQ,MAAM,oBAAoB,CAAC,CAW3G,CAAA"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Functions } from "firebase/functions";
|
|
2
|
+
import { CeremonyInputData, CircuitDocument, ETagWithPartNumber, FirebaseDocumentInfo } from "../types/index";
|
|
3
|
+
/**
|
|
4
|
+
* Setup a new ceremony by calling the related cloud function.
|
|
5
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
6
|
+
* @param ceremonyInputData <CeremonyInputData> - the input data of the ceremony.
|
|
7
|
+
* @param ceremonyPrefix <string> - the prefix of the ceremony.
|
|
8
|
+
* @param circuits <Circuit[]> - the circuits data.
|
|
9
|
+
* @returns Promise<string> - the unique identifier of the created ceremony.
|
|
10
|
+
*/
|
|
11
|
+
export declare const setupCeremony: (functions: Functions, ceremonyInputData: CeremonyInputData, ceremonyPrefix: string, circuits: CircuitDocument[]) => Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Check the user's current participant status for the ceremony
|
|
14
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
15
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
16
|
+
* @returns <boolean> - true when participant is able to contribute; otherwise false.
|
|
17
|
+
*/
|
|
18
|
+
export declare const checkParticipantForCeremony: (functions: Functions, ceremonyId: string) => Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* Progress the participant to the next circuit preparing for the next contribution.
|
|
21
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
22
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
23
|
+
*/
|
|
24
|
+
export declare const progressToNextCircuitForContribution: (functions: Functions, ceremonyId: string) => Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Resume the contributor circuit contribution from scratch after the timeout expiration.
|
|
27
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
28
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
29
|
+
*/
|
|
30
|
+
export declare const resumeContributionAfterTimeoutExpiration: (functions: Functions, ceremonyId: string) => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Make a request to create a new AWS S3 bucket for a ceremony.
|
|
33
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
34
|
+
* @param bucketName <string> - the name of the ceremony bucket.
|
|
35
|
+
*/
|
|
36
|
+
export declare const createS3Bucket: (functions: Functions, bucketName: string) => Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Return a pre-signed url for a given object contained inside the provided AWS S3 bucket in order to perform a GET request.
|
|
39
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
40
|
+
* @param bucketName <string> - the name of the ceremony bucket.
|
|
41
|
+
* @param objectKey <string> - the storage path that locates the artifact to be downloaded in the bucket.
|
|
42
|
+
* @returns <Promise<string>> - the pre-signed url w/ GET request permissions for specified object key.
|
|
43
|
+
*/
|
|
44
|
+
export declare const generateGetObjectPreSignedUrl: (functions: Functions, bucketName: string, objectKey: string) => Promise<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Progress the participant to the next circuit preparing for the next contribution.
|
|
47
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
48
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
49
|
+
*/
|
|
50
|
+
export declare const progressToNextContributionStep: (functions: Functions, ceremonyId: string) => Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Write the information about current contribution hash and computation time for the current contributor.
|
|
53
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
54
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
55
|
+
* @param contributionComputationTime <number> - the time when it was computed
|
|
56
|
+
* @param contributingHash <string> - the hash of the contribution
|
|
57
|
+
*/
|
|
58
|
+
export declare const permanentlyStoreCurrentContributionTimeAndHash: (functions: Functions, ceremonyId: string, contributionComputationTime: number, contributionHash: string) => Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Start a new multi-part upload for a specific object in the given AWS S3 bucket.
|
|
61
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
62
|
+
* @param bucketName <string> - the name of the ceremony bucket.
|
|
63
|
+
* @param objectKey <string> - the storage path that locates the artifact to be downloaded in the bucket.
|
|
64
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
65
|
+
* @returns Promise<string> - the multi-part upload id.
|
|
66
|
+
*/
|
|
67
|
+
export declare const openMultiPartUpload: (functions: Functions, bucketName: string, objectKey: string, ceremonyId?: string) => Promise<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Write temporary information about the unique identifier about the opened multi-part upload to eventually resume the contribution.
|
|
70
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
71
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
72
|
+
* @param uploadId <string> - the unique identifier of the multi-part upload.
|
|
73
|
+
*/
|
|
74
|
+
export declare const temporaryStoreCurrentContributionMultiPartUploadId: (functions: Functions, ceremonyId: string, uploadId: string) => Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Write temporary information about the etags and part numbers for each uploaded chunk in order to make the upload resumable from last chunk.
|
|
77
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
78
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
79
|
+
* @param chunk <ETagWithPartNumber> - the information about the already uploaded chunk.
|
|
80
|
+
*/
|
|
81
|
+
export declare const temporaryStoreCurrentContributionUploadedChunkData: (functions: Functions, ceremonyId: string, chunk: ETagWithPartNumber) => Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Generate a new pre-signed url for each chunk related to a started multi-part upload.
|
|
84
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
85
|
+
* @param bucketName <string> - the name of the ceremony bucket.
|
|
86
|
+
* @param objectKey <string> - the storage path that locates the artifact to be downloaded in the bucket.
|
|
87
|
+
* @param uploadId <string> - the unique identifier of the multi-part upload.
|
|
88
|
+
* @param numberOfChunks <number> - the number of pre-signed urls to be generated.
|
|
89
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
90
|
+
* @returns Promise<Array<string>> - the set of pre-signed urls (one for each chunk).
|
|
91
|
+
*/
|
|
92
|
+
export declare const generatePreSignedUrlsParts: (functions: Functions, bucketName: string, objectKey: string, uploadId: string, numberOfParts: number, ceremonyId?: string) => Promise<Array<string>>;
|
|
93
|
+
/**
|
|
94
|
+
* Complete a multi-part upload for a specific object in the given AWS S3 bucket.
|
|
95
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
96
|
+
* @param bucketName <string> - the name of the ceremony bucket.
|
|
97
|
+
* @param objectKey <string> - the storage path that locates the artifact to be downloaded in the bucket.
|
|
98
|
+
* @param uploadId <string> - the unique identifier of the multi-part upload.
|
|
99
|
+
* @param parts Array<ETagWithPartNumber> - the completed .
|
|
100
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
101
|
+
* @returns Promise<string> - the location of the uploaded ceremony artifact.
|
|
102
|
+
*/
|
|
103
|
+
export declare const completeMultiPartUpload: (functions: Functions, bucketName: string, objectKey: string, uploadId: string, parts: Array<ETagWithPartNumber>, ceremonyId?: string) => Promise<string>;
|
|
104
|
+
/**
|
|
105
|
+
* Check if a specified object exist in a given AWS S3 bucket.
|
|
106
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
107
|
+
* @param bucketName <string> - the name of the ceremony bucket.
|
|
108
|
+
* @param objectKey <string> - the storage path that locates the artifact to be downloaded in the bucket.
|
|
109
|
+
* @returns <Promise<string>> - true if and only if the object exists, otherwise false.
|
|
110
|
+
*/
|
|
111
|
+
export declare const checkIfObjectExist: (functions: Functions, bucketName: string, objectKey: string) => Promise<boolean>;
|
|
112
|
+
/**
|
|
113
|
+
* Request to verify the newest contribution for the circuit.
|
|
114
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
115
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
116
|
+
* @param circuit <FirebaseDocumentInfo> - the document info about the circuit.
|
|
117
|
+
* @param bucketName <string> - the name of the ceremony bucket.
|
|
118
|
+
* @param contributorOrCoordinatorIdentifier <string> - the identifier of the contributor or coordinator (only when finalizing).
|
|
119
|
+
* @param verifyContributionCloudFunctionEndpoint <string> - the endpoint (direct url) necessary to call the V2 Cloud Function.
|
|
120
|
+
* @returns <Promise<void>> -
|
|
121
|
+
*/
|
|
122
|
+
export declare const verifyContribution: (functions: Functions, ceremonyId: string, circuit: FirebaseDocumentInfo, bucketName: string, contributorOrCoordinatorIdentifier: string, verifyContributionCloudFunctionEndpoint: string) => Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Prepare the coordinator for the finalization of the ceremony.
|
|
125
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
126
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
127
|
+
* @returns <Promise<boolean>> - true when the coordinator is ready for finalization; otherwise false.
|
|
128
|
+
*/
|
|
129
|
+
export declare const checkAndPrepareCoordinatorForFinalization: (functions: Functions, ceremonyId: string) => Promise<boolean>;
|
|
130
|
+
/**
|
|
131
|
+
* Finalize the ceremony circuit.
|
|
132
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
133
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
134
|
+
* @param circuitId <string> - the unique identifier of the circuit.
|
|
135
|
+
* @param bucketName <string> - the name of the ceremony bucket.
|
|
136
|
+
* @param beacon <string> - the value used to compute the final contribution while finalizing the ceremony.
|
|
137
|
+
*/
|
|
138
|
+
export declare const finalizeCircuit: (functions: Functions, ceremonyId: string, circuitId: any, bucketName: string, beacon: string) => Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Conclude the finalization of the ceremony.
|
|
141
|
+
* @param functions <Functions> - the Firebase cloud functions object instance.
|
|
142
|
+
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
143
|
+
*/
|
|
144
|
+
export declare const finalizeCeremony: (functions: Functions, ceremonyId: string) => Promise<void>;
|
|
145
|
+
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../src/helpers/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuC,MAAM,oBAAoB,CAAA;AAEnF,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAG7G;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,cACX,SAAS,qBACD,iBAAiB,kBACpB,MAAM,YACZ,eAAe,EAAE,KAC5B,QAAQ,MAAM,CAShB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,cAAqB,SAAS,cAAc,MAAM,KAAG,QAAQ,GAAG,CAMvG,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,cAAqB,SAAS,cAAc,MAAM,KAAG,QAAQ,IAAI,CAMjH,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,wCAAwC,cACtC,SAAS,cACR,MAAM,KACnB,QAAQ,IAAI,CAMd,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,cAAqB,SAAS,cAAc,MAAM,kBAI5E,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,cAC3B,SAAS,cACR,MAAM,aACP,MAAM,KAClB,QAAQ,MAAM,CAShB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,cAAqB,SAAS,cAAc,MAAM,kBAM5F,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,8CAA8C,cAC5C,SAAS,cACR,MAAM,+BACW,MAAM,oBACjB,MAAM,kBAQ3B,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,cACjB,SAAS,cACR,MAAM,aACP,MAAM,eACJ,MAAM,KACpB,QAAQ,MAAM,CAUhB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kDAAkD,cAChD,SAAS,cACR,MAAM,YACR,MAAM,kBAWnB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kDAAkD,cAChD,SAAS,cACR,MAAM,SACX,kBAAkB,kBAU5B,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,cACxB,SAAS,cACR,MAAM,aACP,MAAM,YACP,MAAM,iBACD,MAAM,eACR,MAAM,KACpB,QAAQ,MAAM,MAAM,CAAC,CAYvB,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,cACrB,SAAS,cACR,MAAM,aACP,MAAM,YACP,MAAM,SACT,MAAM,kBAAkB,CAAC,eACnB,MAAM,KACpB,QAAQ,MAAM,CAahB,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,cAChB,SAAS,cACR,MAAM,aACP,MAAM,KAClB,QAAQ,OAAO,CASjB,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,cAChB,SAAS,cACR,MAAM,WACT,oBAAoB,cACjB,MAAM,sCACkB,MAAM,2CACD,MAAM,KAChD,QAAQ,IAAI,CAuEd,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,yCAAyC,cACvC,SAAS,cACR,MAAM,KACnB,QAAQ,OAAO,CAQjB,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,cACb,SAAS,cACR,MAAM,aACP,GAAG,cACF,MAAM,UACV,MAAM,kBAUjB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,cAAqB,SAAS,cAAc,MAAM,kBAM9E,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function will check if the user is reputable enough to be able to use the app
|
|
3
|
+
* @param userLogin <string> The username of the user
|
|
4
|
+
* @param minimumAmountOfFollowing <number> The minimum amount of following the user should have
|
|
5
|
+
* @param minimumAmountOfFollowers <number> The minimum amount of followers the user should have
|
|
6
|
+
* @param minimumAmountOfPublicRepos <number> The minimum amount of public repos the user should have
|
|
7
|
+
* @returns <boolean> True if the user is reputable enough, false otherwise
|
|
8
|
+
*/
|
|
9
|
+
export declare const githubReputation: (userLogin: string, minimumAmountOfFollowing: number, minimumAmountOfFollowers: number, minimumAmountOfPublicRepos: number) => Promise<boolean>;
|
|
10
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../../src/helpers/security.ts"],"names":[],"mappings":"AAwDA;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,cACd,MAAM,4BACS,MAAM,4BACN,MAAM,8BACJ,MAAM,KACnC,QAAQ,OAAO,CAgBjB,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FirebaseApp, FirebaseOptions } from "firebase/app";
|
|
2
|
+
import { Firestore } from "firebase/firestore";
|
|
3
|
+
import { Functions } from "firebase/functions";
|
|
4
|
+
import { AWSVariables, FirebaseServices } from "../types/index";
|
|
5
|
+
/**
|
|
6
|
+
* This method initialize a Firebase app if no other app has already been initialized.
|
|
7
|
+
* @param options <FirebaseOptions> - an object w/ every necessary Firebase option to init app.
|
|
8
|
+
* @returns <FirebaseApp> - the initialized Firebase app object.
|
|
9
|
+
*/
|
|
10
|
+
export declare const initializeFirebaseApp: (options: FirebaseOptions) => FirebaseApp;
|
|
11
|
+
/**
|
|
12
|
+
* This method returns the Firestore database instance associated to the given Firebase application.
|
|
13
|
+
* @param app <FirebaseApp> - the Firebase application.
|
|
14
|
+
* @returns <Firestore> - the Firebase Firestore associated to the application.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getFirestoreDatabase: (app: FirebaseApp) => Firestore;
|
|
17
|
+
/**
|
|
18
|
+
* This method returns the Cloud Functions instance associated to the given Firebase application.
|
|
19
|
+
* @param app <FirebaseApp> - the Firebase application.
|
|
20
|
+
* @returns <Functions> - the Cloud Functions associated to the application.
|
|
21
|
+
*/
|
|
22
|
+
export declare const getFirebaseFunctions: (app: FirebaseApp) => Functions;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieve the configuration variables for the AWS services (S3, EC2).
|
|
25
|
+
* @returns <AWSVariables> - the values of the AWS services configuration variables.
|
|
26
|
+
*/
|
|
27
|
+
export declare const getAWSVariables: () => AWSVariables;
|
|
28
|
+
/**
|
|
29
|
+
* Return the core Firebase services instances (App, Database, Functions).
|
|
30
|
+
* @param apiKey <string> - the API key specified in the application config.
|
|
31
|
+
* @param authDomain <string> - the authDomain string specified in the application config.
|
|
32
|
+
* @param projectId <string> - the projectId specified in the application config.
|
|
33
|
+
* @param messagingSenderId <string> - the messagingSenderId specified in the application config.
|
|
34
|
+
* @param appId <string> - the appId specified in the application config.
|
|
35
|
+
* @returns <Promise<FirebaseServices>>
|
|
36
|
+
*/
|
|
37
|
+
export declare const initializeFirebaseCoreServices: (apiKey: string, authDomain: string, projectId: string, messagingSenderId: string, appId: string) => Promise<FirebaseServices>;
|
|
38
|
+
//# sourceMappingURL=services.d.ts.map
|