Skip to content

Commit 21e2c24

Browse files
Sim POC
1 parent c7e453d commit 21e2c24

63 files changed

Lines changed: 3351 additions & 1284 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
WEB3_HTTPS_PROVIDER_URI=https://eth-mainnet.g.alchemy.com/v2/422IpViRAru0Uu1SANhySuOStpaIK3AG
2+
ALCHEMY_API_KEY=xxx
3+
QUART_APP=quart_sqlalchemy.sim.main:app

docs/Simulation.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Simulation Docs
2+
3+
# initialize database
4+
```shell
5+
quart db create
6+
```
7+
```
8+
Initialized database schema for <QuartSQLAlchemy sqlite:///file:sim.db?cache=shared&uri=true>
9+
```
10+
11+
# add first client to the database (Using CLI)
12+
```shell
13+
quart auth add-client
14+
```
15+
```
16+
Created client 2VolejRejNmG with public_api_key: 5f794cf72d0cef2dd008be2c0b7a632b
17+
```
18+
19+
Use the `public_api_key` returned for the value of the `X-Public-API-Key` header when making API requests.
20+
21+
22+
# Create new auth_user via api
23+
```shell
24+
curl -X POST localhost:8081/api/auth_user/ \
25+
-H 'X-Public-API-Key: 5f794cf72d0cef2dd008be2c0b7a632b' \
26+
-H 'Content-Type: application/json' \
27+
--data '{"email": "joe2@joe.com"}'
28+
```
29+
```json
30+
{
31+
"data": {
32+
"auth_user": {
33+
"client_id": "2VolejRejNmG",
34+
"current_session_token": "69ee9af5b9296a09f90be5b71c1dda38",
35+
"date_verified": 1681344793,
36+
"delegated_identity_pool_id": null,
37+
"delegated_user_id": null,
38+
"email": "joe2@joe.com",
39+
"global_auth_user_id": null,
40+
"id": "GWpmbk5ezJn4",
41+
"is_admin": false,
42+
"linked_primary_auth_user_id": null,
43+
"phone_number": null,
44+
"provenance": null,
45+
"user_type": 2
46+
}
47+
},
48+
"error_code": "",
49+
"message": "",
50+
"status": ""
51+
}
52+
```
53+
54+
Use the `current_session_token` returned for the value of `Authorization: Bearer {token}` header when making API Requests requiring a user.
55+
56+
# get AuthUser corresponding to provided bearer session token
57+
```shell
58+
curl -X GET localhost:8081/api/auth_user/ \
59+
-H 'X-Public-API-Key: 5f794cf72d0cef2dd008be2c0b7a632b' \
60+
-H 'Authorization: Bearer 69ee9af5b9296a09f90be5b71c1dda38' \
61+
-H 'Content-Type: application/json'
62+
```
63+
```json
64+
{
65+
"data": {
66+
"client_id": "2VolejRejNmG",
67+
"current_session_token": "69ee9af5b9296a09f90be5b71c1dda38",
68+
"date_verified": 1681344793,
69+
"delegated_identity_pool_id": null,
70+
"delegated_user_id": null,
71+
"email": "joe2@joe.com",
72+
"global_auth_user_id": null,
73+
"id": "GWpmbk5ezJn4",
74+
"is_admin": false,
75+
"linked_primary_auth_user_id": null,
76+
"phone_number": null,
77+
"provenance": null,
78+
"user_type": 2
79+
},
80+
"error_code": "",
81+
"message": "",
82+
"status": ""
83+
}
84+
```
85+
86+
87+
# AuthWallet Sync
88+
```shell
89+
curl -X POST localhost:8081/api/auth_wallet/sync \
90+
-H 'X-Public-API-Key: 5f794cf72d0cef2dd008be2c0b7a632b' \
91+
-H 'Authorization: Bearer 69ee9af5b9296a09f90be5b71c1dda38' \
92+
-H 'Content-Type: application/json' \
93+
--data '{"public_address": "xxx", "encrypted_private_address": "xxx", "wallet_type": "ETH"}'
94+
```
95+
```json
96+
{
97+
"data": {
98+
"auth_user_id": "GWpmbk5ezJn4",
99+
"encrypted_private_address": "xxx",
100+
"public_address": "xxx",
101+
"wallet_id": "GWpmbk5ezJn4",
102+
"wallet_type": "ETH"
103+
},
104+
"error_code": "",
105+
"message": "",
106+
"status": ""
107+
}
108+
```
109+
110+
# get magic client corresponding to provided public api key
111+
```shell
112+
curl -X GET localhost:8081/api/magic_client/ \
113+
-H 'X-Public-API-Key: 5f794cf72d0cef2dd008be2c0b7a632b' \
114+
-H 'Content-Type: application/json'
115+
```
116+
```json
117+
{
118+
"data": {
119+
"app_name": "My App",
120+
"connect_interop": null,
121+
"global_audience_enabled": false,
122+
"id": "2VolejRejNmG",
123+
"is_signing_modal_enabled": false,
124+
"public_api_key": "5f794cf72d0cef2dd008be2c0b7a632b",
125+
"rate_limit_tier": null,
126+
"secret_api_key": "c6ecbced505b35505751c862ed0fb10ffb623d24095019433e0d4d94e240e508"
127+
},
128+
"error_code": "",
129+
"message": "",
130+
"status": ""
131+
}
132+
```
133+
134+
# Create new magic client
135+
```shell
136+
curl -X POST localhost:8081/api/magic_client/ \
137+
-H 'X-Public-API-Key: 5f794cf72d0cef2dd008be2c0b7a632b' \
138+
-H 'Content-Type: application/json' \
139+
--data '{"app_name": "New App"}'
140+
```
141+
```json
142+
{
143+
"data": {
144+
"magic_client": {
145+
"app_name": "New App",
146+
"connect_interop": null,
147+
"global_audience_enabled": false,
148+
"id": "GWpmbk5ezJn4",
149+
"is_signing_modal_enabled": false,
150+
"public_api_key": "fb7e0466e2e09387b93af7da49bb1386",
151+
"rate_limit_tier": null,
152+
"secret_api_key": "2ac56a6068d0d4b2ce911ba08401c7bf4acdb03db957550c260bd317c6c49a76"
153+
}
154+
},
155+
"error_code": "",
156+
"message": "",
157+
"status": ""
158+
}
159+
```

0 commit comments

Comments
 (0)