Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
# EditorConfig is awesome: https://editorconfig.org

# top-most EditorConfig file
root = true
max_line_length = 100


# Unix-style newlines with a newline ending every file
[*]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
charset = utf-8
max_line_length = 88

[*.{yml,yaml,json,js,css,html}]
[*.md]
trim_trailing_whitespace = false


# 2 space indentation
[*.{yml,yaml,css,html}]
indent_size = 2


[*.py]
indent_style = space
indent_size = 4

# Tab indentation (no size specified)
[Makefile]
indent_style = tab
tab_width = 4

3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
WEB3_HTTPS_PROVIDER_URI=https://eth-mainnet.g.alchemy.com/v2/422IpViRAru0Uu1SANhySuOStpaIK3AG
ALCHEMY_API_KEY=xxx
QUART_APP=quart_sqlalchemy.sim.main:app
19 changes: 0 additions & 19 deletions .flake8

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ pytest-plugin-work
old
examples/two/
*.sqlite
*.db
*.db
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.13
3.12.2
159 changes: 159 additions & 0 deletions docs/Simulation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# Simulation Docs

# initialize database
```shell
quart db create
```
```
Initialized database schema for <QuartSQLAlchemy sqlite:///file:sim.db?cache=shared&uri=true>
```

# add first client to the database (Using CLI)
```shell
quart auth add-client
```
```
Created client 2VolejRejNmG with public_api_key: 5f794cf72d0cef2dd008be2c0b7a632b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (generic-api-key): Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Source: gitleaks

```

Use the `public_api_key` returned for the value of the `X-Public-API-Key` header when making API requests.


# Create new auth_user via api
```shell
curl -X POST localhost:8081/api/auth_user/ \
-H 'X-Public-API-Key: 5f794cf72d0cef2dd008be2c0b7a632b' \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (generic-api-key): Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Source: gitleaks

Comment on lines +24 to +25
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (curl-auth-header): Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

Source: gitleaks

-H 'Content-Type: application/json' \
--data '{"email": "[email protected]"}'
```
```json
{
"data": {
"auth_user": {
"client_id": "2VolejRejNmG",
"current_session_token": "69ee9af5b9296a09f90be5b71c1dda38",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (generic-api-key): Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Source: gitleaks

"date_verified": 1681344793,
"delegated_identity_pool_id": null,
"delegated_user_id": null,
"email": "[email protected]",
"global_auth_user_id": null,
"id": "GWpmbk5ezJn4",
"is_admin": false,
"linked_primary_auth_user_id": null,
"phone_number": null,
"provenance": null,
"user_type": 2
}
},
"error_code": "",
"message": "",
"status": ""
}
```

Use the `current_session_token` returned for the value of `Authorization: Bearer {token}` header when making API Requests requiring a user.

# get AuthUser corresponding to provided bearer session token
```shell
curl -X GET localhost:8081/api/auth_user/ \
-H 'X-Public-API-Key: 5f794cf72d0cef2dd008be2c0b7a632b' \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (generic-api-key): Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Source: gitleaks

Comment on lines +58 to +59
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (curl-auth-header): Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

Source: gitleaks

-H 'Authorization: Bearer 69ee9af5b9296a09f90be5b71c1dda38' \
-H 'Content-Type: application/json'
```
```json
{
"data": {
"client_id": "2VolejRejNmG",
"current_session_token": "69ee9af5b9296a09f90be5b71c1dda38",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (generic-api-key): Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Source: gitleaks

"date_verified": 1681344793,
"delegated_identity_pool_id": null,
"delegated_user_id": null,
"email": "[email protected]",
"global_auth_user_id": null,
"id": "GWpmbk5ezJn4",
"is_admin": false,
"linked_primary_auth_user_id": null,
"phone_number": null,
"provenance": null,
"user_type": 2
},
"error_code": "",
"message": "",
"status": ""
}
```


# AuthWallet Sync
```shell
curl -X POST localhost:8081/api/auth_wallet/sync \
-H 'X-Public-API-Key: 5f794cf72d0cef2dd008be2c0b7a632b' \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (generic-api-key): Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Source: gitleaks

Comment on lines +89 to +90
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (curl-auth-header): Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

Source: gitleaks

-H 'Authorization: Bearer 69ee9af5b9296a09f90be5b71c1dda38' \
-H 'Content-Type: application/json' \
--data '{"public_address": "xxx", "encrypted_private_address": "xxx", "wallet_type": "ETH"}'
```
```json
{
"data": {
"auth_user_id": "GWpmbk5ezJn4",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (generic-api-key): Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Source: gitleaks

"encrypted_private_address": "xxx",
"public_address": "xxx",
"wallet_id": "GWpmbk5ezJn4",
"wallet_type": "ETH"
},
"error_code": "",
"message": "",
"status": ""
}
```

# get magic client corresponding to provided public api key
```shell
curl -X GET localhost:8081/api/magic_client/ \
-H 'X-Public-API-Key: 5f794cf72d0cef2dd008be2c0b7a632b' \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (generic-api-key): Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Source: gitleaks

Comment on lines +112 to +113
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (curl-auth-header): Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

Source: gitleaks

-H 'Content-Type: application/json'
```
```json
{
"data": {
"app_name": "My App",
"connect_interop": null,
"global_audience_enabled": false,
"id": "2VolejRejNmG",
"is_signing_modal_enabled": false,
"public_api_key": "5f794cf72d0cef2dd008be2c0b7a632b",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (generic-api-key): Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Source: gitleaks

"rate_limit_tier": null,
"secret_api_key": "c6ecbced505b35505751c862ed0fb10ffb623d24095019433e0d4d94e240e508"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (generic-api-key): Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Source: gitleaks

},
"error_code": "",
"message": "",
"status": ""
}
```

# Create new magic client
```shell
curl -X POST localhost:8081/api/magic_client/ \
-H 'X-Public-API-Key: 5f794cf72d0cef2dd008be2c0b7a632b' \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (generic-api-key): Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Source: gitleaks

Comment on lines +136 to +137
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (curl-auth-header): Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

Source: gitleaks

-H 'Content-Type: application/json' \
--data '{"app_name": "New App"}'
```
```json
{
"data": {
"magic_client": {
"app_name": "New App",
"connect_interop": null,
"global_audience_enabled": false,
"id": "GWpmbk5ezJn4",
"is_signing_modal_enabled": false,
"public_api_key": "fb7e0466e2e09387b93af7da49bb1386",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (generic-api-key): Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Source: gitleaks

"rate_limit_tier": null,
"secret_api_key": "2ac56a6068d0d4b2ce911ba08401c7bf4acdb03db957550c260bd317c6c49a76"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (generic-api-key): Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

Source: gitleaks

}
},
"error_code": "",
"message": "",
"status": ""
}
```
Loading