@devtion/backend 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 +151 -0
- package/dist/src/functions/index.js +2644 -0
- package/dist/src/functions/index.mjs +2596 -0
- package/dist/types/functions/ceremony.d.ts +33 -0
- package/dist/types/functions/ceremony.d.ts.map +1 -0
- package/dist/types/functions/circuit.d.ts +63 -0
- package/dist/types/functions/circuit.d.ts.map +1 -0
- package/dist/types/functions/index.d.ts +7 -0
- package/dist/types/functions/index.d.ts.map +1 -0
- package/dist/types/functions/participant.d.ts +58 -0
- package/dist/types/functions/participant.d.ts.map +1 -0
- package/dist/types/functions/storage.d.ts +37 -0
- package/dist/types/functions/storage.d.ts.map +1 -0
- package/dist/types/functions/timeout.d.ts +26 -0
- package/dist/types/functions/timeout.d.ts.map +1 -0
- package/dist/types/functions/user.d.ts +15 -0
- package/dist/types/functions/user.d.ts.map +1 -0
- package/dist/types/lib/errors.d.ts +75 -0
- package/dist/types/lib/errors.d.ts.map +1 -0
- package/dist/types/lib/services.d.ts +9 -0
- package/dist/types/lib/services.d.ts.map +1 -0
- package/dist/types/lib/utils.d.ts +141 -0
- package/dist/types/lib/utils.d.ts.map +1 -0
- package/dist/types/types/enums.d.ts +13 -0
- package/dist/types/types/enums.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +130 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/package.json +89 -0
- package/src/functions/ceremony.ts +333 -0
- package/src/functions/circuit.ts +1092 -0
- package/src/functions/index.ts +36 -0
- package/src/functions/participant.ts +526 -0
- package/src/functions/storage.ts +548 -0
- package/src/functions/timeout.ts +294 -0
- package/src/functions/user.ts +142 -0
- package/src/lib/errors.ts +237 -0
- package/src/lib/services.ts +28 -0
- package/src/lib/utils.ts +472 -0
- package/src/types/enums.ts +12 -0
- package/src/types/index.ts +140 -0
- package/test/index.test.ts +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Ethereum Foundation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">
|
|
3
|
+
Backend ⚙️
|
|
4
|
+
</h1>
|
|
5
|
+
<p align="center">An easy-to-configure, deploy and maintain cloud infrastructure solution for automating the coordination, scalability, and storage of your Groth16 zkSNARKs Phase 2 Trusted Setup ceremonies.</p>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://github.com/privacy-scaling-explorations/p0tion">
|
|
10
|
+
<img src="https://img.shields.io/badge/project-p0tion-blue.svg?style=flat-square">
|
|
11
|
+
</a>
|
|
12
|
+
<a href="https://github.com/privacy-scaling-explorations/p0tion/blob/main/LICENSE">
|
|
13
|
+
<img alt="Github License" src="https://img.shields.io/github/license/privacy-scaling-explorations/p0tion.svg?style=flat-square">
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://www.npmjs.com/package/@p0tion/backend">
|
|
16
|
+
<img alt="NPM Version" src="https://img.shields.io/npm/v/@p0tion/backend?style=flat-square" />
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://npmjs.org/package/@p0tion/backend">
|
|
19
|
+
<img alt="Downloads" src="https://img.shields.io/npm/dm/@p0tion/backend.svg?style=flat-square" />
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://eslint.org/">
|
|
22
|
+
<img alt="Linter" src="https://img.shields.io/badge/linter-eslint-8080f2?style=flat-square&logo=eslint" />
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://prettier.io/">
|
|
25
|
+
<img alt="Prettier" src="https://img.shields.io/badge/code%20style-prettier-f8bc45?style=flat-square&logo=prettier" />
|
|
26
|
+
</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
<div align="center">
|
|
30
|
+
<h4>
|
|
31
|
+
<a href="https://github.com/privacy-scaling-explorations/p0tion/blob/main/CONTRIBUTING.md">
|
|
32
|
+
👥 Contributing
|
|
33
|
+
</a>
|
|
34
|
+
<span> | </span>
|
|
35
|
+
<a href="https://github.com/privacy-scaling-explorations/p0tion/blob/main/CODE_OF_CONDUCT.md">
|
|
36
|
+
🤝 Code of conduct
|
|
37
|
+
</a>
|
|
38
|
+
<span> | </span>
|
|
39
|
+
<a href="https://discord.gg/sF5CT5rzrR">
|
|
40
|
+
🗣️ Chat & Support
|
|
41
|
+
</a>
|
|
42
|
+
</h4>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
| This library provides everything needed to configure, deploy and manage the infrastructure required to run one or more Phase 2 Trusted Setup ceremonies. |
|
|
46
|
+
| -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
47
|
+
|
|
48
|
+
Launching the ready-to-run customized scripts everyone could handle whatever is needed to accomplish the users authentication, ceremony setup, coordination and finalization. You could count on the combination of services provided by the far most popular cloud solutions in the market, as AWS for S3 Storage and GCP Firebase for Authentication, Firestore DB and, Cloud Functions services.
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
## 🛠 Installation
|
|
53
|
+
|
|
54
|
+
**Prerequisities**
|
|
55
|
+
|
|
56
|
+
- Node.js version 16.0 or higher.
|
|
57
|
+
- Yarn version 3.5.0 or higher.
|
|
58
|
+
- A Firebase Application w/ active billing (Blaze Plan) in order to support Cloud Functions deployment.
|
|
59
|
+
- Follow the [Installation](https://github.com/privacy-scaling-explorations/p0tion/blob/main/README.md#installation) and [Usage](https://github.com/privacy-scaling-explorations/p0tion/blob/main/README.md#usage) guide.
|
|
60
|
+
- Generate and store a configuration file with your service account's credentials as stated in this [documentation](https://firebase.google.com/docs/admin/setup#set-up-project-and-service-account) inside the `packages/backend/serviceAccountKey.json` file.
|
|
61
|
+
- Rename the `.firebaserc` production project alias with your Firebase project name.
|
|
62
|
+
|
|
63
|
+
Navigate to backend package by running
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
cd packages/backend
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Copy the `.default.env` file as `.env`:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
cp .env.default .env
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
And add your environment variables.
|
|
76
|
+
|
|
77
|
+
## 📜 Usage
|
|
78
|
+
|
|
79
|
+
### Authorization
|
|
80
|
+
|
|
81
|
+
Login using your Google Account to Firebase CLI running
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
yarn firebase:login
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Run the following to logout
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
yarn firebase:logout
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Initialization
|
|
94
|
+
|
|
95
|
+
Initialize a new Firebase project interactively
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
yarn firebase:init
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Deployment
|
|
102
|
+
|
|
103
|
+
Deploy the current configuration to the `prod` project running
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
yarn firebase:deploy
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
To deploy only the latest Cloud Functions run
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
yarn firebase:deploy-functions
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
To deploy only the latest Firestore configuration and rules run
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
yarn firebase:deploy-firestore
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Local Emulator
|
|
122
|
+
|
|
123
|
+
Firebase provides a [Local Emulator Suite](https://firebase.google.com/docs/emulator-suite) as a set of advanced dev-tools w/ a rich user-interface to build and test apps locally using Firebase services as Cloud Functions, Firestore and Authentication.
|
|
124
|
+
|
|
125
|
+
**Prerequisities**
|
|
126
|
+
|
|
127
|
+
- You will need Java JDK version 11 or higher to run the Firebase Local Emulator.
|
|
128
|
+
|
|
129
|
+
To start the Emulator run
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
yarn emulator:serve
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
To emulate only Cloud Functions service run
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
yarn emulator:serve-functions
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
To run the Emulator shell in a new command line window run
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
yarn emulator:shell
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
To run tests (e2e/unit) locally in the Emulator run
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
yarn test:emulator
|
|
151
|
+
```
|