diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 855fb2576..c7c1c9c26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,15 +6,15 @@ on: - main - dev paths-ignore: - - '*.md' - - 'LICENSE' + - "*.md" + - "LICENSE" pull_request: branches: - main - dev paths-ignore: - - '*.md' - - 'LICENSE' + - "*.md" + - "LICENSE" env: CARGO_TERM_COLOR: always @@ -22,7 +22,7 @@ env: jobs: test: runs-on: self-hosted - container: rust:1.71 + container: rust:1.72 services: postgres: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c497f594f..6a9cc21a5 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -4,8 +4,8 @@ on: branches: - main paths-ignore: - - '*.md' - - 'LICENSE' + - "*.md" + - "LICENSE" env: CARGO_INCREMENTAL: 0 @@ -16,10 +16,10 @@ env: jobs: rustdoc: runs-on: self-hosted - container: rust:1.71 + container: rust:1.72 services: postgres: - image: postgres:14-alpine + image: postgres:15-alpine env: POSTGRES_DB: defguard POSTGRES_USER: defguard diff --git a/.gitignore b/.gitignore index fcecfe1cb..f513607b0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ dist-ssr build ladle-build .idea/ +.vscode/ diff --git a/.sqlx/query-0377049270e6dcc4f0ec3571bd998dcdbab8366524ff1f20f48a208b9f7dd9c6.json b/.sqlx/query-0377049270e6dcc4f0ec3571bd998dcdbab8366524ff1f20f48a208b9f7dd9c6.json new file mode 100644 index 000000000..73871505a --- /dev/null +++ b/.sqlx/query-0377049270e6dcc4f0ec3571bd998dcdbab8366524ff1f20f48a208b9f7dd9c6.json @@ -0,0 +1,58 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", client_id, client_secret, redirect_uri, scope, name, enabled FROM oauth2client WHERE client_id = $1 AND enabled", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "client_id", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "client_secret", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "redirect_uri", + "type_info": "TextArray" + }, + { + "ordinal": 4, + "name": "scope", + "type_info": "TextArray" + }, + { + "ordinal": 5, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "enabled", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "0377049270e6dcc4f0ec3571bd998dcdbab8366524ff1f20f48a208b9f7dd9c6" +} diff --git a/.sqlx/query-05e3fce0c51856f6033195c7523a2b5fd1c2a7968a7abd27394422a7c93e8815.json b/.sqlx/query-05e3fce0c51856f6033195c7523a2b5fd1c2a7968a7abd27394422a7c93e8815.json new file mode 100644 index 000000000..7b35afeb1 --- /dev/null +++ b/.sqlx/query-05e3fce0c51856f6033195c7523a2b5fd1c2a7968a7abd27394422a7c93e8815.json @@ -0,0 +1,37 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT\n date_trunc($1, collected_at) \"collected_at: NaiveDateTime\",\n cast(sum(upload) AS bigint) upload, cast(sum(download) AS bigint) download\n FROM wireguard_peer_stats_view\n WHERE collected_at >= $2 AND network = $3\n GROUP BY 1\n ORDER BY 1\n LIMIT $4\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "collected_at: NaiveDateTime", + "type_info": "Timestamp" + }, + { + "ordinal": 1, + "name": "upload", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "download", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Text", + "Timestamp", + "Int8", + "Int8" + ] + }, + "nullable": [ + null, + null, + null + ] + }, + "hash": "05e3fce0c51856f6033195c7523a2b5fd1c2a7968a7abd27394422a7c93e8815" +} diff --git a/.sqlx/query-06be7b39c87c3a1d1465dfb007937b5b584f60e9094a18936b482c4dfb6b1aca.json b/.sqlx/query-06be7b39c87c3a1d1465dfb007937b5b584f60e9094a18936b482c4dfb6b1aca.json new file mode 100644 index 000000000..d70e49da1 --- /dev/null +++ b/.sqlx/query-06be7b39c87c3a1d1465dfb007937b5b584f60e9094a18936b482c4dfb6b1aca.json @@ -0,0 +1,26 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"name\" FROM \"group\"", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false + ] + }, + "hash": "06be7b39c87c3a1d1465dfb007937b5b584f60e9094a18936b482c4dfb6b1aca" +} diff --git a/.sqlx/query-06f847d99d452dafd10f4a6bec309c330d76eb5d0a34012bd75395b13e3ff659.json b/.sqlx/query-06f847d99d452dafd10f4a6bec309c330d76eb5d0a34012bd75395b13e3ff659.json new file mode 100644 index 000000000..c291b5a4e --- /dev/null +++ b/.sqlx/query-06f847d99d452dafd10f4a6bec309c330d76eb5d0a34012bd75395b13e3ff659.json @@ -0,0 +1,44 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"name\",\"wireguard_pubkey\",\"user_id\",\"created\" FROM \"device\"", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "wireguard_pubkey", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 4, + "name": "created", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false, + false + ] + }, + "hash": "06f847d99d452dafd10f4a6bec309c330d76eb5d0a34012bd75395b13e3ff659" +} diff --git a/.sqlx/query-0739dda752a2a5b4bb6483d8fdc87b7065d01d6d5990c7d344be2d0068cac835.json b/.sqlx/query-0739dda752a2a5b4bb6483d8fdc87b7065d01d6d5990c7d344be2d0068cac835.json new file mode 100644 index 000000000..e0722c555 --- /dev/null +++ b/.sqlx/query-0739dda752a2a5b4bb6483d8fdc87b7065d01d6d5990c7d344be2d0068cac835.json @@ -0,0 +1,58 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", client_id, client_secret, redirect_uri, scope, name, enabled FROM oauth2client WHERE client_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "client_id", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "client_secret", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "redirect_uri", + "type_info": "TextArray" + }, + { + "ordinal": 4, + "name": "scope", + "type_info": "TextArray" + }, + { + "ordinal": 5, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "enabled", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "0739dda752a2a5b4bb6483d8fdc87b7065d01d6d5990c7d344be2d0068cac835" +} diff --git a/.sqlx/query-087a0d357b61dd2266e804982fba2e6ca06a3f95da3225be6fcc38d324c143e7.json b/.sqlx/query-087a0d357b61dd2266e804982fba2e6ca06a3f95da3225be6fcc38d324c143e7.json new file mode 100644 index 000000000..d3f74fad6 --- /dev/null +++ b/.sqlx/query-087a0d357b61dd2266e804982fba2e6ca06a3f95da3225be6fcc38d324c143e7.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT MAX(started_at) FROM wireguard_stats_purge", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "max", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + null + ] + }, + "hash": "087a0d357b61dd2266e804982fba2e6ca06a3f95da3225be6fcc38d324c143e7" +} diff --git a/.sqlx/query-0ad599ef120ecc02b030bd1276172929d6a612846acf4a5489c36a04cb57de59.json b/.sqlx/query-0ad599ef120ecc02b030bd1276172929d6a612846acf4a5489c36a04cb57de59.json new file mode 100644 index 000000000..ce67e4293 --- /dev/null +++ b/.sqlx/query-0ad599ef120ecc02b030bd1276172929d6a612846acf4a5489c36a04cb57de59.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT recovery_codes FROM \"user\" WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "recovery_codes", + "type_info": "TextArray" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false + ] + }, + "hash": "0ad599ef120ecc02b030bd1276172929d6a612846acf4a5489c36a04cb57de59" +} diff --git a/.sqlx/query-0b53e81d6f1ce3c3a68c871e7a4b9e41db58b112d12281516e10421d46fbbd94.json b/.sqlx/query-0b53e81d6f1ce3c3a68c871e7a4b9e41db58b112d12281516e10421d46fbbd94.json new file mode 100644 index 000000000..828f2523d --- /dev/null +++ b/.sqlx/query-0b53e81d6f1ce3c3a68c871e7a4b9e41db58b112d12281516e10421d46fbbd94.json @@ -0,0 +1,46 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT DISTINCT ON (d.id) d.id as \"id?\", d.name, d.wireguard_pubkey, d.user_id, d.created\n FROM device d\n JOIN \"user\" u ON d.user_id = u.id\n JOIN group_user gu ON u.id = gu.user_id\n JOIN \"group\" g ON gu.group_id = g.id\n WHERE g.\"name\" IN (SELECT * FROM UNNEST($1::text[]))\n ORDER BY d.id ASC\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "wireguard_pubkey", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 4, + "name": "created", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "TextArray" + ] + }, + "nullable": [ + false, + false, + false, + false, + false + ] + }, + "hash": "0b53e81d6f1ce3c3a68c871e7a4b9e41db58b112d12281516e10421d46fbbd94" +} diff --git a/.sqlx/query-0b64dc92dc09d7fc080c6d2f2d016db4c11f9a99442428a9e473c75c7633927b.json b/.sqlx/query-0b64dc92dc09d7fc080c6d2f2d016db4c11f9a99442428a9e473c75c7633927b.json new file mode 100644 index 000000000..a4709ab49 --- /dev/null +++ b/.sqlx/query-0b64dc92dc09d7fc080c6d2f2d016db4c11f9a99442428a9e473c75c7633927b.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM \"group\" WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "0b64dc92dc09d7fc080c6d2f2d016db4c11f9a99442428a9e473c75c7633927b" +} diff --git a/.sqlx/query-0bb2828da4f0631d12773b904a0f917b7d43ef12809d9398ed2cf2a0a314d5cf.json b/.sqlx/query-0bb2828da4f0631d12773b904a0f917b7d43ef12809d9398ed2cf2a0a314d5cf.json new file mode 100644 index 000000000..913a13ff3 --- /dev/null +++ b/.sqlx/query-0bb2828da4f0631d12773b904a0f917b7d43ef12809d9398ed2cf2a0a314d5cf.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM \"authorization_code\" WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "0bb2828da4f0631d12773b904a0f917b7d43ef12809d9398ed2cf2a0a314d5cf" +} diff --git a/.sqlx/query-10dacbf1e23b51d0ae069dd0a06c0b135662c6c1564ba0605fee42cf69c93bc1.json b/.sqlx/query-10dacbf1e23b51d0ae069dd0a06c0b135662c6c1564ba0605fee42cf69c93bc1.json new file mode 100644 index 000000000..10f97d20f --- /dev/null +++ b/.sqlx/query-10dacbf1e23b51d0ae069dd0a06c0b135662c6c1564ba0605fee42cf69c93bc1.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"user\" SET \"username\" = $2,\"password_hash\" = $3,\"last_name\" = $4,\"first_name\" = $5,\"email\" = $6,\"phone\" = $7,\"ssh_key\" = $8,\"pgp_key\" = $9,\"pgp_cert_id\" = $10,\"mfa_enabled\" = $11,\"totp_enabled\" = $12,\"totp_secret\" = $13,\"mfa_method\" = $14,\"recovery_codes\" = $15 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Bool", + "Bool", + "Bytea", + { + "Custom": { + "name": "mfa_method", + "kind": { + "Enum": [ + "none", + "one_time_password", + "webauthn", + "web3" + ] + } + } + }, + "TextArray" + ] + }, + "nullable": [] + }, + "hash": "10dacbf1e23b51d0ae069dd0a06c0b135662c6c1564ba0605fee42cf69c93bc1" +} diff --git a/.sqlx/query-125d37ad8e24d8fd71b3d695ec4ec2787e4f0de98005b0003c63b9bdedad9aa1.json b/.sqlx/query-125d37ad8e24d8fd71b3d695ec4ec2787e4f0de98005b0003c63b9bdedad9aa1.json new file mode 100644 index 000000000..a4242ca08 --- /dev/null +++ b/.sqlx/query-125d37ad8e24d8fd71b3d695ec4ec2787e4f0de98005b0003c63b9bdedad9aa1.json @@ -0,0 +1,34 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT oauth2client.id \"oauth2client_id!\", oauth2client.name \"oauth2client_name\", oauth2authorizedapp.user_id \"user_id\" FROM oauth2authorizedapp JOIN oauth2client ON oauth2client.id = oauth2authorizedapp.oauth2client_id WHERE oauth2authorizedapp.user_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "oauth2client_id!", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "oauth2client_name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "user_id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "125d37ad8e24d8fd71b3d695ec4ec2787e4f0de98005b0003c63b9bdedad9aa1" +} diff --git a/.sqlx/query-1559d43b6ed3d6c2e62011acc1dfb827793d43053e5ed1c87aac818a47e38934.json b/.sqlx/query-1559d43b6ed3d6c2e62011acc1dfb827793d43053e5ed1c87aac818a47e38934.json new file mode 100644 index 000000000..b11617379 --- /dev/null +++ b/.sqlx/query-1559d43b6ed3d6c2e62011acc1dfb827793d43053e5ed1c87aac818a47e38934.json @@ -0,0 +1,118 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"username\",\"password_hash\",\"last_name\",\"first_name\",\"email\",\"phone\",\"ssh_key\",\"pgp_key\",\"pgp_cert_id\",\"mfa_enabled\",\"totp_enabled\",\"totp_secret\",\"mfa_method\" \"mfa_method: _\",\"recovery_codes\" \"recovery_codes: _\" FROM \"user\" WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "username", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "password_hash", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "last_name", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "first_name", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "email", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "phone", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "ssh_key", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "pgp_key", + "type_info": "Text" + }, + { + "ordinal": 9, + "name": "pgp_cert_id", + "type_info": "Text" + }, + { + "ordinal": 10, + "name": "mfa_enabled", + "type_info": "Bool" + }, + { + "ordinal": 11, + "name": "totp_enabled", + "type_info": "Bool" + }, + { + "ordinal": 12, + "name": "totp_secret", + "type_info": "Bytea" + }, + { + "ordinal": 13, + "name": "mfa_method: _", + "type_info": { + "Custom": { + "name": "mfa_method", + "kind": { + "Enum": [ + "none", + "one_time_password", + "webauthn", + "web3" + ] + } + } + } + }, + { + "ordinal": 14, + "name": "recovery_codes: _", + "type_info": "TextArray" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + true, + false, + false, + false, + true, + true, + true, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "1559d43b6ed3d6c2e62011acc1dfb827793d43053e5ed1c87aac818a47e38934" +} diff --git a/.sqlx/query-15d8aae5b2f7cbc1c415f8e589b12c762f8f7f386beea4543f96f471814a6929.json b/.sqlx/query-15d8aae5b2f7cbc1c415f8e589b12c762f8f7f386beea4543f96f471814a6929.json new file mode 100644 index 000000000..84e74c0c3 --- /dev/null +++ b/.sqlx/query-15d8aae5b2f7cbc1c415f8e589b12c762f8f7f386beea4543f96f471814a6929.json @@ -0,0 +1,32 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"user_id\",\"oauth2client_id\" FROM \"oauth2authorizedapp\"", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "oauth2client_id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "15d8aae5b2f7cbc1c415f8e589b12c762f8f7f386beea4543f96f471814a6929" +} diff --git a/.sqlx/query-169a39acbf7e6b74fd9f538047b0af650fe1bfa21d844a216e80965011290412.json b/.sqlx/query-169a39acbf7e6b74fd9f538047b0af650fe1bfa21d844a216e80965011290412.json new file mode 100644 index 000000000..8d9140ebd --- /dev/null +++ b/.sqlx/query-169a39acbf7e6b74fd9f538047b0af650fe1bfa21d844a216e80965011290412.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM \"wallet\" WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "169a39acbf7e6b74fd9f538047b0af650fe1bfa21d844a216e80965011290412" +} diff --git a/.sqlx/query-18bffe90d894f5a122df97ef37c4afb69f97c74acf36ee7596476ab7fee850b3.json b/.sqlx/query-18bffe90d894f5a122df97ef37c4afb69f97c74acf36ee7596476ab7fee850b3.json new file mode 100644 index 000000000..0902ed5b0 --- /dev/null +++ b/.sqlx/query-18bffe90d894f5a122df97ef37c4afb69f97c74acf36ee7596476ab7fee850b3.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", user_id, name, passkey FROM webauthn WHERE user_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "passkey", + "type_info": "Bytea" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "18bffe90d894f5a122df97ef37c4afb69f97c74acf36ee7596476ab7fee850b3" +} diff --git a/.sqlx/query-18e96b44b04c6ed00424ac497889e5952c877f1d14216f5b083fd7fa7c927bb7.json b/.sqlx/query-18e96b44b04c6ed00424ac497889e5952c877f1d14216f5b083fd7fa7c927bb7.json new file mode 100644 index 000000000..210810108 --- /dev/null +++ b/.sqlx/query-18e96b44b04c6ed00424ac497889e5952c877f1d14216f5b083fd7fa7c927bb7.json @@ -0,0 +1,34 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT device_id, wireguard_network_id, wireguard_ip as \"wireguard_ip: IpAddr\" FROM\n wireguard_network_device\n WHERE wireguard_network_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "device_id", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "wireguard_network_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "wireguard_ip: IpAddr", + "type_info": "Inet" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "18e96b44b04c6ed00424ac497889e5952c877f1d14216f5b083fd7fa7c927bb7" +} diff --git a/.sqlx/query-1996dee9b5e3b8f8a1f63f99e83230927c09d30ceabd07dc193502ce780a3aed.json b/.sqlx/query-1996dee9b5e3b8f8a1f63f99e83230927c09d30ceabd07dc193502ce780a3aed.json new file mode 100644 index 000000000..399f90a24 --- /dev/null +++ b/.sqlx/query-1996dee9b5e3b8f8a1f63f99e83230927c09d30ceabd07dc193502ce780a3aed.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM \"oauth2client\" WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "1996dee9b5e3b8f8a1f63f99e83230927c09d30ceabd07dc193502ce780a3aed" +} diff --git a/.sqlx/query-1cb8e98cf71355633ee9f09594c210349dceeeabc7212dc49ac484ba949ec9e5.json b/.sqlx/query-1cb8e98cf71355633ee9f09594c210349dceeeabc7212dc49ac484ba949ec9e5.json new file mode 100644 index 000000000..725f3146c --- /dev/null +++ b/.sqlx/query-1cb8e98cf71355633ee9f09594c210349dceeeabc7212dc49ac484ba949ec9e5.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE session SET webauthn_challenge = $1 WHERE id = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Bytea", + "Text" + ] + }, + "nullable": [] + }, + "hash": "1cb8e98cf71355633ee9f09594c210349dceeeabc7212dc49ac484ba949ec9e5" +} diff --git a/.sqlx/query-1feeccc3729029c40d9cbecd21919fc184af94f52cb135c4c8bd2830c92a47db.json b/.sqlx/query-1feeccc3729029c40d9cbecd21919fc184af94f52cb135c4c8bd2830c92a47db.json new file mode 100644 index 000000000..20ef03c47 --- /dev/null +++ b/.sqlx/query-1feeccc3729029c40d9cbecd21919fc184af94f52cb135c4c8bd2830c92a47db.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE wallet SET use_for_mfa = FALSE WHERE user_id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "1feeccc3729029c40d9cbecd21919fc184af94f52cb135c4c8bd2830c92a47db" +} diff --git a/.sqlx/query-2163bfa0df95cc31d0325f2a2a6521ef7e3b701ba5a97a74d5e6b3637c626dda.json b/.sqlx/query-2163bfa0df95cc31d0325f2a2a6521ef7e3b701ba5a97a74d5e6b3637c626dda.json new file mode 100644 index 000000000..f83e89958 --- /dev/null +++ b/.sqlx/query-2163bfa0df95cc31d0325f2a2a6521ef7e3b701ba5a97a74d5e6b3637c626dda.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM \"settings\" WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "2163bfa0df95cc31d0325f2a2a6521ef7e3b701ba5a97a74d5e6b3637c626dda" +} diff --git a/.sqlx/query-248067b0803eaf09f88746459986ac8cccb04723772c5b3ec745dbbdf47efe30.json b/.sqlx/query-248067b0803eaf09f88746459986ac8cccb04723772c5b3ec745dbbdf47efe30.json new file mode 100644 index 000000000..6317c1448 --- /dev/null +++ b/.sqlx/query-248067b0803eaf09f88746459986ac8cccb04723772c5b3ec745dbbdf47efe30.json @@ -0,0 +1,29 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO \"authorization_code\" (\"user_id\",\"client_id\",\"code\",\"redirect_uri\",\"scope\",\"auth_time\",\"nonce\",\"code_challenge\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Int8", + "Text", + "Text", + "Text", + "Text", + "Int8", + "Text", + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "248067b0803eaf09f88746459986ac8cccb04723772c5b3ec745dbbdf47efe30" +} diff --git a/.sqlx/query-28faeea866a4b6bd7c816b9d375e38fc174e88b2c111b10dda6bce475737154e.json b/.sqlx/query-28faeea866a4b6bd7c816b9d375e38fc174e88b2c111b10dda6bce475737154e.json new file mode 100644 index 000000000..1b1be1f32 --- /dev/null +++ b/.sqlx/query-28faeea866a4b6bd7c816b9d375e38fc174e88b2c111b10dda6bce475737154e.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO \"oauth2authorizedapp\" (\"user_id\",\"oauth2client_id\") VALUES ($1,$2) RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + }, + "nullable": [ + false + ] + }, + "hash": "28faeea866a4b6bd7c816b9d375e38fc174e88b2c111b10dda6bce475737154e" +} diff --git a/.sqlx/query-2e73d767e5c98702de3d5340e9f0818f346d9d25547aedd4dc388347b7620cfd.json b/.sqlx/query-2e73d767e5c98702de3d5340e9f0818f346d9d25547aedd4dc388347b7620cfd.json new file mode 100644 index 000000000..827af9731 --- /dev/null +++ b/.sqlx/query-2e73d767e5c98702de3d5340e9f0818f346d9d25547aedd4dc388347b7620cfd.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT address \"address!\", name, chain_id, use_for_mfa FROM wallet WHERE user_id = $1 AND validation_timestamp IS NOT NULL", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "address!", + "type_info": "Text" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "chain_id", + "type_info": "Int8" + }, + { + "ordinal": 3, + "name": "use_for_mfa", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "2e73d767e5c98702de3d5340e9f0818f346d9d25547aedd4dc388347b7620cfd" +} diff --git a/.sqlx/query-300bf0d77c93e2e0d731f22278d7747ae93b8534e99f7a8c56e46d3e4d1fc34e.json b/.sqlx/query-300bf0d77c93e2e0d731f22278d7747ae93b8534e99f7a8c56e46d3e4d1fc34e.json new file mode 100644 index 000000000..2dfffc5fe --- /dev/null +++ b/.sqlx/query-300bf0d77c93e2e0d731f22278d7747ae93b8534e99f7a8c56e46d3e4d1fc34e.json @@ -0,0 +1,52 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT oauth2authorizedapp_id, access_token, refresh_token, redirect_uri, scope, expires_in FROM oauth2token WHERE oauth2authorizedapp_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "oauth2authorizedapp_id", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "access_token", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "refresh_token", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "redirect_uri", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "scope", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "expires_in", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false + ] + }, + "hash": "300bf0d77c93e2e0d731f22278d7747ae93b8534e99f7a8c56e46d3e4d1fc34e" +} diff --git a/.sqlx/query-31b3fcaa8109121f985a2c740475f1d77fe8dcbcab76e64164be140ad361ab14.json b/.sqlx/query-31b3fcaa8109121f985a2c740475f1d77fe8dcbcab76e64164be140ad361ab14.json new file mode 100644 index 000000000..084c8458a --- /dev/null +++ b/.sqlx/query-31b3fcaa8109121f985a2c740475f1d77fe8dcbcab76e64164be140ad361ab14.json @@ -0,0 +1,27 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"user\" SET mfa_method = $2 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + { + "Custom": { + "name": "mfa_method", + "kind": { + "Enum": [ + "none", + "one_time_password", + "webauthn", + "web3" + ] + } + } + } + ] + }, + "nullable": [] + }, + "hash": "31b3fcaa8109121f985a2c740475f1d77fe8dcbcab76e64164be140ad361ab14" +} diff --git a/.sqlx/query-3245de884168dd4a396376933d4d462728c1441c603c69161813cf4ea19c65b6.json b/.sqlx/query-3245de884168dd4a396376933d4d462728c1441c603c69161813cf4ea19c65b6.json new file mode 100644 index 000000000..7b134d739 --- /dev/null +++ b/.sqlx/query-3245de884168dd4a396376933d4d462728c1441c603c69161813cf4ea19c65b6.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT totp_enabled OR coalesce(bool_or(wallet.use_for_mfa), FALSE) OR count(webauthn.id) > 0 \"bool!\" FROM \"user\" LEFT JOIN wallet ON wallet.user_id = \"user\".id LEFT JOIN webauthn ON webauthn.user_id = \"user\".id WHERE \"user\".id = $1 GROUP BY totp_enabled;", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "bool!", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + null + ] + }, + "hash": "3245de884168dd4a396376933d4d462728c1441c603c69161813cf4ea19c65b6" +} diff --git a/.sqlx/query-32ed6b107ba5012c9f798bd197abfefafc692d81699e48cae16d09bf88d3a5b5.json b/.sqlx/query-32ed6b107ba5012c9f798bd197abfefafc692d81699e48cae16d09bf88d3a5b5.json new file mode 100644 index 000000000..1b4faf55c --- /dev/null +++ b/.sqlx/query-32ed6b107ba5012c9f798bd197abfefafc692d81699e48cae16d09bf88d3a5b5.json @@ -0,0 +1,52 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT oauth2authorizedapp_id, access_token, refresh_token, redirect_uri, scope, expires_in FROM oauth2token WHERE refresh_token = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "oauth2authorizedapp_id", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "access_token", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "refresh_token", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "redirect_uri", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "scope", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "expires_in", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false + ] + }, + "hash": "32ed6b107ba5012c9f798bd197abfefafc692d81699e48cae16d09bf88d3a5b5" +} diff --git a/.sqlx/query-336532632eb24ed923842cdc8976e26a7f9b8d28ef1d7011407f388d3e983e62.json b/.sqlx/query-336532632eb24ed923842cdc8976e26a7f9b8d28ef1d7011407f388d3e983e62.json new file mode 100644 index 000000000..ca8985f9c --- /dev/null +++ b/.sqlx/query-336532632eb24ed923842cdc8976e26a7f9b8d28ef1d7011407f388d3e983e62.json @@ -0,0 +1,74 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"user_id\",\"address\",\"name\",\"chain_id\",\"challenge_message\",\"challenge_signature\",\"creation_timestamp\",\"validation_timestamp\",\"use_for_mfa\" FROM \"wallet\"", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "address", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "chain_id", + "type_info": "Int8" + }, + { + "ordinal": 5, + "name": "challenge_message", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "challenge_signature", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "creation_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "validation_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 9, + "name": "use_for_mfa", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + true, + false, + true, + false + ] + }, + "hash": "336532632eb24ed923842cdc8976e26a7f9b8d28ef1d7011407f388d3e983e62" +} diff --git a/.sqlx/query-33813a92407a52297f68cff8c6c3dcd8ae0d54ac743398e9ab3cf9e6a28c3660.json b/.sqlx/query-33813a92407a52297f68cff8c6c3dcd8ae0d54ac743398e9ab3cf9e6a28c3660.json new file mode 100644 index 000000000..6acca5ce3 --- /dev/null +++ b/.sqlx/query-33813a92407a52297f68cff8c6c3dcd8ae0d54ac743398e9ab3cf9e6a28c3660.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM group_user WHERE group_id = $1 AND user_id = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + }, + "nullable": [] + }, + "hash": "33813a92407a52297f68cff8c6c3dcd8ae0d54ac743398e9ab3cf9e6a28c3660" +} diff --git a/.sqlx/query-33a1e2f1904757c775d389fa99d67916b7b220d6aa1fe8bb6690f85ed1cd5666.json b/.sqlx/query-33a1e2f1904757c775d389fa99d67916b7b220d6aa1fe8bb6690f85ed1cd5666.json new file mode 100644 index 000000000..462ab0695 --- /dev/null +++ b/.sqlx/query-33a1e2f1904757c775d389fa99d67916b7b220d6aa1fe8bb6690f85ed1cd5666.json @@ -0,0 +1,46 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT device.id \"id?\", name, wireguard_pubkey, user_id, created FROM device JOIN \"user\" ON device.user_id = \"user\".id WHERE \"user\".username = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "wireguard_pubkey", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 4, + "name": "created", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false + ] + }, + "hash": "33a1e2f1904757c775d389fa99d67916b7b220d6aa1fe8bb6690f85ed1cd5666" +} diff --git a/.sqlx/query-33e91546890789d9341b06c541648149baf908b4f2ba35da8adc07feda6299e3.json b/.sqlx/query-33e91546890789d9341b06c541648149baf908b4f2ba35da8adc07feda6299e3.json new file mode 100644 index 000000000..694ea0750 --- /dev/null +++ b/.sqlx/query-33e91546890789d9341b06c541648149baf908b4f2ba35da8adc07feda6299e3.json @@ -0,0 +1,70 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", url, description, token, enabled, on_user_created, on_user_deleted, on_user_modified, on_hwkey_provision FROM webhook WHERE url = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "url", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "description", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "token", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "enabled", + "type_info": "Bool" + }, + { + "ordinal": 5, + "name": "on_user_created", + "type_info": "Bool" + }, + { + "ordinal": 6, + "name": "on_user_deleted", + "type_info": "Bool" + }, + { + "ordinal": 7, + "name": "on_user_modified", + "type_info": "Bool" + }, + { + "ordinal": 8, + "name": "on_hwkey_provision", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "33e91546890789d9341b06c541648149baf908b4f2ba35da8adc07feda6299e3" +} diff --git a/.sqlx/query-381a91411dae9517c285d2f57cf81ac75d3bf0812c190ef118d6dce1b564b37d.json b/.sqlx/query-381a91411dae9517c285d2f57cf81ac75d3bf0812c190ef118d6dce1b564b37d.json new file mode 100644 index 000000000..1331b3002 --- /dev/null +++ b/.sqlx/query-381a91411dae9517c285d2f57cf81ac75d3bf0812c190ef118d6dce1b564b37d.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"user\" SET mfa_enabled = $2, totp_enabled = $3 AND totp_secret = $4 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Bool", + "Bool", + "Bytea" + ] + }, + "nullable": [] + }, + "hash": "381a91411dae9517c285d2f57cf81ac75d3bf0812c190ef118d6dce1b564b37d" +} diff --git a/.sqlx/query-3874e3ddc2d3b4b455fddca611702b86a1f2d02b1878f6f262211f97e0d661b2.json b/.sqlx/query-3874e3ddc2d3b4b455fddca611702b86a1f2d02b1878f6f262211f97e0d661b2.json new file mode 100644 index 000000000..7d54a1398 --- /dev/null +++ b/.sqlx/query-3874e3ddc2d3b4b455fddca611702b86a1f2d02b1878f6f262211f97e0d661b2.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT count(*) \"count!\" FROM wireguard_network_device WHERE wireguard_network_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "count!", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + null + ] + }, + "hash": "3874e3ddc2d3b4b455fddca611702b86a1f2d02b1878f6f262211f97e0d661b2" +} diff --git a/.sqlx/query-3a0fc5bc3005b4b6b5d6ccf2cf71b7915cda2c440eb8f3194480bbaf2969228e.json b/.sqlx/query-3a0fc5bc3005b4b6b5d6ccf2cf71b7915cda2c440eb8f3194480bbaf2969228e.json new file mode 100644 index 000000000..68f826f2e --- /dev/null +++ b/.sqlx/query-3a0fc5bc3005b4b6b5d6ccf2cf71b7915cda2c440eb8f3194480bbaf2969228e.json @@ -0,0 +1,52 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT mfa_method \"mfa_method: _\", totp_enabled totp_available, (SELECT count(*) > 0 FROM wallet WHERE user_id = $1 AND wallet.use_for_mfa) \"web3_available!\", (SELECT count(*) > 0 FROM webauthn WHERE user_id = $1) \"webauthn_available!\" FROM \"user\" WHERE \"user\".id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "mfa_method: _", + "type_info": { + "Custom": { + "name": "mfa_method", + "kind": { + "Enum": [ + "none", + "one_time_password", + "webauthn", + "web3" + ] + } + } + } + }, + { + "ordinal": 1, + "name": "totp_available", + "type_info": "Bool" + }, + { + "ordinal": 2, + "name": "web3_available!", + "type_info": "Bool" + }, + { + "ordinal": 3, + "name": "webauthn_available!", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + null, + null + ] + }, + "hash": "3a0fc5bc3005b4b6b5d6ccf2cf71b7915cda2c440eb8f3194480bbaf2969228e" +} diff --git a/.sqlx/query-3be325a5e6b8ef591fde2e339eee96d6fba101fc81565cffbc26dfb9f8a4fd8d.json b/.sqlx/query-3be325a5e6b8ef591fde2e339eee96d6fba101fc81565cffbc26dfb9f8a4fd8d.json new file mode 100644 index 000000000..420aafbb1 --- /dev/null +++ b/.sqlx/query-3be325a5e6b8ef591fde2e339eee96d6fba101fc81565cffbc26dfb9f8a4fd8d.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM \"webhook\" WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "3be325a5e6b8ef591fde2e339eee96d6fba101fc81565cffbc26dfb9f8a4fd8d" +} diff --git a/.sqlx/query-3d7def96ee88ac4f1c46ff6ef93b06b8acc1f4bc9e34ff1cca6d64d6d281c039.json b/.sqlx/query-3d7def96ee88ac4f1c46ff6ef93b06b8acc1f4bc9e34ff1cca6d64d6d281c039.json new file mode 100644 index 000000000..0443a1d38 --- /dev/null +++ b/.sqlx/query-3d7def96ee88ac4f1c46ff6ef93b06b8acc1f4bc9e34ff1cca6d64d6d281c039.json @@ -0,0 +1,68 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"device_id\",\"collected_at\",\"network\",\"endpoint\",\"upload\",\"download\",\"latest_handshake\",\"allowed_ips\" FROM \"wireguard_peer_stats\"", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "device_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "collected_at", + "type_info": "Timestamp" + }, + { + "ordinal": 3, + "name": "network", + "type_info": "Int8" + }, + { + "ordinal": 4, + "name": "endpoint", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "upload", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "download", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "latest_handshake", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "allowed_ips", + "type_info": "Text" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false, + true, + false, + false, + false, + true + ] + }, + "hash": "3d7def96ee88ac4f1c46ff6ef93b06b8acc1f4bc9e34ff1cca6d64d6d281c039" +} diff --git a/.sqlx/query-3daa0bbce8f2f5d0d30b104db8fd043e7a4938d94962844c66a2be3d242c00ce.json b/.sqlx/query-3daa0bbce8f2f5d0d30b104db8fd043e7a4938d94962844c66a2be3d242c00ce.json new file mode 100644 index 000000000..9acf7d2eb --- /dev/null +++ b/.sqlx/query-3daa0bbce8f2f5d0d30b104db8fd043e7a4938d94962844c66a2be3d242c00ce.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"wireguard_peer_stats\" SET \"device_id\" = $2,\"collected_at\" = $3,\"network\" = $4,\"endpoint\" = $5,\"upload\" = $6,\"download\" = $7,\"latest_handshake\" = $8,\"allowed_ips\" = $9 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Int8", + "Timestamp", + "Int8", + "Text", + "Int8", + "Int8", + "Timestamp", + "Text" + ] + }, + "nullable": [] + }, + "hash": "3daa0bbce8f2f5d0d30b104db8fd043e7a4938d94962844c66a2be3d242c00ce" +} diff --git a/.sqlx/query-3fc4cbb5242fb2e3e3b5de7bcf4c1975f2838d58ffc37b68b57e7ec5acd21bde.json b/.sqlx/query-3fc4cbb5242fb2e3e3b5de7bcf4c1975f2838d58ffc37b68b57e7ec5acd21bde.json new file mode 100644 index 000000000..2c6525b4b --- /dev/null +++ b/.sqlx/query-3fc4cbb5242fb2e3e3b5de7bcf4c1975f2838d58ffc37b68b57e7ec5acd21bde.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"webhook\" SET \"url\" = $2,\"description\" = $3,\"token\" = $4,\"enabled\" = $5,\"on_user_created\" = $6,\"on_user_deleted\" = $7,\"on_user_modified\" = $8,\"on_hwkey_provision\" = $9 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Text", + "Text", + "Text", + "Bool", + "Bool", + "Bool", + "Bool", + "Bool" + ] + }, + "nullable": [] + }, + "hash": "3fc4cbb5242fb2e3e3b5de7bcf4c1975f2838d58ffc37b68b57e7ec5acd21bde" +} diff --git a/.sqlx/query-4183b4f169126bcc511ff76c7554622fc71857d0d459588b4f3934307611aee7.json b/.sqlx/query-4183b4f169126bcc511ff76c7554622fc71857d0d459588b4f3934307611aee7.json new file mode 100644 index 000000000..e2761039f --- /dev/null +++ b/.sqlx/query-4183b4f169126bcc511ff76c7554622fc71857d0d459588b4f3934307611aee7.json @@ -0,0 +1,29 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT\n COALESCE(COUNT(DISTINCT(u.id)), 0) as \"active_users!\",\n COALESCE(COUNT(DISTINCT(s.device_id)), 0) as \"active_devices!\"\n FROM \"user\" u\n JOIN device d ON d.user_id = u.id\n JOIN wireguard_peer_stats s ON s.device_id = d.id\n WHERE latest_handshake >= $1 AND s.network = $2\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "active_users!", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "active_devices!", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Timestamp", + "Int8" + ] + }, + "nullable": [ + null, + null + ] + }, + "hash": "4183b4f169126bcc511ff76c7554622fc71857d0d459588b4f3934307611aee7" +} diff --git a/.sqlx/query-435e3f1969c8809b466228cbaa1811f62a4823257b0513a82a0c098218ea2062.json b/.sqlx/query-435e3f1969c8809b466228cbaa1811f62a4823257b0513a82a0c098218ea2062.json new file mode 100644 index 000000000..27ed0f18f --- /dev/null +++ b/.sqlx/query-435e3f1969c8809b466228cbaa1811f62a4823257b0513a82a0c098218ea2062.json @@ -0,0 +1,29 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO \"webhook\" (\"url\",\"description\",\"token\",\"enabled\",\"on_user_created\",\"on_user_deleted\",\"on_user_modified\",\"on_hwkey_provision\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Text", + "Text", + "Text", + "Bool", + "Bool", + "Bool", + "Bool", + "Bool" + ] + }, + "nullable": [ + false + ] + }, + "hash": "435e3f1969c8809b466228cbaa1811f62a4823257b0513a82a0c098218ea2062" +} diff --git a/.sqlx/query-439bef62ccc846cccca2c6979e5698a7aaba2beb19645b720eefa73e4dcac942.json b/.sqlx/query-439bef62ccc846cccca2c6979e5698a7aaba2beb19645b720eefa73e4dcac942.json new file mode 100644 index 000000000..b5ca2d931 --- /dev/null +++ b/.sqlx/query-439bef62ccc846cccca2c6979e5698a7aaba2beb19645b720eefa73e4dcac942.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT device.id \"id?\", name, wireguard_pubkey, user_id, created FROM device JOIN \"user\" ON device.user_id = \"user\".id WHERE device.id = $1 AND \"user\".username = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "wireguard_pubkey", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 4, + "name": "created", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Int8", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false + ] + }, + "hash": "439bef62ccc846cccca2c6979e5698a7aaba2beb19645b720eefa73e4dcac942" +} diff --git a/.sqlx/query-443177d880a607fc5c545cad75db89ab8ca59b3b1bc9f5ed6847afd7fea9d68c.json b/.sqlx/query-443177d880a607fc5c545cad75db89ab8ca59b3b1bc9f5ed6847afd7fea9d68c.json new file mode 100644 index 000000000..2efcfdf4d --- /dev/null +++ b/.sqlx/query-443177d880a607fc5c545cad75db89ab8ca59b3b1bc9f5ed6847afd7fea9d68c.json @@ -0,0 +1,58 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"client_id\",\"client_secret\",\"redirect_uri\" \"redirect_uri: _\",\"scope\" \"scope: _\",\"name\",\"enabled\" FROM \"oauth2client\" WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "client_id", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "client_secret", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "redirect_uri: _", + "type_info": "TextArray" + }, + { + "ordinal": 4, + "name": "scope: _", + "type_info": "TextArray" + }, + { + "ordinal": 5, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "enabled", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "443177d880a607fc5c545cad75db89ab8ca59b3b1bc9f5ed6847afd7fea9d68c" +} diff --git a/.sqlx/query-454f2edaee1d6c60e75f20ef4344e5ceba35c07316b4317b9b0a6e78b41de0bf.json b/.sqlx/query-454f2edaee1d6c60e75f20ef4344e5ceba35c07316b4317b9b0a6e78b41de0bf.json new file mode 100644 index 000000000..869dbe658 --- /dev/null +++ b/.sqlx/query-454f2edaee1d6c60e75f20ef4344e5ceba35c07316b4317b9b0a6e78b41de0bf.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"user\" SET mfa_enabled = $2 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Bool" + ] + }, + "nullable": [] + }, + "hash": "454f2edaee1d6c60e75f20ef4344e5ceba35c07316b4317b9b0a6e78b41de0bf" +} diff --git a/.sqlx/query-45545d3190c14bb3e9528ab3d3a8522209f36956f65bf5a126682d5477db425e.json b/.sqlx/query-45545d3190c14bb3e9528ab3d3a8522209f36956f65bf5a126682d5477db425e.json new file mode 100644 index 000000000..02e887ea1 --- /dev/null +++ b/.sqlx/query-45545d3190c14bb3e9528ab3d3a8522209f36956f65bf5a126682d5477db425e.json @@ -0,0 +1,16 @@ +{ + "db_name": "PostgreSQL", + "query": "\n UPDATE wireguard_network_device\n SET wireguard_ip = $3\n WHERE device_id = $1 AND wireguard_network_id = $2\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Int8", + "Inet" + ] + }, + "nullable": [] + }, + "hash": "45545d3190c14bb3e9528ab3d3a8522209f36956f65bf5a126682d5477db425e" +} diff --git a/.sqlx/query-473aaa871ecb2e8485c770bf10c6245d2b8b2affb4e151dea34801fe00fff84a.json b/.sqlx/query-473aaa871ecb2e8485c770bf10c6245d2b8b2affb4e151dea34801fe00fff84a.json new file mode 100644 index 000000000..9321cfb42 --- /dev/null +++ b/.sqlx/query-473aaa871ecb2e8485c770bf10c6245d2b8b2affb4e151dea34801fe00fff84a.json @@ -0,0 +1,151 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"openid_enabled\",\"ldap_enabled\",\"wireguard_enabled\",\"webhooks_enabled\",\"worker_enabled\",\"challenge_template\",\"instance_name\",\"main_logo_url\",\"nav_logo_url\",\"smtp_server\",\"smtp_port\",\"smtp_encryption\" \"smtp_encryption: _\",\"smtp_user\",\"smtp_password\" \"smtp_password?: SecretString\",\"smtp_sender\",\"enrollment_vpn_step_optional\",\"enrollment_welcome_message\",\"enrollment_welcome_email\",\"enrollment_welcome_email_subject\",\"enrollment_use_welcome_message_as_email\" FROM \"settings\"", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "openid_enabled", + "type_info": "Bool" + }, + { + "ordinal": 2, + "name": "ldap_enabled", + "type_info": "Bool" + }, + { + "ordinal": 3, + "name": "wireguard_enabled", + "type_info": "Bool" + }, + { + "ordinal": 4, + "name": "webhooks_enabled", + "type_info": "Bool" + }, + { + "ordinal": 5, + "name": "worker_enabled", + "type_info": "Bool" + }, + { + "ordinal": 6, + "name": "challenge_template", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "instance_name", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "main_logo_url", + "type_info": "Text" + }, + { + "ordinal": 9, + "name": "nav_logo_url", + "type_info": "Text" + }, + { + "ordinal": 10, + "name": "smtp_server", + "type_info": "Text" + }, + { + "ordinal": 11, + "name": "smtp_port", + "type_info": "Int4" + }, + { + "ordinal": 12, + "name": "smtp_encryption: _", + "type_info": { + "Custom": { + "name": "smtp_encryption", + "kind": { + "Enum": [ + "none", + "starttls", + "implicittls" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "smtp_user", + "type_info": "Text" + }, + { + "ordinal": 14, + "name": "smtp_password?: SecretString", + "type_info": "Text" + }, + { + "ordinal": 15, + "name": "smtp_sender", + "type_info": "Text" + }, + { + "ordinal": 16, + "name": "enrollment_vpn_step_optional", + "type_info": "Bool" + }, + { + "ordinal": 17, + "name": "enrollment_welcome_message", + "type_info": "Text" + }, + { + "ordinal": 18, + "name": "enrollment_welcome_email", + "type_info": "Text" + }, + { + "ordinal": 19, + "name": "enrollment_welcome_email_subject", + "type_info": "Text" + }, + { + "ordinal": 20, + "name": "enrollment_use_welcome_message_as_email", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + true, + false, + true, + true, + true, + false, + true, + true, + true, + false + ] + }, + "hash": "473aaa871ecb2e8485c770bf10c6245d2b8b2affb4e151dea34801fe00fff84a" +} diff --git a/.sqlx/query-48ecfa6318149ac712807ca8fa0ec1fcb972f917729ffb9b7849830113d04bd8.json b/.sqlx/query-48ecfa6318149ac712807ca8fa0ec1fcb972f917729ffb9b7849830113d04bd8.json new file mode 100644 index 000000000..c79058797 --- /dev/null +++ b/.sqlx/query-48ecfa6318149ac712807ca8fa0ec1fcb972f917729ffb9b7849830113d04bd8.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"user_id\",\"name\",\"passkey\" FROM \"webauthn\" WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "passkey", + "type_info": "Bytea" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "48ecfa6318149ac712807ca8fa0ec1fcb972f917729ffb9b7849830113d04bd8" +} diff --git a/.sqlx/query-49749227cacd46dd9a392d58233a511ee03c0df12cb28ce247d574923fee31a9.json b/.sqlx/query-49749227cacd46dd9a392d58233a511ee03c0df12cb28ce247d574923fee31a9.json new file mode 100644 index 000000000..2ac3ac936 --- /dev/null +++ b/.sqlx/query-49749227cacd46dd9a392d58233a511ee03c0df12cb28ce247d574923fee31a9.json @@ -0,0 +1,56 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, user_id, admin_id, email, created_at, expires_at, used_at FROM enrollment", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Text" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "admin_id", + "type_info": "Int8" + }, + { + "ordinal": 3, + "name": "email", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 5, + "name": "expires_at", + "type_info": "Timestamp" + }, + { + "ordinal": 6, + "name": "used_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + true, + false, + false, + true + ] + }, + "hash": "49749227cacd46dd9a392d58233a511ee03c0df12cb28ce247d574923fee31a9" +} diff --git a/.sqlx/query-4f318cd5100bf4d155a555b927cc7421cb5324f70e427bd7e6f7312be4a20946.json b/.sqlx/query-4f318cd5100bf4d155a555b927cc7421cb5324f70e427bd7e6f7312be4a20946.json new file mode 100644 index 000000000..c3f53658b --- /dev/null +++ b/.sqlx/query-4f318cd5100bf4d155a555b927cc7421cb5324f70e427bd7e6f7312be4a20946.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "\n DELETE FROM wireguard_network_allowed_group\n WHERE network_id = $1 AND group_id IN (\n SELECT id\n FROM \"group\"\n WHERE name IN (SELECT * FROM UNNEST($2::text[]))\n )\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "TextArray" + ] + }, + "nullable": [] + }, + "hash": "4f318cd5100bf4d155a555b927cc7421cb5324f70e427bd7e6f7312be4a20946" +} diff --git a/.sqlx/query-501e4426106d4972d7bd6d769bb6dd239be2168c4afdfc618de4c7facaad67a3.json b/.sqlx/query-501e4426106d4972d7bd6d769bb6dd239be2168c4afdfc618de4c7facaad67a3.json new file mode 100644 index 000000000..5c396350e --- /dev/null +++ b/.sqlx/query-501e4426106d4972d7bd6d769bb6dd239be2168c4afdfc618de4c7facaad67a3.json @@ -0,0 +1,71 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT id \"id?\", device_id \"device_id!\", collected_at \"collected_at!\", network \"network!\",\n endpoint, upload \"upload!\", download \"download!\", latest_handshake \"latest_handshake!\", allowed_ips\n FROM wireguard_peer_stats\n WHERE device_id = $1 AND network = $2\n ORDER BY collected_at DESC\n LIMIT 1\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "device_id!", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "collected_at!", + "type_info": "Timestamp" + }, + { + "ordinal": 3, + "name": "network!", + "type_info": "Int8" + }, + { + "ordinal": 4, + "name": "endpoint", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "upload!", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "download!", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "latest_handshake!", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "allowed_ips", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + true, + false, + false, + false, + true + ] + }, + "hash": "501e4426106d4972d7bd6d769bb6dd239be2168c4afdfc618de4c7facaad67a3" +} diff --git a/.sqlx/query-52b8921f5ee56c73d44d71200514b84a1d5421bd9dd7d604cbc9ccbc2fe36039.json b/.sqlx/query-52b8921f5ee56c73d44d71200514b84a1d5421bd9dd7d604cbc9ccbc2fe36039.json new file mode 100644 index 000000000..b3f290ddd --- /dev/null +++ b/.sqlx/query-52b8921f5ee56c73d44d71200514b84a1d5421bd9dd7d604cbc9ccbc2fe36039.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM oauth2authorizedapp WHERE user_id = $1 AND oauth2client_id = ANY($2)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Int8Array" + ] + }, + "nullable": [] + }, + "hash": "52b8921f5ee56c73d44d71200514b84a1d5421bd9dd7d604cbc9ccbc2fe36039" +} diff --git a/.sqlx/query-52b93ff07493589383745923dbe340b5adde936a4e4474d530b70002eb92063e.json b/.sqlx/query-52b93ff07493589383745923dbe340b5adde936a4e4474d530b70002eb92063e.json new file mode 100644 index 000000000..50c5d3c5f --- /dev/null +++ b/.sqlx/query-52b93ff07493589383745923dbe340b5adde936a4e4474d530b70002eb92063e.json @@ -0,0 +1,68 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"url\",\"description\",\"token\",\"enabled\",\"on_user_created\",\"on_user_deleted\",\"on_user_modified\",\"on_hwkey_provision\" FROM \"webhook\"", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "url", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "description", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "token", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "enabled", + "type_info": "Bool" + }, + { + "ordinal": 5, + "name": "on_user_created", + "type_info": "Bool" + }, + { + "ordinal": 6, + "name": "on_user_deleted", + "type_info": "Bool" + }, + { + "ordinal": 7, + "name": "on_user_modified", + "type_info": "Bool" + }, + { + "ordinal": 8, + "name": "on_hwkey_provision", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "52b93ff07493589383745923dbe340b5adde936a4e4474d530b70002eb92063e" +} diff --git a/.sqlx/query-560de8bc16c1bcc80d31c99dc4b788bf5eeef60689d104448989726a5999eb42.json b/.sqlx/query-560de8bc16c1bcc80d31c99dc4b788bf5eeef60689d104448989726a5999eb42.json new file mode 100644 index 000000000..bdf9168f9 --- /dev/null +++ b/.sqlx/query-560de8bc16c1bcc80d31c99dc4b788bf5eeef60689d104448989726a5999eb42.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"wallet\" SET \"user_id\" = $2,\"address\" = $3,\"name\" = $4,\"chain_id\" = $5,\"challenge_message\" = $6,\"challenge_signature\" = $7,\"creation_timestamp\" = $8,\"validation_timestamp\" = $9,\"use_for_mfa\" = $10 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Int8", + "Text", + "Text", + "Int8", + "Text", + "Text", + "Timestamp", + "Timestamp", + "Bool" + ] + }, + "nullable": [] + }, + "hash": "560de8bc16c1bcc80d31c99dc4b788bf5eeef60689d104448989726a5999eb42" +} diff --git a/.sqlx/query-57f9cef4b6b89be730168450c5dfe5bac9d102aecdb8c82f940b4f34e2b9ccd2.json b/.sqlx/query-57f9cef4b6b89be730168450c5dfe5bac9d102aecdb8c82f940b4f34e2b9ccd2.json new file mode 100644 index 000000000..24e5885b8 --- /dev/null +++ b/.sqlx/query-57f9cef4b6b89be730168450c5dfe5bac9d102aecdb8c82f940b4f34e2b9ccd2.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT \"group\".name FROM \"group\" JOIN group_user ON \"group\".id = group_user.group_id WHERE group_user.user_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "name", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false + ] + }, + "hash": "57f9cef4b6b89be730168450c5dfe5bac9d102aecdb8c82f940b4f34e2b9ccd2" +} diff --git a/.sqlx/query-66d2e2f3156ce802a0018bea5aa0718b2ce599d44de6382e854174053a639f5a.json b/.sqlx/query-66d2e2f3156ce802a0018bea5aa0718b2ce599d44de6382e854174053a639f5a.json new file mode 100644 index 000000000..f1a5f025f --- /dev/null +++ b/.sqlx/query-66d2e2f3156ce802a0018bea5aa0718b2ce599d44de6382e854174053a639f5a.json @@ -0,0 +1,35 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT device_id, wireguard_network_id, wireguard_ip as \"wireguard_ip: IpAddr\" FROM\n wireguard_network_device\n WHERE device_id = $1 AND wireguard_network_id = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "device_id", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "wireguard_network_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "wireguard_ip: IpAddr", + "type_info": "Inet" + } + ], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "66d2e2f3156ce802a0018bea5aa0718b2ce599d44de6382e854174053a639f5a" +} diff --git a/.sqlx/query-6b07d6ea56bcded73038dfd59cff3d7d15049caf771aec6b0fcd42bea7169998.json b/.sqlx/query-6b07d6ea56bcded73038dfd59cff3d7d15049caf771aec6b0fcd42bea7169998.json new file mode 100644 index 000000000..1794b02be --- /dev/null +++ b/.sqlx/query-6b07d6ea56bcded73038dfd59cff3d7d15049caf771aec6b0fcd42bea7169998.json @@ -0,0 +1,74 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"name\",\"address\" \"address: _\",\"port\",\"pubkey\",\"prvkey\",\"endpoint\",\"dns\",\"allowed_ips\" \"allowed_ips: _\",\"connected_at\" FROM \"wireguard_network\"", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "address: _", + "type_info": "Inet" + }, + { + "ordinal": 3, + "name": "port", + "type_info": "Int4" + }, + { + "ordinal": 4, + "name": "pubkey", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "prvkey", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "endpoint", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "dns", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "allowed_ips: _", + "type_info": "InetArray" + }, + { + "ordinal": 9, + "name": "connected_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + false, + true + ] + }, + "hash": "6b07d6ea56bcded73038dfd59cff3d7d15049caf771aec6b0fcd42bea7169998" +} diff --git a/.sqlx/query-6b659b309306098a1f8b5b5592facba9cd54f93f5239fbc62a858bb91f502472.json b/.sqlx/query-6b659b309306098a1f8b5b5592facba9cd54f93f5239fbc62a858bb91f502472.json new file mode 100644 index 000000000..0bbbc964f --- /dev/null +++ b/.sqlx/query-6b659b309306098a1f8b5b5592facba9cd54f93f5239fbc62a858bb91f502472.json @@ -0,0 +1,56 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"client_id\",\"client_secret\",\"redirect_uri\" \"redirect_uri: _\",\"scope\" \"scope: _\",\"name\",\"enabled\" FROM \"oauth2client\"", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "client_id", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "client_secret", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "redirect_uri: _", + "type_info": "TextArray" + }, + { + "ordinal": 4, + "name": "scope: _", + "type_info": "TextArray" + }, + { + "ordinal": 5, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "enabled", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "6b659b309306098a1f8b5b5592facba9cd54f93f5239fbc62a858bb91f502472" +} diff --git a/.sqlx/query-6dfb9442da967755230ab2b7c5baf8eec06d64af5886e840bea1b32d2be10ca0.json b/.sqlx/query-6dfb9442da967755230ab2b7c5baf8eec06d64af5886e840bea1b32d2be10ca0.json new file mode 100644 index 000000000..1a836e180 --- /dev/null +++ b/.sqlx/query-6dfb9442da967755230ab2b7c5baf8eec06d64af5886e840bea1b32d2be10ca0.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"device\" SET \"name\" = $2,\"wireguard_pubkey\" = $3,\"user_id\" = $4,\"created\" = $5 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Text", + "Text", + "Int8", + "Timestamp" + ] + }, + "nullable": [] + }, + "hash": "6dfb9442da967755230ab2b7c5baf8eec06d64af5886e840bea1b32d2be10ca0" +} diff --git a/.sqlx/query-6e1a03b05c4522a63ffa580d23489b4e6339580d2d28d228cd002e8590b359a3.json b/.sqlx/query-6e1a03b05c4522a63ffa580d23489b4e6339580d2d28d228cd002e8590b359a3.json new file mode 100644 index 000000000..84b71eaaf --- /dev/null +++ b/.sqlx/query-6e1a03b05c4522a63ffa580d23489b4e6339580d2d28d228cd002e8590b359a3.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO \"user\" (username, password_hash, last_name, first_name, email) VALUES ('admin', $1, 'Administrator', 'DefGuard', 'admin@defguard') ON CONFLICT DO NOTHING RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "6e1a03b05c4522a63ffa580d23489b4e6339580d2d28d228cd002e8590b359a3" +} diff --git a/.sqlx/query-70bd32dd667bbc7e0c6f7cdbb6234f22498c310685f84a2ea43659519adf86a5.json b/.sqlx/query-70bd32dd667bbc7e0c6f7cdbb6234f22498c310685f84a2ea43659519adf86a5.json new file mode 100644 index 000000000..1bf6c788c --- /dev/null +++ b/.sqlx/query-70bd32dd667bbc7e0c6f7cdbb6234f22498c310685f84a2ea43659519adf86a5.json @@ -0,0 +1,116 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", username, last_name, first_name, email, phone, ssh_key, pgp_key, pgp_cert_id, mfa_enabled, totp_enabled, mfa_method \"mfa_method: _\", ARRAY[]::TEXT[] AS \"recovery_codes!\", '*' AS password_hash, CAST(NULL AS BYTEA) totp_secret FROM \"user\"", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "username", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "last_name", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "first_name", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "email", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "phone", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "ssh_key", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "pgp_key", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "pgp_cert_id", + "type_info": "Text" + }, + { + "ordinal": 9, + "name": "mfa_enabled", + "type_info": "Bool" + }, + { + "ordinal": 10, + "name": "totp_enabled", + "type_info": "Bool" + }, + { + "ordinal": 11, + "name": "mfa_method: _", + "type_info": { + "Custom": { + "name": "mfa_method", + "kind": { + "Enum": [ + "none", + "one_time_password", + "webauthn", + "web3" + ] + } + } + } + }, + { + "ordinal": 12, + "name": "recovery_codes!", + "type_info": "TextArray" + }, + { + "ordinal": 13, + "name": "password_hash", + "type_info": "Text" + }, + { + "ordinal": 14, + "name": "totp_secret", + "type_info": "Bytea" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false, + false, + true, + true, + true, + true, + false, + false, + false, + null, + null, + null + ] + }, + "hash": "70bd32dd667bbc7e0c6f7cdbb6234f22498c310685f84a2ea43659519adf86a5" +} diff --git a/.sqlx/query-71465915aa72eed5d35fb82149a1bd32df7c4f5af1457dfa5406b3c82fb77231.json b/.sqlx/query-71465915aa72eed5d35fb82149a1bd32df7c4f5af1457dfa5406b3c82fb77231.json new file mode 100644 index 000000000..60581bbde --- /dev/null +++ b/.sqlx/query-71465915aa72eed5d35fb82149a1bd32df7c4f5af1457dfa5406b3c82fb77231.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM enrollment\n WHERE user_id = $1\n AND used_at IS NULL", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "71465915aa72eed5d35fb82149a1bd32df7c4f5af1457dfa5406b3c82fb77231" +} diff --git a/.sqlx/query-71e9c3921543a990ba6c6a8a0a9254757a1208ea9bfb2e0570626a39f8463467.json b/.sqlx/query-71e9c3921543a990ba6c6a8a0a9254757a1208ea9bfb2e0570626a39f8463467.json new file mode 100644 index 000000000..6095c37cf --- /dev/null +++ b/.sqlx/query-71e9c3921543a990ba6c6a8a0a9254757a1208ea9bfb2e0570626a39f8463467.json @@ -0,0 +1,58 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, user_id, admin_id, email, created_at, expires_at, used_at FROM enrollment WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Text" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "admin_id", + "type_info": "Int8" + }, + { + "ordinal": 3, + "name": "email", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 5, + "name": "expires_at", + "type_info": "Timestamp" + }, + { + "ordinal": 6, + "name": "used_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + true, + false, + false, + true + ] + }, + "hash": "71e9c3921543a990ba6c6a8a0a9254757a1208ea9bfb2e0570626a39f8463467" +} diff --git a/.sqlx/query-7244c9c8e437770235fa6cdb48e66719abf054cae9a35f833b8418d974aa45e1.json b/.sqlx/query-7244c9c8e437770235fa6cdb48e66719abf054cae9a35f833b8418d974aa45e1.json new file mode 100644 index 000000000..d4010f8f0 --- /dev/null +++ b/.sqlx/query-7244c9c8e437770235fa6cdb48e66719abf054cae9a35f833b8418d974aa45e1.json @@ -0,0 +1,70 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"user_id\",\"client_id\",\"code\",\"redirect_uri\",\"scope\",\"auth_time\",\"nonce\",\"code_challenge\" FROM \"authorization_code\" WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "client_id", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "code", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "redirect_uri", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "scope", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "auth_time", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "nonce", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "code_challenge", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + true + ] + }, + "hash": "7244c9c8e437770235fa6cdb48e66719abf054cae9a35f833b8418d974aa45e1" +} diff --git a/.sqlx/query-727ed093b693f0f48e83779f9ee58de725cbec807ae286ae5900f426f2492f9d.json b/.sqlx/query-727ed093b693f0f48e83779f9ee58de725cbec807ae286ae5900f426f2492f9d.json new file mode 100644 index 000000000..3bb8b2509 --- /dev/null +++ b/.sqlx/query-727ed093b693f0f48e83779f9ee58de725cbec807ae286ae5900f426f2492f9d.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE enrollment SET used_at = $1 WHERE id = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Timestamp", + "Text" + ] + }, + "nullable": [] + }, + "hash": "727ed093b693f0f48e83779f9ee58de725cbec807ae286ae5900f426f2492f9d" +} diff --git a/.sqlx/query-73ab0d514bbce0a69e1b22d9f5a2a58be7427882b368eef4d45529e9e85d885c.json b/.sqlx/query-73ab0d514bbce0a69e1b22d9f5a2a58be7427882b368eef4d45529e9e85d885c.json new file mode 100644 index 000000000..847391cec --- /dev/null +++ b/.sqlx/query-73ab0d514bbce0a69e1b22d9f5a2a58be7427882b368eef4d45529e9e85d885c.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"wireguard_network\" SET \"name\" = $2,\"address\" = $3,\"port\" = $4,\"pubkey\" = $5,\"prvkey\" = $6,\"endpoint\" = $7,\"dns\" = $8,\"allowed_ips\" = $9,\"connected_at\" = $10 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Text", + "Inet", + "Int4", + "Text", + "Text", + "Text", + "Text", + "InetArray", + "Timestamp" + ] + }, + "nullable": [] + }, + "hash": "73ab0d514bbce0a69e1b22d9f5a2a58be7427882b368eef4d45529e9e85d885c" +} diff --git a/.sqlx/query-77532f50fc8765ac97323cd3df60df8ae443769670c459426d738ac8d4fab6f4.json b/.sqlx/query-77532f50fc8765ac97323cd3df60df8ae443769670c459426d738ac8d4fab6f4.json new file mode 100644 index 000000000..77aa40a3a --- /dev/null +++ b/.sqlx/query-77532f50fc8765ac97323cd3df60df8ae443769670c459426d738ac8d4fab6f4.json @@ -0,0 +1,28 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id!\", name FROM webauthn WHERE user_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id!", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false + ] + }, + "hash": "77532f50fc8765ac97323cd3df60df8ae443769670c459426d738ac8d4fab6f4" +} diff --git a/.sqlx/query-77ca1d65a66cc81ad4855fed73539cdee5e50626f35bfef02fbd1378537c7f35.json b/.sqlx/query-77ca1d65a66cc81ad4855fed73539cdee5e50626f35bfef02fbd1378537c7f35.json new file mode 100644 index 000000000..67d845e68 --- /dev/null +++ b/.sqlx/query-77ca1d65a66cc81ad4855fed73539cdee5e50626f35bfef02fbd1378537c7f35.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO \"user\" (\"username\",\"password_hash\",\"last_name\",\"first_name\",\"email\",\"phone\",\"ssh_key\",\"pgp_key\",\"pgp_cert_id\",\"mfa_enabled\",\"totp_enabled\",\"totp_secret\",\"mfa_method\",\"recovery_codes\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14) RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Bool", + "Bool", + "Bytea", + { + "Custom": { + "name": "mfa_method", + "kind": { + "Enum": [ + "none", + "one_time_password", + "webauthn", + "web3" + ] + } + } + }, + "TextArray" + ] + }, + "nullable": [ + false + ] + }, + "hash": "77ca1d65a66cc81ad4855fed73539cdee5e50626f35bfef02fbd1378537c7f35" +} diff --git a/.sqlx/query-78766325753732e8873adc2b04bf73a3770887ba3b28c8568e71a7e4b83ab7a4.json b/.sqlx/query-78766325753732e8873adc2b04bf73a3770887ba3b28c8568e71a7e4b83ab7a4.json new file mode 100644 index 000000000..2a9f91497 --- /dev/null +++ b/.sqlx/query-78766325753732e8873adc2b04bf73a3770887ba3b28c8568e71a7e4b83ab7a4.json @@ -0,0 +1,68 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"user_id\",\"client_id\",\"code\",\"redirect_uri\",\"scope\",\"auth_time\",\"nonce\",\"code_challenge\" FROM \"authorization_code\"", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "client_id", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "code", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "redirect_uri", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "scope", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "auth_time", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "nonce", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "code_challenge", + "type_info": "Text" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + true + ] + }, + "hash": "78766325753732e8873adc2b04bf73a3770887ba3b28c8568e71a7e4b83ab7a4" +} diff --git a/.sqlx/query-7acf1bf5bd1597e01908c3a9e4d5540db061f77d69de853abe8e5f09149dfdf8.json b/.sqlx/query-7acf1bf5bd1597e01908c3a9e4d5540db061f77d69de853abe8e5f09149dfdf8.json new file mode 100644 index 000000000..55fb6f943 --- /dev/null +++ b/.sqlx/query-7acf1bf5bd1597e01908c3a9e4d5540db061f77d69de853abe8e5f09149dfdf8.json @@ -0,0 +1,35 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", user_id, oauth2client_id FROM oauth2authorizedapp WHERE user_id = $1 AND oauth2client_id = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "oauth2client_id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "7acf1bf5bd1597e01908c3a9e4d5540db061f77d69de853abe8e5f09149dfdf8" +} diff --git a/.sqlx/query-7b7092bd5fe377c8b28862721b05b3ca39aab9fb176fe970b9309d6371072e95.json b/.sqlx/query-7b7092bd5fe377c8b28862721b05b3ca39aab9fb176fe970b9309d6371072e95.json new file mode 100644 index 000000000..d53ea77b7 --- /dev/null +++ b/.sqlx/query-7b7092bd5fe377c8b28862721b05b3ca39aab9fb176fe970b9309d6371072e95.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM wireguard_peer_stats\n WHERE collected_at < $1\n AND (device_id, network, collected_at) NOT IN (\n SELECT device_id, network, MAX(collected_at)\n FROM wireguard_peer_stats\n GROUP BY device_id, network\n )", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Timestamp" + ] + }, + "nullable": [] + }, + "hash": "7b7092bd5fe377c8b28862721b05b3ca39aab9fb176fe970b9309d6371072e95" +} diff --git a/.sqlx/query-7d202e1f66e134a78fbd808e578e295afcdc4daf5f3be7cca0be247e47133794.json b/.sqlx/query-7d202e1f66e134a78fbd808e578e295afcdc4daf5f3be7cca0be247e47133794.json new file mode 100644 index 000000000..6376a5fac --- /dev/null +++ b/.sqlx/query-7d202e1f66e134a78fbd808e578e295afcdc4daf5f3be7cca0be247e47133794.json @@ -0,0 +1,30 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO \"wallet\" (\"user_id\",\"address\",\"name\",\"chain_id\",\"challenge_message\",\"challenge_signature\",\"creation_timestamp\",\"validation_timestamp\",\"use_for_mfa\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9) RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Int8", + "Text", + "Text", + "Int8", + "Text", + "Text", + "Timestamp", + "Timestamp", + "Bool" + ] + }, + "nullable": [ + false + ] + }, + "hash": "7d202e1f66e134a78fbd808e578e295afcdc4daf5f3be7cca0be247e47133794" +} diff --git a/.sqlx/query-7dd9cb419f9488ab2f1da11febdbac08a3a37eb93864104bd667f95615c87c41.json b/.sqlx/query-7dd9cb419f9488ab2f1da11febdbac08a3a37eb93864104bd667f95615c87c41.json new file mode 100644 index 000000000..4bb2c7039 --- /dev/null +++ b/.sqlx/query-7dd9cb419f9488ab2f1da11febdbac08a3a37eb93864104bd667f95615c87c41.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"user\" SET mfa_enabled = FALSE, mfa_method = 'none', totp_enabled = FALSE, totp_secret = NULL, recovery_codes = '{}' WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "7dd9cb419f9488ab2f1da11febdbac08a3a37eb93864104bd667f95615c87c41" +} diff --git a/.sqlx/query-7e7ec27c0fba3e139e4add5600befe98a10f89eced7daffcbdd1d963264112a1.json b/.sqlx/query-7e7ec27c0fba3e139e4add5600befe98a10f89eced7daffcbdd1d963264112a1.json new file mode 100644 index 000000000..72a89e6c2 --- /dev/null +++ b/.sqlx/query-7e7ec27c0fba3e139e4add5600befe98a10f89eced7daffcbdd1d963264112a1.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE session SET web3_challenge = $1 WHERE id = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [] + }, + "hash": "7e7ec27c0fba3e139e4add5600befe98a10f89eced7daffcbdd1d963264112a1" +} diff --git a/.sqlx/query-7fa302170061ee58a46152f581f13dbae26b7dd6ba59169cb5a18d443d039c14.json b/.sqlx/query-7fa302170061ee58a46152f581f13dbae26b7dd6ba59169cb5a18d443d039c14.json new file mode 100644 index 000000000..e11dbc205 --- /dev/null +++ b/.sqlx/query-7fa302170061ee58a46152f581f13dbae26b7dd6ba59169cb5a18d443d039c14.json @@ -0,0 +1,70 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"url\",\"description\",\"token\",\"enabled\",\"on_user_created\",\"on_user_deleted\",\"on_user_modified\",\"on_hwkey_provision\" FROM \"webhook\" WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "url", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "description", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "token", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "enabled", + "type_info": "Bool" + }, + { + "ordinal": 5, + "name": "on_user_created", + "type_info": "Bool" + }, + { + "ordinal": 6, + "name": "on_user_deleted", + "type_info": "Bool" + }, + { + "ordinal": 7, + "name": "on_user_modified", + "type_info": "Bool" + }, + { + "ordinal": 8, + "name": "on_hwkey_provision", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "7fa302170061ee58a46152f581f13dbae26b7dd6ba59169cb5a18d443d039c14" +} diff --git a/.sqlx/query-80c48375b2eea6f83038d443c0d2d180b1bb35cf84c19eb8ad6b6f8ed8b994e1.json b/.sqlx/query-80c48375b2eea6f83038d443c0d2d180b1bb35cf84c19eb8ad6b6f8ed8b994e1.json new file mode 100644 index 000000000..7f700e1f6 --- /dev/null +++ b/.sqlx/query-80c48375b2eea6f83038d443c0d2d180b1bb35cf84c19eb8ad6b6f8ed8b994e1.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM \"wireguard_network\" WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "80c48375b2eea6f83038d443c0d2d180b1bb35cf84c19eb8ad6b6f8ed8b994e1" +} diff --git a/.sqlx/query-84782f5c98572a6689dda1a98d71b749bf6beb025c1e493c1c4183f09aead891.json b/.sqlx/query-84782f5c98572a6689dda1a98d71b749bf6beb025c1e493c1c4183f09aead891.json new file mode 100644 index 000000000..caf7427e9 --- /dev/null +++ b/.sqlx/query-84782f5c98572a6689dda1a98d71b749bf6beb025c1e493c1c4183f09aead891.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT \"user\".username FROM \"user\" JOIN group_user ON \"user\".id = group_user.user_id WHERE group_user.group_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "username", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false + ] + }, + "hash": "84782f5c98572a6689dda1a98d71b749bf6beb025c1e493c1c4183f09aead891" +} diff --git a/.sqlx/query-86135388d6da625f594c74860ca50859589f8735396acffa968ce88cfe307ff5.json b/.sqlx/query-86135388d6da625f594c74860ca50859589f8735396acffa968ce88cfe307ff5.json new file mode 100644 index 000000000..a19212061 --- /dev/null +++ b/.sqlx/query-86135388d6da625f594c74860ca50859589f8735396acffa968ce88cfe307ff5.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"group\" SET \"name\" = $2 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Text" + ] + }, + "nullable": [] + }, + "hash": "86135388d6da625f594c74860ca50859589f8735396acffa968ce88cfe307ff5" +} diff --git a/.sqlx/query-865131a7e440c7e5f297cb8620487fe0cf641f481175adaf22982d1f983d362e.json b/.sqlx/query-865131a7e440c7e5f297cb8620487fe0cf641f481175adaf22982d1f983d362e.json new file mode 100644 index 000000000..53638cdc0 --- /dev/null +++ b/.sqlx/query-865131a7e440c7e5f297cb8620487fe0cf641f481175adaf22982d1f983d362e.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "\n WITH s AS (\n SELECT DISTINCT ON (device_id) *\n FROM wireguard_peer_stats\n ORDER BY device_id, latest_handshake DESC\n )\n SELECT\n d.id \"id?\", d.name, d.wireguard_pubkey, d.user_id, d.created\n FROM device d\n JOIN s ON d.id = s.device_id\n WHERE s.latest_handshake >= $1 AND s.network = $2\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "wireguard_pubkey", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 4, + "name": "created", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Timestamp", + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + false + ] + }, + "hash": "865131a7e440c7e5f297cb8620487fe0cf641f481175adaf22982d1f983d362e" +} diff --git a/.sqlx/query-872e70c5006c45dc3502642444a4d00e5f8a5c23062392e1a60613936acfa07b.json b/.sqlx/query-872e70c5006c45dc3502642444a4d00e5f8a5c23062392e1a60613936acfa07b.json new file mode 100644 index 000000000..cf444f7a9 --- /dev/null +++ b/.sqlx/query-872e70c5006c45dc3502642444a4d00e5f8a5c23062392e1a60613936acfa07b.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM wireguard_network_allowed_group WHERE network_id=$1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "872e70c5006c45dc3502642444a4d00e5f8a5c23062392e1a60613936acfa07b" +} diff --git a/.sqlx/query-8880011a898ca2b97b0cfdbf027509d4855f46e4871caaa1fc95f2f612efcc4b.json b/.sqlx/query-8880011a898ca2b97b0cfdbf027509d4855f46e4871caaa1fc95f2f612efcc4b.json new file mode 100644 index 000000000..bb241b225 --- /dev/null +++ b/.sqlx/query-8880011a898ca2b97b0cfdbf027509d4855f46e4871caaa1fc95f2f612efcc4b.json @@ -0,0 +1,34 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT device_id, wireguard_network_id, wireguard_ip as \"wireguard_ip: IpAddr\"\n FROM wireguard_network_device WHERE device_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "device_id", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "wireguard_network_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "wireguard_ip: IpAddr", + "type_info": "Inet" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "8880011a898ca2b97b0cfdbf027509d4855f46e4871caaa1fc95f2f612efcc4b" +} diff --git a/.sqlx/query-89ecf876c5ba576acc57f53e273f1e1799ad9cf619a1d31e79de116308f85c30.json b/.sqlx/query-89ecf876c5ba576acc57f53e273f1e1799ad9cf619a1d31e79de116308f85c30.json new file mode 100644 index 000000000..9d877d6aa --- /dev/null +++ b/.sqlx/query-89ecf876c5ba576acc57f53e273f1e1799ad9cf619a1d31e79de116308f85c30.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM oauth2token WHERE access_token = $1 AND refresh_token = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [] + }, + "hash": "89ecf876c5ba576acc57f53e273f1e1799ad9cf619a1d31e79de116308f85c30" +} diff --git a/.sqlx/query-8ef0599222964d57b9d35e56a3d2d78e6ddb644d9de8ffe8445e7497a1f71477.json b/.sqlx/query-8ef0599222964d57b9d35e56a3d2d78e6ddb644d9de8ffe8445e7497a1f71477.json new file mode 100644 index 000000000..ff2b25625 --- /dev/null +++ b/.sqlx/query-8ef0599222964d57b9d35e56a3d2d78e6ddb644d9de8ffe8445e7497a1f71477.json @@ -0,0 +1,16 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"oauth2authorizedapp\" SET \"user_id\" = $2,\"oauth2client_id\" = $3 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Int8", + "Int8" + ] + }, + "nullable": [] + }, + "hash": "8ef0599222964d57b9d35e56a3d2d78e6ddb644d9de8ffe8445e7497a1f71477" +} diff --git a/.sqlx/query-904ae3993de08b02a547db8d656a23d4a8e7e2d4bd556b1e2f60088b9f6fc679.json b/.sqlx/query-904ae3993de08b02a547db8d656a23d4a8e7e2d4bd556b1e2f60088b9f6fc679.json new file mode 100644 index 000000000..6f2be25b6 --- /dev/null +++ b/.sqlx/query-904ae3993de08b02a547db8d656a23d4a8e7e2d4bd556b1e2f60088b9f6fc679.json @@ -0,0 +1,59 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", client_id, client_secret, redirect_uri, scope, name, enabled FROM oauth2client WHERE client_id = $1 AND client_secret = $2 AND enabled", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "client_id", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "client_secret", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "redirect_uri", + "type_info": "TextArray" + }, + { + "ordinal": 4, + "name": "scope", + "type_info": "TextArray" + }, + { + "ordinal": 5, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "enabled", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "904ae3993de08b02a547db8d656a23d4a8e7e2d4bd556b1e2f60088b9f6fc679" +} diff --git a/.sqlx/query-90d962160e9ecd0708e6a722943c1530fcaadeabc516f81a0375146c94787dd3.json b/.sqlx/query-90d962160e9ecd0708e6a722943c1530fcaadeabc516f81a0375146c94787dd3.json new file mode 100644 index 000000000..a84cd4f85 --- /dev/null +++ b/.sqlx/query-90d962160e9ecd0708e6a722943c1530fcaadeabc516f81a0375146c94787dd3.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO group_user (group_id, user_id) VALUES ($1, $2) ON CONFLICT DO NOTHING", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + }, + "nullable": [] + }, + "hash": "90d962160e9ecd0708e6a722943c1530fcaadeabc516f81a0375146c94787dd3" +} diff --git a/.sqlx/query-90eb99cdd712a78d180babe984f73364b510a1a46236ad4b5f80f4d2666b1567.json b/.sqlx/query-90eb99cdd712a78d180babe984f73364b510a1a46236ad4b5f80f4d2666b1567.json new file mode 100644 index 000000000..59bdba31b --- /dev/null +++ b/.sqlx/query-90eb99cdd712a78d180babe984f73364b510a1a46236ad4b5f80f4d2666b1567.json @@ -0,0 +1,34 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"user_id\",\"oauth2client_id\" FROM \"oauth2authorizedapp\" WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "oauth2client_id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "90eb99cdd712a78d180babe984f73364b510a1a46236ad4b5f80f4d2666b1567" +} diff --git a/.sqlx/query-9213729a9a1ce371ef77898f5792d914a67400cb4cce9a8bf86227ffe7d42eda.json b/.sqlx/query-9213729a9a1ce371ef77898f5792d914a67400cb4cce9a8bf86227ffe7d42eda.json new file mode 100644 index 000000000..285e7121c --- /dev/null +++ b/.sqlx/query-9213729a9a1ce371ef77898f5792d914a67400cb4cce9a8bf86227ffe7d42eda.json @@ -0,0 +1,25 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO \"device\" (\"name\",\"wireguard_pubkey\",\"user_id\",\"created\") VALUES ($1,$2,$3,$4) RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Text", + "Text", + "Int8", + "Timestamp" + ] + }, + "nullable": [ + false + ] + }, + "hash": "9213729a9a1ce371ef77898f5792d914a67400cb4cce9a8bf86227ffe7d42eda" +} diff --git a/.sqlx/query-929535564469ee1701f83a1489301d0d652d5452369a2dce933f032cdb7092e2.json b/.sqlx/query-929535564469ee1701f83a1489301d0d652d5452369a2dce933f032cdb7092e2.json new file mode 100644 index 000000000..8a1e90ee9 --- /dev/null +++ b/.sqlx/query-929535564469ee1701f83a1489301d0d652d5452369a2dce933f032cdb7092e2.json @@ -0,0 +1,46 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT device.id \"id?\", name, wireguard_pubkey, user_id, created\n FROM device WHERE user_id = $1\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "wireguard_pubkey", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 4, + "name": "created", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + false + ] + }, + "hash": "929535564469ee1701f83a1489301d0d652d5452369a2dce933f032cdb7092e2" +} diff --git a/.sqlx/query-92b38a3eec51c346623be6fc2ba18f8ca137d7c810a7cc6591b54bc686099254.json b/.sqlx/query-92b38a3eec51c346623be6fc2ba18f8ca137d7c810a7cc6591b54bc686099254.json new file mode 100644 index 000000000..d2878cfd0 --- /dev/null +++ b/.sqlx/query-92b38a3eec51c346623be6fc2ba18f8ca137d7c810a7cc6591b54bc686099254.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM \"oauth2authorizedapp\" WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "92b38a3eec51c346623be6fc2ba18f8ca137d7c810a7cc6591b54bc686099254" +} diff --git a/.sqlx/query-92e3de4ba50a6705c64523dd177351c5fa887d7116dea6d5f194369339aace56.json b/.sqlx/query-92e3de4ba50a6705c64523dd177351c5fa887d7116dea6d5f194369339aace56.json new file mode 100644 index 000000000..dfb33344c --- /dev/null +++ b/.sqlx/query-92e3de4ba50a6705c64523dd177351c5fa887d7116dea6d5f194369339aace56.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"user\" SET totp_enabled = TRUE WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "92e3de4ba50a6705c64523dd177351c5fa887d7116dea6d5f194369339aace56" +} diff --git a/.sqlx/query-961bd7d2e2cc98e2b968ccb22e065f5c30566de00d9b96d8a70e3f08a31c9dc2.json b/.sqlx/query-961bd7d2e2cc98e2b968ccb22e065f5c30566de00d9b96d8a70e3f08a31c9dc2.json new file mode 100644 index 000000000..3d581539c --- /dev/null +++ b/.sqlx/query-961bd7d2e2cc98e2b968ccb22e065f5c30566de00d9b96d8a70e3f08a31c9dc2.json @@ -0,0 +1,24 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT\n latest_handshake \"latest_handshake: NaiveDateTime\"\n FROM wireguard_peer_stats_view\n WHERE device_id = $1\n AND latest_handshake IS NOT NULL\n AND (latest_handshake_diff > $2 * interval '1 minute' OR latest_handshake_diff IS NULL)\n AND network = $3\n ORDER BY collected_at DESC\n LIMIT 1\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "latest_handshake: NaiveDateTime", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Int8", + "Float8", + "Int8" + ] + }, + "nullable": [ + true + ] + }, + "hash": "961bd7d2e2cc98e2b968ccb22e065f5c30566de00d9b96d8a70e3f08a31c9dc2" +} diff --git a/.sqlx/query-9838df2efdce6632793cb64bf4a118ceb4a68dad324366ed65813b05cc5ba63c.json b/.sqlx/query-9838df2efdce6632793cb64bf4a118ceb4a68dad324366ed65813b05cc5ba63c.json new file mode 100644 index 000000000..919eec6c3 --- /dev/null +++ b/.sqlx/query-9838df2efdce6632793cb64bf4a118ceb4a68dad324366ed65813b05cc5ba63c.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO wireguard_network_allowed_group (network_id, group_id)\n SELECT $1, g.id\n FROM \"group\" g\n WHERE g.name = $2\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Text" + ] + }, + "nullable": [] + }, + "hash": "9838df2efdce6632793cb64bf4a118ceb4a68dad324366ed65813b05cc5ba63c" +} diff --git a/.sqlx/query-9b443a223ba94d9a696a0d8ebe188e50e49f404f8b0057a3015c067c5f57c1bf.json b/.sqlx/query-9b443a223ba94d9a696a0d8ebe188e50e49f404f8b0057a3015c067c5f57c1bf.json new file mode 100644 index 000000000..e45b1c905 --- /dev/null +++ b/.sqlx/query-9b443a223ba94d9a696a0d8ebe188e50e49f404f8b0057a3015c067c5f57c1bf.json @@ -0,0 +1,76 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"user_id\",\"address\",\"name\",\"chain_id\",\"challenge_message\",\"challenge_signature\",\"creation_timestamp\",\"validation_timestamp\",\"use_for_mfa\" FROM \"wallet\" WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "address", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "chain_id", + "type_info": "Int8" + }, + { + "ordinal": 5, + "name": "challenge_message", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "challenge_signature", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "creation_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "validation_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 9, + "name": "use_for_mfa", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + true, + false, + true, + false + ] + }, + "hash": "9b443a223ba94d9a696a0d8ebe188e50e49f404f8b0057a3015c067c5f57c1bf" +} diff --git a/.sqlx/query-9bb9a07281e19a57b10ddfeba1d1eec91021f371d0cf40d6dbdb82e38f28aa04.json b/.sqlx/query-9bb9a07281e19a57b10ddfeba1d1eec91021f371d0cf40d6dbdb82e38f28aa04.json new file mode 100644 index 000000000..884164b10 --- /dev/null +++ b/.sqlx/query-9bb9a07281e19a57b10ddfeba1d1eec91021f371d0cf40d6dbdb82e38f28aa04.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM \"webauthn\" WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "9bb9a07281e19a57b10ddfeba1d1eec91021f371d0cf40d6dbdb82e38f28aa04" +} diff --git a/.sqlx/query-9e3c1c1f52bc1a576012c57c7472f9f7601e1128b15fc0ecc7676cd5aa01c88c.json b/.sqlx/query-9e3c1c1f52bc1a576012c57c7472f9f7601e1128b15fc0ecc7676cd5aa01c88c.json new file mode 100644 index 000000000..82874b3d7 --- /dev/null +++ b/.sqlx/query-9e3c1c1f52bc1a576012c57c7472f9f7601e1128b15fc0ecc7676cd5aa01c88c.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT device.id \"id?\", name, wireguard_pubkey, user_id, created FROM device JOIN \"user\" ON device.user_id = \"user\".id WHERE device.id = $1 AND \"user\".id = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "wireguard_pubkey", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 4, + "name": "created", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + false + ] + }, + "hash": "9e3c1c1f52bc1a576012c57c7472f9f7601e1128b15fc0ecc7676cd5aa01c88c" +} diff --git a/.sqlx/query-9ea6f3e288d0a23c2b020034c80e60c0c73bcc37705cf408ea14c65ec3d1dab8.json b/.sqlx/query-9ea6f3e288d0a23c2b020034c80e60c0c73bcc37705cf408ea14c65ec3d1dab8.json new file mode 100644 index 000000000..583b36b23 --- /dev/null +++ b/.sqlx/query-9ea6f3e288d0a23c2b020034c80e60c0c73bcc37705cf408ea14c65ec3d1dab8.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM \"wireguard_peer_stats\" WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "9ea6f3e288d0a23c2b020034c80e60c0c73bcc37705cf408ea14c65ec3d1dab8" +} diff --git a/.sqlx/query-9f7a75ac4a3c5b767746a836e409e3e3f02a029cf9456bed8c5291f92f1d5f8a.json b/.sqlx/query-9f7a75ac4a3c5b767746a836e409e3e3f02a029cf9456bed8c5291f92f1d5f8a.json new file mode 100644 index 000000000..2c5155873 --- /dev/null +++ b/.sqlx/query-9f7a75ac4a3c5b767746a836e409e3e3f02a029cf9456bed8c5291f92f1d5f8a.json @@ -0,0 +1,77 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", user_id, address, name, chain_id, challenge_message, challenge_signature, creation_timestamp, validation_timestamp, use_for_mfa FROM wallet WHERE user_id = $1 AND address = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "address", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "chain_id", + "type_info": "Int8" + }, + { + "ordinal": 5, + "name": "challenge_message", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "challenge_signature", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "creation_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "validation_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 9, + "name": "use_for_mfa", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Int8", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + true, + false, + true, + false + ] + }, + "hash": "9f7a75ac4a3c5b767746a836e409e3e3f02a029cf9456bed8c5291f92f1d5f8a" +} diff --git a/.sqlx/query-a170af41279bef8b8333d2e313c4ea300bb7fef7d5f742e362e75abbf4350f06.json b/.sqlx/query-a170af41279bef8b8333d2e313c4ea300bb7fef7d5f742e362e75abbf4350f06.json new file mode 100644 index 000000000..b17022011 --- /dev/null +++ b/.sqlx/query-a170af41279bef8b8333d2e313c4ea300bb7fef7d5f742e362e75abbf4350f06.json @@ -0,0 +1,24 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO \"webauthn\" (\"user_id\",\"name\",\"passkey\") VALUES ($1,$2,$3) RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Int8", + "Text", + "Bytea" + ] + }, + "nullable": [ + false + ] + }, + "hash": "a170af41279bef8b8333d2e313c4ea300bb7fef7d5f742e362e75abbf4350f06" +} diff --git a/.sqlx/query-a28203258ea19229b180817c5419c516dd15457db05f436c96ef5287f94daf11.json b/.sqlx/query-a28203258ea19229b180817c5419c516dd15457db05f436c96ef5287f94daf11.json new file mode 100644 index 000000000..58733f34b --- /dev/null +++ b/.sqlx/query-a28203258ea19229b180817c5419c516dd15457db05f436c96ef5287f94daf11.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE oauth2token SET access_token = $2, refresh_token = $3, expires_in = $4 WHERE access_token = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Text", + "Text", + "Int8" + ] + }, + "nullable": [] + }, + "hash": "a28203258ea19229b180817c5419c516dd15457db05f436c96ef5287f94daf11" +} diff --git a/.sqlx/query-a33889f665b0e9f3ef23f86af0bbbc1f7231be9e4b934e0f2aab9d5f5fad3c75.json b/.sqlx/query-a33889f665b0e9f3ef23f86af0bbbc1f7231be9e4b934e0f2aab9d5f5fad3c75.json new file mode 100644 index 000000000..38da7dce1 --- /dev/null +++ b/.sqlx/query-a33889f665b0e9f3ef23f86af0bbbc1f7231be9e4b934e0f2aab9d5f5fad3c75.json @@ -0,0 +1,52 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO \"settings\" (\"openid_enabled\",\"ldap_enabled\",\"wireguard_enabled\",\"webhooks_enabled\",\"worker_enabled\",\"challenge_template\",\"instance_name\",\"main_logo_url\",\"nav_logo_url\",\"smtp_server\",\"smtp_port\",\"smtp_encryption\",\"smtp_user\",\"smtp_password\",\"smtp_sender\",\"enrollment_vpn_step_optional\",\"enrollment_welcome_message\",\"enrollment_welcome_email\",\"enrollment_welcome_email_subject\",\"enrollment_use_welcome_message_as_email\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20) RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Bool", + "Bool", + "Bool", + "Bool", + "Bool", + "Text", + "Text", + "Text", + "Text", + "Text", + "Int4", + { + "Custom": { + "name": "smtp_encryption", + "kind": { + "Enum": [ + "none", + "starttls", + "implicittls" + ] + } + } + }, + "Text", + "Text", + "Text", + "Bool", + "Text", + "Text", + "Text", + "Bool" + ] + }, + "nullable": [ + false + ] + }, + "hash": "a33889f665b0e9f3ef23f86af0bbbc1f7231be9e4b934e0f2aab9d5f5fad3c75" +} diff --git a/.sqlx/query-a4941d4bcf5483036924c13b2293034b9ebc57993c63a2dedb347648c0dfc6a9.json b/.sqlx/query-a4941d4bcf5483036924c13b2293034b9ebc57993c63a2dedb347648c0dfc6a9.json new file mode 100644 index 000000000..9cf3342fd --- /dev/null +++ b/.sqlx/query-a4941d4bcf5483036924c13b2293034b9ebc57993c63a2dedb347648c0dfc6a9.json @@ -0,0 +1,29 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO \"wireguard_peer_stats\" (\"device_id\",\"collected_at\",\"network\",\"endpoint\",\"upload\",\"download\",\"latest_handshake\",\"allowed_ips\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Int8", + "Timestamp", + "Int8", + "Text", + "Int8", + "Int8", + "Timestamp", + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "a4941d4bcf5483036924c13b2293034b9ebc57993c63a2dedb347648c0dfc6a9" +} diff --git a/.sqlx/query-a8f720a41ab4509570490d444180ae58f20596491a3ac2be3ab00a8a19c78c58.json b/.sqlx/query-a8f720a41ab4509570490d444180ae58f20596491a3ac2be3ab00a8a19c78c58.json new file mode 100644 index 000000000..0c3bccda4 --- /dev/null +++ b/.sqlx/query-a8f720a41ab4509570490d444180ae58f20596491a3ac2be3ab00a8a19c78c58.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO session (id, user_id, state, created, expires, webauthn_challenge, web3_challenge) VALUES ($1, $2, $3, $4, $5, $6, $7)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Int8", + "Int2", + "Timestamp", + "Timestamp", + "Bytea", + "Text" + ] + }, + "nullable": [] + }, + "hash": "a8f720a41ab4509570490d444180ae58f20596491a3ac2be3ab00a8a19c78c58" +} diff --git a/.sqlx/query-aa73869e5e09831dbaf55cd737cb44dc7826a63b0c053338cdaabd346c321585.json b/.sqlx/query-aa73869e5e09831dbaf55cd737cb44dc7826a63b0c053338cdaabd346c321585.json new file mode 100644 index 000000000..f98a23fd3 --- /dev/null +++ b/.sqlx/query-aa73869e5e09831dbaf55cd737cb44dc7826a63b0c053338cdaabd346c321585.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"authorization_code\" SET \"user_id\" = $2,\"client_id\" = $3,\"code\" = $4,\"redirect_uri\" = $5,\"scope\" = $6,\"auth_time\" = $7,\"nonce\" = $8,\"code_challenge\" = $9 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Int8", + "Text", + "Text", + "Text", + "Text", + "Int8", + "Text", + "Text" + ] + }, + "nullable": [] + }, + "hash": "aa73869e5e09831dbaf55cd737cb44dc7826a63b0c053338cdaabd346c321585" +} diff --git a/.sqlx/query-aa8bbafc145ad47aaac28e9863c19b1db6a855e917cdaf619a9461ad89b96917.json b/.sqlx/query-aa8bbafc145ad47aaac28e9863c19b1db6a855e917cdaf619a9461ad89b96917.json new file mode 100644 index 000000000..96f0ec290 --- /dev/null +++ b/.sqlx/query-aa8bbafc145ad47aaac28e9863c19b1db6a855e917cdaf619a9461ad89b96917.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "\n DELETE FROM wireguard_network_device\n WHERE device_id = $1 AND wireguard_network_id = $2\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + }, + "nullable": [] + }, + "hash": "aa8bbafc145ad47aaac28e9863c19b1db6a855e917cdaf619a9461ad89b96917" +} diff --git a/.sqlx/query-ad0934b3563f5ab5ca351d0db6a2677301edffa66042632d02c9b77dd11a1e83.json b/.sqlx/query-ad0934b3563f5ab5ca351d0db6a2677301edffa66042632d02c9b77dd11a1e83.json new file mode 100644 index 000000000..b5c9df1d1 --- /dev/null +++ b/.sqlx/query-ad0934b3563f5ab5ca351d0db6a2677301edffa66042632d02c9b77dd11a1e83.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT name\n FROM wireguard_network_allowed_group wag\n JOIN \"group\" g ON wag.group_id = g.id\n WHERE wag.network_id = $1\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "name", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false + ] + }, + "hash": "ad0934b3563f5ab5ca351d0db6a2677301edffa66042632d02c9b77dd11a1e83" +} diff --git a/.sqlx/query-b10e43d2235e858fb0982fcd320c9d0548cde5e7a49e8971f21c31083f0d006c.json b/.sqlx/query-b10e43d2235e858fb0982fcd320c9d0548cde5e7a49e8971f21c31083f0d006c.json new file mode 100644 index 000000000..8e97c0059 --- /dev/null +++ b/.sqlx/query-b10e43d2235e858fb0982fcd320c9d0548cde5e7a49e8971f21c31083f0d006c.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"webauthn\" SET \"user_id\" = $2,\"name\" = $3,\"passkey\" = $4 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Int8", + "Text", + "Bytea" + ] + }, + "nullable": [] + }, + "hash": "b10e43d2235e858fb0982fcd320c9d0548cde5e7a49e8971f21c31083f0d006c" +} diff --git a/.sqlx/query-b2410cc60e0e1dcacd03050d2a3ac417ca5822beebe08be3f23cc0e217e27740.json b/.sqlx/query-b2410cc60e0e1dcacd03050d2a3ac417ca5822beebe08be3f23cc0e217e27740.json new file mode 100644 index 000000000..bb5e7f6ad --- /dev/null +++ b/.sqlx/query-b2410cc60e0e1dcacd03050d2a3ac417ca5822beebe08be3f23cc0e217e27740.json @@ -0,0 +1,28 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"name\" FROM \"group\" WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false + ] + }, + "hash": "b2410cc60e0e1dcacd03050d2a3ac417ca5822beebe08be3f23cc0e217e27740" +} diff --git a/.sqlx/query-b33fa60772e858280c021b3774d01273453d13af4321cae2d244748ca4254b29.json b/.sqlx/query-b33fa60772e858280c021b3774d01273453d13af4321cae2d244748ca4254b29.json new file mode 100644 index 000000000..89e360d76 --- /dev/null +++ b/.sqlx/query-b33fa60772e858280c021b3774d01273453d13af4321cae2d244748ca4254b29.json @@ -0,0 +1,28 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", name FROM \"group\" WHERE name = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false + ] + }, + "hash": "b33fa60772e858280c021b3774d01273453d13af4321cae2d244748ca4254b29" +} diff --git a/.sqlx/query-b362d79ac6b116c97f7489cbfc5801c7f94ba91677af351ef235755bf804e1f7.json b/.sqlx/query-b362d79ac6b116c97f7489cbfc5801c7f94ba91677af351ef235755bf804e1f7.json new file mode 100644 index 000000000..7634f9654 --- /dev/null +++ b/.sqlx/query-b362d79ac6b116c97f7489cbfc5801c7f94ba91677af351ef235755bf804e1f7.json @@ -0,0 +1,76 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"name\",\"address\" \"address: _\",\"port\",\"pubkey\",\"prvkey\",\"endpoint\",\"dns\",\"allowed_ips\" \"allowed_ips: _\",\"connected_at\" FROM \"wireguard_network\" WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "address: _", + "type_info": "Inet" + }, + { + "ordinal": 3, + "name": "port", + "type_info": "Int4" + }, + { + "ordinal": 4, + "name": "pubkey", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "prvkey", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "endpoint", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "dns", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "allowed_ips: _", + "type_info": "InetArray" + }, + { + "ordinal": 9, + "name": "connected_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + false, + true + ] + }, + "hash": "b362d79ac6b116c97f7489cbfc5801c7f94ba91677af351ef235755bf804e1f7" +} diff --git a/.sqlx/query-b57f8562cff6e1d13d6ffa0e7a382fda523559100424c771e25757994a1fca13.json b/.sqlx/query-b57f8562cff6e1d13d6ffa0e7a382fda523559100424c771e25757994a1fca13.json new file mode 100644 index 000000000..0bed0a2e5 --- /dev/null +++ b/.sqlx/query-b57f8562cff6e1d13d6ffa0e7a382fda523559100424c771e25757994a1fca13.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE session SET state = $1 WHERE id = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int2", + "Text" + ] + }, + "nullable": [] + }, + "hash": "b57f8562cff6e1d13d6ffa0e7a382fda523559100424c771e25757994a1fca13" +} diff --git a/.sqlx/query-b8656ec4ee5b1980223294cad758ea2da20b6cfc25f51a25023d69a4595a4fb9.json b/.sqlx/query-b8656ec4ee5b1980223294cad758ea2da20b6cfc25f51a25023d69a4595a4fb9.json new file mode 100644 index 000000000..c4352f536 --- /dev/null +++ b/.sqlx/query-b8656ec4ee5b1980223294cad758ea2da20b6cfc25f51a25023d69a4595a4fb9.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"user\" SET totp_secret = $1 WHERE id = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Bytea", + "Int8" + ] + }, + "nullable": [] + }, + "hash": "b8656ec4ee5b1980223294cad758ea2da20b6cfc25f51a25023d69a4595a4fb9" +} diff --git a/.sqlx/query-b9673d880db788cd95cbcdfd44ffad014cde4eec69233e7ae79ab35e620a5302.json b/.sqlx/query-b9673d880db788cd95cbcdfd44ffad014cde4eec69233e7ae79ab35e620a5302.json new file mode 100644 index 000000000..2cf5fb36f --- /dev/null +++ b/.sqlx/query-b9673d880db788cd95cbcdfd44ffad014cde4eec69233e7ae79ab35e620a5302.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"oauth2client\" SET \"client_id\" = $2,\"client_secret\" = $3,\"redirect_uri\" = $4,\"scope\" = $5,\"name\" = $6,\"enabled\" = $7 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Text", + "Text", + "TextArray", + "TextArray", + "Text", + "Bool" + ] + }, + "nullable": [] + }, + "hash": "b9673d880db788cd95cbcdfd44ffad014cde4eec69233e7ae79ab35e620a5302" +} diff --git a/.sqlx/query-bd9520722a8392da2bd841e5071400e1658e8d26a73542fac8d8a214009888b7.json b/.sqlx/query-bd9520722a8392da2bd841e5071400e1658e8d26a73542fac8d8a214009888b7.json new file mode 100644 index 000000000..6a3bbf051 --- /dev/null +++ b/.sqlx/query-bd9520722a8392da2bd841e5071400e1658e8d26a73542fac8d8a214009888b7.json @@ -0,0 +1,58 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, user_id, state \"state: SessionState\", created, expires, webauthn_challenge, web3_challenge FROM session WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Text" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "state: SessionState", + "type_info": "Int2" + }, + { + "ordinal": 3, + "name": "created", + "type_info": "Timestamp" + }, + { + "ordinal": 4, + "name": "expires", + "type_info": "Timestamp" + }, + { + "ordinal": 5, + "name": "webauthn_challenge", + "type_info": "Bytea" + }, + { + "ordinal": 6, + "name": "web3_challenge", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + true, + true + ] + }, + "hash": "bd9520722a8392da2bd841e5071400e1658e8d26a73542fac8d8a214009888b7" +} diff --git a/.sqlx/query-bde600b9d9448806df37628d305a09b93f4d1217dfb1141a32be11673d76dd1f.json b/.sqlx/query-bde600b9d9448806df37628d305a09b93f4d1217dfb1141a32be11673d76dd1f.json new file mode 100644 index 000000000..840991111 --- /dev/null +++ b/.sqlx/query-bde600b9d9448806df37628d305a09b93f4d1217dfb1141a32be11673d76dd1f.json @@ -0,0 +1,76 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id as \"id?\", name, address, port, pubkey, prvkey, endpoint, dns, allowed_ips, connected_at FROM wireguard_network WHERE name = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "address", + "type_info": "Inet" + }, + { + "ordinal": 3, + "name": "port", + "type_info": "Int4" + }, + { + "ordinal": 4, + "name": "pubkey", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "prvkey", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "endpoint", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "dns", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "allowed_ips", + "type_info": "InetArray" + }, + { + "ordinal": 9, + "name": "connected_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + false, + true + ] + }, + "hash": "bde600b9d9448806df37628d305a09b93f4d1217dfb1141a32be11673d76dd1f" +} diff --git a/.sqlx/query-c0e30b2a0b711ea77d88a6dc9c92d0faa187d2bb59bedd0c66d1eae866922901.json b/.sqlx/query-c0e30b2a0b711ea77d88a6dc9c92d0faa187d2bb59bedd0c66d1eae866922901.json new file mode 100644 index 000000000..768f9b53d --- /dev/null +++ b/.sqlx/query-c0e30b2a0b711ea77d88a6dc9c92d0faa187d2bb59bedd0c66d1eae866922901.json @@ -0,0 +1,59 @@ +{ + "db_name": "PostgreSQL", + "query": "\n WITH stats AS (\n SELECT DISTINCT ON (network) network, endpoint, latest_handshake\n FROM wireguard_peer_stats\n WHERE device_id = $2\n ORDER BY network, collected_at DESC\n )\n SELECT\n n.id as network_id, n.name as network_name, n.endpoint as gateway_endpoint,\n wnd.wireguard_ip as \"device_wireguard_ip: IpAddr\", stats.endpoint as device_endpoint,\n stats.latest_handshake as \"latest_handshake?\",\n COALESCE (((NOW() - stats.latest_handshake) < $1 * interval '1 minute'), false) as \"is_active!\"\n FROM wireguard_network_device wnd\n JOIN wireguard_network n ON n.id = wnd.wireguard_network_id\n LEFT JOIN stats on n.id = stats.network\n WHERE wnd.device_id = $2\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "network_id", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "network_name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "gateway_endpoint", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "device_wireguard_ip: IpAddr", + "type_info": "Inet" + }, + { + "ordinal": 4, + "name": "device_endpoint", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "latest_handshake?", + "type_info": "Timestamp" + }, + { + "ordinal": 6, + "name": "is_active!", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Float8", + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + true, + false, + null + ] + }, + "hash": "c0e30b2a0b711ea77d88a6dc9c92d0faa187d2bb59bedd0c66d1eae866922901" +} diff --git a/.sqlx/query-c4f0393fc5b1bb1603f1da3a6f2cb7e6253a0cb8fffd710e5a4d03cf9a4eef16.json b/.sqlx/query-c4f0393fc5b1bb1603f1da3a6f2cb7e6253a0cb8fffd710e5a4d03cf9a4eef16.json new file mode 100644 index 000000000..2d73e7c9a --- /dev/null +++ b/.sqlx/query-c4f0393fc5b1bb1603f1da3a6f2cb7e6253a0cb8fffd710e5a4d03cf9a4eef16.json @@ -0,0 +1,38 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"user_id\",\"name\",\"passkey\" FROM \"webauthn\"", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "passkey", + "type_info": "Bytea" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "c4f0393fc5b1bb1603f1da3a6f2cb7e6253a0cb8fffd710e5a4d03cf9a4eef16" +} diff --git a/.sqlx/query-c64f247f81e332689e35c224656847b246deb6f92a5790a4fdd0d5733defbb57.json b/.sqlx/query-c64f247f81e332689e35c224656847b246deb6f92a5790a4fdd0d5733defbb57.json new file mode 100644 index 000000000..4a03705f0 --- /dev/null +++ b/.sqlx/query-c64f247f81e332689e35c224656847b246deb6f92a5790a4fdd0d5733defbb57.json @@ -0,0 +1,46 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"name\",\"wireguard_pubkey\",\"user_id\",\"created\" FROM \"device\" WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "wireguard_pubkey", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 4, + "name": "created", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + false + ] + }, + "hash": "c64f247f81e332689e35c224656847b246deb6f92a5790a4fdd0d5733defbb57" +} diff --git a/.sqlx/query-c863944a13f1b8c3eb0d5a62bff40f453da7ac74551c2e62275931a1e8a7ec9e.json b/.sqlx/query-c863944a13f1b8c3eb0d5a62bff40f453da7ac74551c2e62275931a1e8a7ec9e.json new file mode 100644 index 000000000..4b0c00279 --- /dev/null +++ b/.sqlx/query-c863944a13f1b8c3eb0d5a62bff40f453da7ac74551c2e62275931a1e8a7ec9e.json @@ -0,0 +1,118 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", username, password_hash, last_name, first_name, email, phone, ssh_key, pgp_key, pgp_cert_id, mfa_enabled, totp_enabled, totp_secret, mfa_method \"mfa_method: _\", recovery_codes FROM \"user\" WHERE username = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "username", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "password_hash", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "last_name", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "first_name", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "email", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "phone", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "ssh_key", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "pgp_key", + "type_info": "Text" + }, + { + "ordinal": 9, + "name": "pgp_cert_id", + "type_info": "Text" + }, + { + "ordinal": 10, + "name": "mfa_enabled", + "type_info": "Bool" + }, + { + "ordinal": 11, + "name": "totp_enabled", + "type_info": "Bool" + }, + { + "ordinal": 12, + "name": "totp_secret", + "type_info": "Bytea" + }, + { + "ordinal": 13, + "name": "mfa_method: _", + "type_info": { + "Custom": { + "name": "mfa_method", + "kind": { + "Enum": [ + "none", + "one_time_password", + "webauthn", + "web3" + ] + } + } + } + }, + { + "ordinal": 14, + "name": "recovery_codes", + "type_info": "TextArray" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + true, + false, + false, + false, + true, + true, + true, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "c863944a13f1b8c3eb0d5a62bff40f453da7ac74551c2e62275931a1e8a7ec9e" +} diff --git a/.sqlx/query-cdda0d8e9b34aef0728fc390bf77a3211b708f23ecdb3df5cada3d628280a025.json b/.sqlx/query-cdda0d8e9b34aef0728fc390bf77a3211b708f23ecdb3df5cada3d628280a025.json new file mode 100644 index 000000000..c17124309 --- /dev/null +++ b/.sqlx/query-cdda0d8e9b34aef0728fc390bf77a3211b708f23ecdb3df5cada3d628280a025.json @@ -0,0 +1,28 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT d.wireguard_pubkey as pubkey, array[host(wnd.wireguard_ip)] as \"allowed_ips!: Vec\" FROM wireguard_network_device wnd\n JOIN device d\n ON wnd.device_id = d.id\n WHERE wireguard_network_id = $1\n ORDER BY d.id ASC\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "pubkey", + "type_info": "Text" + }, + { + "ordinal": 1, + "name": "allowed_ips!: Vec", + "type_info": "TextArray" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + null + ] + }, + "hash": "cdda0d8e9b34aef0728fc390bf77a3211b708f23ecdb3df5cada3d628280a025" +} diff --git a/.sqlx/query-cf0ea5510b1017309b0f9c1a2875f393c5012b4ba1a7eac22475b60024b57d06.json b/.sqlx/query-cf0ea5510b1017309b0f9c1a2875f393c5012b4ba1a7eac22475b60024b57d06.json new file mode 100644 index 000000000..fead645d3 --- /dev/null +++ b/.sqlx/query-cf0ea5510b1017309b0f9c1a2875f393c5012b4ba1a7eac22475b60024b57d06.json @@ -0,0 +1,27 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO \"oauth2client\" (\"client_id\",\"client_secret\",\"redirect_uri\",\"scope\",\"name\",\"enabled\") VALUES ($1,$2,$3,$4,$5,$6) RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Text", + "Text", + "TextArray", + "TextArray", + "Text", + "Bool" + ] + }, + "nullable": [ + false + ] + }, + "hash": "cf0ea5510b1017309b0f9c1a2875f393c5012b4ba1a7eac22475b60024b57d06" +} diff --git a/.sqlx/query-d3b425017872becff45f39513c9e09b3d3ba8fc86e97c7f1ff21597a884af06d.json b/.sqlx/query-d3b425017872becff45f39513c9e09b3d3ba8fc86e97c7f1ff21597a884af06d.json new file mode 100644 index 000000000..4c499f9f3 --- /dev/null +++ b/.sqlx/query-d3b425017872becff45f39513c9e09b3d3ba8fc86e97c7f1ff21597a884af06d.json @@ -0,0 +1,28 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT wireguard_network_id as network_id, wireguard_ip as \"device_wireguard_ip: IpAddr\"\n FROM wireguard_network_device\n WHERE device_id = $1\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "network_id", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "device_wireguard_ip: IpAddr", + "type_info": "Inet" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false + ] + }, + "hash": "d3b425017872becff45f39513c9e09b3d3ba8fc86e97c7f1ff21597a884af06d" +} diff --git a/.sqlx/query-d4822c2e2aea609a3807a9f26ad8b9441548a7d17293b87c877a5e8cdcc95b32.json b/.sqlx/query-d4822c2e2aea609a3807a9f26ad8b9441548a7d17293b87c877a5e8cdcc95b32.json new file mode 100644 index 000000000..d35580b59 --- /dev/null +++ b/.sqlx/query-d4822c2e2aea609a3807a9f26ad8b9441548a7d17293b87c877a5e8cdcc95b32.json @@ -0,0 +1,116 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"username\",\"password_hash\",\"last_name\",\"first_name\",\"email\",\"phone\",\"ssh_key\",\"pgp_key\",\"pgp_cert_id\",\"mfa_enabled\",\"totp_enabled\",\"totp_secret\",\"mfa_method\" \"mfa_method: _\",\"recovery_codes\" \"recovery_codes: _\" FROM \"user\"", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "username", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "password_hash", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "last_name", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "first_name", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "email", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "phone", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "ssh_key", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "pgp_key", + "type_info": "Text" + }, + { + "ordinal": 9, + "name": "pgp_cert_id", + "type_info": "Text" + }, + { + "ordinal": 10, + "name": "mfa_enabled", + "type_info": "Bool" + }, + { + "ordinal": 11, + "name": "totp_enabled", + "type_info": "Bool" + }, + { + "ordinal": 12, + "name": "totp_secret", + "type_info": "Bytea" + }, + { + "ordinal": 13, + "name": "mfa_method: _", + "type_info": { + "Custom": { + "name": "mfa_method", + "kind": { + "Enum": [ + "none", + "one_time_password", + "webauthn", + "web3" + ] + } + } + } + }, + { + "ordinal": 14, + "name": "recovery_codes: _", + "type_info": "TextArray" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + true, + false, + false, + false, + true, + true, + true, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "d4822c2e2aea609a3807a9f26ad8b9441548a7d17293b87c877a5e8cdcc95b32" +} diff --git a/.sqlx/query-d98e365929bb0fbf3915b517db93168f76f9a0c4832cd2efd13d74268cc435b8.json b/.sqlx/query-d98e365929bb0fbf3915b517db93168f76f9a0c4832cd2efd13d74268cc435b8.json new file mode 100644 index 000000000..7ad0b6f53 --- /dev/null +++ b/.sqlx/query-d98e365929bb0fbf3915b517db93168f76f9a0c4832cd2efd13d74268cc435b8.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"user\" SET recovery_codes = $2 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "TextArray" + ] + }, + "nullable": [] + }, + "hash": "d98e365929bb0fbf3915b517db93168f76f9a0c4832cd2efd13d74268cc435b8" +} diff --git a/.sqlx/query-dab9a6b3dc5d3f57c0f49f1f111db88c8c5658ea7d1492e1922820bbebc51209.json b/.sqlx/query-dab9a6b3dc5d3f57c0f49f1f111db88c8c5658ea7d1492e1922820bbebc51209.json new file mode 100644 index 000000000..e04aa15ec --- /dev/null +++ b/.sqlx/query-dab9a6b3dc5d3f57c0f49f1f111db88c8c5658ea7d1492e1922820bbebc51209.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT passkey FROM webauthn WHERE user_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "passkey", + "type_info": "Bytea" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false + ] + }, + "hash": "dab9a6b3dc5d3f57c0f49f1f111db88c8c5658ea7d1492e1922820bbebc51209" +} diff --git a/.sqlx/query-dc21ad55a35e5ea826e64030b4d71a0df499cc1b22f1d8fcffa135307b09c187.json b/.sqlx/query-dc21ad55a35e5ea826e64030b4d71a0df499cc1b22f1d8fcffa135307b09c187.json new file mode 100644 index 000000000..9462acb1b --- /dev/null +++ b/.sqlx/query-dc21ad55a35e5ea826e64030b4d71a0df499cc1b22f1d8fcffa135307b09c187.json @@ -0,0 +1,70 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"device_id\",\"collected_at\",\"network\",\"endpoint\",\"upload\",\"download\",\"latest_handshake\",\"allowed_ips\" FROM \"wireguard_peer_stats\" WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "device_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "collected_at", + "type_info": "Timestamp" + }, + { + "ordinal": 3, + "name": "network", + "type_info": "Int8" + }, + { + "ordinal": 4, + "name": "endpoint", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "upload", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "download", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "latest_handshake", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "allowed_ips", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + true, + false, + false, + false, + true + ] + }, + "hash": "dc21ad55a35e5ea826e64030b4d71a0df499cc1b22f1d8fcffa135307b09c187" +} diff --git a/.sqlx/query-e0d59d4aa01a863eca5f00470c70112fd9a78c4565fd8e44185dc31c9b894b9e.json b/.sqlx/query-e0d59d4aa01a863eca5f00470c70112fd9a78c4565fd8e44185dc31c9b894b9e.json new file mode 100644 index 000000000..bb2b4ad1e --- /dev/null +++ b/.sqlx/query-e0d59d4aa01a863eca5f00470c70112fd9a78c4565fd8e44185dc31c9b894b9e.json @@ -0,0 +1,70 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", user_id, client_id, code, redirect_uri, scope, auth_time, nonce, code_challenge FROM authorization_code WHERE code = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 2, + "name": "client_id", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "code", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "redirect_uri", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "scope", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "auth_time", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "nonce", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "code_challenge", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + true + ] + }, + "hash": "e0d59d4aa01a863eca5f00470c70112fd9a78c4565fd8e44185dc31c9b894b9e" +} diff --git a/.sqlx/query-e19b29d2e52ad2a2a5c20ce205d5c949d02219fd252d78f7fffa202cc804b4c2.json b/.sqlx/query-e19b29d2e52ad2a2a5c20ce205d5c949d02219fd252d78f7fffa202cc804b4c2.json new file mode 100644 index 000000000..e1fe0b4b9 --- /dev/null +++ b/.sqlx/query-e19b29d2e52ad2a2a5c20ce205d5c949d02219fd252d78f7fffa202cc804b4c2.json @@ -0,0 +1,30 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO \"wireguard_network\" (\"name\",\"address\",\"port\",\"pubkey\",\"prvkey\",\"endpoint\",\"dns\",\"allowed_ips\",\"connected_at\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9) RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Text", + "Inet", + "Int4", + "Text", + "Text", + "Text", + "Text", + "InetArray", + "Timestamp" + ] + }, + "nullable": [ + false + ] + }, + "hash": "e19b29d2e52ad2a2a5c20ce205d5c949d02219fd252d78f7fffa202cc804b4c2" +} diff --git a/.sqlx/query-e1c693d11abacbffbeb48c1bb215d8fe08c229a8e7c5befa18406e1be89d69ea.json b/.sqlx/query-e1c693d11abacbffbeb48c1bb215d8fe08c229a8e7c5befa18406e1be89d69ea.json new file mode 100644 index 000000000..d37623f74 --- /dev/null +++ b/.sqlx/query-e1c693d11abacbffbeb48c1bb215d8fe08c229a8e7c5befa18406e1be89d69ea.json @@ -0,0 +1,153 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", \"openid_enabled\",\"ldap_enabled\",\"wireguard_enabled\",\"webhooks_enabled\",\"worker_enabled\",\"challenge_template\",\"instance_name\",\"main_logo_url\",\"nav_logo_url\",\"smtp_server\",\"smtp_port\",\"smtp_encryption\" \"smtp_encryption: _\",\"smtp_user\",\"smtp_password\" \"smtp_password?: SecretString\",\"smtp_sender\",\"enrollment_vpn_step_optional\",\"enrollment_welcome_message\",\"enrollment_welcome_email\",\"enrollment_welcome_email_subject\",\"enrollment_use_welcome_message_as_email\" FROM \"settings\" WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "openid_enabled", + "type_info": "Bool" + }, + { + "ordinal": 2, + "name": "ldap_enabled", + "type_info": "Bool" + }, + { + "ordinal": 3, + "name": "wireguard_enabled", + "type_info": "Bool" + }, + { + "ordinal": 4, + "name": "webhooks_enabled", + "type_info": "Bool" + }, + { + "ordinal": 5, + "name": "worker_enabled", + "type_info": "Bool" + }, + { + "ordinal": 6, + "name": "challenge_template", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "instance_name", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "main_logo_url", + "type_info": "Text" + }, + { + "ordinal": 9, + "name": "nav_logo_url", + "type_info": "Text" + }, + { + "ordinal": 10, + "name": "smtp_server", + "type_info": "Text" + }, + { + "ordinal": 11, + "name": "smtp_port", + "type_info": "Int4" + }, + { + "ordinal": 12, + "name": "smtp_encryption: _", + "type_info": { + "Custom": { + "name": "smtp_encryption", + "kind": { + "Enum": [ + "none", + "starttls", + "implicittls" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "smtp_user", + "type_info": "Text" + }, + { + "ordinal": 14, + "name": "smtp_password?: SecretString", + "type_info": "Text" + }, + { + "ordinal": 15, + "name": "smtp_sender", + "type_info": "Text" + }, + { + "ordinal": 16, + "name": "enrollment_vpn_step_optional", + "type_info": "Bool" + }, + { + "ordinal": 17, + "name": "enrollment_welcome_message", + "type_info": "Text" + }, + { + "ordinal": 18, + "name": "enrollment_welcome_email", + "type_info": "Text" + }, + { + "ordinal": 19, + "name": "enrollment_welcome_email_subject", + "type_info": "Text" + }, + { + "ordinal": 20, + "name": "enrollment_use_welcome_message_as_email", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + true, + false, + true, + true, + true, + false, + true, + true, + true, + false + ] + }, + "hash": "e1c693d11abacbffbeb48c1bb215d8fe08c229a8e7c5befa18406e1be89d69ea" +} diff --git a/.sqlx/query-e34c2a7ac137329f1a9813db3f1ebbc837971d9c64ee2a6d7d902c1a0f8d6c05.json b/.sqlx/query-e34c2a7ac137329f1a9813db3f1ebbc837971d9c64ee2a6d7d902c1a0f8d6c05.json new file mode 100644 index 000000000..81febce5d --- /dev/null +++ b/.sqlx/query-e34c2a7ac137329f1a9813db3f1ebbc837971d9c64ee2a6d7d902c1a0f8d6c05.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM \"device\" WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "e34c2a7ac137329f1a9813db3f1ebbc837971d9c64ee2a6d7d902c1a0f8d6c05" +} diff --git a/.sqlx/query-e5624c65ab8248f1fcf973c0c7501792d53748dbd5d227e492527f07ca194fc6.json b/.sqlx/query-e5624c65ab8248f1fcf973c0c7501792d53748dbd5d227e492527f07ca194fc6.json new file mode 100644 index 000000000..256e393ae --- /dev/null +++ b/.sqlx/query-e5624c65ab8248f1fcf973c0c7501792d53748dbd5d227e492527f07ca194fc6.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM session WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [] + }, + "hash": "e5624c65ab8248f1fcf973c0c7501792d53748dbd5d227e492527f07ca194fc6" +} diff --git a/.sqlx/query-e6baa94aed2de495bad45e2b7b2464c1de949bf4973c0dbcad906e25cde8c2e3.json b/.sqlx/query-e6baa94aed2de495bad45e2b7b2464c1de949bf4973c0dbcad906e25cde8c2e3.json new file mode 100644 index 000000000..ebf1921ae --- /dev/null +++ b/.sqlx/query-e6baa94aed2de495bad45e2b7b2464c1de949bf4973c0dbcad906e25cde8c2e3.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM \"user\" WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "e6baa94aed2de495bad45e2b7b2464c1de949bf4973c0dbcad906e25cde8c2e3" +} diff --git a/.sqlx/query-e7e944f6bce4dce8cd58889dca8e38ceab97af014b51bfa24933e296e803effc.json b/.sqlx/query-e7e944f6bce4dce8cd58889dca8e38ceab97af014b51bfa24933e296e803effc.json new file mode 100644 index 000000000..eb7659098 --- /dev/null +++ b/.sqlx/query-e7e944f6bce4dce8cd58889dca8e38ceab97af014b51bfa24933e296e803effc.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT wireguard_ip\n FROM wireguard_network_device\n WHERE device_id = $1 AND wireguard_network_id = $2\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "wireguard_ip", + "type_info": "Inet" + } + ], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + }, + "nullable": [ + false + ] + }, + "hash": "e7e944f6bce4dce8cd58889dca8e38ceab97af014b51bfa24933e296e803effc" +} diff --git a/.sqlx/query-e99464b4da5a21bcffda16866783d11c819eb078e392f1492467ae420800242d.json b/.sqlx/query-e99464b4da5a21bcffda16866783d11c819eb078e392f1492467ae420800242d.json new file mode 100644 index 000000000..424aad372 --- /dev/null +++ b/.sqlx/query-e99464b4da5a21bcffda16866783d11c819eb078e392f1492467ae420800242d.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO \"group\" (\"name\") VALUES ($1) RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "e99464b4da5a21bcffda16866783d11c819eb078e392f1492467ae420800242d" +} diff --git a/.sqlx/query-eb6dee5462657ac5ce0ecf31d1477ce7cc874d9ad8b3119977168f601b3e8072.json b/.sqlx/query-eb6dee5462657ac5ce0ecf31d1477ce7cc874d9ad8b3119977168f601b3e8072.json new file mode 100644 index 000000000..b0e4fe52a --- /dev/null +++ b/.sqlx/query-eb6dee5462657ac5ce0ecf31d1477ce7cc874d9ad8b3119977168f601b3e8072.json @@ -0,0 +1,46 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id \"id?\", name, wireguard_pubkey, user_id, created FROM device WHERE wireguard_pubkey = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "wireguard_pubkey", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 4, + "name": "created", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false + ] + }, + "hash": "eb6dee5462657ac5ce0ecf31d1477ce7cc874d9ad8b3119977168f601b3e8072" +} diff --git a/.sqlx/query-ed38aaf593faf8d597a30003e7334681dc354535c96fdd33d3f364bde6293575.json b/.sqlx/query-ed38aaf593faf8d597a30003e7334681dc354535c96fdd33d3f364bde6293575.json new file mode 100644 index 000000000..5e3473b94 --- /dev/null +++ b/.sqlx/query-ed38aaf593faf8d597a30003e7334681dc354535c96fdd33d3f364bde6293575.json @@ -0,0 +1,45 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE \"settings\" SET \"openid_enabled\" = $2,\"ldap_enabled\" = $3,\"wireguard_enabled\" = $4,\"webhooks_enabled\" = $5,\"worker_enabled\" = $6,\"challenge_template\" = $7,\"instance_name\" = $8,\"main_logo_url\" = $9,\"nav_logo_url\" = $10,\"smtp_server\" = $11,\"smtp_port\" = $12,\"smtp_encryption\" = $13,\"smtp_user\" = $14,\"smtp_password\" = $15,\"smtp_sender\" = $16,\"enrollment_vpn_step_optional\" = $17,\"enrollment_welcome_message\" = $18,\"enrollment_welcome_email\" = $19,\"enrollment_welcome_email_subject\" = $20,\"enrollment_use_welcome_message_as_email\" = $21 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Bool", + "Bool", + "Bool", + "Bool", + "Bool", + "Text", + "Text", + "Text", + "Text", + "Text", + "Int4", + { + "Custom": { + "name": "smtp_encryption", + "kind": { + "Enum": [ + "none", + "starttls", + "implicittls" + ] + } + } + }, + "Text", + "Text", + "Text", + "Bool", + "Text", + "Text", + "Text", + "Bool" + ] + }, + "nullable": [] + }, + "hash": "ed38aaf593faf8d597a30003e7334681dc354535c96fdd33d3f364bde6293575" +} diff --git a/.sqlx/query-ee6ed3df25517a6fedf6981166e58601de53af70dd28f69b84caca6e36cb8956.json b/.sqlx/query-ee6ed3df25517a6fedf6981166e58601de53af70dd28f69b84caca6e36cb8956.json new file mode 100644 index 000000000..d59b060a1 --- /dev/null +++ b/.sqlx/query-ee6ed3df25517a6fedf6981166e58601de53af70dd28f69b84caca6e36cb8956.json @@ -0,0 +1,16 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO wireguard_network_device\n (device_id, wireguard_network_id, wireguard_ip)\n VALUES ($1, $2, $3)\n ON CONFLICT ON CONSTRAINT device_network\n DO UPDATE SET wireguard_ip = $3", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Int8", + "Inet" + ] + }, + "nullable": [] + }, + "hash": "ee6ed3df25517a6fedf6981166e58601de53af70dd28f69b84caca6e36cb8956" +} diff --git a/.sqlx/query-eee2734f98b411d6fc75bf92027d84b8ca5e41de023a473681c076d6cc072ab2.json b/.sqlx/query-eee2734f98b411d6fc75bf92027d84b8ca5e41de023a473681c076d6cc072ab2.json new file mode 100644 index 000000000..e41c258ce --- /dev/null +++ b/.sqlx/query-eee2734f98b411d6fc75bf92027d84b8ca5e41de023a473681c076d6cc072ab2.json @@ -0,0 +1,12 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM session WHERE expires < now()", + "describe": { + "columns": [], + "parameters": { + "Left": [] + }, + "nullable": [] + }, + "hash": "eee2734f98b411d6fc75bf92027d84b8ca5e41de023a473681c076d6cc072ab2" +} diff --git a/.sqlx/query-ef05db120b43f66cb1eebea856471ee8d81cdcf11af03472a10893ecedeeced3.json b/.sqlx/query-ef05db120b43f66cb1eebea856471ee8d81cdcf11af03472a10893ecedeeced3.json new file mode 100644 index 000000000..3cb31e6cb --- /dev/null +++ b/.sqlx/query-ef05db120b43f66cb1eebea856471ee8d81cdcf11af03472a10893ecedeeced3.json @@ -0,0 +1,52 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT oauth2authorizedapp_id, access_token, refresh_token, redirect_uri, scope, expires_in FROM oauth2token WHERE access_token = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "oauth2authorizedapp_id", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "access_token", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "refresh_token", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "redirect_uri", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "scope", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "expires_in", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false + ] + }, + "hash": "ef05db120b43f66cb1eebea856471ee8d81cdcf11af03472a10893ecedeeced3" +} diff --git a/.sqlx/query-effe03b1e22929191b7d07e51586153215f982b9c8e43f68ebb62597df31d8f8.json b/.sqlx/query-effe03b1e22929191b7d07e51586153215f982b9c8e43f68ebb62597df31d8f8.json new file mode 100644 index 000000000..40aebf630 --- /dev/null +++ b/.sqlx/query-effe03b1e22929191b7d07e51586153215f982b9c8e43f68ebb62597df31d8f8.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO enrollment (id, user_id, admin_id, email, created_at, expires_at, used_at) VALUES ($1, $2, $3, $4, $5, $6, $7)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Int8", + "Int8", + "Text", + "Timestamp", + "Timestamp", + "Timestamp" + ] + }, + "nullable": [] + }, + "hash": "effe03b1e22929191b7d07e51586153215f982b9c8e43f68ebb62597df31d8f8" +} diff --git a/.sqlx/query-f5a52d311dd0ac4c76cf1638f30cffd8c97fe2b4987fcfb9f9ca523ab6e5bf5d.json b/.sqlx/query-f5a52d311dd0ac4c76cf1638f30cffd8c97fe2b4987fcfb9f9ca523ab6e5bf5d.json new file mode 100644 index 000000000..69f0ff602 --- /dev/null +++ b/.sqlx/query-f5a52d311dd0ac4c76cf1638f30cffd8c97fe2b4987fcfb9f9ca523ab6e5bf5d.json @@ -0,0 +1,16 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE wallet SET challenge_signature = $1, validation_timestamp = $2 WHERE id = $3", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Timestamp", + "Int8" + ] + }, + "nullable": [] + }, + "hash": "f5a52d311dd0ac4c76cf1638f30cffd8c97fe2b4987fcfb9f9ca523ab6e5bf5d" +} diff --git a/.sqlx/query-f6e0a7877fb3fb17470c006453dcbbeabc7bd64204429a7b4add532cfac9b603.json b/.sqlx/query-f6e0a7877fb3fb17470c006453dcbbeabc7bd64204429a7b4add532cfac9b603.json new file mode 100644 index 000000000..96a3b6e6c --- /dev/null +++ b/.sqlx/query-f6e0a7877fb3fb17470c006453dcbbeabc7bd64204429a7b4add532cfac9b603.json @@ -0,0 +1,19 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO oauth2token (oauth2authorizedapp_id, access_token, refresh_token, redirect_uri, scope, expires_in) VALUES ($1, $2, $3, $4, $5, $6)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Text", + "Text", + "Text", + "Text", + "Int8" + ] + }, + "nullable": [] + }, + "hash": "f6e0a7877fb3fb17470c006453dcbbeabc7bd64204429a7b4add532cfac9b603" +} diff --git a/.sqlx/query-fa9759385716d697b84d74006ac8738772575de69605375c4c38b9d32fea34f6.json b/.sqlx/query-fa9759385716d697b84d74006ac8738772575de69605375c4c38b9d32fea34f6.json new file mode 100644 index 000000000..abd106dbb --- /dev/null +++ b/.sqlx/query-fa9759385716d697b84d74006ac8738772575de69605375c4c38b9d32fea34f6.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO wireguard_stats_purge (started_at, finished_at, removal_threshold, records_removed) VALUES ($1, $2, $3, $4)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Timestamp", + "Timestamp", + "Timestamp", + "Int8" + ] + }, + "nullable": [] + }, + "hash": "fa9759385716d697b84d74006ac8738772575de69605375c4c38b9d32fea34f6" +} diff --git a/.sqlx/query-fc3e288a55cef64d17ef2a373aa7fb46dd2548610a09ada4bf2daa8b98249901.json b/.sqlx/query-fc3e288a55cef64d17ef2a373aa7fb46dd2548610a09ada4bf2daa8b98249901.json new file mode 100644 index 000000000..9c01bc5fe --- /dev/null +++ b/.sqlx/query-fc3e288a55cef64d17ef2a373aa7fb46dd2548610a09ada4bf2daa8b98249901.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM webauthn WHERE user_id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [] + }, + "hash": "fc3e288a55cef64d17ef2a373aa7fb46dd2548610a09ada4bf2daa8b98249901" +} diff --git a/.sqlx/query-fd92ab2977c9c170e2254f13bd99fcb569ef4b44029783648b0613ca8db2a393.json b/.sqlx/query-fd92ab2977c9c170e2254f13bd99fcb569ef4b44029783648b0613ca8db2a393.json new file mode 100644 index 000000000..900c1d364 --- /dev/null +++ b/.sqlx/query-fd92ab2977c9c170e2254f13bd99fcb569ef4b44029783648b0613ca8db2a393.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT d.id \"id?\", d.name, d.wireguard_pubkey, d.user_id, d.created\n FROM device d\n JOIN wireguard_network_device wnd\n ON d.id = wnd.device_id\n WHERE wnd.wireguard_ip = $1 AND wnd.wireguard_network_id = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id?", + "type_info": "Int8" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "wireguard_pubkey", + "type_info": "Text" + }, + { + "ordinal": 3, + "name": "user_id", + "type_info": "Int8" + }, + { + "ordinal": 4, + "name": "created", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Inet", + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + false + ] + }, + "hash": "fd92ab2977c9c170e2254f13bd99fcb569ef4b44029783648b0613ca8db2a393" +} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 2bad4bdd9..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "cSpell.words": [ - "appstate", - "ipnetwork" - ] -} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ff34205aa..69aad48aa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,13 +2,13 @@ 1. Sqlx offline build -Requires `sqlx-data.json` to be present in the root directory of the project. Create the file using: +Requires `.sqlx` directory to be present in the root directory of the project. Create the file using: ``` cargo sqlx prepare -- --lib ``` -2. Build docker image +1. Build docker image ``` docker-compose build diff --git a/Cargo.lock b/Cargo.lock index bc8ad00eb..0e6fdafce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,17 +52,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - [[package]] name = "ahash" version = "0.8.3" @@ -70,15 +59,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", + "getrandom", "once_cell", "version_check", ] [[package]] name = "aho-corasick" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" dependencies = [ "memchr", ] @@ -106,16 +96,15 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] @@ -145,9 +134,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" dependencies = [ "anstyle", "windows-sys", @@ -161,9 +150,9 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "argon2" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e554a8638bdc1e4eae9984845306cc95f8a9208ba8d49c3859fd958b46774d" +checksum = "17ba4cac0a46bc1d2912652a751c47f2a9f3a7fe89bcae2275d418f5270402f9" dependencies = [ "base64ct", "blake2", @@ -235,7 +224,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] @@ -246,14 +235,14 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] name = "atoi" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c57d12312ff59c811c0643f4d80830505833c9ffaebd193d819392b265be8e" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" dependencies = [ "num-traits", ] @@ -362,9 +351,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "base64ct" @@ -378,7 +367,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18b3d30abb74120a9d5267463b9e0045fdccc4dd152e7249d966612dc1721384" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "serde", "serde_json", ] @@ -409,6 +398,9 @@ name = "bitflags" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +dependencies = [ + "serde", +] [[package]] name = "bitvec" @@ -442,9 +434,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.6.0" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a" dependencies = [ "memchr", "serde", @@ -470,9 +462,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" dependencies = [ "serde", ] @@ -494,22 +486,24 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877" dependencies = [ "android-tzdata", "iana-time-zone", + "js-sys", "num-traits", "serde", - "winapi", + "wasm-bindgen", + "windows-targets", ] [[package]] name = "chrono-tz" -version = "0.6.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58549f1842da3080ce63002102d5bc954c7bc843d4f47818e642abdc36253552" +checksum = "f1369bc6b9e9a7dfdae2055f6ec151fe9c554a9d23d357c0237cee2e25eaabb7" dependencies = [ "chrono", "chrono-tz-build", @@ -518,9 +512,9 @@ dependencies = [ [[package]] name = "chrono-tz-build" -version = "0.0.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db058d493fb2f65f41861bfed7e3fe6335264a9f0f92710cab5bdf01fef09069" +checksum = "e2f5ebdc942f57ed96d560a6d1a459bae5851102a25d5bf89dc04ae453e31ecf" dependencies = [ "parse-zoneinfo", "phf", @@ -548,20 +542,19 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.24" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb690e81c7840c0d7aade59f242ea3b41b9bc27bcd5997890e7702ae4b32e487" +checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.24" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ed2e96bc16d8d740f6f48d663eddf4b8a0983e79210fd55479b7bcd0a69860e" +checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08" dependencies = [ "anstream", "anstyle", @@ -571,21 +564,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "colorchoice" @@ -606,9 +599,9 @@ dependencies = [ [[package]] name = "compact_jwt" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f9032b96a89dd79ffc5f62523d5351ebb40680cbdfc4029393b511b9e971aa" +checksum = "7aa76ef19968577838a34d02848136bb9b6bdbfd7675fb968fe9c931bc434b33" dependencies = [ "base64 0.13.1", "base64urlsafedata", @@ -623,9 +616,9 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.6.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca268df6cd88e646b564e6aff1a016834e5f42077c736ef6b6789c31ef9ec5dc" +checksum = "08849ed393c907c90016652a01465a12d86361cd38ad2a7de026c56a520cc259" dependencies = [ "cfg-if", "cpufeatures", @@ -668,7 +661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7efb37c3e1ccb1ff97164ad95ac1606e8ccd35b3fa0a7d99a304c7f4a428cc24" dependencies = [ "aes-gcm", - "base64 0.21.2", + "base64 0.21.4", "hkdf", "percent-encoding", "rand", @@ -754,9 +747,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" dependencies = [ "generic-array", "rand_core", @@ -786,9 +779,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f711ade317dd348950a9910f81c5947e3d8907ebd2b83f76203ff1807e6a2bc2" +checksum = "622178105f911d937a42cdb140730ba4a3ed2becd8ae6ce39c7d28b5d75d4588" dependencies = [ "cfg-if", "cpufeatures", @@ -808,7 +801,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] @@ -832,7 +825,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] @@ -843,7 +836,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] @@ -858,13 +851,12 @@ version = "0.7.0" dependencies = [ "anyhow", "argon2", - "base64 0.21.2", + "base64 0.21.4", "bincode", "chrono", "claims", "clap", "dotenvy", - "ethabi", "ethers-core", "fern", "humantime", @@ -887,7 +879,7 @@ dependencies = [ "regex", "reqwest", "rocket", - "rsa 0.8.2", + "rsa", "rust-ini", "secp256k1", "secrecy", @@ -912,17 +904,6 @@ dependencies = [ "x25519-dalek", ] -[[package]] -name = "der" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" -dependencies = [ - "const-oid", - "pem-rfc7468 0.6.0", - "zeroize", -] - [[package]] name = "der" version = "0.7.8" @@ -930,7 +911,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ "const-oid", - "pem-rfc7468 0.7.0", + "pem-rfc7468", "zeroize", ] @@ -1004,7 +985,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] @@ -1019,26 +1000,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "displaydoc" version = "0.2.4" @@ -1047,14 +1008,14 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] name = "dlv-list" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d529fd73d344663edfd598ccb3f344e46034db51ebd103518eae34338248ad73" +checksum = "8aead04dc46b5f263c25721cf25c9e595951d15055f8063f92392fa0d7f64cf4" dependencies = [ "const-random", ] @@ -1077,12 +1038,12 @@ version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" dependencies = [ - "der 0.7.8", + "der", "digest", "elliptic-curve", "rfc6979", "signature", - "spki 0.7.2", + "spki", ] [[package]] @@ -1107,8 +1068,8 @@ dependencies = [ "generic-array", "group", "hkdf", - "pem-rfc7468 0.7.0", - "pkcs8 0.10.2", + "pem-rfc7468", + "pkcs8", "rand_core", "sec1", "subtle", @@ -1121,7 +1082,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbfb21b9878cf7a348dcb8559109aabc0ec40d69924bd706fa5149846c4fef75" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "memchr", ] @@ -1148,9 +1109,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" dependencies = [ "errno-dragonfly", "libc", @@ -1167,6 +1128,17 @@ dependencies = [ "libc", ] +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys", +] + [[package]] name = "ethabi" version = "18.0.0" @@ -1217,9 +1189,9 @@ dependencies = [ [[package]] name = "ethers-core" -version = "2.0.9" +version = "2.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c29523f73c12753165781c6e5dc11c84d3e44c080a15f7c6cfbd70b514cb6f1" +checksum = "c0a17f0708692024db9956b31d7a20163607d2745953f5ae8125ab368ba280ad" dependencies = [ "arrayvec", "bytes", @@ -1285,9 +1257,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.1.20" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" +checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" [[package]] name = "figment" @@ -1303,6 +1275,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "finl_unicode" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" + [[package]] name = "fixed-hash" version = "0.8.0" @@ -1331,6 +1309,18 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "flume" +version = "0.10.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +dependencies = [ + "futures-core", + "futures-sink", + "pin-project", + "spin 0.9.8", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1411,13 +1401,13 @@ dependencies = [ [[package]] name = "futures-intrusive" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" dependencies = [ "futures-core", "lock_api", - "parking_lot 0.11.2", + "parking_lot", ] [[package]] @@ -1434,7 +1424,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] @@ -1613,15 +1603,15 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" dependencies = [ - "ahash 0.8.3", + "ahash", "allocator-api2", ] [[package]] name = "hashlink" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312f66718a2d7789ffef4f4b7b213138ed9f1eb3aa1d0d82fc99f88fb3ffd26f" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ "hashbrown 0.14.0", ] @@ -1665,6 +1655,15 @@ dependencies = [ "digest", ] +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys", +] + [[package]] name = "hostname" version = "0.3.1" @@ -1932,9 +1931,9 @@ checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "ipnetwork" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f84f1612606f3753f205a4e9a2efd6fe5b4c573a6269b2cc6c3003d44a0d127" +checksum = "bf466541e9d546596ee94f9f69590f89473455f88372423e0008fc1a7daf100e" dependencies = [ "serde", ] @@ -1959,6 +1958,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" @@ -1980,7 +1988,7 @@ version = "8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "pem", "ring", "serde", @@ -2060,7 +2068,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76bd09637ae3ec7bd605b8e135e757980b3968430ff2b1a4a94fb7769e50166d" dependencies = [ "async-trait", - "base64 0.21.2", + "base64 0.21.4", "email-encoding", "email_address", "fastrand 1.9.0", @@ -2091,11 +2099,22 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" +[[package]] +name = "libsqlite3-sys" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" [[package]] name = "lock_api" @@ -2175,9 +2194,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "mime" @@ -2216,7 +2235,7 @@ name = "model_derive" version = "0.1.2" dependencies = [ "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] @@ -2370,14 +2389,14 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] name = "oauth2" -version = "4.4.1" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a6e2a2b13a56ebeabba9142f911745be6456163fd6c3d361274ebcd891a80c" +checksum = "c38841cdd844847e3e7c8d29cef9dcfed8877f8f56f9071f77843ecf3baf937f" dependencies = [ "base64 0.13.1", "chrono", @@ -2394,9 +2413,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -2449,22 +2468,22 @@ dependencies = [ [[package]] name = "openidconnect" -version = "3.3.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03335ade401352b354b017e7597ddb40040091da445b031bf659e597e032b1fc" +checksum = "8e9bcb11cef8c32242e1ab8ff0b11bc7f763dea4d83c103dc75beb743a528932" dependencies = [ "base64 0.13.1", "chrono", "dyn-clone", "hmac", "http", - "itertools", + "itertools 0.10.5", "log", "oauth2", "p256", "p384", "rand", - "rsa 0.9.2", + "rsa", "serde", "serde-value", "serde_derive", @@ -2480,11 +2499,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.56" +version = "0.10.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" +checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "cfg-if", "foreign-types", "libc", @@ -2501,7 +2520,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] @@ -2512,9 +2531,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.91" +version = "0.9.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" dependencies = [ "cc", "libc", @@ -2584,9 +2603,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.4" +version = "3.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8e946cc0cc711189c0b0249fb8b599cbeeab9784d83c415719368bb8d4ac64" +checksum = "f88eaac72ead1b9bd4ce747d577dbd2ad31fb0a56a9a20c611bf27bd1b97fbed" dependencies = [ "arrayvec", "bitvec", @@ -2598,9 +2617,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.4" +version = "3.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a296c3079b5fefbc499e1de58dc26c09b1b9a5952d26694ee89f04a43ebbb3e" +checksum = "33bdcd446e9400b6ad9fc85b4aea68846c258b07c3efb994679ae82707b133f0" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2608,17 +2627,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -2626,21 +2634,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.8", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -2651,7 +2645,7 @@ checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall", "smallvec", "windows-targets", ] @@ -2702,7 +2696,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] @@ -2714,15 +2708,6 @@ dependencies = [ "base64 0.13.1", ] -[[package]] -name = "pem-rfc7468" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d159833a9105500e0398934e205e0773f0b27529557134ecfc51c27646adac" -dependencies = [ - "base64ct", -] - [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -2740,19 +2725,20 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1acb4a4365a13f749a93f1a094a7805e5cfa0955373a9de860d962eaa3a5fe5a" +checksum = "d7a4d085fd991ac8d5b05a147b437791b4260b76326baf0fc60cf7c9c27ecd33" dependencies = [ + "memchr", "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666d00490d4ac815001da55838c500eafb0320019bbaa44444137c48b443a853" +checksum = "a2bee7be22ce7918f641a33f08e3f43388c7656772244e2bbb2477f44cc9021a" dependencies = [ "pest", "pest_generator", @@ -2760,22 +2746,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ca01446f50dbda87c1786af8770d535423fa8a53aec03b8f4e3d7eb10e0929" +checksum = "d1511785c5e98d79a05e8a6bc34b4ac2168a0e3e92161862030ad84daa223141" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] name = "pest_meta" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56af0a30af74d0445c0bf6d9d051c979b516a1a5af790d251daee76005420a48" +checksum = "b42f0394d3123e33353ca5e1e89092e533d2cc490389f2bd6131c43c634ebc5f" dependencies = [ "once_cell", "pest", @@ -2794,18 +2780,18 @@ dependencies = [ [[package]] name = "phf" -version = "0.10.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ "phf_shared", ] [[package]] name = "phf_codegen" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" dependencies = [ "phf_generator", "phf_shared", @@ -2813,9 +2799,9 @@ dependencies = [ [[package]] name = "phf_generator" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ "phf_shared", "rand", @@ -2823,12 +2809,11 @@ dependencies = [ [[package]] name = "phf_shared" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ "siphasher", - "uncased", ] [[package]] @@ -2848,14 +2833,14 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -2863,37 +2848,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkcs1" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff33bdbdfc54cc98a2eca766ebdec3e1b8fb7387523d5c9c9a2891da856f719" -dependencies = [ - "der 0.6.1", - "pkcs8 0.9.0", - "spki 0.6.0", - "zeroize", -] - [[package]] name = "pkcs1" version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" dependencies = [ - "der 0.7.8", - "pkcs8 0.10.2", - "spki 0.7.2", -] - -[[package]] -name = "pkcs8" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" -dependencies = [ - "der 0.6.1", - "spki 0.6.0", + "der", + "pkcs8", + "spki", ] [[package]] @@ -2902,8 +2865,8 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der 0.7.8", - "spki 0.7.2", + "der", + "spki", ] [[package]] @@ -2914,9 +2877,9 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "platforms" -version = "3.0.2" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" [[package]] name = "polyval" @@ -3026,7 +2989,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", "version_check", "yansi 1.0.0-rc.1", ] @@ -3049,7 +3012,7 @@ checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", "heck", - "itertools", + "itertools 0.10.5", "lazy_static", "log", "multimap", @@ -3070,7 +3033,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", - "itertools", + "itertools 0.10.5", "proc-macro2", "quote", "syn 1.0.109", @@ -3148,15 +3111,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.3.5" @@ -3166,17 +3120,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall 0.2.16", - "thiserror", -] - [[package]] name = "ref-cast" version = "1.0.20" @@ -3194,19 +3137,19 @@ checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] name = "regex" -version = "1.9.3" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.6", - "regex-syntax 0.7.4", + "regex-automata 0.3.8", + "regex-syntax 0.7.5", ] [[package]] @@ -3220,13 +3163,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax 0.7.5", ] [[package]] @@ -3237,9 +3180,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "reqwest" @@ -3247,7 +3190,7 @@ version = "0.11.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "bytes", "encoding_rs", "futures-core", @@ -3345,7 +3288,7 @@ dependencies = [ "memchr", "multer", "num_cpus", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "rand", "ref-cast", @@ -3376,7 +3319,7 @@ dependencies = [ "proc-macro2", "quote", "rocket_http", - "syn 2.0.29", + "syn 2.0.32", "unicode-xid", ] @@ -3417,26 +3360,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rsa" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55a77d189da1fee555ad95b7e50e7457d91c0e089ec68ca69ad2989413bbdab4" -dependencies = [ - "byteorder", - "digest", - "num-bigint-dig", - "num-integer", - "num-iter", - "num-traits", - "pkcs1 0.4.1", - "pkcs8 0.9.0", - "rand_core", - "signature", - "subtle", - "zeroize", -] - [[package]] name = "rsa" version = "0.9.2" @@ -3450,11 +3373,11 @@ dependencies = [ "num-integer", "num-iter", "num-traits", - "pkcs1 0.7.5", - "pkcs8 0.10.2", + "pkcs1", + "pkcs8", "rand_core", "signature", - "spki 0.7.2", + "spki", "subtle", "zeroize", ] @@ -3501,9 +3424,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.8" +version = "0.38.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" dependencies = [ "bitflags 2.4.0", "errno", @@ -3514,9 +3437,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.6" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", @@ -3542,7 +3465,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", ] [[package]] @@ -3638,9 +3561,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct", - "der 0.7.8", + "der", "generic-array", - "pkcs8 0.10.2", + "pkcs8", "subtle", "zeroize", ] @@ -3705,9 +3628,9 @@ checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" [[package]] name = "serde" -version = "1.0.186" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f5db24220c009de9bd45e69fb2938f4b6d2df856aa9304ce377b3180f83b7c1" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] @@ -3734,20 +3657,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.186" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad697f7e0b65af4983a4ce8f56ed5b357e8d3c36651bf6a7e13639c17b8e670" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "2cc66a619ed80bf7a0f6b17dd063a84b88f6dea1813737cf469aef1d081142c2" dependencies = [ "itoa", "ryu", @@ -3766,9 +3689,9 @@ dependencies = [ [[package]] name = "serde_plain" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6018081315db179d0ce57b1fe4b62a12a0028c9cf9bbef868c9cf477b3c34ae" +checksum = "9ce1fc6db65a611022b23a0dec6975d63fb80a302cb3388835ff02c097258d50" dependencies = [ "serde", ] @@ -3811,7 +3734,7 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ca3b16a3d82c4088f343b7480a93550b3eabe1a358569c2dfe38bbcead07237" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "chrono", "hex", "indexmap 1.9.3", @@ -3831,7 +3754,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] @@ -3978,15 +3901,8 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - -[[package]] -name = "spki" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ - "base64ct", - "der 0.6.1", + "lock_api", ] [[package]] @@ -3996,88 +3912,95 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", - "der 0.7.8", + "der", ] [[package]] name = "sqlformat" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c12bc9199d1db8234678b7051747c07f517cdcf019262d1847b94ec8b1aee3e" +checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85" dependencies = [ - "itertools", + "itertools 0.11.0", "nom", "unicode_categories", ] [[package]] name = "sqlx" -version = "0.6.3" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8de3b03a925878ed54a954f621e64bf55a3c1bd29652d0d1a17830405350188" +checksum = "8e58421b6bc416714d5115a2ca953718f6c621a51b68e4f4922aea5a4391a721" dependencies = [ "sqlx-core", "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", ] [[package]] name = "sqlx-core" -version = "0.6.3" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8241483a83a3f33aa5fff7e7d9def398ff9990b2752b6c6112b83c6d246029" +checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53" dependencies = [ - "ahash 0.7.6", + "ahash", "atoi", - "base64 0.13.1", - "bitflags 1.3.2", "byteorder", "bytes", "chrono", "crc", "crossbeam-queue", - "dirs", "dotenvy", "either", "event-listener", "futures-channel", "futures-core", "futures-intrusive", + "futures-io", "futures-util", "hashlink", "hex", - "hkdf", - "hmac", - "indexmap 1.9.3", + "indexmap 2.0.0", "ipnetwork", - "itoa", - "libc", "log", - "md-5", "memchr", + "native-tls", "once_cell", "paste", "percent-encoding", - "rand", "serde", "serde_json", - "sha1", "sha2", "smallvec", "sqlformat", - "sqlx-rt", - "stringprep", "thiserror", + "tokio", "tokio-stream", + "tracing", "url", "uuid", - "whoami", ] [[package]] name = "sqlx-macros" -version = "0.6.3" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "208e3165167afd7f3881b16c1ef3f2af69fa75980897aac8874a0696516d12c2" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 1.0.109", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9966e64ae989e7e575b19d7265cb79d7fc3cbbdf179835cb0d716f294c2049c9" +checksum = "8a4a8336d278c62231d87f24e8a7a74898156e34c1c18942857be2acb29c7dfc" dependencies = [ "dotenvy", "either", @@ -4090,21 +4013,123 @@ dependencies = [ "serde_json", "sha2", "sqlx-core", - "sqlx-rt", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", "syn 1.0.109", + "tempfile", + "tokio", "url", ] [[package]] -name = "sqlx-rt" -version = "0.6.3" +name = "sqlx-mysql" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "804d3f245f894e61b1e6263c84b23ca675d96753b5abfd5cc8597d86806e8024" +checksum = "8ca69bf415b93b60b80dc8fda3cb4ef52b2336614d8da2de5456cc942a110482" dependencies = [ - "native-tls", + "atoi", + "base64 0.21.4", + "bitflags 2.4.0", + "byteorder", + "bytes", + "chrono", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", "once_cell", - "tokio", - "tokio-native-tls", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "uuid", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0db2df1b8731c3651e204629dd55e52adbae0462fa1bdcbed56a2302c18181e" +dependencies = [ + "atoi", + "base64 0.21.4", + "bitflags 2.4.0", + "byteorder", + "chrono", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "ipnetwork", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand", + "serde", + "serde_json", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "uuid", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4c21bf34c7cae5b283efb3ac1bcc7670df7561124dc2f8bdc0b59be40f79a2" +dependencies = [ + "atoi", + "chrono", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "tracing", + "url", + "uuid", ] [[package]] @@ -4133,10 +4158,11 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stringprep" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3737bde7edce97102e0e2b15365bf7a20bfdb5f60f4f9e8d7004258a51a8da" +checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" dependencies = [ + "finl_unicode", "unicode-bidi", "unicode-normalization", ] @@ -4166,7 +4192,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] @@ -4188,9 +4214,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", @@ -4229,16 +4255,16 @@ checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand 2.0.0", - "redox_syscall 0.3.5", + "redox_syscall", "rustix", "windows-sys", ] [[package]] name = "tera" -version = "1.19.0" +version = "1.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ab29bb4f3e256ae6ad5c3e2775aa1f8829f2c0c101fc407bfd3a6df15c60c5" +checksum = "970dff17c11e884a4a09bc76e3a17ef71e01bb13447a11e85226e254fe6d10b8" dependencies = [ "chrono", "chrono-tz", @@ -4253,44 +4279,44 @@ dependencies = [ "serde", "serde_json", "slug", - "thread_local", "unic-segment", ] [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] name = "thread_local" -version = "1.1.4" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ + "cfg-if", "once_cell", ] [[package]] name = "time" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07" +checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" dependencies = [ "deranged", "itoa", @@ -4307,9 +4333,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733d258752e9303d392b94b75230d07b0b9c489350c69b851fc6c065fde3e8f9" +checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" dependencies = [ "time-core", ] @@ -4349,7 +4375,7 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2 0.5.3", @@ -4375,7 +4401,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] @@ -4425,9 +4451,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ "serde", "serde_spanned", @@ -4446,9 +4472,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.0.0", "serde", @@ -4466,7 +4492,7 @@ dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.21.2", + "base64 0.21.4", "bytes", "flate2", "futures-core", @@ -4542,6 +4568,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4555,7 +4582,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] [[package]] @@ -4768,9 +4795,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna 0.4.0", @@ -4814,9 +4841,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -4858,7 +4885,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", "wasm-bindgen-shared", ] @@ -4892,7 +4919,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4984,13 +5011,14 @@ dependencies = [ [[package]] name = "which" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ "either", - "libc", + "home", "once_cell", + "rustix", ] [[package]] @@ -4998,10 +5026,6 @@ name = "whoami" version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" -dependencies = [ - "wasm-bindgen", - "web-sys", -] [[package]] name = "winapi" @@ -5196,5 +5220,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.32", ] diff --git a/Cargo.toml b/Cargo.toml index 75fd24f6e..c17c78e14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,32 +16,31 @@ chrono = { version = "0.4", default-features = false, features = [ "serde", "std", ] } -clap = { version = "4.0", features = ["derive", "env"] } +clap = { version = "4.4", features = ["derive", "env"] } dotenvy = "0.15" -ethers-core = { version = "2.0", features = ["eip712"] } -ethabi = "18.0" +ethers-core = "2.0" fern = { version = "0.6", features = ["colored"] } humantime = "2.1" -# match ipnetwork version from sqlx-core -ipnetwork = { version = "0.19", features = ["serde"] } -jsonwebtoken = "8.1" +# match ipnetwork version from sqlx +ipnetwork = { version = "0.20", features = ["serde"] } +jsonwebtoken = "8.3" lazy_static = "1.4" ldap3 = "0.11" lettre = { version = "0.10", features = ["tokio1", "tokio1-native-tls"] } log = "0.4" md4 = "0.10" otpauth = "0.4" -openidconnect = { version = "3.0", default-features = false, optional = true } +openidconnect = { version = "3.3", default-features = false, optional = true } pulldown-cmark = "0.9" prost = "0.11" rand = "0.8" rand_core = { version = "0.6", default-features = false, features = [ "getrandom", ] } -regex = "1.8" +regex = "1.9" reqwest = { version = "0.11", features = ["json"] } rocket = { version = "0.5.0-rc.3", features = ["json", "secrets"] } -rsa = { version = "0.8", features = ["pem"] } +rsa = { version = "0.9", features = ["pem"] } rust-ini = "0.19" secp256k1 = { version = "0.27", features = [ "recovery", @@ -55,10 +54,9 @@ serde_cbor = { version = "0.12.0-dev", package = "serde_cbor_2" } serde_json = "1.0.104" serde_urlencoded = "0.7" sha-1 = "0.10" -sqlx = { version = "0.6", features = [ +sqlx = { version = "0.7", features = [ "chrono", "ipnetwork", - "offline", "runtime-tokio-native-tls", "postgres", "uuid", @@ -76,14 +74,13 @@ tokio = { version = "1", features = [ ] } tokio-stream = "0.1" tonic = { version = "0.9", features = ["gzip", "tls", "tls-roots"] } -uuid = { version = "1.1", features = ["v4"] } +uuid = { version = "1.4", features = ["v4"] } webauthn-authenticator-rs = { version = "0.4" } webauthn-rs = { version = "0.4", features = [ "danger-allow-state-serialisation", ] } -webauthn-rs-proto = "0.4.9" -# Use pre to match zeroize version used by ethers -x25519-dalek = { version = "2.0.0-rc.2", features = ["static_secrets"] } +webauthn-rs-proto = "0.4" +x25519-dalek = { version = "2.0", features = ["static_secrets"] } [dev-dependencies] claims = "0.7" diff --git a/Dockerfile b/Dockerfile index 263fcc4b2..ae9f6d2c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.71 as chef +FROM rust:1.72 as chef WORKDIR /build @@ -21,13 +21,13 @@ RUN cargo chef cook --release --recipe-path recipe.json # build project RUN apt-get update && apt-get -y install protobuf-compiler libprotobuf-dev -COPY Cargo.toml Cargo.lock build.rs sqlx-data.json ./ +COPY Cargo.toml Cargo.lock build.rs ./ +COPY .sqlx .sqlx COPY src src COPY templates templates COPY model-derive model-derive COPY proto proto COPY migrations migrations -ENV SQLX_OFFLINE true RUN cargo install --locked --path . --root /build FROM node:20.5-alpine3.17 as web @@ -43,9 +43,9 @@ RUN pnpm run generate-translation-types RUN pnpm build # run -FROM debian:bullseye-slim as runtime +FROM debian:bookworm-slim as runtime RUN apt-get update -y && \ - apt-get install --no-install-recommends -y ca-certificates && \ + apt-get install --no-install-recommends -y ca-certificates libssl-dev && \ rm -rf /var/lib/apt/lists/* WORKDIR /app COPY --from=builder /build/bin/defguard . diff --git a/docker-compose.e2e.yaml b/docker-compose.e2e.yaml index 3d9371ef4..246697d9e 100644 --- a/docker-compose.e2e.yaml +++ b/docker-compose.e2e.yaml @@ -27,7 +27,7 @@ services: - db db: - image: postgres:14-alpine + image: postgres:15-alpine environment: POSTGRES_DB: defguard POSTGRES_USER: defguard diff --git a/docker-compose.ldap.yaml b/docker-compose.ldap.yaml index 6c69e8067..fd6ebd058 100644 --- a/docker-compose.ldap.yaml +++ b/docker-compose.ldap.yaml @@ -46,7 +46,7 @@ services: - NET_ADMIN db: - image: postgres:14-alpine + image: postgres:15-alpine environment: POSTGRES_DB: defguard POSTGRES_USER: defguard diff --git a/docker-compose.yaml b/docker-compose.yaml index ed30a06cf..de0f90c79 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,6 +7,7 @@ services: context: . dockerfile: Dockerfile environment: + DEFGUARD_COOKIE_INSECURE: true DEFGUARD_SECRET_KEY: aa5a506b11d719dd7170f57f5d9947faf8eb0bc2be1325e42aa0237c3dcfd26456e73dff9eef3b12c7bcf8711b45e3e703d8e21ee1c08520f5e12e3f5772da94 DEFGUARD_AUTH_SECRET: defguard-auth-secret DEFGUARD_GATEWAY_SECRET: defguard-gateway-secret @@ -42,7 +43,7 @@ services: - NET_ADMIN db: - image: postgres:14-alpine + image: postgres:15-alpine environment: POSTGRES_DB: defguard POSTGRES_USER: defguard diff --git a/docs/header.png b/docs/header.png index 6e4d1b9d2..0a1b94068 100644 Binary files a/docs/header.png and b/docs/header.png differ diff --git a/docs/network-overview.png b/docs/network-overview.png index d5141cfd0..ea6798517 100644 Binary files a/docs/network-overview.png and b/docs/network-overview.png differ diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 000000000..743f7cd99 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "1.72.0" diff --git a/sqlx-data.json b/sqlx-data.json deleted file mode 100644 index 42fafe863..000000000 --- a/sqlx-data.json +++ /dev/null @@ -1,4965 +0,0 @@ -{ - "db": "PostgreSQL", - "0377049270e6dcc4f0ec3571bd998dcdbab8366524ff1f20f48a208b9f7dd9c6": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "client_id", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "client_secret", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "redirect_uri", - "ordinal": 3, - "type_info": "TextArray" - }, - { - "name": "scope", - "ordinal": 4, - "type_info": "TextArray" - }, - { - "name": "name", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "enabled", - "ordinal": 6, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id \"id?\", client_id, client_secret, redirect_uri, scope, name, enabled FROM oauth2client WHERE client_id = $1 AND enabled" - }, - "05e3fce0c51856f6033195c7523a2b5fd1c2a7968a7abd27394422a7c93e8815": { - "describe": { - "columns": [ - { - "name": "collected_at: NaiveDateTime", - "ordinal": 0, - "type_info": "Timestamp" - }, - { - "name": "upload", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "download", - "ordinal": 2, - "type_info": "Int8" - } - ], - "nullable": [ - null, - null, - null - ], - "parameters": { - "Left": [ - "Text", - "Timestamp", - "Int8", - "Int8" - ] - } - }, - "query": "\n SELECT\n date_trunc($1, collected_at) \"collected_at: NaiveDateTime\",\n cast(sum(upload) AS bigint) upload, cast(sum(download) AS bigint) download\n FROM wireguard_peer_stats_view\n WHERE collected_at >= $2 AND network = $3\n GROUP BY 1\n ORDER BY 1\n LIMIT $4\n " - }, - "06be7b39c87c3a1d1465dfb007937b5b584f60e9094a18936b482c4dfb6b1aca": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id \"id?\", \"name\" FROM \"group\"" - }, - "06f847d99d452dafd10f4a6bec309c330d76eb5d0a34012bd75395b13e3ff659": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "wireguard_pubkey", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "created", - "ordinal": 4, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id \"id?\", \"name\",\"wireguard_pubkey\",\"user_id\",\"created\" FROM \"device\"" - }, - "0739dda752a2a5b4bb6483d8fdc87b7065d01d6d5990c7d344be2d0068cac835": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "client_id", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "client_secret", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "redirect_uri", - "ordinal": 3, - "type_info": "TextArray" - }, - { - "name": "scope", - "ordinal": 4, - "type_info": "TextArray" - }, - { - "name": "name", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "enabled", - "ordinal": 6, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id \"id?\", client_id, client_secret, redirect_uri, scope, name, enabled FROM oauth2client WHERE client_id = $1" - }, - "087a0d357b61dd2266e804982fba2e6ca06a3f95da3225be6fcc38d324c143e7": { - "describe": { - "columns": [ - { - "name": "max", - "ordinal": 0, - "type_info": "Timestamp" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT MAX(started_at) FROM wireguard_stats_purge" - }, - "0ad599ef120ecc02b030bd1276172929d6a612846acf4a5489c36a04cb57de59": { - "describe": { - "columns": [ - { - "name": "recovery_codes", - "ordinal": 0, - "type_info": "TextArray" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT recovery_codes FROM \"user\" WHERE id = $1" - }, - "0b53e81d6f1ce3c3a68c871e7a4b9e41db58b112d12281516e10421d46fbbd94": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "wireguard_pubkey", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "created", - "ordinal": 4, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "TextArray" - ] - } - }, - "query": "\n SELECT DISTINCT ON (d.id) d.id as \"id?\", d.name, d.wireguard_pubkey, d.user_id, d.created\n FROM device d\n JOIN \"user\" u ON d.user_id = u.id\n JOIN group_user gu ON u.id = gu.user_id\n JOIN \"group\" g ON gu.group_id = g.id\n WHERE g.\"name\" IN (SELECT * FROM UNNEST($1::text[]))\n ORDER BY d.id ASC\n " - }, - "0b64dc92dc09d7fc080c6d2f2d016db4c11f9a99442428a9e473c75c7633927b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM \"group\" WHERE id = $1" - }, - "0bb2828da4f0631d12773b904a0f917b7d43ef12809d9398ed2cf2a0a314d5cf": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM \"authorization_code\" WHERE id = $1" - }, - "10dacbf1e23b51d0ae069dd0a06c0b135662c6c1564ba0605fee42cf69c93bc1": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Bool", - "Bool", - "Bytea", - { - "Custom": { - "kind": { - "Enum": [ - "none", - "one_time_password", - "webauthn", - "web3" - ] - }, - "name": "mfa_method" - } - }, - "TextArray" - ] - } - }, - "query": "UPDATE \"user\" SET \"username\" = $2,\"password_hash\" = $3,\"last_name\" = $4,\"first_name\" = $5,\"email\" = $6,\"phone\" = $7,\"ssh_key\" = $8,\"pgp_key\" = $9,\"pgp_cert_id\" = $10,\"mfa_enabled\" = $11,\"totp_enabled\" = $12,\"totp_secret\" = $13,\"mfa_method\" = $14,\"recovery_codes\" = $15 WHERE id = $1" - }, - "125d37ad8e24d8fd71b3d695ec4ec2787e4f0de98005b0003c63b9bdedad9aa1": { - "describe": { - "columns": [ - { - "name": "oauth2client_id!", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "oauth2client_name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 2, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT oauth2client.id \"oauth2client_id!\", oauth2client.name \"oauth2client_name\", oauth2authorizedapp.user_id \"user_id\" FROM oauth2authorizedapp JOIN oauth2client ON oauth2client.id = oauth2authorizedapp.oauth2client_id WHERE oauth2authorizedapp.user_id = $1" - }, - "1559d43b6ed3d6c2e62011acc1dfb827793d43053e5ed1c87aac818a47e38934": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "username", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "password_hash", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "last_name", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "first_name", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "email", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "phone", - "ordinal": 6, - "type_info": "Text" - }, - { - "name": "ssh_key", - "ordinal": 7, - "type_info": "Text" - }, - { - "name": "pgp_key", - "ordinal": 8, - "type_info": "Text" - }, - { - "name": "pgp_cert_id", - "ordinal": 9, - "type_info": "Text" - }, - { - "name": "mfa_enabled", - "ordinal": 10, - "type_info": "Bool" - }, - { - "name": "totp_enabled", - "ordinal": 11, - "type_info": "Bool" - }, - { - "name": "totp_secret", - "ordinal": 12, - "type_info": "Bytea" - }, - { - "name": "mfa_method: _", - "ordinal": 13, - "type_info": { - "Custom": { - "kind": { - "Enum": [ - "none", - "one_time_password", - "webauthn", - "web3" - ] - }, - "name": "mfa_method" - } - } - }, - { - "name": "recovery_codes: _", - "ordinal": 14, - "type_info": "TextArray" - } - ], - "nullable": [ - false, - false, - true, - false, - false, - false, - true, - true, - true, - true, - false, - false, - true, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", \"username\",\"password_hash\",\"last_name\",\"first_name\",\"email\",\"phone\",\"ssh_key\",\"pgp_key\",\"pgp_cert_id\",\"mfa_enabled\",\"totp_enabled\",\"totp_secret\",\"mfa_method\" \"mfa_method: _\",\"recovery_codes\" \"recovery_codes: _\" FROM \"user\" WHERE id = $1" - }, - "15d8aae5b2f7cbc1c415f8e589b12c762f8f7f386beea4543f96f471814a6929": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "oauth2client_id", - "ordinal": 2, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id \"id?\", \"user_id\",\"oauth2client_id\" FROM \"oauth2authorizedapp\"" - }, - "169a39acbf7e6b74fd9f538047b0af650fe1bfa21d844a216e80965011290412": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM \"wallet\" WHERE id = $1" - }, - "18bffe90d894f5a122df97ef37c4afb69f97c74acf36ee7596476ab7fee850b3": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "passkey", - "ordinal": 3, - "type_info": "Bytea" - } - ], - "nullable": [ - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", user_id, name, passkey FROM webauthn WHERE user_id = $1" - }, - "18e96b44b04c6ed00424ac497889e5952c877f1d14216f5b083fd7fa7c927bb7": { - "describe": { - "columns": [ - { - "name": "device_id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "wireguard_network_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "wireguard_ip: IpAddr", - "ordinal": 2, - "type_info": "Inet" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT device_id, wireguard_network_id, wireguard_ip as \"wireguard_ip: IpAddr\" FROM\n wireguard_network_device\n WHERE wireguard_network_id = $1" - }, - "1996dee9b5e3b8f8a1f63f99e83230927c09d30ceabd07dc193502ce780a3aed": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM \"oauth2client\" WHERE id = $1" - }, - "1cb8e98cf71355633ee9f09594c210349dceeeabc7212dc49ac484ba949ec9e5": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Bytea", - "Text" - ] - } - }, - "query": "UPDATE session SET webauthn_challenge = $1 WHERE id = $2" - }, - "1feeccc3729029c40d9cbecd21919fc184af94f52cb135c4c8bd2830c92a47db": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "UPDATE wallet SET use_for_mfa = FALSE WHERE user_id = $1" - }, - "2163bfa0df95cc31d0325f2a2a6521ef7e3b701ba5a97a74d5e6b3637c626dda": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM \"settings\" WHERE id = $1" - }, - "248067b0803eaf09f88746459986ac8cccb04723772c5b3ec745dbbdf47efe30": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8", - "Text", - "Text", - "Text", - "Text", - "Int8", - "Text", - "Text" - ] - } - }, - "query": "INSERT INTO \"authorization_code\" (\"user_id\",\"client_id\",\"code\",\"redirect_uri\",\"scope\",\"auth_time\",\"nonce\",\"code_challenge\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id" - }, - "28faeea866a4b6bd7c816b9d375e38fc174e88b2c111b10dda6bce475737154e": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "INSERT INTO \"oauth2authorizedapp\" (\"user_id\",\"oauth2client_id\") VALUES ($1,$2) RETURNING id" - }, - "2e73d767e5c98702de3d5340e9f0818f346d9d25547aedd4dc388347b7620cfd": { - "describe": { - "columns": [ - { - "name": "address!", - "ordinal": 0, - "type_info": "Text" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "chain_id", - "ordinal": 2, - "type_info": "Int8" - }, - { - "name": "use_for_mfa", - "ordinal": 3, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT address \"address!\", name, chain_id, use_for_mfa FROM wallet WHERE user_id = $1 AND validation_timestamp IS NOT NULL" - }, - "300bf0d77c93e2e0d731f22278d7747ae93b8534e99f7a8c56e46d3e4d1fc34e": { - "describe": { - "columns": [ - { - "name": "oauth2authorizedapp_id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "access_token", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "refresh_token", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "redirect_uri", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "scope", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "expires_in", - "ordinal": 5, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT oauth2authorizedapp_id, access_token, refresh_token, redirect_uri, scope, expires_in FROM oauth2token WHERE oauth2authorizedapp_id = $1" - }, - "31b3fcaa8109121f985a2c740475f1d77fe8dcbcab76e64164be140ad361ab14": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - { - "Custom": { - "kind": { - "Enum": [ - "none", - "one_time_password", - "webauthn", - "web3" - ] - }, - "name": "mfa_method" - } - } - ] - } - }, - "query": "UPDATE \"user\" SET mfa_method = $2 WHERE id = $1" - }, - "3245de884168dd4a396376933d4d462728c1441c603c69161813cf4ea19c65b6": { - "describe": { - "columns": [ - { - "name": "bool!", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT totp_enabled OR coalesce(bool_or(wallet.use_for_mfa), FALSE) OR count(webauthn.id) > 0 \"bool!\" FROM \"user\" LEFT JOIN wallet ON wallet.user_id = \"user\".id LEFT JOIN webauthn ON webauthn.user_id = \"user\".id WHERE \"user\".id = $1 GROUP BY totp_enabled;" - }, - "32ed6b107ba5012c9f798bd197abfefafc692d81699e48cae16d09bf88d3a5b5": { - "describe": { - "columns": [ - { - "name": "oauth2authorizedapp_id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "access_token", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "refresh_token", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "redirect_uri", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "scope", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "expires_in", - "ordinal": 5, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT oauth2authorizedapp_id, access_token, refresh_token, redirect_uri, scope, expires_in FROM oauth2token WHERE refresh_token = $1" - }, - "336532632eb24ed923842cdc8976e26a7f9b8d28ef1d7011407f388d3e983e62": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "address", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "name", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "chain_id", - "ordinal": 4, - "type_info": "Int8" - }, - { - "name": "challenge_message", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "challenge_signature", - "ordinal": 6, - "type_info": "Text" - }, - { - "name": "creation_timestamp", - "ordinal": 7, - "type_info": "Timestamp" - }, - { - "name": "validation_timestamp", - "ordinal": 8, - "type_info": "Timestamp" - }, - { - "name": "use_for_mfa", - "ordinal": 9, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - true, - false, - true, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id \"id?\", \"user_id\",\"address\",\"name\",\"chain_id\",\"challenge_message\",\"challenge_signature\",\"creation_timestamp\",\"validation_timestamp\",\"use_for_mfa\" FROM \"wallet\"" - }, - "33813a92407a52297f68cff8c6c3dcd8ae0d54ac743398e9ab3cf9e6a28c3660": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "DELETE FROM group_user WHERE group_id = $1 AND user_id = $2" - }, - "33a1e2f1904757c775d389fa99d67916b7b220d6aa1fe8bb6690f85ed1cd5666": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "wireguard_pubkey", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "created", - "ordinal": 4, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT device.id \"id?\", name, wireguard_pubkey, user_id, created FROM device JOIN \"user\" ON device.user_id = \"user\".id WHERE \"user\".username = $1" - }, - "33e91546890789d9341b06c541648149baf908b4f2ba35da8adc07feda6299e3": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "url", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "description", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "token", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "enabled", - "ordinal": 4, - "type_info": "Bool" - }, - { - "name": "on_user_created", - "ordinal": 5, - "type_info": "Bool" - }, - { - "name": "on_user_deleted", - "ordinal": 6, - "type_info": "Bool" - }, - { - "name": "on_user_modified", - "ordinal": 7, - "type_info": "Bool" - }, - { - "name": "on_hwkey_provision", - "ordinal": 8, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id \"id?\", url, description, token, enabled, on_user_created, on_user_deleted, on_user_modified, on_hwkey_provision FROM webhook WHERE url = $1" - }, - "381a91411dae9517c285d2f57cf81ac75d3bf0812c190ef118d6dce1b564b37d": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Bool", - "Bool", - "Bytea" - ] - } - }, - "query": "UPDATE \"user\" SET mfa_enabled = $2, totp_enabled = $3 AND totp_secret = $4 WHERE id = $1" - }, - "3874e3ddc2d3b4b455fddca611702b86a1f2d02b1878f6f262211f97e0d661b2": { - "describe": { - "columns": [ - { - "name": "count!", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT count(*) \"count!\" FROM wireguard_network_device WHERE wireguard_network_id = $1" - }, - "3a0fc5bc3005b4b6b5d6ccf2cf71b7915cda2c440eb8f3194480bbaf2969228e": { - "describe": { - "columns": [ - { - "name": "mfa_method: _", - "ordinal": 0, - "type_info": { - "Custom": { - "kind": { - "Enum": [ - "none", - "one_time_password", - "webauthn", - "web3" - ] - }, - "name": "mfa_method" - } - } - }, - { - "name": "totp_available", - "ordinal": 1, - "type_info": "Bool" - }, - { - "name": "web3_available!", - "ordinal": 2, - "type_info": "Bool" - }, - { - "name": "webauthn_available!", - "ordinal": 3, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - null, - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT mfa_method \"mfa_method: _\", totp_enabled totp_available, (SELECT count(*) > 0 FROM wallet WHERE user_id = $1 AND wallet.use_for_mfa) \"web3_available!\", (SELECT count(*) > 0 FROM webauthn WHERE user_id = $1) \"webauthn_available!\" FROM \"user\" WHERE \"user\".id = $1" - }, - "3be325a5e6b8ef591fde2e339eee96d6fba101fc81565cffbc26dfb9f8a4fd8d": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM \"webhook\" WHERE id = $1" - }, - "3d7def96ee88ac4f1c46ff6ef93b06b8acc1f4bc9e34ff1cca6d64d6d281c039": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "device_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "collected_at", - "ordinal": 2, - "type_info": "Timestamp" - }, - { - "name": "network", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "endpoint", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "upload", - "ordinal": 5, - "type_info": "Int8" - }, - { - "name": "download", - "ordinal": 6, - "type_info": "Int8" - }, - { - "name": "latest_handshake", - "ordinal": 7, - "type_info": "Timestamp" - }, - { - "name": "allowed_ips", - "ordinal": 8, - "type_info": "Text" - } - ], - "nullable": [ - false, - false, - false, - false, - true, - false, - false, - false, - true - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id \"id?\", \"device_id\",\"collected_at\",\"network\",\"endpoint\",\"upload\",\"download\",\"latest_handshake\",\"allowed_ips\" FROM \"wireguard_peer_stats\"" - }, - "3daa0bbce8f2f5d0d30b104db8fd043e7a4938d94962844c66a2be3d242c00ce": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Timestamp", - "Int8", - "Text", - "Int8", - "Int8", - "Timestamp", - "Text" - ] - } - }, - "query": "UPDATE \"wireguard_peer_stats\" SET \"device_id\" = $2,\"collected_at\" = $3,\"network\" = $4,\"endpoint\" = $5,\"upload\" = $6,\"download\" = $7,\"latest_handshake\" = $8,\"allowed_ips\" = $9 WHERE id = $1" - }, - "3fc4cbb5242fb2e3e3b5de7bcf4c1975f2838d58ffc37b68b57e7ec5acd21bde": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Text", - "Text", - "Text", - "Bool", - "Bool", - "Bool", - "Bool", - "Bool" - ] - } - }, - "query": "UPDATE \"webhook\" SET \"url\" = $2,\"description\" = $3,\"token\" = $4,\"enabled\" = $5,\"on_user_created\" = $6,\"on_user_deleted\" = $7,\"on_user_modified\" = $8,\"on_hwkey_provision\" = $9 WHERE id = $1" - }, - "4183b4f169126bcc511ff76c7554622fc71857d0d459588b4f3934307611aee7": { - "describe": { - "columns": [ - { - "name": "active_users!", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "active_devices!", - "ordinal": 1, - "type_info": "Int8" - } - ], - "nullable": [ - null, - null - ], - "parameters": { - "Left": [ - "Timestamp", - "Int8" - ] - } - }, - "query": "\n SELECT\n COALESCE(COUNT(DISTINCT(u.id)), 0) as \"active_users!\",\n COALESCE(COUNT(DISTINCT(s.device_id)), 0) as \"active_devices!\"\n FROM \"user\" u\n JOIN device d ON d.user_id = u.id\n JOIN wireguard_peer_stats s ON s.device_id = d.id\n WHERE latest_handshake >= $1 AND s.network = $2\n " - }, - "435e3f1969c8809b466228cbaa1811f62a4823257b0513a82a0c098218ea2062": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text", - "Text", - "Text", - "Bool", - "Bool", - "Bool", - "Bool", - "Bool" - ] - } - }, - "query": "INSERT INTO \"webhook\" (\"url\",\"description\",\"token\",\"enabled\",\"on_user_created\",\"on_user_deleted\",\"on_user_modified\",\"on_hwkey_provision\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id" - }, - "439bef62ccc846cccca2c6979e5698a7aaba2beb19645b720eefa73e4dcac942": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "wireguard_pubkey", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "created", - "ordinal": 4, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8", - "Text" - ] - } - }, - "query": "SELECT device.id \"id?\", name, wireguard_pubkey, user_id, created FROM device JOIN \"user\" ON device.user_id = \"user\".id WHERE device.id = $1 AND \"user\".username = $2" - }, - "443177d880a607fc5c545cad75db89ab8ca59b3b1bc9f5ed6847afd7fea9d68c": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "client_id", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "client_secret", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "redirect_uri: _", - "ordinal": 3, - "type_info": "TextArray" - }, - { - "name": "scope: _", - "ordinal": 4, - "type_info": "TextArray" - }, - { - "name": "name", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "enabled", - "ordinal": 6, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", \"client_id\",\"client_secret\",\"redirect_uri\" \"redirect_uri: _\",\"scope\" \"scope: _\",\"name\",\"enabled\" FROM \"oauth2client\" WHERE id = $1" - }, - "454f2edaee1d6c60e75f20ef4344e5ceba35c07316b4317b9b0a6e78b41de0bf": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Bool" - ] - } - }, - "query": "UPDATE \"user\" SET mfa_enabled = $2 WHERE id = $1" - }, - "45545d3190c14bb3e9528ab3d3a8522209f36956f65bf5a126682d5477db425e": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Inet" - ] - } - }, - "query": "\n UPDATE wireguard_network_device\n SET wireguard_ip = $3\n WHERE device_id = $1 AND wireguard_network_id = $2\n " - }, - "473aaa871ecb2e8485c770bf10c6245d2b8b2affb4e151dea34801fe00fff84a": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "openid_enabled", - "ordinal": 1, - "type_info": "Bool" - }, - { - "name": "ldap_enabled", - "ordinal": 2, - "type_info": "Bool" - }, - { - "name": "wireguard_enabled", - "ordinal": 3, - "type_info": "Bool" - }, - { - "name": "webhooks_enabled", - "ordinal": 4, - "type_info": "Bool" - }, - { - "name": "worker_enabled", - "ordinal": 5, - "type_info": "Bool" - }, - { - "name": "challenge_template", - "ordinal": 6, - "type_info": "Text" - }, - { - "name": "instance_name", - "ordinal": 7, - "type_info": "Text" - }, - { - "name": "main_logo_url", - "ordinal": 8, - "type_info": "Text" - }, - { - "name": "nav_logo_url", - "ordinal": 9, - "type_info": "Text" - }, - { - "name": "smtp_server", - "ordinal": 10, - "type_info": "Text" - }, - { - "name": "smtp_port", - "ordinal": 11, - "type_info": "Int4" - }, - { - "name": "smtp_encryption: _", - "ordinal": 12, - "type_info": { - "Custom": { - "kind": { - "Enum": [ - "none", - "starttls", - "implicittls" - ] - }, - "name": "smtp_encryption" - } - } - }, - { - "name": "smtp_user", - "ordinal": 13, - "type_info": "Text" - }, - { - "name": "smtp_password?: SecretString", - "ordinal": 14, - "type_info": "Text" - }, - { - "name": "smtp_sender", - "ordinal": 15, - "type_info": "Text" - }, - { - "name": "enrollment_vpn_step_optional", - "ordinal": 16, - "type_info": "Bool" - }, - { - "name": "enrollment_welcome_message", - "ordinal": 17, - "type_info": "Text" - }, - { - "name": "enrollment_welcome_email", - "ordinal": 18, - "type_info": "Text" - }, - { - "name": "enrollment_welcome_email_subject", - "ordinal": 19, - "type_info": "Text" - }, - { - "name": "enrollment_use_welcome_message_as_email", - "ordinal": 20, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - true, - true, - false, - true, - true, - true, - false, - true, - true, - true, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id \"id?\", \"openid_enabled\",\"ldap_enabled\",\"wireguard_enabled\",\"webhooks_enabled\",\"worker_enabled\",\"challenge_template\",\"instance_name\",\"main_logo_url\",\"nav_logo_url\",\"smtp_server\",\"smtp_port\",\"smtp_encryption\" \"smtp_encryption: _\",\"smtp_user\",\"smtp_password\" \"smtp_password?: SecretString\",\"smtp_sender\",\"enrollment_vpn_step_optional\",\"enrollment_welcome_message\",\"enrollment_welcome_email\",\"enrollment_welcome_email_subject\",\"enrollment_use_welcome_message_as_email\" FROM \"settings\"" - }, - "48ecfa6318149ac712807ca8fa0ec1fcb972f917729ffb9b7849830113d04bd8": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "passkey", - "ordinal": 3, - "type_info": "Bytea" - } - ], - "nullable": [ - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", \"user_id\",\"name\",\"passkey\" FROM \"webauthn\" WHERE id = $1" - }, - "49749227cacd46dd9a392d58233a511ee03c0df12cb28ce247d574923fee31a9": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "admin_id", - "ordinal": 2, - "type_info": "Int8" - }, - { - "name": "email", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "created_at", - "ordinal": 4, - "type_info": "Timestamp" - }, - { - "name": "expires_at", - "ordinal": 5, - "type_info": "Timestamp" - }, - { - "name": "used_at", - "ordinal": 6, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - true - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id, user_id, admin_id, email, created_at, expires_at, used_at FROM enrollment" - }, - "4f318cd5100bf4d155a555b927cc7421cb5324f70e427bd7e6f7312be4a20946": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "TextArray" - ] - } - }, - "query": "\n DELETE FROM wireguard_network_allowed_group\n WHERE network_id = $1 AND group_id IN (\n SELECT id\n FROM \"group\"\n WHERE name IN (SELECT * FROM UNNEST($2::text[]))\n )\n " - }, - "501e4426106d4972d7bd6d769bb6dd239be2168c4afdfc618de4c7facaad67a3": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "device_id!", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "collected_at!", - "ordinal": 2, - "type_info": "Timestamp" - }, - { - "name": "network!", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "endpoint", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "upload!", - "ordinal": 5, - "type_info": "Int8" - }, - { - "name": "download!", - "ordinal": 6, - "type_info": "Int8" - }, - { - "name": "latest_handshake!", - "ordinal": 7, - "type_info": "Timestamp" - }, - { - "name": "allowed_ips", - "ordinal": 8, - "type_info": "Text" - } - ], - "nullable": [ - false, - false, - false, - false, - true, - false, - false, - false, - true - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n SELECT id \"id?\", device_id \"device_id!\", collected_at \"collected_at!\", network \"network!\",\n endpoint, upload \"upload!\", download \"download!\", latest_handshake \"latest_handshake!\", allowed_ips\n FROM wireguard_peer_stats\n WHERE device_id = $1 AND network = $2\n ORDER BY collected_at DESC\n LIMIT 1\n " - }, - "52b8921f5ee56c73d44d71200514b84a1d5421bd9dd7d604cbc9ccbc2fe36039": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8Array" - ] - } - }, - "query": "DELETE FROM oauth2authorizedapp WHERE user_id = $1 AND oauth2client_id = ANY($2)" - }, - "52b93ff07493589383745923dbe340b5adde936a4e4474d530b70002eb92063e": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "url", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "description", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "token", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "enabled", - "ordinal": 4, - "type_info": "Bool" - }, - { - "name": "on_user_created", - "ordinal": 5, - "type_info": "Bool" - }, - { - "name": "on_user_deleted", - "ordinal": 6, - "type_info": "Bool" - }, - { - "name": "on_user_modified", - "ordinal": 7, - "type_info": "Bool" - }, - { - "name": "on_hwkey_provision", - "ordinal": 8, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id \"id?\", \"url\",\"description\",\"token\",\"enabled\",\"on_user_created\",\"on_user_deleted\",\"on_user_modified\",\"on_hwkey_provision\" FROM \"webhook\"" - }, - "560de8bc16c1bcc80d31c99dc4b788bf5eeef60689d104448989726a5999eb42": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Text", - "Text", - "Int8", - "Text", - "Text", - "Timestamp", - "Timestamp", - "Bool" - ] - } - }, - "query": "UPDATE \"wallet\" SET \"user_id\" = $2,\"address\" = $3,\"name\" = $4,\"chain_id\" = $5,\"challenge_message\" = $6,\"challenge_signature\" = $7,\"creation_timestamp\" = $8,\"validation_timestamp\" = $9,\"use_for_mfa\" = $10 WHERE id = $1" - }, - "57f9cef4b6b89be730168450c5dfe5bac9d102aecdb8c82f940b4f34e2b9ccd2": { - "describe": { - "columns": [ - { - "name": "name", - "ordinal": 0, - "type_info": "Text" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT \"group\".name FROM \"group\" JOIN group_user ON \"group\".id = group_user.group_id WHERE group_user.user_id = $1" - }, - "66d2e2f3156ce802a0018bea5aa0718b2ce599d44de6382e854174053a639f5a": { - "describe": { - "columns": [ - { - "name": "device_id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "wireguard_network_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "wireguard_ip: IpAddr", - "ordinal": 2, - "type_info": "Inet" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "SELECT device_id, wireguard_network_id, wireguard_ip as \"wireguard_ip: IpAddr\" FROM\n wireguard_network_device\n WHERE device_id = $1 AND wireguard_network_id = $2" - }, - "6b07d6ea56bcded73038dfd59cff3d7d15049caf771aec6b0fcd42bea7169998": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "address: _", - "ordinal": 2, - "type_info": "Inet" - }, - { - "name": "port", - "ordinal": 3, - "type_info": "Int4" - }, - { - "name": "pubkey", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "prvkey", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "endpoint", - "ordinal": 6, - "type_info": "Text" - }, - { - "name": "dns", - "ordinal": 7, - "type_info": "Text" - }, - { - "name": "allowed_ips: _", - "ordinal": 8, - "type_info": "InetArray" - }, - { - "name": "connected_at", - "ordinal": 9, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - false, - true - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id \"id?\", \"name\",\"address\" \"address: _\",\"port\",\"pubkey\",\"prvkey\",\"endpoint\",\"dns\",\"allowed_ips\" \"allowed_ips: _\",\"connected_at\" FROM \"wireguard_network\"" - }, - "6b659b309306098a1f8b5b5592facba9cd54f93f5239fbc62a858bb91f502472": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "client_id", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "client_secret", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "redirect_uri: _", - "ordinal": 3, - "type_info": "TextArray" - }, - { - "name": "scope: _", - "ordinal": 4, - "type_info": "TextArray" - }, - { - "name": "name", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "enabled", - "ordinal": 6, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id \"id?\", \"client_id\",\"client_secret\",\"redirect_uri\" \"redirect_uri: _\",\"scope\" \"scope: _\",\"name\",\"enabled\" FROM \"oauth2client\"" - }, - "6dfb9442da967755230ab2b7c5baf8eec06d64af5886e840bea1b32d2be10ca0": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Text", - "Text", - "Int8", - "Timestamp" - ] - } - }, - "query": "UPDATE \"device\" SET \"name\" = $2,\"wireguard_pubkey\" = $3,\"user_id\" = $4,\"created\" = $5 WHERE id = $1" - }, - "6e1a03b05c4522a63ffa580d23489b4e6339580d2d28d228cd002e8590b359a3": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "INSERT INTO \"user\" (username, password_hash, last_name, first_name, email) VALUES ('admin', $1, 'Administrator', 'DefGuard', 'admin@defguard') ON CONFLICT DO NOTHING RETURNING id" - }, - "70bd32dd667bbc7e0c6f7cdbb6234f22498c310685f84a2ea43659519adf86a5": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "username", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "last_name", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "first_name", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "email", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "phone", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "ssh_key", - "ordinal": 6, - "type_info": "Text" - }, - { - "name": "pgp_key", - "ordinal": 7, - "type_info": "Text" - }, - { - "name": "pgp_cert_id", - "ordinal": 8, - "type_info": "Text" - }, - { - "name": "mfa_enabled", - "ordinal": 9, - "type_info": "Bool" - }, - { - "name": "totp_enabled", - "ordinal": 10, - "type_info": "Bool" - }, - { - "name": "mfa_method: _", - "ordinal": 11, - "type_info": { - "Custom": { - "kind": { - "Enum": [ - "none", - "one_time_password", - "webauthn", - "web3" - ] - }, - "name": "mfa_method" - } - } - }, - { - "name": "recovery_codes!", - "ordinal": 12, - "type_info": "TextArray" - }, - { - "name": "password_hash", - "ordinal": 13, - "type_info": "Text" - }, - { - "name": "totp_secret", - "ordinal": 14, - "type_info": "Bytea" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - true, - true, - true, - true, - false, - false, - false, - null, - null, - null - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id \"id?\", username, last_name, first_name, email, phone, ssh_key, pgp_key, pgp_cert_id, mfa_enabled, totp_enabled, mfa_method \"mfa_method: _\", ARRAY[]::TEXT[] AS \"recovery_codes!\", '*' AS password_hash, CAST(NULL AS BYTEA) totp_secret FROM \"user\"" - }, - "71465915aa72eed5d35fb82149a1bd32df7c4f5af1457dfa5406b3c82fb77231": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM enrollment\n WHERE user_id = $1\n AND used_at IS NULL" - }, - "71e9c3921543a990ba6c6a8a0a9254757a1208ea9bfb2e0570626a39f8463467": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "admin_id", - "ordinal": 2, - "type_info": "Int8" - }, - { - "name": "email", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "created_at", - "ordinal": 4, - "type_info": "Timestamp" - }, - { - "name": "expires_at", - "ordinal": 5, - "type_info": "Timestamp" - }, - { - "name": "used_at", - "ordinal": 6, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - true - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id, user_id, admin_id, email, created_at, expires_at, used_at FROM enrollment WHERE id = $1" - }, - "7244c9c8e437770235fa6cdb48e66719abf054cae9a35f833b8418d974aa45e1": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "client_id", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "code", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "redirect_uri", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "scope", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "auth_time", - "ordinal": 6, - "type_info": "Int8" - }, - { - "name": "nonce", - "ordinal": 7, - "type_info": "Text" - }, - { - "name": "code_challenge", - "ordinal": 8, - "type_info": "Text" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", \"user_id\",\"client_id\",\"code\",\"redirect_uri\",\"scope\",\"auth_time\",\"nonce\",\"code_challenge\" FROM \"authorization_code\" WHERE id = $1" - }, - "727ed093b693f0f48e83779f9ee58de725cbec807ae286ae5900f426f2492f9d": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Timestamp", - "Text" - ] - } - }, - "query": "UPDATE enrollment SET used_at = $1 WHERE id = $2" - }, - "73ab0d514bbce0a69e1b22d9f5a2a58be7427882b368eef4d45529e9e85d885c": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Text", - "Inet", - "Int4", - "Text", - "Text", - "Text", - "Text", - "InetArray", - "Timestamp" - ] - } - }, - "query": "UPDATE \"wireguard_network\" SET \"name\" = $2,\"address\" = $3,\"port\" = $4,\"pubkey\" = $5,\"prvkey\" = $6,\"endpoint\" = $7,\"dns\" = $8,\"allowed_ips\" = $9,\"connected_at\" = $10 WHERE id = $1" - }, - "77532f50fc8765ac97323cd3df60df8ae443769670c459426d738ac8d4fab6f4": { - "describe": { - "columns": [ - { - "name": "id!", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id!\", name FROM webauthn WHERE user_id = $1" - }, - "77ca1d65a66cc81ad4855fed73539cdee5e50626f35bfef02fbd1378537c7f35": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Bool", - "Bool", - "Bytea", - { - "Custom": { - "kind": { - "Enum": [ - "none", - "one_time_password", - "webauthn", - "web3" - ] - }, - "name": "mfa_method" - } - }, - "TextArray" - ] - } - }, - "query": "INSERT INTO \"user\" (\"username\",\"password_hash\",\"last_name\",\"first_name\",\"email\",\"phone\",\"ssh_key\",\"pgp_key\",\"pgp_cert_id\",\"mfa_enabled\",\"totp_enabled\",\"totp_secret\",\"mfa_method\",\"recovery_codes\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14) RETURNING id" - }, - "78766325753732e8873adc2b04bf73a3770887ba3b28c8568e71a7e4b83ab7a4": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "client_id", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "code", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "redirect_uri", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "scope", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "auth_time", - "ordinal": 6, - "type_info": "Int8" - }, - { - "name": "nonce", - "ordinal": 7, - "type_info": "Text" - }, - { - "name": "code_challenge", - "ordinal": 8, - "type_info": "Text" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id \"id?\", \"user_id\",\"client_id\",\"code\",\"redirect_uri\",\"scope\",\"auth_time\",\"nonce\",\"code_challenge\" FROM \"authorization_code\"" - }, - "7acf1bf5bd1597e01908c3a9e4d5540db061f77d69de853abe8e5f09149dfdf8": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "oauth2client_id", - "ordinal": 2, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", user_id, oauth2client_id FROM oauth2authorizedapp WHERE user_id = $1 AND oauth2client_id = $2" - }, - "7b7092bd5fe377c8b28862721b05b3ca39aab9fb176fe970b9309d6371072e95": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Timestamp" - ] - } - }, - "query": "DELETE FROM wireguard_peer_stats\n WHERE collected_at < $1\n AND (device_id, network, collected_at) NOT IN (\n SELECT device_id, network, MAX(collected_at)\n FROM wireguard_peer_stats\n GROUP BY device_id, network\n )" - }, - "7d202e1f66e134a78fbd808e578e295afcdc4daf5f3be7cca0be247e47133794": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8", - "Text", - "Text", - "Int8", - "Text", - "Text", - "Timestamp", - "Timestamp", - "Bool" - ] - } - }, - "query": "INSERT INTO \"wallet\" (\"user_id\",\"address\",\"name\",\"chain_id\",\"challenge_message\",\"challenge_signature\",\"creation_timestamp\",\"validation_timestamp\",\"use_for_mfa\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9) RETURNING id" - }, - "7dd9cb419f9488ab2f1da11febdbac08a3a37eb93864104bd667f95615c87c41": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "UPDATE \"user\" SET mfa_enabled = FALSE, mfa_method = 'none', totp_enabled = FALSE, totp_secret = NULL, recovery_codes = '{}' WHERE id = $1" - }, - "7e7ec27c0fba3e139e4add5600befe98a10f89eced7daffcbdd1d963264112a1": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "UPDATE session SET web3_challenge = $1 WHERE id = $2" - }, - "7fa302170061ee58a46152f581f13dbae26b7dd6ba59169cb5a18d443d039c14": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "url", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "description", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "token", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "enabled", - "ordinal": 4, - "type_info": "Bool" - }, - { - "name": "on_user_created", - "ordinal": 5, - "type_info": "Bool" - }, - { - "name": "on_user_deleted", - "ordinal": 6, - "type_info": "Bool" - }, - { - "name": "on_user_modified", - "ordinal": 7, - "type_info": "Bool" - }, - { - "name": "on_hwkey_provision", - "ordinal": 8, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", \"url\",\"description\",\"token\",\"enabled\",\"on_user_created\",\"on_user_deleted\",\"on_user_modified\",\"on_hwkey_provision\" FROM \"webhook\" WHERE id = $1" - }, - "80c48375b2eea6f83038d443c0d2d180b1bb35cf84c19eb8ad6b6f8ed8b994e1": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM \"wireguard_network\" WHERE id = $1" - }, - "84782f5c98572a6689dda1a98d71b749bf6beb025c1e493c1c4183f09aead891": { - "describe": { - "columns": [ - { - "name": "username", - "ordinal": 0, - "type_info": "Text" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT \"user\".username FROM \"user\" JOIN group_user ON \"user\".id = group_user.user_id WHERE group_user.group_id = $1" - }, - "86135388d6da625f594c74860ca50859589f8735396acffa968ce88cfe307ff5": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Text" - ] - } - }, - "query": "UPDATE \"group\" SET \"name\" = $2 WHERE id = $1" - }, - "865131a7e440c7e5f297cb8620487fe0cf641f481175adaf22982d1f983d362e": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "wireguard_pubkey", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "created", - "ordinal": 4, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Timestamp", - "Int8" - ] - } - }, - "query": "\n WITH s AS (\n SELECT DISTINCT ON (device_id) *\n FROM wireguard_peer_stats\n ORDER BY device_id, latest_handshake DESC\n )\n SELECT\n d.id \"id?\", d.name, d.wireguard_pubkey, d.user_id, d.created\n FROM device d\n JOIN s ON d.id = s.device_id\n WHERE s.latest_handshake >= $1 AND s.network = $2\n " - }, - "872e70c5006c45dc3502642444a4d00e5f8a5c23062392e1a60613936acfa07b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM wireguard_network_allowed_group WHERE network_id=$1" - }, - "8880011a898ca2b97b0cfdbf027509d4855f46e4871caaa1fc95f2f612efcc4b": { - "describe": { - "columns": [ - { - "name": "device_id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "wireguard_network_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "wireguard_ip: IpAddr", - "ordinal": 2, - "type_info": "Inet" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT device_id, wireguard_network_id, wireguard_ip as \"wireguard_ip: IpAddr\"\n FROM wireguard_network_device WHERE device_id = $1" - }, - "89ecf876c5ba576acc57f53e273f1e1799ad9cf619a1d31e79de116308f85c30": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "DELETE FROM oauth2token WHERE access_token = $1 AND refresh_token = $2" - }, - "8ef0599222964d57b9d35e56a3d2d78e6ddb644d9de8ffe8445e7497a1f71477": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Int8" - ] - } - }, - "query": "UPDATE \"oauth2authorizedapp\" SET \"user_id\" = $2,\"oauth2client_id\" = $3 WHERE id = $1" - }, - "904ae3993de08b02a547db8d656a23d4a8e7e2d4bd556b1e2f60088b9f6fc679": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "client_id", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "client_secret", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "redirect_uri", - "ordinal": 3, - "type_info": "TextArray" - }, - { - "name": "scope", - "ordinal": 4, - "type_info": "TextArray" - }, - { - "name": "name", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "enabled", - "ordinal": 6, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Text", - "Text" - ] - } - }, - "query": "SELECT id \"id?\", client_id, client_secret, redirect_uri, scope, name, enabled FROM oauth2client WHERE client_id = $1 AND client_secret = $2 AND enabled" - }, - "90d962160e9ecd0708e6a722943c1530fcaadeabc516f81a0375146c94787dd3": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "INSERT INTO group_user (group_id, user_id) VALUES ($1, $2) ON CONFLICT DO NOTHING" - }, - "90eb99cdd712a78d180babe984f73364b510a1a46236ad4b5f80f4d2666b1567": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "oauth2client_id", - "ordinal": 2, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", \"user_id\",\"oauth2client_id\" FROM \"oauth2authorizedapp\" WHERE id = $1" - }, - "9213729a9a1ce371ef77898f5792d914a67400cb4cce9a8bf86227ffe7d42eda": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text", - "Text", - "Int8", - "Timestamp" - ] - } - }, - "query": "INSERT INTO \"device\" (\"name\",\"wireguard_pubkey\",\"user_id\",\"created\") VALUES ($1,$2,$3,$4) RETURNING id" - }, - "929535564469ee1701f83a1489301d0d652d5452369a2dce933f032cdb7092e2": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "wireguard_pubkey", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "created", - "ordinal": 4, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT device.id \"id?\", name, wireguard_pubkey, user_id, created\n FROM device WHERE user_id = $1\n " - }, - "92b38a3eec51c346623be6fc2ba18f8ca137d7c810a7cc6591b54bc686099254": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM \"oauth2authorizedapp\" WHERE id = $1" - }, - "92e3de4ba50a6705c64523dd177351c5fa887d7116dea6d5f194369339aace56": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "UPDATE \"user\" SET totp_enabled = TRUE WHERE id = $1" - }, - "961bd7d2e2cc98e2b968ccb22e065f5c30566de00d9b96d8a70e3f08a31c9dc2": { - "describe": { - "columns": [ - { - "name": "latest_handshake: NaiveDateTime", - "ordinal": 0, - "type_info": "Timestamp" - } - ], - "nullable": [ - true - ], - "parameters": { - "Left": [ - "Int8", - "Float8", - "Int8" - ] - } - }, - "query": "\n SELECT\n latest_handshake \"latest_handshake: NaiveDateTime\"\n FROM wireguard_peer_stats_view\n WHERE device_id = $1\n AND latest_handshake IS NOT NULL\n AND (latest_handshake_diff > $2 * interval '1 minute' OR latest_handshake_diff IS NULL)\n AND network = $3\n ORDER BY collected_at DESC\n LIMIT 1\n " - }, - "9838df2efdce6632793cb64bf4a118ceb4a68dad324366ed65813b05cc5ba63c": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Text" - ] - } - }, - "query": "\n INSERT INTO wireguard_network_allowed_group (network_id, group_id)\n SELECT $1, g.id\n FROM \"group\" g\n WHERE g.name = $2\n " - }, - "9b443a223ba94d9a696a0d8ebe188e50e49f404f8b0057a3015c067c5f57c1bf": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "address", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "name", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "chain_id", - "ordinal": 4, - "type_info": "Int8" - }, - { - "name": "challenge_message", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "challenge_signature", - "ordinal": 6, - "type_info": "Text" - }, - { - "name": "creation_timestamp", - "ordinal": 7, - "type_info": "Timestamp" - }, - { - "name": "validation_timestamp", - "ordinal": 8, - "type_info": "Timestamp" - }, - { - "name": "use_for_mfa", - "ordinal": 9, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - true, - false, - true, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", \"user_id\",\"address\",\"name\",\"chain_id\",\"challenge_message\",\"challenge_signature\",\"creation_timestamp\",\"validation_timestamp\",\"use_for_mfa\" FROM \"wallet\" WHERE id = $1" - }, - "9bb9a07281e19a57b10ddfeba1d1eec91021f371d0cf40d6dbdb82e38f28aa04": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM \"webauthn\" WHERE id = $1" - }, - "9e3c1c1f52bc1a576012c57c7472f9f7601e1128b15fc0ecc7676cd5aa01c88c": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "wireguard_pubkey", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "created", - "ordinal": 4, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "SELECT device.id \"id?\", name, wireguard_pubkey, user_id, created FROM device JOIN \"user\" ON device.user_id = \"user\".id WHERE device.id = $1 AND \"user\".id = $2" - }, - "9ea6f3e288d0a23c2b020034c80e60c0c73bcc37705cf408ea14c65ec3d1dab8": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM \"wireguard_peer_stats\" WHERE id = $1" - }, - "9f7a75ac4a3c5b767746a836e409e3e3f02a029cf9456bed8c5291f92f1d5f8a": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "address", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "name", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "chain_id", - "ordinal": 4, - "type_info": "Int8" - }, - { - "name": "challenge_message", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "challenge_signature", - "ordinal": 6, - "type_info": "Text" - }, - { - "name": "creation_timestamp", - "ordinal": 7, - "type_info": "Timestamp" - }, - { - "name": "validation_timestamp", - "ordinal": 8, - "type_info": "Timestamp" - }, - { - "name": "use_for_mfa", - "ordinal": 9, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - true, - false, - true, - false - ], - "parameters": { - "Left": [ - "Int8", - "Text" - ] - } - }, - "query": "SELECT id \"id?\", user_id, address, name, chain_id, challenge_message, challenge_signature, creation_timestamp, validation_timestamp, use_for_mfa FROM wallet WHERE user_id = $1 AND address = $2" - }, - "a170af41279bef8b8333d2e313c4ea300bb7fef7d5f742e362e75abbf4350f06": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8", - "Text", - "Bytea" - ] - } - }, - "query": "INSERT INTO \"webauthn\" (\"user_id\",\"name\",\"passkey\") VALUES ($1,$2,$3) RETURNING id" - }, - "a28203258ea19229b180817c5419c516dd15457db05f436c96ef5287f94daf11": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Text", - "Text", - "Int8" - ] - } - }, - "query": "UPDATE oauth2token SET access_token = $2, refresh_token = $3, expires_in = $4 WHERE access_token = $1" - }, - "a33889f665b0e9f3ef23f86af0bbbc1f7231be9e4b934e0f2aab9d5f5fad3c75": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Bool", - "Bool", - "Bool", - "Bool", - "Bool", - "Text", - "Text", - "Text", - "Text", - "Text", - "Int4", - { - "Custom": { - "kind": { - "Enum": [ - "none", - "starttls", - "implicittls" - ] - }, - "name": "smtp_encryption" - } - }, - "Text", - "Text", - "Text", - "Bool", - "Text", - "Text", - "Text", - "Bool" - ] - } - }, - "query": "INSERT INTO \"settings\" (\"openid_enabled\",\"ldap_enabled\",\"wireguard_enabled\",\"webhooks_enabled\",\"worker_enabled\",\"challenge_template\",\"instance_name\",\"main_logo_url\",\"nav_logo_url\",\"smtp_server\",\"smtp_port\",\"smtp_encryption\",\"smtp_user\",\"smtp_password\",\"smtp_sender\",\"enrollment_vpn_step_optional\",\"enrollment_welcome_message\",\"enrollment_welcome_email\",\"enrollment_welcome_email_subject\",\"enrollment_use_welcome_message_as_email\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20) RETURNING id" - }, - "a4941d4bcf5483036924c13b2293034b9ebc57993c63a2dedb347648c0dfc6a9": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8", - "Timestamp", - "Int8", - "Text", - "Int8", - "Int8", - "Timestamp", - "Text" - ] - } - }, - "query": "INSERT INTO \"wireguard_peer_stats\" (\"device_id\",\"collected_at\",\"network\",\"endpoint\",\"upload\",\"download\",\"latest_handshake\",\"allowed_ips\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8) RETURNING id" - }, - "a8f720a41ab4509570490d444180ae58f20596491a3ac2be3ab00a8a19c78c58": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Int8", - "Int2", - "Timestamp", - "Timestamp", - "Bytea", - "Text" - ] - } - }, - "query": "INSERT INTO session (id, user_id, state, created, expires, webauthn_challenge, web3_challenge) VALUES ($1, $2, $3, $4, $5, $6, $7)" - }, - "aa73869e5e09831dbaf55cd737cb44dc7826a63b0c053338cdaabd346c321585": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Text", - "Text", - "Text", - "Text", - "Int8", - "Text", - "Text" - ] - } - }, - "query": "UPDATE \"authorization_code\" SET \"user_id\" = $2,\"client_id\" = $3,\"code\" = $4,\"redirect_uri\" = $5,\"scope\" = $6,\"auth_time\" = $7,\"nonce\" = $8,\"code_challenge\" = $9 WHERE id = $1" - }, - "aa8bbafc145ad47aaac28e9863c19b1db6a855e917cdaf619a9461ad89b96917": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n DELETE FROM wireguard_network_device\n WHERE device_id = $1 AND wireguard_network_id = $2\n " - }, - "ad0934b3563f5ab5ca351d0db6a2677301edffa66042632d02c9b77dd11a1e83": { - "describe": { - "columns": [ - { - "name": "name", - "ordinal": 0, - "type_info": "Text" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT name\n FROM wireguard_network_allowed_group wag\n JOIN \"group\" g ON wag.group_id = g.id\n WHERE wag.network_id = $1\n " - }, - "b10e43d2235e858fb0982fcd320c9d0548cde5e7a49e8971f21c31083f0d006c": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Text", - "Bytea" - ] - } - }, - "query": "UPDATE \"webauthn\" SET \"user_id\" = $2,\"name\" = $3,\"passkey\" = $4 WHERE id = $1" - }, - "b2410cc60e0e1dcacd03050d2a3ac417ca5822beebe08be3f23cc0e217e27740": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", \"name\" FROM \"group\" WHERE id = $1" - }, - "b33fa60772e858280c021b3774d01273453d13af4321cae2d244748ca4254b29": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id \"id?\", name FROM \"group\" WHERE name = $1" - }, - "b362d79ac6b116c97f7489cbfc5801c7f94ba91677af351ef235755bf804e1f7": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "address: _", - "ordinal": 2, - "type_info": "Inet" - }, - { - "name": "port", - "ordinal": 3, - "type_info": "Int4" - }, - { - "name": "pubkey", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "prvkey", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "endpoint", - "ordinal": 6, - "type_info": "Text" - }, - { - "name": "dns", - "ordinal": 7, - "type_info": "Text" - }, - { - "name": "allowed_ips: _", - "ordinal": 8, - "type_info": "InetArray" - }, - { - "name": "connected_at", - "ordinal": 9, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - false, - true - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", \"name\",\"address\" \"address: _\",\"port\",\"pubkey\",\"prvkey\",\"endpoint\",\"dns\",\"allowed_ips\" \"allowed_ips: _\",\"connected_at\" FROM \"wireguard_network\" WHERE id = $1" - }, - "b57f8562cff6e1d13d6ffa0e7a382fda523559100424c771e25757994a1fca13": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int2", - "Text" - ] - } - }, - "query": "UPDATE session SET state = $1 WHERE id = $2" - }, - "b8656ec4ee5b1980223294cad758ea2da20b6cfc25f51a25023d69a4595a4fb9": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Bytea", - "Int8" - ] - } - }, - "query": "UPDATE \"user\" SET totp_secret = $1 WHERE id = $2" - }, - "b9673d880db788cd95cbcdfd44ffad014cde4eec69233e7ae79ab35e620a5302": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Text", - "Text", - "TextArray", - "TextArray", - "Text", - "Bool" - ] - } - }, - "query": "UPDATE \"oauth2client\" SET \"client_id\" = $2,\"client_secret\" = $3,\"redirect_uri\" = $4,\"scope\" = $5,\"name\" = $6,\"enabled\" = $7 WHERE id = $1" - }, - "bd9520722a8392da2bd841e5071400e1658e8d26a73542fac8d8a214009888b7": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "state: SessionState", - "ordinal": 2, - "type_info": "Int2" - }, - { - "name": "created", - "ordinal": 3, - "type_info": "Timestamp" - }, - { - "name": "expires", - "ordinal": 4, - "type_info": "Timestamp" - }, - { - "name": "webauthn_challenge", - "ordinal": 5, - "type_info": "Bytea" - }, - { - "name": "web3_challenge", - "ordinal": 6, - "type_info": "Text" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - true, - true - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id, user_id, state \"state: SessionState\", created, expires, webauthn_challenge, web3_challenge FROM session WHERE id = $1" - }, - "bde600b9d9448806df37628d305a09b93f4d1217dfb1141a32be11673d76dd1f": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "address", - "ordinal": 2, - "type_info": "Inet" - }, - { - "name": "port", - "ordinal": 3, - "type_info": "Int4" - }, - { - "name": "pubkey", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "prvkey", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "endpoint", - "ordinal": 6, - "type_info": "Text" - }, - { - "name": "dns", - "ordinal": 7, - "type_info": "Text" - }, - { - "name": "allowed_ips", - "ordinal": 8, - "type_info": "InetArray" - }, - { - "name": "connected_at", - "ordinal": 9, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - false, - true - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id as \"id?\", name, address, port, pubkey, prvkey, endpoint, dns, allowed_ips, connected_at FROM wireguard_network WHERE name = $1" - }, - "c0e30b2a0b711ea77d88a6dc9c92d0faa187d2bb59bedd0c66d1eae866922901": { - "describe": { - "columns": [ - { - "name": "network_id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "network_name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "gateway_endpoint", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "device_wireguard_ip: IpAddr", - "ordinal": 3, - "type_info": "Inet" - }, - { - "name": "device_endpoint", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "latest_handshake?", - "ordinal": 5, - "type_info": "Timestamp" - }, - { - "name": "is_active!", - "ordinal": 6, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - true, - false, - null - ], - "parameters": { - "Left": [ - "Float8", - "Int8" - ] - } - }, - "query": "\n WITH stats AS (\n SELECT DISTINCT ON (network) network, endpoint, latest_handshake\n FROM wireguard_peer_stats\n WHERE device_id = $2\n ORDER BY network, collected_at DESC\n )\n SELECT\n n.id as network_id, n.name as network_name, n.endpoint as gateway_endpoint,\n wnd.wireguard_ip as \"device_wireguard_ip: IpAddr\", stats.endpoint as device_endpoint,\n stats.latest_handshake as \"latest_handshake?\",\n COALESCE (((NOW() - stats.latest_handshake) < $1 * interval '1 minute'), false) as \"is_active!\"\n FROM wireguard_network_device wnd\n JOIN wireguard_network n ON n.id = wnd.wireguard_network_id\n LEFT JOIN stats on n.id = stats.network\n WHERE wnd.device_id = $2\n " - }, - "c4f0393fc5b1bb1603f1da3a6f2cb7e6253a0cb8fffd710e5a4d03cf9a4eef16": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "passkey", - "ordinal": 3, - "type_info": "Bytea" - } - ], - "nullable": [ - false, - false, - false, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id \"id?\", \"user_id\",\"name\",\"passkey\" FROM \"webauthn\"" - }, - "c64f247f81e332689e35c224656847b246deb6f92a5790a4fdd0d5733defbb57": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "wireguard_pubkey", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "created", - "ordinal": 4, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", \"name\",\"wireguard_pubkey\",\"user_id\",\"created\" FROM \"device\" WHERE id = $1" - }, - "c863944a13f1b8c3eb0d5a62bff40f453da7ac74551c2e62275931a1e8a7ec9e": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "username", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "password_hash", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "last_name", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "first_name", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "email", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "phone", - "ordinal": 6, - "type_info": "Text" - }, - { - "name": "ssh_key", - "ordinal": 7, - "type_info": "Text" - }, - { - "name": "pgp_key", - "ordinal": 8, - "type_info": "Text" - }, - { - "name": "pgp_cert_id", - "ordinal": 9, - "type_info": "Text" - }, - { - "name": "mfa_enabled", - "ordinal": 10, - "type_info": "Bool" - }, - { - "name": "totp_enabled", - "ordinal": 11, - "type_info": "Bool" - }, - { - "name": "totp_secret", - "ordinal": 12, - "type_info": "Bytea" - }, - { - "name": "mfa_method: _", - "ordinal": 13, - "type_info": { - "Custom": { - "kind": { - "Enum": [ - "none", - "one_time_password", - "webauthn", - "web3" - ] - }, - "name": "mfa_method" - } - } - }, - { - "name": "recovery_codes", - "ordinal": 14, - "type_info": "TextArray" - } - ], - "nullable": [ - false, - false, - true, - false, - false, - false, - true, - true, - true, - true, - false, - false, - true, - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id \"id?\", username, password_hash, last_name, first_name, email, phone, ssh_key, pgp_key, pgp_cert_id, mfa_enabled, totp_enabled, totp_secret, mfa_method \"mfa_method: _\", recovery_codes FROM \"user\" WHERE username = $1" - }, - "cdda0d8e9b34aef0728fc390bf77a3211b708f23ecdb3df5cada3d628280a025": { - "describe": { - "columns": [ - { - "name": "pubkey", - "ordinal": 0, - "type_info": "Text" - }, - { - "name": "allowed_ips!: Vec", - "ordinal": 1, - "type_info": "TextArray" - } - ], - "nullable": [ - false, - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT d.wireguard_pubkey as pubkey, array[host(wnd.wireguard_ip)] as \"allowed_ips!: Vec\" FROM wireguard_network_device wnd\n JOIN device d\n ON wnd.device_id = d.id\n WHERE wireguard_network_id = $1\n ORDER BY d.id ASC\n " - }, - "cf0ea5510b1017309b0f9c1a2875f393c5012b4ba1a7eac22475b60024b57d06": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text", - "Text", - "TextArray", - "TextArray", - "Text", - "Bool" - ] - } - }, - "query": "INSERT INTO \"oauth2client\" (\"client_id\",\"client_secret\",\"redirect_uri\",\"scope\",\"name\",\"enabled\") VALUES ($1,$2,$3,$4,$5,$6) RETURNING id" - }, - "d3b425017872becff45f39513c9e09b3d3ba8fc86e97c7f1ff21597a884af06d": { - "describe": { - "columns": [ - { - "name": "network_id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "device_wireguard_ip: IpAddr", - "ordinal": 1, - "type_info": "Inet" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT wireguard_network_id as network_id, wireguard_ip as \"device_wireguard_ip: IpAddr\"\n FROM wireguard_network_device\n WHERE device_id = $1\n " - }, - "d4822c2e2aea609a3807a9f26ad8b9441548a7d17293b87c877a5e8cdcc95b32": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "username", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "password_hash", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "last_name", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "first_name", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "email", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "phone", - "ordinal": 6, - "type_info": "Text" - }, - { - "name": "ssh_key", - "ordinal": 7, - "type_info": "Text" - }, - { - "name": "pgp_key", - "ordinal": 8, - "type_info": "Text" - }, - { - "name": "pgp_cert_id", - "ordinal": 9, - "type_info": "Text" - }, - { - "name": "mfa_enabled", - "ordinal": 10, - "type_info": "Bool" - }, - { - "name": "totp_enabled", - "ordinal": 11, - "type_info": "Bool" - }, - { - "name": "totp_secret", - "ordinal": 12, - "type_info": "Bytea" - }, - { - "name": "mfa_method: _", - "ordinal": 13, - "type_info": { - "Custom": { - "kind": { - "Enum": [ - "none", - "one_time_password", - "webauthn", - "web3" - ] - }, - "name": "mfa_method" - } - } - }, - { - "name": "recovery_codes: _", - "ordinal": 14, - "type_info": "TextArray" - } - ], - "nullable": [ - false, - false, - true, - false, - false, - false, - true, - true, - true, - true, - false, - false, - true, - false, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT id \"id?\", \"username\",\"password_hash\",\"last_name\",\"first_name\",\"email\",\"phone\",\"ssh_key\",\"pgp_key\",\"pgp_cert_id\",\"mfa_enabled\",\"totp_enabled\",\"totp_secret\",\"mfa_method\" \"mfa_method: _\",\"recovery_codes\" \"recovery_codes: _\" FROM \"user\"" - }, - "d98e365929bb0fbf3915b517db93168f76f9a0c4832cd2efd13d74268cc435b8": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "TextArray" - ] - } - }, - "query": "UPDATE \"user\" SET recovery_codes = $2 WHERE id = $1" - }, - "dab9a6b3dc5d3f57c0f49f1f111db88c8c5658ea7d1492e1922820bbebc51209": { - "describe": { - "columns": [ - { - "name": "passkey", - "ordinal": 0, - "type_info": "Bytea" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT passkey FROM webauthn WHERE user_id = $1" - }, - "dc21ad55a35e5ea826e64030b4d71a0df499cc1b22f1d8fcffa135307b09c187": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "device_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "collected_at", - "ordinal": 2, - "type_info": "Timestamp" - }, - { - "name": "network", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "endpoint", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "upload", - "ordinal": 5, - "type_info": "Int8" - }, - { - "name": "download", - "ordinal": 6, - "type_info": "Int8" - }, - { - "name": "latest_handshake", - "ordinal": 7, - "type_info": "Timestamp" - }, - { - "name": "allowed_ips", - "ordinal": 8, - "type_info": "Text" - } - ], - "nullable": [ - false, - false, - false, - false, - true, - false, - false, - false, - true - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", \"device_id\",\"collected_at\",\"network\",\"endpoint\",\"upload\",\"download\",\"latest_handshake\",\"allowed_ips\" FROM \"wireguard_peer_stats\" WHERE id = $1" - }, - "e0d59d4aa01a863eca5f00470c70112fd9a78c4565fd8e44185dc31c9b894b9e": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "client_id", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "code", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "redirect_uri", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "scope", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "auth_time", - "ordinal": 6, - "type_info": "Int8" - }, - { - "name": "nonce", - "ordinal": 7, - "type_info": "Text" - }, - { - "name": "code_challenge", - "ordinal": 8, - "type_info": "Text" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id \"id?\", user_id, client_id, code, redirect_uri, scope, auth_time, nonce, code_challenge FROM authorization_code WHERE code = $1" - }, - "e19b29d2e52ad2a2a5c20ce205d5c949d02219fd252d78f7fffa202cc804b4c2": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text", - "Inet", - "Int4", - "Text", - "Text", - "Text", - "Text", - "InetArray", - "Timestamp" - ] - } - }, - "query": "INSERT INTO \"wireguard_network\" (\"name\",\"address\",\"port\",\"pubkey\",\"prvkey\",\"endpoint\",\"dns\",\"allowed_ips\",\"connected_at\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9) RETURNING id" - }, - "e1c693d11abacbffbeb48c1bb215d8fe08c229a8e7c5befa18406e1be89d69ea": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "openid_enabled", - "ordinal": 1, - "type_info": "Bool" - }, - { - "name": "ldap_enabled", - "ordinal": 2, - "type_info": "Bool" - }, - { - "name": "wireguard_enabled", - "ordinal": 3, - "type_info": "Bool" - }, - { - "name": "webhooks_enabled", - "ordinal": 4, - "type_info": "Bool" - }, - { - "name": "worker_enabled", - "ordinal": 5, - "type_info": "Bool" - }, - { - "name": "challenge_template", - "ordinal": 6, - "type_info": "Text" - }, - { - "name": "instance_name", - "ordinal": 7, - "type_info": "Text" - }, - { - "name": "main_logo_url", - "ordinal": 8, - "type_info": "Text" - }, - { - "name": "nav_logo_url", - "ordinal": 9, - "type_info": "Text" - }, - { - "name": "smtp_server", - "ordinal": 10, - "type_info": "Text" - }, - { - "name": "smtp_port", - "ordinal": 11, - "type_info": "Int4" - }, - { - "name": "smtp_encryption: _", - "ordinal": 12, - "type_info": { - "Custom": { - "kind": { - "Enum": [ - "none", - "starttls", - "implicittls" - ] - }, - "name": "smtp_encryption" - } - } - }, - { - "name": "smtp_user", - "ordinal": 13, - "type_info": "Text" - }, - { - "name": "smtp_password?: SecretString", - "ordinal": 14, - "type_info": "Text" - }, - { - "name": "smtp_sender", - "ordinal": 15, - "type_info": "Text" - }, - { - "name": "enrollment_vpn_step_optional", - "ordinal": 16, - "type_info": "Bool" - }, - { - "name": "enrollment_welcome_message", - "ordinal": 17, - "type_info": "Text" - }, - { - "name": "enrollment_welcome_email", - "ordinal": 18, - "type_info": "Text" - }, - { - "name": "enrollment_welcome_email_subject", - "ordinal": 19, - "type_info": "Text" - }, - { - "name": "enrollment_use_welcome_message_as_email", - "ordinal": 20, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - true, - true, - false, - true, - true, - true, - false, - true, - true, - true, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id \"id?\", \"openid_enabled\",\"ldap_enabled\",\"wireguard_enabled\",\"webhooks_enabled\",\"worker_enabled\",\"challenge_template\",\"instance_name\",\"main_logo_url\",\"nav_logo_url\",\"smtp_server\",\"smtp_port\",\"smtp_encryption\" \"smtp_encryption: _\",\"smtp_user\",\"smtp_password\" \"smtp_password?: SecretString\",\"smtp_sender\",\"enrollment_vpn_step_optional\",\"enrollment_welcome_message\",\"enrollment_welcome_email\",\"enrollment_welcome_email_subject\",\"enrollment_use_welcome_message_as_email\" FROM \"settings\" WHERE id = $1" - }, - "e34c2a7ac137329f1a9813db3f1ebbc837971d9c64ee2a6d7d902c1a0f8d6c05": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM \"device\" WHERE id = $1" - }, - "e5624c65ab8248f1fcf973c0c7501792d53748dbd5d227e492527f07ca194fc6": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "DELETE FROM session WHERE id = $1" - }, - "e6baa94aed2de495bad45e2b7b2464c1de949bf4973c0dbcad906e25cde8c2e3": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM \"user\" WHERE id = $1" - }, - "e7e944f6bce4dce8cd58889dca8e38ceab97af014b51bfa24933e296e803effc": { - "describe": { - "columns": [ - { - "name": "wireguard_ip", - "ordinal": 0, - "type_info": "Inet" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n SELECT wireguard_ip\n FROM wireguard_network_device\n WHERE device_id = $1 AND wireguard_network_id = $2\n " - }, - "e99464b4da5a21bcffda16866783d11c819eb078e392f1492467ae420800242d": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "INSERT INTO \"group\" (\"name\") VALUES ($1) RETURNING id" - }, - "eb6dee5462657ac5ce0ecf31d1477ce7cc874d9ad8b3119977168f601b3e8072": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "wireguard_pubkey", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "created", - "ordinal": 4, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id \"id?\", name, wireguard_pubkey, user_id, created FROM device WHERE wireguard_pubkey = $1" - }, - "ed38aaf593faf8d597a30003e7334681dc354535c96fdd33d3f364bde6293575": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Bool", - "Bool", - "Bool", - "Bool", - "Bool", - "Text", - "Text", - "Text", - "Text", - "Text", - "Int4", - { - "Custom": { - "kind": { - "Enum": [ - "none", - "starttls", - "implicittls" - ] - }, - "name": "smtp_encryption" - } - }, - "Text", - "Text", - "Text", - "Bool", - "Text", - "Text", - "Text", - "Bool" - ] - } - }, - "query": "UPDATE \"settings\" SET \"openid_enabled\" = $2,\"ldap_enabled\" = $3,\"wireguard_enabled\" = $4,\"webhooks_enabled\" = $5,\"worker_enabled\" = $6,\"challenge_template\" = $7,\"instance_name\" = $8,\"main_logo_url\" = $9,\"nav_logo_url\" = $10,\"smtp_server\" = $11,\"smtp_port\" = $12,\"smtp_encryption\" = $13,\"smtp_user\" = $14,\"smtp_password\" = $15,\"smtp_sender\" = $16,\"enrollment_vpn_step_optional\" = $17,\"enrollment_welcome_message\" = $18,\"enrollment_welcome_email\" = $19,\"enrollment_welcome_email_subject\" = $20,\"enrollment_use_welcome_message_as_email\" = $21 WHERE id = $1" - }, - "ee6ed3df25517a6fedf6981166e58601de53af70dd28f69b84caca6e36cb8956": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Inet" - ] - } - }, - "query": "INSERT INTO wireguard_network_device\n (device_id, wireguard_network_id, wireguard_ip)\n VALUES ($1, $2, $3)\n ON CONFLICT ON CONSTRAINT device_network\n DO UPDATE SET wireguard_ip = $3" - }, - "eee2734f98b411d6fc75bf92027d84b8ca5e41de023a473681c076d6cc072ab2": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [] - } - }, - "query": "DELETE FROM session WHERE expires < now()" - }, - "ef05db120b43f66cb1eebea856471ee8d81cdcf11af03472a10893ecedeeced3": { - "describe": { - "columns": [ - { - "name": "oauth2authorizedapp_id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "access_token", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "refresh_token", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "redirect_uri", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "scope", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "expires_in", - "ordinal": 5, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT oauth2authorizedapp_id, access_token, refresh_token, redirect_uri, scope, expires_in FROM oauth2token WHERE access_token = $1" - }, - "effe03b1e22929191b7d07e51586153215f982b9c8e43f68ebb62597df31d8f8": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Int8", - "Int8", - "Text", - "Timestamp", - "Timestamp", - "Timestamp" - ] - } - }, - "query": "INSERT INTO enrollment (id, user_id, admin_id, email, created_at, expires_at, used_at) VALUES ($1, $2, $3, $4, $5, $6, $7)" - }, - "f5a52d311dd0ac4c76cf1638f30cffd8c97fe2b4987fcfb9f9ca523ab6e5bf5d": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Timestamp", - "Int8" - ] - } - }, - "query": "UPDATE wallet SET challenge_signature = $1, validation_timestamp = $2 WHERE id = $3" - }, - "f6e0a7877fb3fb17470c006453dcbbeabc7bd64204429a7b4add532cfac9b603": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Text", - "Text", - "Text", - "Text", - "Int8" - ] - } - }, - "query": "INSERT INTO oauth2token (oauth2authorizedapp_id, access_token, refresh_token, redirect_uri, scope, expires_in) VALUES ($1, $2, $3, $4, $5, $6)" - }, - "fa9759385716d697b84d74006ac8738772575de69605375c4c38b9d32fea34f6": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Timestamp", - "Timestamp", - "Timestamp", - "Int8" - ] - } - }, - "query": "INSERT INTO wireguard_stats_purge (started_at, finished_at, removal_threshold, records_removed) VALUES ($1, $2, $3, $4)" - }, - "fc3e288a55cef64d17ef2a373aa7fb46dd2548610a09ada4bf2daa8b98249901": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "DELETE FROM webauthn WHERE user_id = $1" - }, - "fd92ab2977c9c170e2254f13bd99fcb569ef4b44029783648b0613ca8db2a393": { - "describe": { - "columns": [ - { - "name": "id?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "wireguard_pubkey", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "user_id", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "created", - "ordinal": 4, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Inet", - "Int8" - ] - } - }, - "query": "SELECT d.id \"id?\", d.name, d.wireguard_pubkey, d.user_id, d.created\n FROM device d\n JOIN wireguard_network_device wnd\n ON d.id = wnd.device_id\n WHERE wnd.wireguard_ip = $1 AND wnd.wireguard_network_id = $2" - } -} diff --git a/src/appstate.rs b/src/appstate.rs index 038820b23..e34191b77 100644 --- a/src/appstate.rs +++ b/src/appstate.rs @@ -84,12 +84,12 @@ impl AppState { pub fn send_multiple_wireguard_events(&self, events: Vec) { debug!("Sending {} wireguard events", events.len()); for event in events { - self.send_wireguard_event(event) + self.send_wireguard_event(event); } } /// Create application state - pub async fn new( + pub fn new( config: DefGuardConfig, pool: DbPool, tx: UnboundedSender, diff --git a/src/auth/failed_login.rs b/src/auth/failed_login.rs index 3b2498c1b..06994a869 100644 --- a/src/auth/failed_login.rs +++ b/src/auth/failed_login.rs @@ -48,7 +48,7 @@ impl FailedLogin { fn increment(&mut self) { self.attempt_count += 1; - self.last_attempt = Local::now() + self.last_attempt = Local::now(); } fn reset(&mut self) { @@ -99,9 +99,9 @@ impl FailedLoginMap { } Some(failed_login) => { if failed_login.should_reset_counter() { - failed_login.reset() + failed_login.reset(); } else { - failed_login.increment() + failed_login.increment(); } } }; diff --git a/src/auth/mod.rs b/src/auth/mod.rs index 03da55a3d..1c34224d0 100644 --- a/src/auth/mod.rs +++ b/src/auth/mod.rs @@ -26,7 +26,7 @@ pub static YUBIBRIDGE_SECRET_ENV: &str = "DEFGUARD_YUBIBRIDGE_SECRET"; pub const SESSION_TIMEOUT: u64 = 3600 * 24 * 7; pub const TOTP_CODE_VALIDITY_PERIOD: u64 = 30; -#[derive(Clone, Default)] +#[derive(Clone, Copy, Default)] pub enum ClaimsType { #[default] Auth, @@ -66,7 +66,7 @@ impl Claims { .expect("valid timestamp") .as_secs(); Self { - secret: Self::get_secret(&claims_type), + secret: Self::get_secret(claims_type), iss: JWT_ISSUER.to_string(), sub, client_id, @@ -75,7 +75,7 @@ impl Claims { } } - fn get_secret(claims_type: &ClaimsType) -> String { + fn get_secret(claims_type: ClaimsType) -> String { let env_var = match claims_type { ClaimsType::Auth => AUTH_SECRET_ENV, ClaimsType::Gateway => GATEWAY_SECRET_ENV, @@ -95,7 +95,7 @@ impl Claims { /// Verify JWT and, if successful, convert it to claims. pub fn from_jwt(claims_type: ClaimsType, token: &str) -> Result { - let secret = Self::get_secret(&claims_type); + let secret = Self::get_secret(claims_type); let mut validation = Validation::default(); validation.validate_nbf = true; validation.set_issuer(&[JWT_ISSUER]); diff --git a/src/bin/defguard.rs b/src/bin/defguard.rs index af0fc235e..8f79d8aff 100644 --- a/src/bin/defguard.rs +++ b/src/bin/defguard.rs @@ -1,10 +1,9 @@ -use defguard::db::Settings; use defguard::{ auth::failed_login::FailedLoginMap, config::{Command, DefGuardConfig}, - db::{init_db, AppEvent, GatewayEvent, User}, + db::{init_db, AppEvent, GatewayEvent, Settings, User}, grpc::{run_grpc_server, GatewayMap, WorkerState}, - init_dev_env, logging, + init_dev_env, init_vpn_location, logging, mail::{run_mail_handler, Mail}, run_web_server, wireguard_stats_purge::run_periodic_stats_purge, @@ -26,31 +25,44 @@ async fn main() -> Result<(), anyhow::Error> { logging::init(&config.log_level, &config.log_file)?; SERVER_CONFIG.set(config.clone())?; - log::debug!("Starting defguard server with config: {config:?}"); + let pool = init_db( + &config.database_host, + config.database_port, + &config.database_name, + &config.database_user, + config.database_password.expose_secret(), + ) + .await; - match config.openid_signing_key { - Some(_) => log::info!("Using RSA OpenID signing key"), - None => log::info!("Using HMAC OpenID signing key"), - } + // handle optional subcommands + if let Some(command) = &config.cmd { + match command { + Command::InitDevEnv => { + init_dev_env(&config).await; + } + Command::InitVpnLocation(args) => { + let token = init_vpn_location(&pool, args).await?; + println!("{token}"); + } + }; - if let Some(Command::InitDevEnv) = config.cmd { - init_dev_env(&config).await; + // return early return Ok(()); } + log::debug!("Starting defguard server with config: {config:?}"); + + if config.openid_signing_key.is_some() { + log::info!("Using RSA OpenID signing key"); + } else { + log::info!("Using HMAC OpenID signing key"); + } + let (webhook_tx, webhook_rx) = unbounded_channel::(); let (wireguard_tx, _wireguard_rx) = broadcast::channel::(256); let (mail_tx, mail_rx) = unbounded_channel::(); let worker_state = Arc::new(Mutex::new(WorkerState::new(webhook_tx.clone()))); let gateway_state = Arc::new(Mutex::new(GatewayMap::new())); - let pool = init_db( - &config.database_host, - config.database_port, - &config.database_name, - &config.database_user, - config.database_password.expose_secret(), - ) - .await; // initialize admin user User::init_admin_user(&pool, config.default_admin_password.expose_secret()).await?; diff --git a/src/config.rs b/src/config.rs index 7295b3a4a..fbfec7721 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,8 +1,14 @@ -use clap::Parser; +use clap::{Args, Parser, Subcommand}; use humantime::Duration; +use ipnetwork::IpNetwork; use openidconnect::{core::CoreRsaPrivateSigningKey, JsonWebKeyId}; use reqwest::Url; -use rsa::{pkcs1::EncodeRsaPrivateKey, pkcs8::DecodePrivateKey, PublicKeyParts, RsaPrivateKey}; +use rsa::{ + pkcs1::{DecodeRsaPrivateKey, EncodeRsaPrivateKey}, + pkcs8::{DecodePrivateKey, LineEnding}, + traits::PublicKeyParts, + RsaPrivateKey, +}; use secrecy::{ExposeSecret, Secret}; #[derive(Clone, Parser, Serialize, Debug)] @@ -175,15 +181,36 @@ pub struct DefGuardConfig { pub cmd: Option, } -#[derive(Clone, Debug, Parser)] +#[derive(Clone, Debug, Subcommand)] pub enum Command { #[command( about = "Initialize development environment. Inserts test network and device into database." )] InitDevEnv, + #[command( + about = "Add a new VPN location and return a gateway token. Used for automated setup." + )] + InitVpnLocation(InitVpnLocationArgs), +} + +#[derive(Args, Debug, Clone)] +pub struct InitVpnLocationArgs { + #[arg(long)] + pub name: String, + #[arg(long)] + pub address: IpNetwork, + #[arg(long)] + pub endpoint: String, + #[arg(long)] + pub port: i32, + #[arg(long)] + pub dns: Option, + #[arg(long)] + pub allowed_ips: Vec, } impl DefGuardConfig { + #[must_use] pub fn new() -> Self { let mut config = Self::parse(); config.validate_rp_id(); @@ -193,6 +220,7 @@ impl DefGuardConfig { } // this is an ugly workaround to avoid `cargo test` args being captured by `clap` + #[must_use] pub fn new_test_config() -> Self { let mut config = Self::parse_from::<[_; 0], String>([]); config.validate_rp_id(); @@ -209,7 +237,7 @@ impl DefGuardConfig { .domain() .expect("Unable to get domain for server URL.") .to_string(), - ) + ); } } @@ -222,7 +250,7 @@ impl DefGuardConfig { .domain() .expect("Unable to get domain for server URL.") .to_string(), - ) + ); } } @@ -258,13 +286,19 @@ impl DefGuardConfig { ) } + /// Try PKCS#1 and PKCS#8 PEM formats. fn parse_openid_key(path: &str) -> Result { - RsaPrivateKey::read_pkcs8_pem_file(path) + if let Ok(key) = RsaPrivateKey::read_pkcs1_pem_file(path) { + Ok(key) + } else { + RsaPrivateKey::read_pkcs8_pem_file(path) + } } + #[must_use] pub fn openid_key(&self) -> Option { let key = self.openid_signing_key.as_ref()?; - if let Ok(pem) = key.to_pkcs1_pem(rsa::pkcs8::LineEnding::default()) { + if let Ok(pem) = key.to_pkcs1_pem(LineEnding::default()) { let key_id = JsonWebKeyId::new(key.n().to_str_radix(36)); CoreRsaPrivateSigningKey::from_pem(pem.as_ref(), Some(key_id)).ok() } else { @@ -288,7 +322,7 @@ mod tests { #[test] fn verify_cli() { use clap::CommandFactory; - DefGuardConfig::command().debug_assert() + DefGuardConfig::command().debug_assert(); } #[test] diff --git a/src/db/models/auth_code.rs b/src/db/models/auth_code.rs index bfe539203..f25aa9066 100644 --- a/src/db/models/auth_code.rs +++ b/src/db/models/auth_code.rs @@ -1,4 +1,5 @@ -use crate::{db::DbPool, random::gen_alphanumeric}; +use super::DbPool; +use crate::random::gen_alphanumeric; use chrono::Utc; use model_derive::Model; use sqlx::{query_as, Error as SqlxError}; diff --git a/src/db/models/device.rs b/src/db/models/device.rs index 2de690625..81be215b6 100644 --- a/src/db/models/device.rs +++ b/src/db/models/device.rs @@ -1,14 +1,19 @@ -use super::{error::ModelError, wireguard::WireguardNetwork, DbPool}; -use crate::db::models::wireguard::WIREGUARD_MAX_HANDSHAKE_MINUTES; +use super::{ + error::ModelError, + wireguard::{WireguardNetwork, WIREGUARD_MAX_HANDSHAKE_MINUTES}, + DbPool, +}; use crate::handlers::wireguard::DeviceConfig; use chrono::{NaiveDateTime, Utc}; use ipnetwork::IpNetwork; use lazy_static::lazy_static; use model_derive::Model; use regex::Regex; -use sqlx::{query, query_as, Error as SqlxError, FromRow, Transaction}; -use std::fmt::{Display, Formatter}; -use std::net::IpAddr; +use sqlx::{query, query_as, Error as SqlxError, FromRow, PgConnection}; +use std::{ + fmt::{Display, Formatter}, + net::IpAddr, +}; use thiserror::Error; #[derive(Clone, Deserialize, Model, Serialize, Debug)] @@ -122,7 +127,7 @@ impl UserDevice { .into_iter() .map(|r| { let device_ip = match r.device_endpoint { - Some(endpoint) => endpoint.split(':').next().map(|ip| ip.to_owned()), + Some(endpoint) => endpoint.split(':').next().map(ToString::to_string), None => None, }; UserDeviceNetworkInfo { @@ -166,6 +171,7 @@ pub struct ModifyDevice { } impl WireguardNetworkDevice { + #[must_use] pub fn new(network_id: i64, device_id: i64, wireguard_ip: IpAddr) -> Self { Self { wireguard_network_id: network_id, @@ -333,7 +339,7 @@ impl Device { if dns.is_empty() { String::new() } else { - format!("DNS = {}", dns) + format!("DNS = {dns}") } } &None => String::new(), @@ -472,7 +478,7 @@ impl Device { // Add device to all existing networks pub async fn add_to_all_networks( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, admin_group_name: &String, ) -> Result<(Vec, Vec), DeviceError> { info!("Adding device {} to all existing networks", self.name); @@ -490,9 +496,8 @@ impl Device { return Err(DeviceError::PubkeyConflict(self.clone(), Box::new(network))); } - let network_id = match network.id { - Some(id) => id, - None => return Err(DeviceError::Unexpected("Network has no ID".to_string())), + let Some(network_id) = network.id else { + return Err(DeviceError::Unexpected("Network has no ID".to_string())); }; if WireguardNetworkDevice::find( @@ -538,20 +543,17 @@ impl Device { // Assign IP to the device in a given network pub async fn assign_network_ip( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, network: &WireguardNetwork, reserved_ips: Option<&Vec>, ) -> Result { - let network_id = match network.id { - Some(id) => id, - None => { - return Err(ModelError::CannotCreate); - } + let Some(network_id) = network.id else { + return Err(ModelError::CannotCreate); }; let net_ip = network.address.ip(); let net_network = network.address.network(); let net_broadcast = network.address.broadcast(); - for ip in network.address.iter() { + for ip in &network.address { if ip == net_ip || ip == net_network || ip == net_broadcast { continue; } @@ -562,15 +564,15 @@ impl Device { } // Break loop if IP is unassigned and return network device - match Self::find_by_ip(&mut *transaction, ip, network_id).await? { - Some(_) => (), - None => { - info!("Created IP: {} for device: {}", ip, self.name); - let wireguard_network_device = - WireguardNetworkDevice::new(network_id, self.get_id()?, ip); - wireguard_network_device.insert(&mut *transaction).await?; - return Ok(wireguard_network_device); - } + if Self::find_by_ip(&mut *transaction, ip, network_id) + .await? + .is_none() + { + info!("Created IP: {ip} for device: {}", self.name); + let wireguard_network_device = + WireguardNetworkDevice::new(network_id, self.get_id()?, ip); + wireguard_network_device.insert(&mut *transaction).await?; + return Ok(wireguard_network_device); } } Err(ModelError::CannotCreate) @@ -583,7 +585,7 @@ impl Device { if RE.is_match(pubkey) { Ok(()) } else { - Err(format!("{} is not a valid pubkey", pubkey)) + Err(format!("{pubkey} is not a valid pubkey")) } } } @@ -603,36 +605,27 @@ mod test { pubkey: String, network: &WireguardNetwork, ) -> Result<(Self, WireguardNetworkDevice), ModelError> { - let network_id = match network.id { - Some(id) => id, - None => { - return Err(ModelError::CannotCreate); - } + let Some(network_id) = network.id else { + return Err(ModelError::CannotCreate); }; let net_ip = network.address.ip(); let net_network = network.address.network(); let net_broadcast = network.address.broadcast(); - for ip in network.address.iter() { + for ip in &network.address { if ip == net_ip || ip == net_network || ip == net_broadcast { continue; } // Break loop if IP is unassigned and return device - match Self::find_by_ip(pool, ip, network_id).await? { - Some(_) => (), - None => { - let mut device = Self::new(name.clone(), pubkey, user_id); - device.save(pool).await?; - info!("Created device: {}", device.name); - debug!("For user: {}", device.user_id); - let wireguard_network_device = - WireguardNetworkDevice::new(network_id, device.id.unwrap(), ip); - wireguard_network_device.insert(pool).await?; - info!( - "Assigned IP: {} for device: {} in network: {}", - ip, name, network_id - ); - return Ok((device, wireguard_network_device)); - } + if Self::find_by_ip(pool, ip, network_id).await?.is_none() { + let mut device = Self::new(name.clone(), pubkey, user_id); + device.save(pool).await?; + info!("Created device: {}", device.name); + debug!("For user: {}", device.user_id); + let wireguard_network_device = + WireguardNetworkDevice::new(network_id, device.id.unwrap(), ip); + wireguard_network_device.insert(pool).await?; + info!("Assigned IP: {ip} for device: {name} in network: {network_id}"); + return Ok((device, wireguard_network_device)); } } Err(ModelError::CannotCreate) diff --git a/src/db/models/enrollment.rs b/src/db/models/enrollment.rs index d405a64dd..c85ca4587 100644 --- a/src/db/models/enrollment.rs +++ b/src/db/models/enrollment.rs @@ -1,5 +1,5 @@ +use super::{settings::Settings, DbPool, User}; use crate::{ - db::{DbPool, Settings, User}, mail::Mail, random::gen_alphanumeric, templates::{self, TemplateError}, @@ -7,7 +7,7 @@ use crate::{ }; use chrono::{Duration, NaiveDateTime, Utc}; use reqwest::Url; -use sqlx::{query, query_as, Error as SqlxError, Transaction}; +use sqlx::{query, query_as, Error as SqlxError, PgConnection}; use tera::{Context, Tera}; use thiserror::Error; use tokio::sync::mpsc::UnboundedSender; @@ -80,6 +80,7 @@ pub struct Enrollment { } impl Enrollment { + #[must_use] pub fn new( user_id: i64, admin_id: i64, @@ -98,10 +99,7 @@ impl Enrollment { } } - pub async fn save( - &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, - ) -> Result<(), EnrollmentError> { + pub async fn save(&self, transaction: &mut PgConnection) -> Result<(), EnrollmentError> { query!( "INSERT INTO enrollment (id, user_id, admin_id, email, created_at, expires_at, used_at) \ VALUES ($1, $2, $3, $4, $5, $6, $7)", @@ -119,17 +117,20 @@ impl Enrollment { } // check if token has already expired + #[must_use] pub fn is_expired(&self) -> bool { self.expires_at < Utc::now().naive_utc() } // check if token has already been used + #[must_use] pub fn is_used(&self) -> bool { self.used_at.is_some() } // check if enrollment session is still valid // after using the token user has 10 minutes to complete enrollment + #[must_use] pub fn is_session_valid(&self, session_timeout_seconds: u64) -> bool { if let Some(used_at) = self.used_at { let now = Utc::now(); @@ -143,7 +144,7 @@ impl Enrollment { // returns session deadline pub async fn start_session( &mut self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, session_timeout_seconds: u64, ) -> Result { // check if token can be used @@ -198,10 +199,9 @@ impl Enrollment { E: sqlx::Executor<'e, Database = sqlx::Postgres>, { debug!("Fetching user for enrollment"); - let Some(user) = User::find_by_id(executor, self.user_id) - .await? else { + let Some(user) = User::find_by_id(executor, self.user_id).await? else { error!("User not found for enrollment token {}", self.id); - return Err(EnrollmentError::UserNotFound) + return Err(EnrollmentError::UserNotFound); }; Ok(user) } @@ -211,16 +211,15 @@ impl Enrollment { E: sqlx::Executor<'e, Database = sqlx::Postgres>, { debug!("Fetching admin for enrollment"); - let Some(user) = User::find_by_id(executor, self.admin_id) - .await? else { + let Some(user) = User::find_by_id(executor, self.admin_id).await? else { error!("Admin not found for enrollment token {}", self.id); - return Err(EnrollmentError::AdminNotFound) + return Err(EnrollmentError::AdminNotFound); }; Ok(user) } pub async fn delete_unused_user_tokens( - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, user_id: i64, ) -> Result<(), EnrollmentError> { debug!("Deleting unused enrollment tokens for user {user_id}"); @@ -253,7 +252,7 @@ impl Enrollment { /// - admin_phone pub async fn get_welcome_message_context( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, ) -> Result { debug!( "Preparing welcome message context for enrollment token {}", @@ -281,7 +280,7 @@ impl Enrollment { // to be displayed on final enrollment page pub async fn get_welcome_page_content( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, ) -> Result { let settings = Settings::get_settings(&mut *transaction).await?; @@ -297,7 +296,7 @@ impl Enrollment { // Render welcome email content pub async fn get_welcome_email_content( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, ) -> Result { let settings = Settings::get_settings(&mut *transaction).await?; @@ -318,7 +317,7 @@ impl User { /// and optionally sends enrollment email notification to user pub async fn start_enrollment( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, admin: &User, email: Option, token_timeout_seconds: u64, @@ -384,7 +383,7 @@ impl User { // Remove unused tokens when triggering user enrollment async fn clear_unused_enrollment_tokens( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, ) -> Result<(), EnrollmentError> { info!( "Removing unused enrollment tokens for user {}", diff --git a/src/db/models/group.rs b/src/db/models/group.rs index dbc009a1c..18be5c375 100644 --- a/src/db/models/group.rs +++ b/src/db/models/group.rs @@ -1,9 +1,10 @@ -use crate::db::models::error::ModelError; -use crate::db::WireguardNetwork; -use crate::DbPool; +use crate::{ + db::{models::error::ModelError, WireguardNetwork}, + DbPool, +}; use model_derive::Model; use rocket::form::validate::Contains; -use sqlx::{query, query_as, query_scalar, Error as SqlxError, Transaction}; +use sqlx::{query, query_as, query_scalar, Error as SqlxError, PgConnection}; #[derive(Model)] pub struct Group { @@ -74,7 +75,7 @@ impl WireguardNetwork { /// access to networks based on allowed groups. pub async fn get_allowed_groups( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, admin_group_name: &String, ) -> Result>, ModelError> { debug!("Returning a list of allowed groups for network {}", self); @@ -97,7 +98,7 @@ impl WireguardNetwork { /// Set allowed groups, removing or adding groups as necessary. pub async fn set_allowed_groups( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, allowed_groups: Vec, ) -> Result<(), ModelError> { info!("Setting allowed groups for network {}", self); @@ -111,7 +112,7 @@ impl WireguardNetwork { // add to group if not already a member for group in &allowed_groups { if !current_groups.contains(group) { - self.add_to_group(transaction, group).await? + self.add_to_group(transaction, group).await?; } } @@ -126,7 +127,7 @@ impl WireguardNetwork { pub async fn add_to_group( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, group: &str, ) -> Result<(), ModelError> { info!("Adding allowed group {} for network {}", group, self); @@ -147,7 +148,7 @@ impl WireguardNetwork { pub async fn remove_from_groups( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, groups: Vec, ) -> Result<(), ModelError> { info!("Removing allowed groups {:?} for network {}", groups, self); @@ -174,10 +175,7 @@ impl WireguardNetwork { } /// Remove all allowed groups for a given network - async fn clear_allowed_groups( - &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, - ) -> Result<(), ModelError> { + async fn clear_allowed_groups(&self, transaction: &mut PgConnection) -> Result<(), ModelError> { info!("Removing all allowed groups for network {}", self); let result = query!( "DELETE FROM wireguard_network_allowed_group WHERE network_id=$1", diff --git a/src/db/models/mod.rs b/src/db/models/mod.rs index e4719e8b6..7894fd6c7 100644 --- a/src/db/models/mod.rs +++ b/src/db/models/mod.rs @@ -18,10 +18,12 @@ pub mod webauthn; pub mod webhook; pub mod wireguard; +use self::{ + device::UserDevice, + user::{MFAMethod, User}, +}; use super::{DbPool, Group}; -use crate::db::models::device::UserDevice; use sqlx::{query_as, Error as SqlxError}; -use user::{MFAMethod, User}; #[cfg(feature = "openid")] #[derive(Deserialize, Serialize)] @@ -216,14 +218,17 @@ impl MFAInfo { } } + #[must_use] pub fn mfa_available(&self) -> bool { self.webauthn_available || self.totp_available || self.web3_available } + #[must_use] pub fn current_mfa_method(&self) -> &MFAMethod { &self.mfa_method } + #[must_use] pub fn list_available_methods(&self) -> Option> { if !self.mfa_available() { return None; @@ -231,13 +236,13 @@ impl MFAInfo { let mut methods = Vec::new(); if self.webauthn_available { - methods.push(MFAMethod::Webauthn) + methods.push(MFAMethod::Webauthn); } if self.web3_available { - methods.push(MFAMethod::Web3) + methods.push(MFAMethod::Web3); } if self.totp_available { - methods.push(MFAMethod::OneTimePassword) + methods.push(MFAMethod::OneTimePassword); } Some(methods) } diff --git a/src/db/models/oauth2authorizedapp.rs b/src/db/models/oauth2authorizedapp.rs index d3552d5fb..011221b93 100644 --- a/src/db/models/oauth2authorizedapp.rs +++ b/src/db/models/oauth2authorizedapp.rs @@ -1,4 +1,4 @@ -use crate::db::DbPool; +use super::DbPool; use model_derive::Model; use sqlx::{query_as, Error as SqlxError}; diff --git a/src/db/models/oauth2client.rs b/src/db/models/oauth2client.rs index 56ef0517b..db13edf32 100644 --- a/src/db/models/oauth2client.rs +++ b/src/db/models/oauth2client.rs @@ -1,5 +1,5 @@ -use super::NewOpenIDClient; -use crate::{db::DbPool, random::gen_alphanumeric}; +use super::{DbPool, NewOpenIDClient}; +use crate::random::gen_alphanumeric; use model_derive::Model; use sqlx::{query_as, Error as SqlxError}; diff --git a/src/db/models/oauth2token.rs b/src/db/models/oauth2token.rs index 64d618171..11d69f744 100644 --- a/src/db/models/oauth2token.rs +++ b/src/db/models/oauth2token.rs @@ -1,4 +1,5 @@ -use crate::{auth::SESSION_TIMEOUT, db::DbPool, random::gen_alphanumeric}; +use super::DbPool; +use crate::{auth::SESSION_TIMEOUT, random::gen_alphanumeric}; use chrono::{Duration, Utc}; use sqlx::{query, query_as, Error as SqlxError}; diff --git a/src/db/models/session.rs b/src/db/models/session.rs index 6fd7fb836..c6b245cea 100644 --- a/src/db/models/session.rs +++ b/src/db/models/session.rs @@ -1,4 +1,5 @@ -use crate::{auth::SESSION_TIMEOUT, db::DbPool, random::gen_alphanumeric}; +use super::DbPool; +use crate::{auth::SESSION_TIMEOUT, random::gen_alphanumeric}; use chrono::{Duration, NaiveDateTime, Utc}; use sqlx::{query, query_as, Error as SqlxError, Type}; use webauthn_rs::prelude::{PasskeyAuthentication, PasskeyRegistration}; @@ -39,6 +40,7 @@ impl Session { } } + #[must_use] pub fn expired(&self) -> bool { self.expires < Utc::now().naive_utc() } diff --git a/src/db/models/settings.rs b/src/db/models/settings.rs index dee932440..514c6edf0 100644 --- a/src/db/models/settings.rs +++ b/src/db/models/settings.rs @@ -1,4 +1,5 @@ -use crate::{db::DbPool, secret::SecretString}; +use super::DbPool; +use crate::secret::SecretString; use model_derive::Model; use sqlx::{query, Type}; use std::collections::HashMap; diff --git a/src/db/models/user.rs b/src/db/models/user.rs index b73872dec..c2481174a 100644 --- a/src/db/models/user.rs +++ b/src/db/models/user.rs @@ -1,14 +1,11 @@ use super::{ - device::Device, group::Group, MFAInfo, OAuth2AuthorizedAppInfo, SecurityKey, WalletInfo, -}; -use crate::db::models::device::UserDevice; -use crate::{ - auth::TOTP_CODE_VALIDITY_PERIOD, - db::{Wallet, WebAuthn}, - error::OriWebError, - random::gen_alphanumeric, - DbPool, + device::{Device, UserDevice}, + group::Group, + wallet::Wallet, + webauthn::WebAuthn, + DbPool, MFAInfo, OAuth2AuthorizedAppInfo, SecurityKey, WalletInfo, }; +use crate::{auth::TOTP_CODE_VALIDITY_PERIOD, error::OriWebError, random::gen_alphanumeric}; use argon2::{ password_hash::{ errors::Error as HashError, rand_core::OsRng, PasswordHash, PasswordHasher, @@ -113,10 +110,12 @@ impl User { } } + #[must_use] pub fn has_password(&self) -> bool { self.password_hash.is_some() } + #[must_use] pub fn name(&self) -> String { format!("{} {}", self.first_name, self.last_name) } diff --git a/src/db/models/wallet.rs b/src/db/models/wallet.rs index c7328f66c..ecdb53e9f 100644 --- a/src/db/models/wallet.rs +++ b/src/db/models/wallet.rs @@ -1,4 +1,5 @@ -use crate::{hex::hex_decode, DbPool}; +use super::DbPool; +use crate::hex::hex_decode; use chrono::{NaiveDateTime, Utc}; use ethers_core::types::transaction::eip712::{Eip712, TypedData}; use model_derive::Model; @@ -43,6 +44,7 @@ impl Display for Web3Error { } /// Compute the Keccak-256 hash of input bytes. +#[must_use] pub fn keccak256(bytes: &[u8]) -> [u8; 32] { let mut output = [0u8; 32]; let mut hasher = Keccak::v256(); @@ -146,6 +148,7 @@ impl Wallet { } /// Prepare challenge message using EIP-712 format + #[must_use] pub fn format_challenge(address: &str, challenge_message: &str) -> String { let nonce = Nonce::new_random(); diff --git a/src/db/models/wireguard.rs b/src/db/models/wireguard.rs index 0668de2e7..c6f99a51d 100644 --- a/src/db/models/wireguard.rs +++ b/src/db/models/wireguard.rs @@ -1,18 +1,19 @@ use super::{ - device::{Device, WireguardNetworkDevice}, + device::{Device, DeviceError, DeviceInfo, DeviceNetworkInfo, WireguardNetworkDevice}, error::ModelError, DbPool, User, UserInfo, }; -use crate::db::models::device::{DeviceError, DeviceInfo, DeviceNetworkInfo}; -use crate::grpc::{gateway::Peer, GatewayState}; -use crate::handlers::wireguard::MappedDevice; -use crate::wg_config::ImportedDevice; +use crate::{ + grpc::{gateway::Peer, GatewayState}, + handlers::wireguard::MappedDevice, + wg_config::ImportedDevice, +}; use base64::Engine; use chrono::{Duration, NaiveDateTime, Utc}; use ipnetwork::{IpNetwork, IpNetworkError, NetworkSize}; use model_derive::Model; use rand_core::OsRng; -use sqlx::{query_as, query_scalar, Error as SqlxError, FromRow, Transaction}; +use sqlx::{query_as, query_scalar, Error as SqlxError, FromRow, PgConnection}; use std::{ collections::HashMap, fmt::{Debug, Display, Formatter}, @@ -159,7 +160,7 @@ impl WireguardNetwork { /// Return number of devices that use this network. async fn device_count( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, ) -> Result { let count = query_scalar!("SELECT count(*) \"count!\" FROM wireguard_network_device WHERE wireguard_network_id = $1", self.id) .fetch_one(transaction) @@ -211,7 +212,7 @@ impl WireguardNetwork { /// Try to change network address, changing device addresses if necessary. pub async fn change_address( &mut self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, new_address: IpNetwork, ) -> Result<(), WireguardNetworkError> { info!( @@ -249,17 +250,14 @@ impl WireguardNetwork { let net_broadcast = new_address.broadcast(); let mut devices_iter = devices.iter_mut(); - for ip in new_address.iter() { + for ip in &new_address { if ip == net_ip || ip == net_network || ip == net_broadcast { continue; } match devices_iter.next() { Some(device) => { - let device_id = match device.id { - Some(id) => id, - None => { - return Err(WireguardNetworkError::from(ModelError::CannotModify)); - } + let Some(device_id) = device.id else { + return Err(WireguardNetworkError::from(ModelError::CannotModify)); }; let wireguard_network_device = WireguardNetworkDevice::new(network_id, device_id, ip); @@ -278,7 +276,7 @@ impl WireguardNetwork { /// Admin users should always be allowed to access a network. async fn get_allowed_devices( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, admin_group_name: &String, ) -> Result, ModelError> { debug!("Fetching all allowed devices for network {}", self); @@ -316,7 +314,7 @@ impl WireguardNetwork { /// If `allowed_groups` is set, devices should be filtered accordingly pub async fn add_all_allowed_devices( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, admin_group_name: &String, ) -> Result<(), ModelError> { info!( @@ -337,12 +335,12 @@ impl WireguardNetwork { /// Generate network IPs for a device if it's allowed in network pub async fn add_device_to_network( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, device: &Device, admin_group_name: &String, reserved_ips: Option<&Vec>, ) -> Result { - info!("Assigning IP in network {} for {}", self, device); + info!("Assigning IP in network {self} for {device}"); let allowed_devices = self .get_allowed_devices(&mut *transaction, admin_group_name) .await?; @@ -367,7 +365,7 @@ impl WireguardNetwork { /// If the network address has changed readdress existing devices pub async fn sync_allowed_devices( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, admin_group_name: &String, reserved_ips: Option<&Vec>, ) -> Result, WireguardNetworkError> { @@ -399,51 +397,42 @@ impl WireguardNetwork { let network_id = self.get_id()?; let mut events = Vec::new(); for device_network_config in assigned_ips { - match allowed_devices.remove(&device_network_config.device_id) { - // device is allowed and an IP was already assigned - Some(device) => { - // network address changed and IP needs to be updated - if !self.address.contains(device_network_config.wireguard_ip) { - let wireguard_network_device = device - .assign_network_ip(&mut *transaction, self, reserved_ips) - .await?; - events.push(GatewayEvent::DeviceModified(DeviceInfo { - device, - network_info: vec![DeviceNetworkInfo { - network_id, - device_wireguard_ip: wireguard_network_device.wireguard_ip, - }], - })); - } + // device is allowed and an IP was already assigned + if let Some(device) = allowed_devices.remove(&device_network_config.device_id) { + // network address changed and IP needs to be updated + if !self.address.contains(device_network_config.wireguard_ip) { + let wireguard_network_device = device + .assign_network_ip(&mut *transaction, self, reserved_ips) + .await?; + events.push(GatewayEvent::DeviceModified(DeviceInfo { + device, + network_info: vec![DeviceNetworkInfo { + network_id, + device_wireguard_ip: wireguard_network_device.wireguard_ip, + }], + })); } - // device is no longer allowed - None => { - debug!( - "Device {} no longer allowed, removing network config for {}", - device_network_config.device_id, self - ); - device_network_config.delete(&mut *transaction).await?; - match Device::find_by_id(&mut *transaction, device_network_config.device_id) - .await? - { - Some(device) => { - events.push(GatewayEvent::DeviceDeleted(DeviceInfo { - device, - network_info: vec![DeviceNetworkInfo { - network_id, - device_wireguard_ip: device_network_config.wireguard_ip, - }], - })); - } - None => { - let msg = format!( - "Device {} does not exist", - device_network_config.device_id - ); - error!("{}", msg); - return Err(WireguardNetworkError::Unexpected(msg)); - } - } + // device is no longer allowed + } else { + debug!( + "Device {} no longer allowed, removing network config for {self}", + device_network_config.device_id + ); + device_network_config.delete(&mut *transaction).await?; + if let Some(device) = + Device::find_by_id(&mut *transaction, device_network_config.device_id).await? + { + events.push(GatewayEvent::DeviceDeleted(DeviceInfo { + device, + network_info: vec![DeviceNetworkInfo { + network_id, + device_wireguard_ip: device_network_config.wireguard_ip, + }], + })); + } else { + let msg = format!("Device {} does not exist", device_network_config.device_id); + error!("{msg}"); + return Err(WireguardNetworkError::Unexpected(msg)); } } } @@ -471,7 +460,7 @@ impl WireguardNetwork { /// and a list of wireguard events to be sent out. pub async fn handle_imported_devices( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, imported_devices: Vec, admin_group_name: &String, ) -> Result<(Vec, Vec), WireguardNetworkError> { @@ -536,7 +525,7 @@ impl WireguardNetwork { /// Handle device -> user mapping in second step of network import wizard pub async fn handle_mapped_devices( &self, - transaction: &mut Transaction<'_, sqlx::Postgres>, + transaction: &mut PgConnection, mapped_devices: Vec, admin_group_name: &String, ) -> Result, WireguardNetworkError> { @@ -725,13 +714,12 @@ impl WireguardNetwork { cast(sum(download) as bigint) as download, cast(sum(upload) as bigint) as upload FROM wireguard_peer_stats_view - WHERE device_id IN ({}) + WHERE device_id IN ({device_ids}) AND collected_at >= $2 AND network = $3 GROUP BY 1, 2 ORDER BY 1, 2 - "#, - device_ids + "# ); let stats: Vec = query_as(&query) .bind(aggregation.fstring()) @@ -755,7 +743,7 @@ impl WireguardNetwork { .filter(|s| Some(s.device_id) == device.id) .cloned() .collect(), - }) + }); } Ok(result) } @@ -1051,8 +1039,8 @@ mod test { .change_address(&mut transaction, "10.2.2.2/24".parse().unwrap()) .await .unwrap(); - let keys = vec!["key0", "key1", "key2"]; - let ips = vec!["10.2.2.1", "10.2.2.3", "10.2.2.4"]; + let keys = ["key0", "key1", "key2"]; + let ips = ["10.2.2.1", "10.2.2.3", "10.2.2.4"]; transaction.commit().await.unwrap(); for (index, pub_key) in keys.iter().enumerate() { @@ -1068,7 +1056,7 @@ mod test { assert_eq!( wireguard_network_device.wireguard_ip.to_string(), ips[index] - ) + ); } } diff --git a/src/error.rs b/src/error.rs index e5daca322..72937db59 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,10 +1,13 @@ -use crate::auth::failed_login::FailedLoginError; -use crate::db::models::device::DeviceError; -use crate::db::models::enrollment::EnrollmentError; -use crate::db::models::wireguard::WireguardNetworkError; -use crate::grpc::GatewayMapError; -use crate::templates::TemplateError; -use crate::{db::models::error::ModelError, ldap::error::OriLDAPError}; +use crate::{ + auth::failed_login::FailedLoginError, + db::models::{ + device::DeviceError, enrollment::EnrollmentError, error::ModelError, + wireguard::WireguardNetworkError, + }, + grpc::GatewayMapError, + ldap::error::OriLDAPError, + templates::TemplateError, +}; use rocket::http::Status; use sqlx::error::Error as SqlxError; use thiserror::Error; @@ -82,9 +85,9 @@ impl From for OriWebError { impl From for OriWebError { fn from(error: DeviceError) -> Self { match error { - DeviceError::PubkeyConflict(..) => Self::PubkeyValidation(format!("{}", error)), - DeviceError::DatabaseError(_) => Self::DbError(format!("{}", error)), - DeviceError::ModelError(_) => Self::ModelError(format!("{}", error)), + DeviceError::PubkeyConflict(..) => Self::PubkeyValidation(error.to_string()), + DeviceError::DatabaseError(_) => Self::DbError(error.to_string()), + DeviceError::ModelError(_) => Self::ModelError(error.to_string()), DeviceError::Unexpected(_) => Self::Http(Status::InternalServerError), } } @@ -95,8 +98,8 @@ impl From for OriWebError { match error { GatewayMapError::NotFound(_, _) | GatewayMapError::NetworkNotFound(_) - | GatewayMapError::UidNotFound(_) => Self::ObjectNotFound(format!("{}", error)), - GatewayMapError::RemoveActive(_) => Self::BadRequest(format!("{}", error)), + | GatewayMapError::UidNotFound(_) => Self::ObjectNotFound(error.to_string()), + GatewayMapError::RemoveActive(_) => Self::BadRequest(error.to_string()), } } } @@ -106,9 +109,7 @@ impl From for OriWebError { match error { WireguardNetworkError::NetworkTooSmall | WireguardNetworkError::IpNetworkError(_) - | WireguardNetworkError::InvalidDevicePubkey(_) => { - Self::BadRequest(format!("{}", error)) - } + | WireguardNetworkError::InvalidDevicePubkey(_) => Self::BadRequest(error.to_string()), WireguardNetworkError::DbError(_) | WireguardNetworkError::ModelError(_) | WireguardNetworkError::Unexpected(_) diff --git a/src/grpc/auth.rs b/src/grpc/auth.rs index 3856226f3..950eb0ac7 100644 --- a/src/grpc/auth.rs +++ b/src/grpc/auth.rs @@ -1,6 +1,8 @@ -use crate::auth::failed_login::{check_username, log_failed_login_attempt, FailedLoginMap}; use crate::{ - auth::{Claims, ClaimsType, SESSION_TIMEOUT}, + auth::{ + failed_login::{check_username, log_failed_login_attempt, FailedLoginMap}, + Claims, ClaimsType, SESSION_TIMEOUT, + }, db::{DbPool, User}, }; use jsonwebtoken::errors::Error as JWTError; @@ -43,28 +45,24 @@ impl auth_service_server::AuthService for AuthServer { check_username(&self.failed_logins, &request.username) .map_err(|_| Status::resource_exhausted("too many login requests"))?; - match User::find_by_username(&self.pool, &request.username).await { - Ok(Some(user)) => match user.verify_password(&request.password) { - Ok(_) => { - info!("Authentication successful for user {}", &request.username); - Ok(Response::new(AuthenticateResponse { - token: Self::create_jwt(&request.username).map_err(|_| { - log_failed_login_attempt(&self.failed_logins, &request.username); - Status::unauthenticated("error creating JWT token") - })?, - })) - } - Err(_) => { - warn!("Invalid login credentials for user {}", &request.username); - log_failed_login_attempt(&self.failed_logins, &request.username); - Err(Status::unauthenticated("invalid credentials")) - } - }, - _ => { - warn!("User {} not found", &request.username); + if let Ok(Some(user)) = User::find_by_username(&self.pool, &request.username).await { + if user.verify_password(&request.password).is_ok() { + info!("Authentication successful for user {}", &request.username); + Ok(Response::new(AuthenticateResponse { + token: Self::create_jwt(&request.username).map_err(|_| { + log_failed_login_attempt(&self.failed_logins, &request.username); + Status::unauthenticated("error creating JWT token") + })?, + })) + } else { + warn!("Invalid login credentials for user {}", &request.username); log_failed_login_attempt(&self.failed_logins, &request.username); Err(Status::unauthenticated("invalid credentials")) } + } else { + warn!("User {} not found", &request.username); + log_failed_login_attempt(&self.failed_logins, &request.username); + Err(Status::unauthenticated("invalid credentials")) } } } diff --git a/src/grpc/enrollment.rs b/src/grpc/enrollment.rs index bef7736a8..e42798398 100644 --- a/src/grpc/enrollment.rs +++ b/src/grpc/enrollment.rs @@ -60,14 +60,13 @@ impl EnrollmentServer { request: &Request, ) -> Result { debug!("Validating enrollment session token: {request:?}"); - let token = match request.metadata().get("authorization") { - Some(token) => token + let token = if let Some(token) = request.metadata().get("authorization") { + token .to_str() - .map_err(|_| Status::unauthenticated("Invalid token"))?, - None => { - error!("Missing authorization header in request"); - return Err(Status::unauthenticated("Missing authorization header")); - } + .map_err(|_| Status::unauthenticated("Invalid token"))? + } else { + error!("Missing authorization header in request"); + return Err(Status::unauthenticated("Missing authorization header")); }; let enrollment = Enrollment::find_by_id(&self.pool, token).await?; @@ -117,7 +116,7 @@ impl enrollment_service_server::EnrollmentService for EnrollmentServer { ) .await?; - let settings = Settings::get_settings(&mut transaction) + let settings = Settings::get_settings(&mut *transaction) .await .map_err(|_| { error!("Failed to get settings"); @@ -172,7 +171,7 @@ impl enrollment_service_server::EnrollmentService for EnrollmentServer { // update user user.phone = Some(request.phone_number); user.set_password(&request.password); - user.save(&mut transaction).await.map_err(|err| { + user.save(&mut *transaction).await.map_err(|err| { error!("Failed to update user {}: {err}", user.username); Status::internal("unexpected error") })?; @@ -182,7 +181,7 @@ impl enrollment_service_server::EnrollmentService for EnrollmentServer { let _result = ldap_add_user(&self.config, &user, &request.password).await; }; - let settings = Settings::get_settings(&mut transaction) + let settings = Settings::get_settings(&mut *transaction) .await .map_err(|_| { error!("Failed to get settings"); @@ -195,8 +194,8 @@ impl enrollment_service_server::EnrollmentService for EnrollmentServer { .await?; // send success notification to admin - let admin = enrollment.fetch_admin(&mut transaction).await?; - enrollment.send_admin_notification(&self.mail_tx, &admin, &user)?; + let admin = enrollment.fetch_admin(&mut *transaction).await?; + Enrollment::send_admin_notification(&self.mail_tx, &admin, &user)?; transaction.commit().await.map_err(|_| { error!("Failed to commit transaction"); @@ -229,7 +228,7 @@ impl enrollment_service_server::EnrollmentService for EnrollmentServer { error!("Failed to begin transaction"); Status::internal("unexpected error") })?; - device.save(&mut transaction).await.map_err(|err| { + device.save(&mut *transaction).await.map_err(|err| { error!("Failed to save device {}: {err}", device.name); Status::internal("unexpected error") })?; @@ -257,7 +256,7 @@ impl enrollment_service_server::EnrollmentService for EnrollmentServer { let response = CreateDeviceResponse { device: Some(device.into()), - configs: configs.into_iter().map(|config| config.into()).collect(), + configs: configs.into_iter().map(Into::into).collect(), }; Ok(Response::new(response)) @@ -339,7 +338,6 @@ impl Enrollment { // Notify admin that a user has completed enrollment fn send_admin_notification( - &self, mail_tx: &UnboundedSender, admin: &User, user: &User, diff --git a/src/grpc/gateway.rs b/src/grpc/gateway.rs index 05e8a62c5..a5e33ad5c 100644 --- a/src/grpc/gateway.rs +++ b/src/grpc/gateway.rs @@ -1,9 +1,7 @@ -use crate::{ - db::{ - models::wireguard::{WireguardNetwork, WireguardPeerStats}, - DbPool, Device, GatewayEvent, - }, - grpc::GatewayMap, +use super::GatewayMap; +use crate::db::{ + models::wireguard::{WireguardNetwork, WireguardPeerStats}, + DbPool, Device, GatewayEvent, }; use chrono::{NaiveDateTime, Utc}; use sqlx::{query_as, Error as SqlxError}; @@ -287,10 +285,9 @@ impl GatewayUpdatesHandler { .await { let msg = format!( - "Failed to send network update, network {}, update type: {}, error: {}", - network, update_type, err, + "Failed to send network update, network {network}, update type: {update_type}, error: {err}", ); - error!("{}", msg); + error!("{msg}"); return Err(Status::new(tonic::Code::Internal, msg)); } Ok(()) @@ -450,27 +447,27 @@ impl gateway_service_server::GatewayService for GatewayServer { } Err(err) => { error!( - "Failed to retrieve device with public key {}: {}", - &public_key, err + "Failed to retrieve device with public key {}: {err}", + &public_key ); return Err(Status::new( tonic::Code::Internal, format!( - "Failed to retrieve device with public key {}: {}", - &public_key, err + "Failed to retrieve device with public key {}: {err}", + &public_key ), )); } }; // Save stats to db if let Err(err) = stats.save(&self.pool).await { - error!("Saving WireGuard peer stats to db failed: {}", err); + error!("Saving WireGuard peer stats to db failed: {err}"); return Err(Status::new( tonic::Code::Internal, - format!("Saving WireGuard peer stats to db failed: {}", err), + format!("Saving WireGuard peer stats to db failed: {err}"), )); } - info!("Saved WireGuard peer stats to db: {:?}", stats); + info!("Saved WireGuard peer stats to db: {stats:?}"); } Ok(Response::new(())) } @@ -490,15 +487,12 @@ impl gateway_service_server::GatewayService for GatewayServer { error!("Network {} not found", network_id); Status::new( tonic::Code::Internal, - format!("Failed to retrieve network: {}", e), + format!("Failed to retrieve network: {e}"), ) })? .ok_or_else(|| Status::new(tonic::Code::Internal, "Network not found"))?; - info!( - "Sending configuration to gateway client, network {}.", - network - ); + info!("Sending configuration to gateway client, network {network}."); { let mut state = self.state.lock().unwrap(); @@ -507,17 +501,14 @@ impl gateway_service_server::GatewayService for GatewayServer { network.connected_at = Some(Utc::now().naive_utc()); if let Err(err) = network.save(&pool).await { - error!("Failed to update network {} status: {}", network_id, err); + error!("Failed to update network {network_id} status: {err}"); } let peers = network.get_peers(&pool).await.map_err(|error| { - error!( - "Failed to fetch peers for network {}: {}", - network_id, error - ); + error!("Failed to fetch peers for network {network_id}: {error}",); Status::new( tonic::Code::Internal, - format!("Failed to retrieve peers for network: {}", network_id), + format!("Failed to retrieve peers for network: {network_id}"), ) })?; @@ -528,23 +519,20 @@ impl gateway_service_server::GatewayService for GatewayServer { let gateway_network_id = Self::get_network_id(request.metadata())?; let hostname = Self::get_gateway_hostname(request.metadata())?; - let network = match WireguardNetwork::find_by_id(&self.pool, gateway_network_id) + let Some(network) = WireguardNetwork::find_by_id(&self.pool, gateway_network_id) .await .map_err(|_| { - error!("Failed to fetch network {}", gateway_network_id); + error!("Failed to fetch network {gateway_network_id}"); Status::new( tonic::Code::Internal, - format!("Failed to retrieve network {}", gateway_network_id), + format!("Failed to retrieve network {gateway_network_id}"), ) - })? { - Some(network) => network, - None => return Err(Status::new(Code::Internal, "Network not found")), + })? + else { + return Err(Status::new(Code::Internal, "Network not found")); }; - info!( - "New client connected to updates stream: {}, network {}", - hostname, network - ); + info!("New client connected to updates stream: {hostname}, network {network}",); let (tx, rx) = mpsc::channel(4); let events_rx = self.wireguard_tx.subscribe(); @@ -552,7 +540,7 @@ impl gateway_service_server::GatewayService for GatewayServer { state .connect_gateway(gateway_network_id, &hostname) .map_err(|err| { - error!("Failed to connect gateway: {}", err); + error!("Failed to connect gateway: {err}"); Status::new(tonic::Code::Internal, "Failed to connect gateway ") })?; @@ -566,7 +554,7 @@ impl gateway_service_server::GatewayService for GatewayServer { events_rx, tx, ); - update_handler.run().await + update_handler.run().await; }); Ok(Response::new(GatewayUpdatesStream::new( diff --git a/src/grpc/interceptor.rs b/src/grpc/interceptor.rs index 349b3085f..4872a327b 100644 --- a/src/grpc/interceptor.rs +++ b/src/grpc/interceptor.rs @@ -23,7 +23,7 @@ impl Interceptor for JwtInterceptor { .map_err(|_| Status::unauthenticated("Invalid token"))?, None => return Err(Status::unauthenticated("Missing authorization header")), }; - if let Ok(claims) = Claims::from_jwt(self.claims_type.clone(), token) { + if let Ok(claims) = Claims::from_jwt(self.claims_type, token) { let request_metadata = req.metadata_mut(); if let ClaimsType::Gateway = self.claims_type { diff --git a/src/grpc/mod.rs b/src/grpc/mod.rs index 95073fdda..f82af4425 100644 --- a/src/grpc/mod.rs +++ b/src/grpc/mod.rs @@ -1,34 +1,31 @@ +use self::{ + interceptor::JwtInterceptor, + worker::{worker_service_server::WorkerServiceServer, WorkerServer}, +}; +use crate::{auth::failed_login::FailedLoginMap, config::DefGuardConfig, db::AppEvent, mail::Mail}; #[cfg(feature = "worker")] use crate::{ auth::ClaimsType, db::{DbPool, GatewayEvent}, - grpc::{ - interceptor::JwtInterceptor, - worker::{worker_service_server::WorkerServiceServer, WorkerServer}, - }, }; use auth::{auth_service_server::AuthServiceServer, AuthServer}; +use chrono::{NaiveDateTime, Utc}; use enrollment::{proto::enrollment_service_server::EnrollmentServiceServer, EnrollmentServer}; #[cfg(feature = "wireguard")] use gateway::{gateway_service_server::GatewayServiceServer, GatewayServer}; +use serde::Serialize; +use std::{ + collections::hash_map::HashMap, + time::{Duration, Instant}, +}; #[cfg(any(feature = "wireguard", feature = "worker"))] use std::{ net::{IpAddr, Ipv4Addr, SocketAddr}, sync::{Arc, Mutex}, }; -use tokio::sync::mpsc::UnboundedSender; -use tonic::transport::{Identity, Server, ServerTlsConfig}; - -use crate::auth::failed_login::FailedLoginMap; -use crate::config::DefGuardConfig; -use crate::db::AppEvent; -use crate::mail::Mail; -use chrono::{NaiveDateTime, Utc}; -use serde::Serialize; -use std::time::Duration; -use std::{collections::hash_map::HashMap, time::Instant}; use thiserror::Error; -use tokio::sync::broadcast::Sender; +use tokio::sync::{broadcast::Sender, mpsc::UnboundedSender}; +use tonic::transport::{Identity, Server, ServerTlsConfig}; use uuid::Uuid; mod auth; @@ -68,58 +65,49 @@ impl GatewayMap { // this method is meant to be called when a gateway requests a config // as a sort of "registration" pub fn add_gateway(&mut self, network_id: i64, hostname: String, name: Option) { - info!( - "Adding gateway {} with to gateway map for network {}", - hostname, network_id - ); - match self.0.get_mut(&network_id) { - Some(network_gateway_map) => { - network_gateway_map.insert( - hostname.clone(), - GatewayState::new(network_id, hostname, name), - ); - } + info!("Adding gateway {hostname} with to gateway map for network {network_id}",); + if let Some(network_gateway_map) = self.0.get_mut(&network_id) { + network_gateway_map.insert( + hostname.clone(), + GatewayState::new(network_id, hostname, name), + ); + } else { // no map for a given network exists yet - None => { - let mut network_gateway_map = HashMap::new(); - network_gateway_map.insert( - hostname.clone(), - GatewayState::new(network_id, hostname, name), - ); - self.0.insert(network_id, network_gateway_map); - } + let mut network_gateway_map = HashMap::new(); + network_gateway_map.insert( + hostname.clone(), + GatewayState::new(network_id, hostname, name), + ); + self.0.insert(network_id, network_gateway_map); } } // remove gateway from map pub fn remove_gateway(&mut self, network_id: i64, uid: Uuid) -> Result<(), GatewayMapError> { - info!("Removing gateway from network {}", network_id); - match self.0.get_mut(&network_id) { - Some(network_gateway_map) => { - // find gateway by uuid - let hostname = match network_gateway_map - .iter() - .find(|(_address, state)| state.uid == uid) - { - None => { - error!("Failed to find gateway with UID {}", uid); - return Err(GatewayMapError::UidNotFound(uid)); - } - Some((hostname, state)) => { - if state.connected { - return Err(GatewayMapError::RemoveActive(uid)); - } - hostname.clone() + info!("Removing gateway from network {network_id}"); + if let Some(network_gateway_map) = self.0.get_mut(&network_id) { + // find gateway by uuid + let hostname = match network_gateway_map + .iter() + .find(|(_address, state)| state.uid == uid) + { + None => { + error!("Failed to find gateway with UID {uid}"); + return Err(GatewayMapError::UidNotFound(uid)); + } + Some((hostname, state)) => { + if state.connected { + return Err(GatewayMapError::RemoveActive(uid)); } - }; - // remove matching gateway - network_gateway_map.remove(&hostname) - } + hostname.clone() + } + }; + // remove matching gateway + network_gateway_map.remove(&hostname) + } else { // no map for a given network exists yet - None => { - error!("Network {} not found in gateway map", network_id); - return Err(GatewayMapError::NetworkNotFound(network_id)); - } + error!("Network {network_id} not found in gateway map"); + return Err(GatewayMapError::NetworkNotFound(network_id)); }; Ok(()) } @@ -131,26 +119,19 @@ impl GatewayMap { network_id: i64, hostname: &str, ) -> Result<(), GatewayMapError> { - info!("Connecting gateway {} in network {}", hostname, network_id); - match self.0.get_mut(&network_id) { - Some(network_gateway_map) => match network_gateway_map.get_mut(hostname) { - Some(state) => { - state.connected = true; - state.connected_at = Some(Utc::now().naive_utc()); - } - None => { - error!( - "Gateway {} not found in gateway map for network {}", - hostname, network_id - ); - return Err(GatewayMapError::NotFound(network_id, hostname.into())); - } - }, - // no map for a given network exists yet - None => { - error!("Network {} not found in gateway map", network_id); - return Err(GatewayMapError::NetworkNotFound(network_id)); + info!("Connecting gateway {hostname} in network {network_id}"); + if let Some(network_gateway_map) = self.0.get_mut(&network_id) { + if let Some(state) = network_gateway_map.get_mut(hostname) { + state.connected = true; + state.connected_at = Some(Utc::now().naive_utc()); + } else { + error!("Gateway {hostname} not found in gateway map for network {network_id}"); + return Err(GatewayMapError::NotFound(network_id, hostname.into())); } + } else { + // no map for a given network exists yet + error!("Network {network_id} not found in gateway map"); + return Err(GatewayMapError::NetworkNotFound(network_id)); }; Ok(()) } @@ -161,10 +142,7 @@ impl GatewayMap { network_id: i64, hostname: String, ) -> Result<(), GatewayMapError> { - info!( - "Disconnecting gateway {} in network {}", - hostname, network_id - ); + info!("Disconnecting gateway {hostname} in network {network_id}"); if let Some(network_gateway_map) = self.0.get_mut(&network_id) { if let Some(state) = network_gateway_map.get_mut(&hostname) { state.connected = false; @@ -173,11 +151,12 @@ impl GatewayMap { }; }; let err = GatewayMapError::NotFound(network_id, hostname); - error!("Gateway disconnect failed: {}", err); + error!("Gateway disconnect failed: {err}"); Err(err) } // return `true` if at least one gateway in a given network is connected + #[must_use] pub fn connected(&self, network_id: i64) -> bool { match self.0.get(&network_id) { Some(network_gateway_map) => network_gateway_map @@ -188,6 +167,7 @@ impl GatewayMap { } // return a list af aff statuses af all gateways in a given network + #[must_use] pub fn get_network_gateway_status(&self, network_id: i64) -> Vec { match self.0.get(&network_id) { Some(network_gateway_map) => network_gateway_map.clone().into_values().collect(), diff --git a/src/handlers/auth.rs b/src/handlers/auth.rs index f3cccf972..a893872ef 100644 --- a/src/handlers/auth.rs +++ b/src/handlers/auth.rs @@ -2,12 +2,11 @@ use super::{ ApiResponse, ApiResult, Auth, AuthCode, AuthResponse, AuthTotp, RecoveryCode, RecoveryCodes, WalletAddress, WalletSignature, WebAuthnRegistration, }; -use crate::auth::failed_login::{check_username, log_failed_login_attempt}; -use crate::db::MFAMethod; use crate::{ appstate::AppState, + auth::failed_login::{check_username, log_failed_login_attempt}, auth::SessionInfo, - db::{MFAInfo, Session, SessionState, Settings, User, UserInfo, Wallet, WebAuthn}, + db::{MFAInfo, MFAMethod, Session, SessionState, Settings, User, UserInfo, Wallet, WebAuthn}, error::OriWebError, ldap::utils::user_from_ldap, license::Features, @@ -269,7 +268,7 @@ pub async fn webauthn_finish( .webauthn .get_allowed_origins() .iter() - .map(|url| url.to_string()) + .map(ToString::to_string) .collect::>() ); @@ -574,15 +573,15 @@ pub async fn recovery_code( }), status: Status::Ok, }); - } else { - return Ok(ApiResponse { - json: json!(AuthResponse { - user: user_info, - url: None, - }), - status: Status::Ok, - }); } + + return Ok(ApiResponse { + json: json!(AuthResponse { + user: user_info, + url: None, + }), + status: Status::Ok, + }); } } Err(OriWebError::Http(Status::Unauthorized)) diff --git a/src/handlers/forward_auth.rs b/src/handlers/forward_auth.rs index f3d68f6c6..9939b4856 100644 --- a/src/handlers/forward_auth.rs +++ b/src/handlers/forward_auth.rs @@ -91,11 +91,10 @@ async fn login_redirect(headers: ForwardAuthHeaders) -> Result Result) -> A #[get("/group/", format = "json")] pub async fn get_group(_session: SessionInfo, appstate: &State, name: &str) -> ApiResult { - debug!("Retrieving group {}", name); - match Group::find_by_name(&appstate.pool, name).await? { - Some(group) => { - let members = group.member_usernames(&appstate.pool).await?; - info!("Retrieved group {}", name); - Ok(ApiResponse { - json: json!(GroupInfo::new(name.into(), members)), - status: Status::Ok, - }) - } - None => { - error!("Group {} not found", name); - Err(OriWebError::ObjectNotFound(format!( - "Group {} not found", - name - ))) - } + debug!("Retrieving group {name}"); + if let Some(group) = Group::find_by_name(&appstate.pool, name).await? { + let members = group.member_usernames(&appstate.pool).await?; + info!("Retrieved group {name}"); + Ok(ApiResponse { + json: json!(GroupInfo::new(name.into(), members)), + status: Status::Ok, + }) + } else { + error!("Group {name} not found"); + Err(OriWebError::ObjectNotFound(format!( + "Group {name} not found", + ))) } } @@ -82,31 +77,26 @@ pub async fn add_group_member( name: &str, data: Json, ) -> ApiResult { - match Group::find_by_name(&appstate.pool, name).await? { - Some(group) => match User::find_by_username(&appstate.pool, &data.username).await? { - Some(user) => { - debug!("Adding user: {} to group: {}", user.username, group.name); - user.add_to_group(&appstate.pool, &group).await?; - let _result = - ldap_add_user_to_group(&appstate.config, &user.username, &group.name).await; - info!("Added user: {} to group: {}", user.username, group.name); - Ok(ApiResponse::default()) - } - None => { - error!("User not found {}", data.username); - Err(OriWebError::ObjectNotFound(format!( - "User {} not found", - data.username - ))) - } - }, - None => { - error!("Group {} not found", name); + if let Some(group) = Group::find_by_name(&appstate.pool, name).await? { + if let Some(user) = User::find_by_username(&appstate.pool, &data.username).await? { + debug!("Adding user: {} to group: {}", user.username, group.name); + user.add_to_group(&appstate.pool, &group).await?; + let _result = + ldap_add_user_to_group(&appstate.config, &user.username, &group.name).await; + info!("Added user: {} to group: {}", user.username, group.name); + Ok(ApiResponse::default()) + } else { + error!("User not found {}", data.username); Err(OriWebError::ObjectNotFound(format!( - "Group {} not found", - name + "User {} not found", + data.username ))) } + } else { + error!("Group {name} not found"); + Err(OriWebError::ObjectNotFound(format!( + "Group {name} not found" + ))) } } @@ -117,37 +107,30 @@ pub async fn remove_group_member( name: &str, username: &str, ) -> ApiResult { - match Group::find_by_name(&appstate.pool, name).await? { - Some(group) => match User::find_by_username(&appstate.pool, username).await? { - Some(user) => { - debug!( - "Removing user: {} from group: {}", - user.username, group.name - ); - user.remove_from_group(&appstate.pool, &group).await?; - let _result = - ldap_remove_user_from_group(&appstate.config, &user.username, &group.name) - .await; - info!("Removed user: {} from group: {}", user.username, group.name); - Ok(ApiResponse { - json: json!({}), - status: Status::Ok, - }) - } - None => { - error!("User not found {}", username); - Err(OriWebError::ObjectNotFound(format!( - "User {} not found", - username - ))) - } - }, - None => { - error!("Group {} not found", name); + if let Some(group) = Group::find_by_name(&appstate.pool, name).await? { + if let Some(user) = User::find_by_username(&appstate.pool, username).await? { + debug!( + "Removing user: {} from group: {}", + user.username, group.name + ); + user.remove_from_group(&appstate.pool, &group).await?; + let _result = + ldap_remove_user_from_group(&appstate.config, &user.username, &group.name).await; + info!("Removed user: {} from group: {}", user.username, group.name); + Ok(ApiResponse { + json: json!({}), + status: Status::Ok, + }) + } else { + error!("User not found {}", username); Err(OriWebError::ObjectNotFound(format!( - "Group {} not found", - name + "User {username} not found" ))) } + } else { + error!("Group {name} not found"); + Err(OriWebError::ObjectNotFound(format!( + "Group {name} not found", + ))) } } diff --git a/src/handlers/license.rs b/src/handlers/license.rs index 726a99a06..2f318c822 100644 --- a/src/handlers/license.rs +++ b/src/handlers/license.rs @@ -1,4 +1,5 @@ -use crate::{appstate::AppState, handlers::ApiResponse, license::License}; +use super::ApiResponse; +use crate::{appstate::AppState, license::License}; use rocket::{http::Status, serde::json::serde_json::json, State}; #[get("/license", format = "json")] diff --git a/src/handlers/mail.rs b/src/handlers/mail.rs index 9840256a2..bc9240338 100644 --- a/src/handlers/mail.rs +++ b/src/handlers/mail.rs @@ -9,11 +9,11 @@ use rocket::{ }; use tokio::sync::mpsc::unbounded_channel; +use super::{ApiResponse, ApiResult}; use crate::{ appstate::AppState, auth::{AdminRole, SessionInfo}, config::DefGuardConfig, - handlers::{ApiResponse, ApiResult}, mail::{Attachment, Mail}, support::dump_config, templates::{self, support_data_mail}, @@ -84,9 +84,8 @@ pub async fn test_mail( } async fn read_logs(config: &DefGuardConfig) -> String { - let path = match &config.log_file { - Some(path) => path, - None => return "Log file not configured".to_string(), + let Some(path) = &config.log_file else { + return "Log file not configured".to_string(); }; match tokio::fs::read_to_string(path).await { diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 4757ccbe8..81662be53 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -240,8 +240,7 @@ pub async fn user_for_admin_or_self( match User::find_by_username(pool, username).await? { Some(user) => Ok(user), None => Err(OriWebError::ObjectNotFound(format!( - "user {} not found", - username + "user {username} not found" ))), } } else { @@ -266,8 +265,7 @@ pub async fn device_for_admin_or_self( match fetch { Some(device) => Ok(device), None => Err(OriWebError::ObjectNotFound(format!( - "device id {} not found", - id + "device id {id} not found" ))), } } diff --git a/src/handlers/openid_clients.rs b/src/handlers/openid_clients.rs index 18653ec47..b759c3e87 100644 --- a/src/handlers/openid_clients.rs +++ b/src/handlers/openid_clients.rs @@ -1,12 +1,11 @@ -use crate::auth::AdminRole; +use super::{webhooks::ChangeStateData, ApiResponse, ApiResult}; use crate::{ appstate::AppState, - auth::SessionInfo, + auth::{AdminRole, SessionInfo}, db::models::{ oauth2client::{OAuth2Client, OAuth2ClientSafe}, NewOpenIDClient, }, - handlers::{webhooks::ChangeStateData, ApiResponse, ApiResult}, }; use rocket::{ http::Status, diff --git a/src/handlers/openid_flow.rs b/src/handlers/openid_flow.rs index 9b9cf731c..90fb04ba6 100644 --- a/src/handlers/openid_flow.rs +++ b/src/handlers/openid_flow.rs @@ -1,13 +1,12 @@ +use super::{ApiResponse, ApiResult}; use crate::{ appstate::AppState, - auth::{SessionInfo, SESSION_TIMEOUT}, + auth::{AccessUserInfo, SessionInfo, SESSION_TIMEOUT}, db::{ models::{auth_code::AuthCode, oauth2client::OAuth2Client}, - OAuth2AuthorizedApp, OAuth2Token, + DbPool, OAuth2AuthorizedApp, OAuth2Token, Session, User, }, - db::{DbPool, Session, User}, error::OriWebError, - handlers::{ApiResponse, ApiResult}, }; use base64::Engine; use chrono::{Duration, Utc}; @@ -35,8 +34,6 @@ use rocket::{ time::{Duration as TimeDuration, OffsetDateTime}, State, }; - -use crate::auth::AccessUserInfo; use std::ops::{Deref, DerefMut}; /// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims @@ -315,27 +312,31 @@ pub async fn authorization( cookies: &CookieJar<'_>, ) -> Result { let error; - match OAuth2Client::find_by_client_id(&appstate.pool, data.client_id).await? { - Some(oauth2client) => match data.validate_for_client(&oauth2client) { - Ok(()) => match data.prompt { - Some("consent") => { - info!( - "Redirecting user to consent form - client id {}", - data.client_id - ); - return Ok(Redirect::found(format!( - "/consent?{}", - serde_urlencoded::to_string(data).unwrap() - ))); - } - Some("none") => { - error!("'none' prompt in client id {} request", data.client_id); - error = CoreAuthErrorResponseType::LoginRequired; - } - _ => { - return if let Some(session_cookie) = cookies.get("defguard_session") { - match Session::find_by_id(&appstate.pool, session_cookie.value()).await { - Ok(Some(session)) => { + if let Some(oauth2client) = + OAuth2Client::find_by_client_id(&appstate.pool, data.client_id).await? + { + match data.validate_for_client(&oauth2client) { + Ok(()) => { + match data.prompt { + Some("consent") => { + info!( + "Redirecting user to consent form - client id {}", + data.client_id + ); + return Ok(Redirect::found(format!( + "/consent?{}", + serde_urlencoded::to_string(data).unwrap() + ))); + } + Some("none") => { + error!("'none' prompt in client id {} request", data.client_id); + error = CoreAuthErrorResponseType::LoginRequired; + } + _ => { + return if let Some(session_cookie) = cookies.get("defguard_session") { + if let Ok(Some(session)) = + Session::find_by_id(&appstate.pool, session_cookie.value()).await + { // If session expired return login if session.expired() { info!("Session {} for user id {} has expired, redirecting to login", session.id, session.user_id); @@ -344,52 +345,49 @@ pub async fn authorization( } else { // If session is present check if app is in user authorized apps. // If yes return auth code and state else redirect to consent form. - match OAuth2AuthorizedApp::find_by_user_and_oauth2client_id( - &appstate.pool, - session.user_id, - oauth2client.id.unwrap(), - ) - .await? + if let Some(app) = + OAuth2AuthorizedApp::find_by_user_and_oauth2client_id( + &appstate.pool, + session.user_id, + oauth2client.id.unwrap(), + ) + .await? { - Some(app) => { - info!("OAuth client id {} authorized by user id {}, returning auth code", app.oauth2client_id, session.user_id); - cookies.remove_private(Cookie::named("known_sign_in")); - let location = generate_auth_code_redirect( - appstate, - &data, - Some(session.user_id), - ) - .await?; - Ok(Redirect::found(location)) - } + info!("OAuth client id {} authorized by user id {}, returning auth code", app.oauth2client_id, session.user_id); + cookies.remove_private(Cookie::named("known_sign_in")); + let location = generate_auth_code_redirect( + appstate, + &data, + Some(session.user_id), + ) + .await?; + Ok(Redirect::found(location)) + } else { // If authorized app not found redirect to consent form - None => { - info!("OAuth client id {} not yet authorized by user id {}, redirecting to consent form", oauth2client.id.unwrap(), session.user_id); - Ok(Redirect::found(format!( - "/consent?{}", - serde_urlencoded::to_string(data).unwrap() - ))) - } + info!("OAuth client id {} not yet authorized by user id {}, redirecting to consent form", oauth2client.id.unwrap(), session.user_id); + Ok(Redirect::found(format!( + "/consent?{}", + serde_urlencoded::to_string(data).unwrap() + ))) } } - } - // If session not present in db redirect to login - _ => { + } else { + // If session is not present in db redirect to login info!( "Session {} not found, redirecting to login page", session_cookie.value() ); login_redirect(appstate, &data, cookies).await } - } - // If no session cookie provided redirect to login - } else { - info!("Session cookie not provided, redirecting to login page"); - login_redirect(appstate, &data, cookies).await - }; + // If no session cookie provided redirect to login + } else { + info!("Session cookie not provided, redirecting to login page"); + login_redirect(appstate, &data, cookies).await + }; + } } - }, + } Err(err) => { error!( "OIDC login validation failed for client {}: {:?}", @@ -397,11 +395,10 @@ pub async fn authorization( ); error = err; } - }, - None => { - error!("OIDC client id {} not found", data.client_id); - error = CoreAuthErrorResponseType::UnauthorizedClient; } + } else { + error!("OIDC client id {} not found", data.client_id); + error = CoreAuthErrorResponseType::UnauthorizedClient; } let mut url = @@ -431,37 +428,37 @@ pub async fn secure_authorization( Url::parse(data.redirect_uri).map_err(|_| OriWebError::Http(Status::BadRequest))?; let error; if allow { - match OAuth2Client::find_by_client_id(&appstate.pool, data.client_id).await? { - Some(oauth2client) => match data.validate_for_client(&oauth2client) { + if let Some(oauth2client) = + OAuth2Client::find_by_client_id(&appstate.pool, data.client_id).await? + { + match data.validate_for_client(&oauth2client) { Ok(()) => { - match OAuth2AuthorizedApp::find_by_user_and_oauth2client_id( + if OAuth2AuthorizedApp::find_by_user_and_oauth2client_id( &appstate.pool, session_info.user.id.unwrap(), oauth2client.id.unwrap(), ) .await? + .is_none() { - Some(_) => {} - None => { - let mut app = OAuth2AuthorizedApp::new( - session_info.user.id.unwrap(), - oauth2client.id.unwrap(), - ); - app.save(&appstate.pool).await?; - } + let mut app = OAuth2AuthorizedApp::new( + session_info.user.id.unwrap(), + oauth2client.id.unwrap(), + ); + app.save(&appstate.pool).await?; } info!( "User {} allowed login with client {}", session_info.user.username, oauth2client.name ); if let Some(cookie) = cookies.get_private("known_sign_in") { - cookies.remove(cookie.to_owned()); + cookies.remove(cookie.clone()); }; let location = generate_auth_code_redirect(appstate, &data, session_info.user.id).await?; info!( - "Redirecting user {} to {}", - session_info.user.username, location + "Redirecting user {} to {location}", + session_info.user.username ); return Ok(Redirect::found(location)); } @@ -472,14 +469,13 @@ pub async fn secure_authorization( ); error = err; } - }, - None => { - error!( - "User {} tried to log in with non-existent OIDC client id {}", - session_info.user.username, data.client_id - ); - error = CoreAuthErrorResponseType::UnauthorizedClient; } + } else { + error!( + "User {} tried to log in with non-existent OIDC client id {}", + session_info.user.username, data.client_id + ); + error = CoreAuthErrorResponseType::UnauthorizedClient; } } else { info!( @@ -622,10 +618,8 @@ impl<'r> TokenRequest<'r> { } fn refresh_token_flow( - &self, token: &OAuth2Token, - ) -> Result, CoreErrorResponseType> - { + ) -> StandardTokenResponse { // assume self.grant_type == "refresh_token" let access_token = AccessToken::new(token.access_token.clone()); let refresh_token = RefreshToken::new(token.refresh_token.clone()); @@ -635,7 +629,7 @@ impl<'r> TokenRequest<'r> { EmptyExtraTokenFields {}, ); token_response.set_refresh_token(Some(refresh_token)); - Ok(token_response) + token_response } async fn oauth2client(&self, pool: &DbPool) -> Option { @@ -738,9 +732,8 @@ pub async fn token( }); } } - } else { - error!("Can't issue token - authorized app not found for user {}, client {}", user.username, client.name); } + error!("Can't issue token - authorized app not found for user {}, client {}", user.username, client.name); } else { error!("User id {} not found", auth_code.user_id); } @@ -764,24 +757,12 @@ pub async fn token( OAuth2Token::find_refresh_token(&appstate.pool, refresh_token).await { token.refresh_and_save(&appstate.pool).await?; - match form.refresh_token_flow(&token) { - Ok(response) => { - token.save(&appstate.pool).await?; - return Ok(ApiResponse { - json: json!(response), - status: Status::Ok, - }); - } - Err(err) => { - let response = StandardErrorResponse::::new( - err, None, None, - ); - return Ok(ApiResponse { - json: json!(response), - status: Status::BadRequest, - }); - } - } + let response = TokenRequest::refresh_token_flow(&token); + token.save(&appstate.pool).await?; + return Ok(ApiResponse { + json: json!(response), + status: Status::Ok, + }); } } } diff --git a/src/handlers/user.rs b/src/handlers/user.rs index e22d2fd9e..2050c50da 100644 --- a/src/handlers/user.rs +++ b/src/handlers/user.rs @@ -1,8 +1,8 @@ use super::{ - user_for_admin_or_self, AddUserData, ApiResponse, ApiResult, PasswordChange, RecoveryCodes, - Username, WalletChallenge, WalletChange, WalletSignature, + user_for_admin_or_self, AddUserData, ApiResponse, ApiResult, PasswordChange, + PasswordChangeSelf, RecoveryCodes, StartEnrollmentRequest, Username, WalletChallenge, + WalletChange, WalletSignature, }; -use crate::handlers::StartEnrollmentRequest; use crate::{ appstate::AppState, auth::{AdminRole, SessionInfo}, @@ -11,7 +11,6 @@ use crate::{ WebAuthn, }, error::OriWebError, - handlers::PasswordChangeSelf, ldap::utils::{ldap_add_user, ldap_change_password, ldap_delete_user, ldap_modify_user}, license::Features, }; @@ -28,8 +27,7 @@ fn check_username(username: &str) -> Result<(), OriWebError> { let length = username.len(); if !(3..64).contains(&length) { return Err(OriWebError::Serialization(format!( - "Username ({}) has incorrect length", - username + "Username ({username}) has incorrect length" ))); } @@ -167,7 +165,7 @@ pub async fn add_user( appstate.trigger_action(AppEvent::UserCreated(user_info.clone())); info!("User {} added user {username}", session.user.username); if !user.has_password() { - warn!("User {username} is not active yet. Please proceed with enrollment.") + warn!("User {username} is not active yet. Please proceed with enrollment."); }; Ok(ApiResponse { json: json!(&user_info), @@ -255,7 +253,7 @@ pub async fn modify_user( username: &str, data: Json, ) -> ApiResult { - debug!("User {} updating user {}", session.user.username, username); + debug!("User {} updating user {username}", session.user.username); let mut user = user_for_admin_or_self(&appstate.pool, &session, username).await?; let user_info = data.into_inner(); if let Err(err) = check_username(&user_info.username) { @@ -295,7 +293,7 @@ pub async fn modify_user( }; let user_info = UserInfo::from_user(&appstate.pool, &user).await?; appstate.trigger_action(AppEvent::UserModified(user_info)); - info!("User {} updated user {}", session.user.username, username); + info!("User {} updated user {username}", session.user.username); Ok(ApiResponse::default()) } @@ -306,31 +304,27 @@ pub async fn delete_user( username: &str, session: SessionInfo, ) -> ApiResult { - debug!("User {} deleting user {}", session.user.username, username); + debug!("User {} deleting user {username}", session.user.username); if session.user.username == username { - debug!("User {} attempted to delete himself", username); + debug!("User {username} attempted to delete himself"); return Ok(ApiResponse { json: json!({}), status: Status::BadRequest, }); } - match User::find_by_username(&appstate.pool, username).await? { - Some(user) => { - user.delete(&appstate.pool).await?; - if appstate.license.validate(&Features::Ldap) { - let _result = ldap_delete_user(&appstate.config, username).await; - }; - appstate.trigger_action(AppEvent::UserDeleted(username.into())); - info!("User {} deleted user {}", session.user.username, username); - Ok(ApiResponse::default()) - } - None => { - error!("User {} not found", username); - Err(OriWebError::ObjectNotFound(format!( - "User {} not found", - username - ))) - } + if let Some(user) = User::find_by_username(&appstate.pool, username).await? { + user.delete(&appstate.pool).await?; + if appstate.license.validate(&Features::Ldap) { + let _result = ldap_delete_user(&appstate.config, username).await; + }; + appstate.trigger_action(AppEvent::UserDeleted(username.into())); + info!("User {} deleted user {}", session.user.username, username); + Ok(ApiResponse::default()) + } else { + error!("User {username} not found"); + Err(OriWebError::ObjectNotFound(format!( + "User {username} not found" + ))) } } @@ -409,27 +403,24 @@ pub async fn change_password( let user = User::find_by_username(&appstate.pool, username).await?; - match user { - Some(mut user) => { - user.set_password(&data.new_password); - user.save(&appstate.pool).await?; - if appstate.license.validate(&Features::Ldap) { - let _result = - ldap_change_password(&appstate.config, username, &data.new_password).await; - } - info!( - "Admin {} changed password for user {}", - session.user.username, username - ); - Ok(ApiResponse::default()) - } - None => { - debug!("User not found"); - Ok(ApiResponse { - json: json!({}), - status: Status::NotFound, - }) + if let Some(mut user) = user { + user.set_password(&data.new_password); + user.save(&appstate.pool).await?; + if appstate.license.validate(&Features::Ldap) { + let _result = + ldap_change_password(&appstate.config, username, &data.new_password).await; } + info!( + "Admin {} changed password for user {username}", + session.user.username + ); + Ok(ApiResponse::default()) + } else { + debug!("User not found"); + Ok(ApiResponse { + json: json!({}), + status: Status::NotFound, + }) } } @@ -449,35 +440,34 @@ pub async fn wallet_challenge( let user = user_for_admin_or_self(&appstate.pool, &session, username).await?; // check if address already exists - let wallet = match Wallet::find_by_user_and_address(&appstate.pool, user.id.unwrap(), address) - .await? + let wallet = if let Some(wallet) = + Wallet::find_by_user_and_address(&appstate.pool, user.id.unwrap(), address).await? { - Some(wallet) => { - if wallet.validation_timestamp.is_some() { - return Err(OriWebError::ObjectNotFound("wrong address".into())); - } - wallet + if wallet.validation_timestamp.is_some() { + return Err(OriWebError::ObjectNotFound("wrong address".into())); } - None => { - let challenge_message = match Settings::find_by_id(&appstate.pool, 1).await? { - Some(settings) => Wallet::format_challenge(address, &settings.challenge_template), - None => return Err(OriWebError::DbError("cannot retrieve settings".into())), + wallet + } else { + let challenge_message = + if let Some(settings) = Settings::find_by_id(&appstate.pool, 1).await? { + Wallet::format_challenge(address, &settings.challenge_template) + } else { + return Err(OriWebError::DbError("cannot retrieve settings".into())); }; - let mut wallet = Wallet::new_for_user( - user.id.unwrap(), - address.into(), - name.into(), - chain_id, - challenge_message, - ); - wallet.save(&appstate.pool).await?; - wallet - } + let mut wallet = Wallet::new_for_user( + user.id.unwrap(), + address.into(), + name.into(), + chain_id, + challenge_message, + ); + wallet.save(&appstate.pool).await?; + wallet }; info!( - "User {} generated wallet challenge for user {}", - session.user.username, username + "User {} generated wallet challenge for user {username}", + session.user.username ); Ok(ApiResponse { json: json!(WalletChallenge { diff --git a/src/handlers/webhooks.rs b/src/handlers/webhooks.rs index 260b54e11..464f88e29 100644 --- a/src/handlers/webhooks.rs +++ b/src/handlers/webhooks.rs @@ -1,8 +1,8 @@ +use super::{ApiResponse, ApiResult}; use crate::{ appstate::AppState, auth::{AdminRole, SessionInfo}, db::WebHook, - handlers::{ApiResponse, ApiResult}, }; use rocket::{ http::Status, diff --git a/src/handlers/wireguard.rs b/src/handlers/wireguard.rs index 91819ea8c..031574227 100644 --- a/src/handlers/wireguard.rs +++ b/src/handlers/wireguard.rs @@ -1,19 +1,17 @@ use super::{ device_for_admin_or_self, user_for_admin_or_self, ApiResponse, ApiResult, OriWebError, }; -use crate::db::models::device::{DeviceInfo, DeviceNetworkInfo}; -use crate::db::models::wireguard::WireguardNetworkInfo; -use crate::grpc::GatewayMap; use crate::{ appstate::AppState, auth::{AdminRole, Claims, ClaimsType, SessionInfo}, db::{ models::{ - device::{ModifyDevice, WireguardNetworkDevice}, - wireguard::DateTimeAggregation, + device::{DeviceInfo, DeviceNetworkInfo, ModifyDevice, WireguardNetworkDevice}, + wireguard::{DateTimeAggregation, WireguardNetworkInfo}, }, AddDevice, DbPool, Device, GatewayEvent, WireguardNetwork, }, + grpc::GatewayMap, wg_config::{parse_wireguard_config, ImportedDevice}, }; use chrono::{DateTime, Duration, NaiveDateTime, Utc}; @@ -27,9 +25,11 @@ use rocket::{ State, }; use serde_json::Value; -use std::net::IpAddr; -use std::str::FromStr; -use std::sync::{Arc, Mutex}; +use std::{ + net::IpAddr, + str::FromStr, + sync::{Arc, Mutex}, +}; use uuid::Uuid; #[derive(Deserialize, Serialize)] @@ -112,7 +112,7 @@ pub async fn create_network( .map_err(|_| OriWebError::Serialization("Invalid network address".into()))?; let mut transaction = appstate.pool.begin().await?; - network.save(&mut transaction).await?; + network.save(&mut *transaction).await?; network .set_allowed_groups(&mut transaction, data.allowed_groups) .await?; @@ -152,7 +152,7 @@ pub async fn create_network( async fn find_network(id: i64, pool: &DbPool) -> Result { WireguardNetwork::find_by_id(pool, id) .await? - .ok_or_else(|| OriWebError::ObjectNotFound(format!("Network {} not found", id))) + .ok_or_else(|| OriWebError::ObjectNotFound(format!("Network {id} not found"))) } #[put("/", format = "json", data = "")] @@ -179,7 +179,7 @@ pub async fn modify_network( network.port = data.port; network.dns = data.dns; network.address = data.address; - network.save(&mut transaction).await?; + network.save(&mut *transaction).await?; network .set_allowed_groups(&mut transaction, data.allowed_groups) .await?; @@ -189,7 +189,7 @@ pub async fn modify_network( match &network.id { Some(network_id) => { - let peers = network.get_peers(&mut transaction).await?; + let peers = network.get_peers(&mut *transaction).await?; appstate.send_wireguard_event(GatewayEvent::NetworkModified( *network_id, network.clone(), @@ -261,7 +261,7 @@ pub async fn list_networks( connected: gateway_state.connected(network_id), gateways: gateway_state.get_network_gateway_status(network_id), allowed_groups, - }) + }); } } debug!("Listed WireGuard networks"); @@ -365,7 +365,7 @@ pub async fn import_network( network.endpoint = data.endpoint; let mut transaction = appstate.pool.begin().await?; - network.save(&mut transaction).await?; + network.save(&mut *transaction).await?; network .set_allowed_groups(&mut transaction, data.allowed_groups) .await?; @@ -377,7 +377,7 @@ pub async fn import_network( .send_wireguard_event(GatewayEvent::NetworkCreated(network_id, network.clone())); } None => { - error!("Network {} id not found, gateway event not sent!", network); + error!("Network {network} id not found, gateway event not sent!"); } } @@ -465,8 +465,7 @@ pub async fn add_user_devices( }) } None => Err(OriWebError::ObjectNotFound(format!( - "Network {} not found", - network_id + "Network {network_id} not found" ))), } } @@ -504,16 +503,13 @@ pub async fn add_device( // save device let add_device = data.into_inner(); - let user_id = match user.id { - Some(id) => id, - None => { - return Err(OriWebError::ModelError("User has no id".to_string())); - } + let Some(user_id) = user.id else { + return Err(OriWebError::ModelError("User has no id".to_string())); }; let mut device = Device::new(add_device.name, add_device.wireguard_pubkey, user_id); let mut transaction = appstate.pool.begin().await?; - device.save(&mut transaction).await?; + device.save(&mut *transaction).await?; // assign IPs and generate configs for each network #[derive(Serialize)] @@ -534,11 +530,11 @@ pub async fn add_device( transaction.commit().await?; info!( - "User {} added device {} for user {}", - session.user.username, device_name, username + "User {} added device {device_name} for user {username}", + session.user.username ); - let result = AddDeviceResult { device, configs }; + let result = AddDeviceResult { configs, device }; Ok(ApiResponse { json: json!(result), @@ -594,7 +590,7 @@ pub async fn modify_device( network_id, device_wireguard_ip: wireguard_network_device.wireguard_ip, }; - network_info.push(device_network_info) + network_info.push(device_network_info); } } } @@ -672,7 +668,7 @@ pub async fn list_user_devices( if !session.is_admin && session.user.username != username { return Err(OriWebError::Forbidden("Admin access required".into())); }; - debug!("Listing devices for user: {}", username); + debug!("Listing devices for user: {username}"); let devices = Device::all_for_username(&appstate.pool, username).await?; Ok(ApiResponse { @@ -692,20 +688,18 @@ pub async fn download_config( let device = device_for_admin_or_self(&appstate.pool, &session, device_id).await?; let wireguard_network_device = WireguardNetworkDevice::find(&appstate.pool, device_id, network_id).await?; - match wireguard_network_device { - Some(wireguard_network_device) => { - Ok(device.create_config(&network, &wireguard_network_device)) - } - None => { - let device_id = match device.id { - Some(id) => id.to_string(), - None => "".to_string(), - }; - Err(OriWebError::ObjectNotFound(format!( - "No ip found for device: {}({})", - device.name, device_id - ))) - } + if let Some(wireguard_network_device) = wireguard_network_device { + Ok(device.create_config(&network, &wireguard_network_device)) + } else { + let device_id = if let Some(id) = device.id { + id.to_string() + } else { + String::new() + }; + Err(OriWebError::ObjectNotFound(format!( + "No ip found for device: {}({device_id})", + device.name + ))) } } @@ -715,11 +709,11 @@ pub async fn create_network_token( appstate: &State, network_id: i64, ) -> ApiResult { - info!("Generating a new token for network ID {}", network_id); + info!("Generating a new token for network ID {network_id}"); let network = find_network(network_id, &appstate.pool).await?; let token = Claims::new( ClaimsType::Gateway, - format!("DEFGUARD-NETWORK-{}", network_id), + format!("DEFGUARD-NETWORK-{network_id}"), network_id.to_string(), u32::MAX.into(), ) @@ -765,14 +759,10 @@ pub async fn user_stats( network_id: i64, ) -> ApiResult { debug!("Displaying wireguard user stats"); - let network = match WireguardNetwork::find_by_id(&appstate.pool, network_id).await? { - Some(n) => n, - None => { - return Err(OriWebError::ObjectNotFound(format!( - "Requested network ({}) not found", - network_id - ))); - } + let Some(network) = WireguardNetwork::find_by_id(&appstate.pool, network_id).await? else { + return Err(OriWebError::ObjectNotFound(format!( + "Requested network ({network_id}) not found", + ))); }; let from = parse_timestamp(from)?.naive_utc(); let aggregation = get_aggregation(from)?; @@ -795,14 +785,10 @@ pub async fn network_stats( network_id: i64, ) -> ApiResult { debug!("Displaying wireguard network stats"); - let network = match WireguardNetwork::find_by_id(&appstate.pool, network_id).await? { - Some(n) => n, - None => { - return Err(OriWebError::ObjectNotFound(format!( - "Requested network ({}) not found", - network_id - ))); - } + let Some(network) = WireguardNetwork::find_by_id(&appstate.pool, network_id).await? else { + return Err(OriWebError::ObjectNotFound(format!( + "Requested network ({network_id}) not found" + ))); }; let from = parse_timestamp(from)?.naive_utc(); let aggregation = get_aggregation(from)?; diff --git a/src/handlers/worker.rs b/src/handlers/worker.rs index 963004f74..39412a278 100644 --- a/src/handlers/worker.rs +++ b/src/handlers/worker.rs @@ -1,12 +1,11 @@ +use super::{ApiResponse, ApiResult}; use crate::{ appstate::AppState, auth::{AdminRole, Claims, ClaimsType, SessionInfo}, db::User, error::OriWebError, grpc::WorkerState, - handlers::{ApiResponse, ApiResult}, }; - use rocket::{ http::Status, serde::json::{serde_json::json, Json}, diff --git a/src/hex.rs b/src/hex.rs index 79f8852ce..44fb14693 100644 --- a/src/hex.rs +++ b/src/hex.rs @@ -53,6 +53,7 @@ pub fn hex_decode>(hex: T) -> Result, HexError> { Ok(bytes) } +#[must_use] pub fn to_lower_hex(bytes: &[u8]) -> String { let mut hex = String::with_capacity(bytes.len() + 2); let to_char = |nibble: u8| -> char { @@ -61,10 +62,10 @@ pub fn to_lower_hex(bytes: &[u8]) -> String { _ => nibble + b'a' - 10, }) as char }; - bytes.iter().for_each(|byte| { + for byte in bytes { hex.push(to_char(*byte >> 4)); hex.push(to_char(*byte & 0xf)); - }); + } hex } diff --git a/src/ldap/error.rs b/src/ldap/error.rs index 171e0e0cd..34ff11fb2 100644 --- a/src/ldap/error.rs +++ b/src/ldap/error.rs @@ -10,8 +10,8 @@ pub enum OriLDAPError { impl fmt::Display for OriLDAPError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - OriLDAPError::Ldap(msg) => write!(f, "LDAP error: {}", msg), - OriLDAPError::ObjectNotFound(msg) => write!(f, "Object not found: {}", msg), + OriLDAPError::Ldap(msg) => write!(f, "LDAP error: {msg}"), + OriLDAPError::ObjectNotFound(msg) => write!(f, "Object not found: {msg}"), } } } diff --git a/src/ldap/mod.rs b/src/ldap/mod.rs index be29260d7..54e809683 100644 --- a/src/ldap/mod.rs +++ b/src/ldap/mod.rs @@ -1,7 +1,6 @@ +use self::{error::OriLDAPError, model::Group}; use crate::{config::DefGuardConfig, db::User}; -use error::OriLDAPError; use ldap3::{drive, Ldap, LdapConnAsync, Mod, Scope, SearchEntry}; -use model::Group; use secrecy::ExposeSecret; use std::collections::HashSet; @@ -132,7 +131,7 @@ impl<'a> LDAPConnection<'a> { /// Retrieves user with given username from LDAP. /// TODO: Password must agree with the password stored in LDAP. pub async fn get_user(&mut self, username: &str, password: &str) -> Result { - debug!("Performing LDAP user search: {}", username); + debug!("Performing LDAP user search: {username}"); let mut entries = self .search_users(&format!( "(&({}={})(objectClass={}))", @@ -140,12 +139,11 @@ impl<'a> LDAPConnection<'a> { )) .await?; if let Some(entry) = entries.pop() { - info!("Performed LDAP user search: {}", username); + info!("Performed LDAP user search: {username}"); Ok(User::from_searchentry(&entry, username, password)) } else { Err(OriLDAPError::ObjectNotFound(format!( - "User {} not found", - username + "User {username} not found", ))) } } @@ -164,21 +162,21 @@ impl<'a> LDAPConnection<'a> { /// Modifies LDAP user. pub async fn modify_user(&mut self, username: &str, user: &User) -> Result<(), OriLDAPError> { - debug!("Modifying user {}", username); + debug!("Modifying user {username}"); let old_dn = self.config.user_dn(username); let new_dn = self.config.user_dn(&user.username); self.modify(&old_dn, &new_dn, user.as_ldap_mod(self.config)) .await?; - info!("Modified user {}", username); + info!("Modified user {username}"); Ok(()) } /// Deletes user from LDAP. pub async fn delete_user(&mut self, username: &str) -> Result<(), OriLDAPError> { - debug!("Deleting user {}", username); + debug!("Deleting user {username}"); let dn = self.config.user_dn(username); self.delete(&dn).await?; - info!("Deleted user {}", username); + info!("Deleted user {username}"); Ok(()) } @@ -188,7 +186,7 @@ impl<'a> LDAPConnection<'a> { username: &str, password: &str, ) -> Result<(), OriLDAPError> { - debug!("Setting password for user {}", username); + debug!("Setting password for user {username}"); let user_dn = self.config.user_dn(username); let ssha_password = hash::salted_sha1_hash(password); let nt_password = hash::nthash(password); @@ -201,13 +199,13 @@ impl<'a> LDAPConnection<'a> { ], ) .await?; - info!("Password set for user {}", username); + info!("Password set for user {username}"); Ok(()) } /// Retrieves group with given groupname from LDAP. pub async fn get_group(&mut self, groupname: &str) -> Result { - debug!("Performing LDAP group search: {}", groupname); + debug!("Performing LDAP group search: {groupname}"); let mut enties = self .search_groups(&format!( "(&({}={})(objectClass={}))", @@ -215,12 +213,11 @@ impl<'a> LDAPConnection<'a> { )) .await?; if let Some(entry) = enties.pop() { - info!("Performed LDAP user search: {}", groupname); + info!("Performed LDAP user search: {groupname}"); Ok(Group::from_searchentry(&entry, self.config)) } else { Err(OriLDAPError::ObjectNotFound(format!( - "Group {} not found", - groupname + "Group {groupname} not found" ))) } } diff --git a/src/ldap/model.rs b/src/ldap/model.rs index 81fd41751..57edf9b1d 100644 --- a/src/ldap/model.rs +++ b/src/ldap/model.rs @@ -3,6 +3,7 @@ use ldap3::{Mod, SearchEntry}; use std::collections::HashSet; impl User { + #[must_use] pub fn from_searchentry(entry: &SearchEntry, username: &str, password: &str) -> Self { Self::new( username.into(), @@ -14,6 +15,7 @@ impl User { ) } + #[must_use] pub fn as_ldap_mod(&self, config: &DefGuardConfig) -> Vec> { let mut changes = vec![ Mod::Replace("sn", hashset![self.last_name.as_str()]), @@ -33,6 +35,7 @@ impl User { changes } + #[must_use] pub fn as_ldap_attrs<'a>( &'a self, ssha_password: &'a str, @@ -68,6 +71,7 @@ pub struct Group { } impl Group { + #[must_use] pub fn from_searchentry(entry: &SearchEntry, config: &DefGuardConfig) -> Self { Self { name: get_value_or_default(entry, &config.ldap_groupname_attr), @@ -97,9 +101,10 @@ fn get_value(entry: &SearchEntry, key: &str) -> Option { } /// Get first value from distinguished name, for example: cn=,... +#[must_use] pub fn extract_dn_value(dn: &str) -> Option { if let (Some(eq_index), Some(comma_index)) = (dn.find('='), dn.find(',')) { - dn.get((eq_index + 1)..comma_index).map(|s| s.to_string()) + dn.get((eq_index + 1)..comma_index).map(ToString::to_string) } else { None } diff --git a/src/ldap/utils.rs b/src/ldap/utils.rs index 8f92269e7..3ac9fd0b1 100644 --- a/src/ldap/utils.rs +++ b/src/ldap/utils.rs @@ -1,7 +1,7 @@ +use super::{error::OriLDAPError, LDAPConnection}; use crate::{ config::DefGuardConfig, db::{DbPool, User}, - ldap::{error::OriLDAPError, LDAPConnection}, }; pub async fn user_from_ldap( diff --git a/src/lib.rs b/src/lib.rs index 158a87fb2..f6c48667e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,10 +4,13 @@ #![allow(clippy::too_many_arguments)] use crate::{ + auth::{Claims, ClaimsType}, + config::InitVpnLocationArgs, db::User, handlers::{ - mail::send_support_data, + mail::{send_support_data, test_mail}, support::{configuration, logs}, + user::change_self_password, }, }; use secrecy::ExposeSecret; @@ -16,7 +19,6 @@ use secrecy::ExposeSecret; use crate::handlers::worker::{ create_job, create_worker_token, job_status, list_workers, remove_worker, }; -use crate::handlers::{mail::test_mail, user::change_self_password}; #[cfg(feature = "openid")] use crate::handlers::{ openid_clients::{ @@ -31,12 +33,14 @@ use crate::handlers::{ use crate::{ auth::failed_login::FailedLoginMap, db::models::oauth2client::OAuth2Client, - grpc::GatewayMap, - grpc::WorkerState, - handlers::app_info::get_app_info, - handlers::wireguard::{add_user_devices, import_network}, + grpc::{GatewayMap, WorkerState}, + handlers::{ + app_info::get_app_info, + wireguard::{add_user_devices, import_network}, + }, license::{Features, License}, }; +use anyhow::anyhow; use appstate::AppState; use config::DefGuardConfig; use db::{init_db, AppEvent, DbPool, Device, GatewayEvent, WireguardNetwork}; @@ -292,19 +296,16 @@ pub async fn build_webapp( webapp }; - webapp.manage( - AppState::new( - config, - pool, - webhook_tx, - webhook_rx, - wireguard_tx, - mail_tx, - license_decoded, - failed_logins, - ) - .await, - ) + webapp.manage(AppState::new( + config, + pool, + webhook_tx, + webhook_rx, + wireguard_tx, + mail_tx, + license_decoded, + failed_logins, + )) } /// Runs core web server exposing REST API. @@ -363,70 +364,66 @@ pub async fn init_dev_env(config: &DefGuardConfig) { .await .expect("Failed to initialize transaction"); - let network = match WireguardNetwork::find_by_name(&mut transaction, "TestNet") - .await - .expect("Failed to search for test network") + let network = if let Some(networks) = + WireguardNetwork::find_by_name(&mut *transaction, "TestNet") + .await + .expect("Failed to search for test network") { - Some(networks) => { - info!("Test network exists already, skipping creation..."); - networks.into_iter().next().unwrap() - } - None => { - info!("Creating test network "); - let mut network = WireguardNetwork::new( - "TestNet".to_string(), - "10.1.1.1/24".parse().unwrap(), - 50051, - "0.0.0.0".to_string(), - None, - vec!["10.1.1.0/24".parse().unwrap()], - ) - .expect("Could not create network"); - network.pubkey = "zGMeVGm9HV9I4wSKF9AXmYnnAIhDySyqLMuKpcfIaQo=".to_string(); - network.prvkey = "MAk3d5KuB167G88HM7nGYR6ksnPMAOguAg2s5EcPp1M=".to_string(); - network - .save(&mut transaction) - .await - .expect("Could not save network"); - network - } + info!("Test network exists already, skipping creation..."); + networks.into_iter().next().unwrap() + } else { + info!("Creating test network "); + let mut network = WireguardNetwork::new( + "TestNet".to_string(), + "10.1.1.1/24".parse().unwrap(), + 50051, + "0.0.0.0".to_string(), + None, + vec!["10.1.1.0/24".parse().unwrap()], + ) + .expect("Could not create network"); + network.pubkey = "zGMeVGm9HV9I4wSKF9AXmYnnAIhDySyqLMuKpcfIaQo=".to_string(); + network.prvkey = "MAk3d5KuB167G88HM7nGYR6ksnPMAOguAg2s5EcPp1M=".to_string(); + network + .save(&mut *transaction) + .await + .expect("Could not save network"); + network }; - match Device::find_by_pubkey( - &mut transaction, + if Device::find_by_pubkey( + &mut *transaction, "gQYL5eMeFDj0R+lpC7oZyIl0/sNVmQDC6ckP7husZjc=", ) .await .expect("Failed to search for test device") + .is_some() { - Some(_) => { - info!("Test device exists already, skipping creation..."); - } - None => { - info!("Creating test device"); - let mut device = Device::new( - "TestDevice".to_string(), - "gQYL5eMeFDj0R+lpC7oZyIl0/sNVmQDC6ckP7husZjc=".to_string(), - 1, - ); - device - .save(&mut transaction) - .await - .expect("Could not save device"); - device - .assign_network_ip(&mut transaction, &network, None) - .await - .expect("Could not assign IP to device"); - } + info!("Test device exists already, skipping creation..."); + } else { + info!("Creating test device"); + let mut device = Device::new( + "TestDevice".to_string(), + "gQYL5eMeFDj0R+lpC7oZyIl0/sNVmQDC6ckP7husZjc=".to_string(), + 1, + ); + device + .save(&mut *transaction) + .await + .expect("Could not save device"); + device + .assign_network_ip(&mut transaction, &network, None) + .await + .expect("Could not assign IP to device"); } for app_id in 1..=3 { let mut app = OAuth2Client::new( - vec![format!("https://app-{}.com", app_id)], + vec![format!("https://app-{app_id}.com")], vec!["openid".into(), "profile".into(), "email".into()], - format!("app-{}", app_id), + format!("app-{app_id}"), ); - app.save(&mut transaction) + app.save(&mut *transaction) .await .expect("Could not save oauth2client"); } @@ -437,3 +434,42 @@ pub async fn init_dev_env(config: &DefGuardConfig) { info!("Dev environment initialized - TestNet, TestDevice, AuthorizedApps added"); } + +/// Create a new VPN location. +/// Meant to be used to automate setting up a new defguard instance. +/// Does not handle assigning device IPs, since no device should exist at this point. +pub async fn init_vpn_location( + pool: &DbPool, + args: &InitVpnLocationArgs, +) -> Result { + // check if a VPN location exists already + let networks = WireguardNetwork::all(pool).await?; + if !networks.is_empty() { + return Err(anyhow!( + "Failed to initialize first VPN location. A location already exists." + )); + }; + + // create a new network + let mut network = WireguardNetwork::new( + args.name.clone(), + args.address, + args.port, + args.endpoint.clone(), + args.dns.clone(), + args.allowed_ips.clone(), + )?; + network.save(pool).await?; + let network_id = network.get_id()?; + + // generate gateway token + let token = Claims::new( + ClaimsType::Gateway, + format!("DEFGUARD-NETWORK-{network_id}"), + network_id.to_string(), + u32::MAX.into(), + ) + .to_jwt()?; + + Ok(token) +} diff --git a/src/mail.rs b/src/mail.rs index c6fcf4395..f1a16b2f7 100644 --- a/src/mail.rs +++ b/src/mail.rs @@ -51,11 +51,11 @@ struct SmtpSettings { impl SmtpSettings { /// Retrieves Settings object from database and builds SmtpSettings pub async fn get(db: &Pool) -> Result { - Self::from_settings(Self::get_settings(db).await?).await + Self::from_settings(Self::get_settings(db).await?) } /// Constructs SmtpSettings object from Settings. Returns error if SMTP settings are incomplete. - pub async fn from_settings(settings: Settings) -> Result { + pub fn from_settings(settings: Settings) -> Result { if let (Some(server), Some(port), encryption, Some(user), Some(password), Some(sender)) = ( settings.smtp_server, settings.smtp_port, @@ -149,7 +149,7 @@ impl MailHandler { Self { rx, db } } - pub async fn send_result( + pub fn send_result( tx: Option>>, result: Result, ) { @@ -157,7 +157,7 @@ impl MailHandler { if tx.send(result).is_ok() { debug!("SMTP result sent back to caller"); } else { - error!("Error sending SMTP result back to caller") + error!("Error sending SMTP result back to caller"); } } } @@ -189,34 +189,31 @@ impl MailHandler { } }; // Build mailer and send the message - match self.mailer(settings).await { + match Self::mailer(settings) { Ok(mailer) => match mailer.send(message).await { Ok(response) => { - Self::send_result(result_tx, Ok(response.clone())).await; + Self::send_result(result_tx, Ok(response.clone())); info!("Mail sent successfully to: {to}, subject: {subject}, response: {response:?}"); } Err(err) => { error!("Mail sending failed to: {to}, subject: {subject}, error: {err}"); - Self::send_result(result_tx, Err(MailError::SmtpError(err))).await; + Self::send_result(result_tx, Err(MailError::SmtpError(err))); } }, Err(MailError::SmtpNotConfigured) => { warn!("SMTP not configured, onboarding email sending skipped"); - Self::send_result(result_tx, Err(MailError::SmtpNotConfigured)).await; + Self::send_result(result_tx, Err(MailError::SmtpNotConfigured)); } Err(err) => { error!("Error building mailer: {err}"); - Self::send_result(result_tx, Err(err)).await + Self::send_result(result_tx, Err(err)); } } } } /// Builds mailer object with specified configuration - async fn mailer( - &self, - settings: SmtpSettings, - ) -> Result, MailError> { + fn mailer(settings: SmtpSettings) -> Result, MailError> { let builder = match settings.encryption { SmtpEncryption::None => { AsyncSmtpTransport::::builder_dangerous(settings.server) diff --git a/src/secret.rs b/src/secret.rs index ee28154aa..ee1696688 100644 --- a/src/secret.rs +++ b/src/secret.rs @@ -13,6 +13,7 @@ use sqlx::{ pub struct SecretString(Secret); impl SecretString { + #[must_use] pub fn expose_secret(&self) -> &str { self.0.expose_secret() } diff --git a/src/support.rs b/src/support.rs index 85a721a31..84b203c4b 100644 --- a/src/support.rs +++ b/src/support.rs @@ -35,9 +35,8 @@ pub async fn dump_config(db: &Pool, config: &DefGuardConfig) -> Value // Devices for each network let mut devices = HashMap::::default(); for network in &networks { - let network_id = match network.id { - Some(id) => id, - None => continue, + let Some(network_id) = network.id else { + continue; }; devices.insert( network_id, diff --git a/src/wg_config.rs b/src/wg_config.rs index 657b3f9eb..2670320f2 100644 --- a/src/wg_config.rs +++ b/src/wg_config.rs @@ -1,8 +1,7 @@ use crate::db::{models::wireguard::WireguardNetworkError, Device, WireguardNetwork}; use base64::{DecodeError, Engine}; use ipnetwork::{IpNetwork, IpNetworkError}; -use std::array::TryFromSliceError; -use std::net::IpAddr; +use std::{array::TryFromSliceError, net::IpAddr}; use thiserror::Error; use x25519_dalek::{PublicKey, StaticSecret}; @@ -36,13 +35,13 @@ pub enum WireguardConfigParseError { impl From for WireguardConfigParseError { fn from(e: TryFromSliceError) -> Self { - WireguardConfigParseError::InvalidKey(format!("{}", e)) + WireguardConfigParseError::InvalidKey(format!("{e}")) } } impl From for WireguardConfigParseError { fn from(e: DecodeError) -> Self { - WireguardConfigParseError::InvalidKey(format!("{}", e)) + WireguardConfigParseError::InvalidKey(format!("{e}")) } } @@ -72,14 +71,14 @@ pub fn parse_wireguard_config( let port = port .parse() .map_err(|_| WireguardConfigParseError::InvalidPort(port.to_string()))?; - let dns = interface_section.get("DNS").map(|s| s.to_string()); + let dns = interface_section.get("DNS").map(ToString::to_string); let network_address: IpNetwork = address.parse()?; let allowed_ips = IpNetwork::new(network_address.network(), network_address.prefix())?; let mut network = WireguardNetwork::new( pubkey.clone(), network_address, port, - "".to_string(), + String::new(), dns, vec![allowed_ips], )?; @@ -113,8 +112,7 @@ pub fn parse_wireguard_config( // check if device pubkey collides with network pubkey if pubkey == network.pubkey { return Err(WireguardConfigParseError::InvalidKey(format!( - "Device pubkey is the same as network pubkey {}", - pubkey + "Device pubkey is the same as network pubkey {pubkey}" ))); } diff --git a/src/wireguard_stats_purge.rs b/src/wireguard_stats_purge.rs index 357c12340..df3c20092 100644 --- a/src/wireguard_stats_purge.rs +++ b/src/wireguard_stats_purge.rs @@ -120,12 +120,11 @@ pub async fn run_periodic_stats_purge( .expect("Failed to parse duration")) .naive_utc(); info!( - "Stats purge successful. Next purge will be executed at {}", - next_purge_timestamp + "Stats purge successful. Next purge will be executed at {next_purge_timestamp}" ); } Err(err) => { - error!("Error while purging stats: {}", err) + error!("Error while purging stats: {err}"); } } } diff --git a/tests/auth.rs b/tests/auth.rs index 83ff5750c..ddabb511d 100644 --- a/tests/auth.rs +++ b/tests/auth.rs @@ -585,7 +585,7 @@ This request will not trigger a blockchain transaction or cost any gas fees."; assert_eq!(data.challenge, message); // Sign message - let signature = sign_message(data.challenge, secp, secret_key); + let signature = sign_message(&data.challenge, secp, secret_key); // Check if invalid signature results into 401 let invalid_request_response = client @@ -612,7 +612,7 @@ This request will not trigger a blockchain transaction or cost any gas fees."; assert_eq!(response.status(), Status::Ok); } -fn sign_message(message: String, secp: &Secp256k1, secret_key: SecretKey) -> String { +fn sign_message(message: &str, secp: &Secp256k1, secret_key: SecretKey) -> String { let typed_data: TypedData = rocket::serde::json::serde_json::from_str(&message).unwrap(); let hash_msg = typed_data.encode_eip712().unwrap(); let message = Message::from_slice(&hash_msg).unwrap(); @@ -708,7 +708,7 @@ async fn test_re_adding_wallet() { .dispatch() .await; let challenge: WalletChallenge = response.into_json().await.unwrap(); - let signature = sign_message(challenge.message, &secp, secret_key); + let signature = sign_message(&challenge.message, &secp, secret_key); let response = client .put("/api/v1/user/hpotter/wallet") .json(&json!({ @@ -770,7 +770,7 @@ async fn test_re_adding_wallet() { .dispatch() .await; let challenge: WalletChallenge = response.into_json().await.unwrap(); - let signature = sign_message(challenge.message, &secp, secret_key); + let signature = sign_message(&challenge.message, &secp, secret_key); let response = client .put("/api/v1/user/hpotter/wallet") .json(&json!({ diff --git a/tests/common/mod.rs b/tests/common/mod.rs index d0d6830e8..3c31ff366 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -1,20 +1,20 @@ -#[cfg(test)] use defguard::{ auth::failed_login::FailedLoginMap, build_webapp, config::DefGuardConfig, - db::{init_db, AppEvent, DbPool, GatewayEvent, User}, + db::{init_db, AppEvent, DbPool, GatewayEvent, User, UserDetails}, grpc::{GatewayMap, WorkerState}, + mail::Mail, + SERVER_CONFIG, }; -use defguard::{db::UserDetails, mail::Mail, SERVER_CONFIG}; -use rocket::http::Status; -use rocket::local::asynchronous::Client; +use rocket::{http::Status, local::asynchronous::Client}; use secrecy::ExposeSecret; use sqlx::{postgres::PgConnectOptions, query, types::Uuid}; use std::sync::{Arc, Mutex}; -use tokio::sync::broadcast; -use tokio::sync::broadcast::Receiver; -use tokio::sync::mpsc::unbounded_channel; +use tokio::sync::{ + broadcast::{self, Receiver}, + mpsc::unbounded_channel, +}; pub async fn init_test_db() -> (DbPool, DefGuardConfig) { let config = DefGuardConfig::new_test_config(); @@ -29,7 +29,7 @@ pub async fn init_test_db() -> (DbPool, DefGuardConfig) { .await .expect("Failed to connect to Postgres"); let db_name = Uuid::new_v4().to_string(); - query(&format!("CREATE DATABASE \"{}\"", db_name)) + query(&format!("CREATE DATABASE \"{db_name}\"")) .execute(&pool) .await .expect("Failed to create test database"); @@ -150,7 +150,7 @@ pub async fn make_enterprise_test_client() -> (Client, ClientState) { #[allow(dead_code)] pub async fn fetch_user_details(client: &Client, username: &str) -> UserDetails { let response = client - .get(format!("/api/v1/user/{}", username)) + .get(format!("/api/v1/user/{username}")) .dispatch() .await; assert_eq!(response.status(), Status::Ok); diff --git a/tests/enrollment.rs b/tests/enrollment.rs index 353d1d63c..7fa9fc0ee 100644 --- a/tests/enrollment.rs +++ b/tests/enrollment.rs @@ -6,7 +6,7 @@ use rocket::{http::Status, local::asynchronous::Client, serde::Deserialize}; use serde_json::json; mod common; -use crate::common::make_test_client; +use self::common::make_test_client; async fn make_client() -> (Client, DbPool) { let (client, client_state) = make_test_client().await; diff --git a/tests/forward_auth.rs b/tests/forward_auth.rs index ffb5604ad..34d10dbf2 100644 --- a/tests/forward_auth.rs +++ b/tests/forward_auth.rs @@ -5,7 +5,7 @@ use rocket::{ }; mod common; -use crate::common::make_test_client; +use self::common::make_test_client; async fn make_client() -> Client { let (client, client_state) = make_test_client().await; diff --git a/tests/license.rs b/tests/license.rs index 64b62154d..7acb59940 100644 --- a/tests/license.rs +++ b/tests/license.rs @@ -2,7 +2,7 @@ use defguard::handlers::Auth; use rocket::{http::Status, local::asynchronous::Client}; mod common; -use common::{ +use self::common::{ make_license_test_client, LICENSE_ENTERPRISE, LICENSE_EXPIRED, LICENSE_WITHOUT_OPENID, }; diff --git a/tests/oauth.rs b/tests/oauth.rs index e3dc093f9..4e0b3c1ae 100644 --- a/tests/oauth.rs +++ b/tests/oauth.rs @@ -17,7 +17,7 @@ use rocket::{ use std::borrow::Cow; mod common; -use crate::common::make_enterprise_test_client; +use self::common::make_enterprise_test_client; async fn make_client() -> (Client, DbPool) { let (client, client_state) = make_enterprise_test_client().await; @@ -128,7 +128,6 @@ async fn test_authorize() { .await; assert_eq!(response.status(), Status::Found); let redirect_url = Url::parse(response.headers().get_one("Location").unwrap()).unwrap(); - println!("{}", redirect_url); assert_eq!(redirect_url.domain().unwrap(), "test.server.tnt"); let mut pairs = redirect_url.query_pairs(); assert_eq!(pairs.count(), 2); diff --git a/tests/openid.rs b/tests/openid.rs index e8d99fd59..9bdf337ba 100644 --- a/tests/openid.rs +++ b/tests/openid.rs @@ -6,10 +6,10 @@ use defguard::{ }, handlers::Auth, }; - -use openidconnect::core::CoreTokenResponse; use openidconnect::{ - core::{CoreClient, CoreGenderClaim, CoreProviderMetadata, CoreResponseType}, + core::{ + CoreClient, CoreGenderClaim, CoreProviderMetadata, CoreResponseType, CoreTokenResponse, + }, http::{ header::{HeaderName, HeaderValue}, HeaderMap, Method, StatusCode, @@ -27,8 +27,9 @@ use serde::Deserialize; use std::str::FromStr; mod common; -use crate::common::{make_base_client, make_enterprise_test_client}; -use common::{init_test_db, LICENSE_ENTERPRISE}; +use self::common::{ + init_test_db, make_base_client, make_enterprise_test_client, LICENSE_ENTERPRISE, +}; async fn make_client() -> Client { let (client, _) = make_enterprise_test_client().await; @@ -342,13 +343,13 @@ async fn http_client( let client = make_client_v2(pool, config).await; let uri = request.url.path(); - eprintln!("HTTP client request path: {}", uri); + eprintln!("HTTP client request path: {uri}"); if let Some(query) = request.url.query() { - eprintln!("HTTP client request query: {}", query); + eprintln!("HTTP client request query: {query}"); } eprintln!("HTTP client request headers: {:#?}", request.headers); if let Ok(text) = String::from_utf8(request.body.clone()) { - eprintln!("HTTP client body: {}", text); + eprintln!("HTTP client body: {text}"); } let mut rocket_request = match request.method { Method::GET => client.get(uri), @@ -357,7 +358,7 @@ async fn http_client( Method::DELETE => client.delete(uri), _ => unimplemented!(), }; - for (key, value) in request.headers.iter() { + for (key, value) in &request.headers { let header = Header::new(key.as_str().to_owned(), value.to_str().unwrap().to_owned()); rocket_request = rocket_request.header(header); } @@ -584,7 +585,7 @@ async fn test_openid_authorization_code_with_pkce() { // userinfo let _userinfo_claims: UserInfoClaims = core_client - .user_info(token_response.access_token().to_owned(), None) + .user_info(token_response.access_token().clone(), None) .expect("Missing info endpoint") .request_async(move |r| http_client(r, pool, config)) .await diff --git a/tests/settings.rs b/tests/settings.rs index 07c377b41..42e8e68ec 100644 --- a/tests/settings.rs +++ b/tests/settings.rs @@ -5,7 +5,7 @@ use defguard::{ use rocket::{http::Status, local::asynchronous::Client}; mod common; -use crate::common::make_test_client; +use self::common::make_test_client; async fn make_client() -> Client { let (client, _) = make_test_client().await; diff --git a/tests/user.rs b/tests/user.rs index c39e6aec1..0612843d1 100644 --- a/tests/user.rs +++ b/tests/user.rs @@ -8,12 +8,12 @@ use defguard::{ }; use ethers_core::types::transaction::eip712::{Eip712, TypedData}; use rocket::{http::Status, local::asynchronous::Client, serde::json::serde_json::json}; - use secp256k1::{rand::rngs::OsRng, Message, Secp256k1}; -mod common; -use crate::common::{fetch_user_details, make_test_client}; use tokio_stream::{self as stream, StreamExt}; +mod common; +use self::common::{fetch_user_details, make_test_client}; + async fn make_client() -> Client { let (client, _) = make_test_client().await; client @@ -479,10 +479,10 @@ async fn test_check_password_strength() { let mut stream = stream::iter(weak_passwords.iter().enumerate()); while let Some((index, password)) = stream.next().await { let weak_password_user = AddUserData { - username: format!("weakpass{}", index), + username: format!("weakpass{index}"), first_name: "testpassfn".into(), last_name: "testpassln".into(), - email: format!("testpass{}@test.test", index), + email: format!("testpass{index}@test.test"), password: Some(password.to_owned().into()), phone: None, }; diff --git a/tests/webhook.rs b/tests/webhook.rs index 04e5f4deb..ae9ffe1f7 100644 --- a/tests/webhook.rs +++ b/tests/webhook.rs @@ -2,7 +2,7 @@ use defguard::{db::WebHook, handlers::Auth}; use rocket::{http::Status, local::asynchronous::Client}; mod common; -use crate::common::make_test_client; +use self::common::make_test_client; async fn make_client() -> Client { let (client, _) = make_test_client().await; diff --git a/tests/wireguard.rs b/tests/wireguard.rs index 2131b3c3c..f3a35045c 100644 --- a/tests/wireguard.rs +++ b/tests/wireguard.rs @@ -1,6 +1,5 @@ -use defguard::db::models::device::WireguardNetworkDevice; use defguard::{ - db::{Device, GatewayEvent, WireguardNetwork}, + db::{models::device::WireguardNetworkDevice, Device, GatewayEvent, WireguardNetwork}, handlers::{wireguard::WireguardNetworkData, Auth}, }; use matches::assert_matches; @@ -10,7 +9,7 @@ use rocket::{ }; mod common; -use crate::common::make_test_client; +use self::common::make_test_client; fn make_network() -> Value { json!({ diff --git a/tests/wireguard_network_allowed_groups.rs b/tests/wireguard_network_allowed_groups.rs index 998350515..b34a2431b 100644 --- a/tests/wireguard_network_allowed_groups.rs +++ b/tests/wireguard_network_allowed_groups.rs @@ -1,13 +1,13 @@ use claims::assert_err; -use defguard::db::{DbPool, Device, GatewayEvent, Group, User, WireguardNetwork}; -use defguard::handlers::wireguard::ImportedNetworkData; -use defguard::handlers::Auth; +use defguard::{ + db::{DbPool, Device, GatewayEvent, Group, User, WireguardNetwork}, + handlers::{wireguard::ImportedNetworkData, Auth}, +}; use matches::assert_matches; -use rocket::http::Status; -use rocket::serde::json::json; +use rocket::{http::Status, serde::json::json}; mod common; -use crate::common::make_test_client; +use self::common::make_test_client; // setup user groups, test users and devices async fn setup_test_users(pool: &DbPool) -> (Vec, Vec) { @@ -330,7 +330,9 @@ async fn test_import_network_existing_devices() { assert_matches!(event, GatewayEvent::NetworkCreated(..)); // network config was only created for one of the existing devices and the admin device - let GatewayEvent::DeviceModified(device_info) = wg_rx.try_recv().unwrap() else { panic!() }; + let GatewayEvent::DeviceModified(device_info) = wg_rx.try_recv().unwrap() else { + panic!() + }; assert_eq!(device_info.device.id.unwrap(), devices[1].id.unwrap()); assert_eq!(device_info.network_info.len(), 1); assert_eq!(device_info.network_info[0].network_id, 1); @@ -339,7 +341,9 @@ async fn test_import_network_existing_devices() { peers[1].allowed_ips[0] ); - let GatewayEvent::DeviceCreated(device_info) = wg_rx.try_recv().unwrap() else { panic!() }; + let GatewayEvent::DeviceCreated(device_info) = wg_rx.try_recv().unwrap() else { + panic!() + }; assert_eq!(device_info.device.id.unwrap(), devices[0].id.unwrap()); assert_eq!(device_info.network_info.len(), 1); assert_eq!(device_info.network_info[0].network_id, 1); @@ -427,7 +431,9 @@ PersistentKeepalive = 300 assert_eq!(peers[3].pubkey, mapped_devices[1].wireguard_pubkey); // assert events - let GatewayEvent::DeviceCreated(device_info) = wg_rx.try_recv().unwrap() else { panic!() }; + let GatewayEvent::DeviceCreated(device_info) = wg_rx.try_recv().unwrap() else { + panic!() + }; assert_eq!( device_info.device.wireguard_pubkey, mapped_devices[0].wireguard_pubkey @@ -439,7 +445,9 @@ PersistentKeepalive = 300 mapped_devices[0].wireguard_ip ); - let GatewayEvent::DeviceCreated(device_info) = wg_rx.try_recv().unwrap() else { panic!() }; + let GatewayEvent::DeviceCreated(device_info) = wg_rx.try_recv().unwrap() else { + panic!() + }; assert_eq!( device_info.device.wireguard_pubkey, mapped_devices[1].wireguard_pubkey diff --git a/tests/wireguard_network_import.rs b/tests/wireguard_network_import.rs index 3cf47512d..02a0fde87 100644 --- a/tests/wireguard_network_import.rs +++ b/tests/wireguard_network_import.rs @@ -1,6 +1,5 @@ -use defguard::db::models::device::UserDevice; use defguard::{ - db::{Device, GatewayEvent, WireguardNetwork}, + db::{models::device::UserDevice, Device, GatewayEvent, WireguardNetwork}, handlers::{wireguard::ImportedNetworkData, Auth}, }; use matches::assert_matches; @@ -8,7 +7,7 @@ use rocket::{http::Status, serde::json::serde_json::json}; use tokio::sync::broadcast::error::TryRecvError; mod common; -use crate::common::{fetch_user_details, make_test_client}; +use self::common::{fetch_user_details, make_test_client}; #[rocket::async_test] async fn test_config_import() { @@ -42,7 +41,7 @@ async fn test_config_import() { "initial".into(), "10.1.9.0/24".parse().unwrap(), 51515, - "".to_string(), + String::new(), None, vec![], ) @@ -57,7 +56,7 @@ async fn test_config_import() { "l07+qPWs4jzW3Gp1DKbHgBMRRm4Jg3q2BJxw0ZYl6c4=".into(), 1, ); - device_1.save(&mut transaction).await.unwrap(); + device_1.save(&mut *transaction).await.unwrap(); device_1 .add_to_all_networks(&mut transaction, &client_state.config.admin_groupname) .await @@ -68,7 +67,7 @@ async fn test_config_import() { "v2U14sjNN4tOYD3P15z0WkjriKY9Hl85I3vIEPomrYs=".into(), 1, ); - device_2.save(&mut transaction).await.unwrap(); + device_2.save(&mut *transaction).await.unwrap(); device_2 .add_to_all_networks(&mut transaction, &client_state.config.admin_groupname) .await diff --git a/tests/wireguard_network_stats.rs b/tests/wireguard_network_stats.rs index e7d7b5dbf..4db1d96ef 100644 --- a/tests/wireguard_network_stats.rs +++ b/tests/wireguard_network_stats.rs @@ -14,7 +14,7 @@ use rocket::{ }; mod common; -use crate::common::make_test_client; +use self::common::make_test_client; fn make_network() -> Value { json!({ diff --git a/tests/worker.rs b/tests/worker.rs index dc91bc189..aca1c8ae5 100644 --- a/tests/worker.rs +++ b/tests/worker.rs @@ -5,11 +5,11 @@ use defguard::{ Auth, }, }; -use rocket::http::Status; -use rocket::local::asynchronous::Client; +use rocket::{http::Status, local::asynchronous::Client}; use std::sync::{Arc, Mutex}; + mod common; -use crate::common::make_test_client; +use self::common::make_test_client; async fn make_client() -> (Client, Arc>) { let (client, client_status) = make_test_client().await; @@ -91,10 +91,10 @@ async fn test_scheduling_worker_jobs() { id: "YubiBridge".to_string(), job_id: user_job_id_1, success: true, - public_key: "".to_string(), - ssh_key: "".to_string(), - fingerprint: "".to_string(), - error: "".to_string(), + public_key: String::new(), + ssh_key: String::new(), + fingerprint: String::new(), + error: String::new(), }, "hpotter".into(), ); @@ -103,10 +103,10 @@ async fn test_scheduling_worker_jobs() { id: "YubiBridge".to_string(), job_id: admin_job_id_1, success: true, - public_key: "".to_string(), - ssh_key: "".to_string(), - fingerprint: "".to_string(), - error: "".to_string(), + public_key: String::new(), + ssh_key: String::new(), + fingerprint: String::new(), + error: String::new(), }, "hpotter".into(), ); @@ -115,10 +115,10 @@ async fn test_scheduling_worker_jobs() { id: "YubiBridge".to_string(), job_id: admin_job_id_2, success: true, - public_key: "".to_string(), - ssh_key: "".to_string(), - fingerprint: "".to_string(), - error: "".to_string(), + public_key: String::new(), + ssh_key: String::new(), + fingerprint: String::new(), + error: String::new(), }, "admin".into(), ); @@ -126,19 +126,19 @@ async fn test_scheduling_worker_jobs() { // admin can fetch status for all jobs let response = client - .get(format!("/api/v1/worker/{}", user_job_id_1)) + .get(format!("/api/v1/worker/{user_job_id_1}")) .dispatch() .await; assert_eq!(response.status(), Status::Ok); let response = client - .get(format!("/api/v1/worker/{}", admin_job_id_1)) + .get(format!("/api/v1/worker/{admin_job_id_1}")) .dispatch() .await; assert_eq!(response.status(), Status::Ok); let response = client - .get(format!("/api/v1/worker/{}", admin_job_id_2)) + .get(format!("/api/v1/worker/{admin_job_id_2}")) .dispatch() .await; assert_eq!(response.status(), Status::Ok); @@ -149,19 +149,19 @@ async fn test_scheduling_worker_jobs() { assert_eq!(response.status(), Status::Ok); let response = client - .get(format!("/api/v1/worker/{}", admin_job_id_1)) + .get(format!("/api/v1/worker/{admin_job_id_1}")) .dispatch() .await; assert_eq!(response.status(), Status::Ok); let response = client - .get(format!("/api/v1/worker/{}", admin_job_id_2)) + .get(format!("/api/v1/worker/{admin_job_id_2}")) .dispatch() .await; assert_eq!(response.status(), Status::Forbidden); let response = client - .get(format!("/api/v1/worker/{}", user_job_id_1)) + .get(format!("/api/v1/worker/{user_job_id_1}")) .dispatch() .await; assert_eq!(response.status(), Status::Ok); diff --git a/web/package.json b/web/package.json index 688698617..5d023e47f 100644 --- a/web/package.json +++ b/web/package.json @@ -1,7 +1,7 @@ { "name": "web", "scripts": { - "dev": "npm-run-all --parallel vite typesafe-i18n", + "dev": "concurrently \"pnpm run vite\" \"pnpm run typesafe-i18n\"", "build": "tsc && vite build", "serve": "vite preview", "generate-translation-types": "typesafe-i18n --no-watch", @@ -111,6 +111,7 @@ "@typescript-eslint/parser": "^6.3.0", "@vitejs/plugin-react-swc": "^3.3.2", "autoprefixer": "^10.4.15", + "concurrently": "^8.2.1", "esbuild": "^0.19.2", "eslint": "^8.47.0", "eslint-config-prettier": "^9.0.0", @@ -121,7 +122,6 @@ "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.3", "eslint-plugin-simple-import-sort": "^10.0.0", - "npm-run-all": "^4.1.5", "postcss": "^8.4.27", "prettier": "^3.0.1", "prop-types": "^15.8.1", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index f8d354cf4..d0cce52ea 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -223,6 +223,9 @@ devDependencies: autoprefixer: specifier: ^10.4.15 version: 10.4.15(postcss@8.4.27) + concurrently: + specifier: ^8.2.1 + version: 8.2.1 esbuild: specifier: ^0.19.2 version: 0.19.2 @@ -253,9 +256,6 @@ devDependencies: eslint-plugin-simple-import-sort: specifier: ^10.0.0 version: 10.0.0(eslint@8.47.0) - npm-run-all: - specifier: ^4.1.5 - version: 4.1.5 postcss: specifier: ^8.4.27 version: 8.4.27 @@ -3788,6 +3788,15 @@ packages: wrap-ansi: 7.0.0 dev: true + /cliui@8.0.1: + resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} + engines: {node: '>=12'} + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + dev: true + /clsx@1.2.1: resolution: {integrity: sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==} engines: {node: '>=6'} @@ -3873,6 +3882,22 @@ packages: typedarray: 0.0.6 dev: true + /concurrently@8.2.1: + resolution: {integrity: sha512-nVraf3aXOpIcNud5pB9M82p1tynmZkrSGQ1p6X/VY8cJ+2LMVqAgXsJxYYefACSHbTYlm92O1xuhdGTjwoEvbQ==} + engines: {node: ^14.13.0 || >=16.0.0} + hasBin: true + dependencies: + chalk: 4.1.2 + date-fns: 2.30.0 + lodash: 4.17.21 + rxjs: 7.8.1 + shell-quote: 1.8.1 + spawn-command: 0.0.2 + supports-color: 8.1.1 + tree-kill: 1.2.2 + yargs: 17.7.2 + dev: true + /content-disposition@0.5.4: resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==} engines: {node: '>= 0.6'} @@ -4104,17 +4129,6 @@ packages: path-type: 4.0.0 dev: true - /cross-spawn@6.0.5: - resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==} - engines: {node: '>=4.8'} - dependencies: - nice-try: 1.0.5 - path-key: 2.0.1 - semver: 5.7.1 - shebang-command: 1.2.0 - which: 1.3.1 - dev: true - /cross-spawn@7.0.3: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} @@ -4264,6 +4278,13 @@ packages: engines: {node: '>=4'} dev: true + /date-fns@2.30.0: + resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==} + engines: {node: '>=0.11'} + dependencies: + '@babel/runtime': 7.21.0 + dev: true + /dateformat@3.0.3: resolution: {integrity: sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==} dev: true @@ -6576,11 +6597,6 @@ packages: resolution: {integrity: sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q==} dev: false - /memorystream@0.3.1: - resolution: {integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==} - engines: {node: '>= 0.10.0'} - dev: true - /meow@10.1.5: resolution: {integrity: sha512-/d+PQ4GKmGvM9Bee/DPa8z3mXs/pkvJE2KEThngVNOqtmljC6K7NMPxtc2JeZYTmpWb9k/TmxjeL18ez3h7vCw==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -7068,10 +7084,6 @@ packages: resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} dev: true - /nice-try@1.0.5: - resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==} - dev: true - /no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} dependencies: @@ -7114,22 +7126,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /npm-run-all@4.1.5: - resolution: {integrity: sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==} - engines: {node: '>= 4'} - hasBin: true - dependencies: - ansi-styles: 3.2.1 - chalk: 2.4.2 - cross-spawn: 6.0.5 - memorystream: 0.3.1 - minimatch: 3.1.2 - pidtree: 0.3.1 - read-pkg: 3.0.0 - shell-quote: 1.8.1 - string.prototype.padend: 3.1.4 - dev: true - /npm-run-path@4.0.1: resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} engines: {node: '>=8'} @@ -7393,11 +7389,6 @@ packages: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} - /path-key@2.0.1: - resolution: {integrity: sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==} - engines: {node: '>=4'} - dev: true - /path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} @@ -7435,12 +7426,6 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} - /pidtree@0.3.1: - resolution: {integrity: sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==} - engines: {node: '>=0.10'} - hasBin: true - dev: true - /pify@2.3.0: resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==} engines: {node: '>=0.10.0'} @@ -8197,7 +8182,6 @@ packages: resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} dependencies: tslib: 2.5.0 - dev: false /sade@1.8.1: resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==} @@ -8273,24 +8257,12 @@ packages: resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} dev: false - /shebang-command@1.2.0: - resolution: {integrity: sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==} - engines: {node: '>=0.10.0'} - dependencies: - shebang-regex: 1.0.0 - dev: true - /shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} dependencies: shebang-regex: 3.0.0 - /shebang-regex@1.0.0: - resolution: {integrity: sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==} - engines: {node: '>=0.10.0'} - dev: true - /shebang-regex@3.0.0: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} @@ -8377,6 +8349,10 @@ packages: resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==} dev: false + /spawn-command@0.0.2: + resolution: {integrity: sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==} + dev: true + /spdx-correct@3.2.0: resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==} dependencies: @@ -8479,15 +8455,6 @@ packages: side-channel: 1.0.4 dev: true - /string.prototype.padend@3.1.4: - resolution: {integrity: sha512-67otBXoksdjsnXXRUq+KMVTdlVRZ2af422Y0aTyTjVaoQkGr3mxl2Bc5emi7dOQ3OGVVQQskmLEWwFXwommpNw==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.2 - define-properties: 1.2.0 - es-abstract: 1.21.2 - dev: true - /string.prototype.trim@1.2.7: resolution: {integrity: sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg==} engines: {node: '>= 0.4'} @@ -8754,6 +8721,13 @@ packages: has-flag: 4.0.0 dev: true + /supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + dependencies: + has-flag: 4.0.0 + dev: true + /supports-hyperlinks@3.0.0: resolution: {integrity: sha512-QBDPHyPQDRTy9ku4URNGY5Lah8PAaXs6tAAwp55sL5WCsSW7GIfdf6W5ixfziW+t7wh3GVvHyHHyQ1ESsoRvaA==} engines: {node: '>=14.18'} @@ -8890,6 +8864,11 @@ packages: resolution: {integrity: sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==} dev: false + /tree-kill@1.2.2: + resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} + hasBin: true + dev: true + /trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} dev: false @@ -9547,6 +9526,11 @@ packages: engines: {node: '>=10'} dev: true + /yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + dev: true + /yargs@15.4.1: resolution: {integrity: sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==} engines: {node: '>=8'} @@ -9577,6 +9561,19 @@ packages: yargs-parser: 20.2.9 dev: true + /yargs@17.7.2: + resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} + engines: {node: '>=12'} + dependencies: + cliui: 8.0.1 + escalade: 3.1.1 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 21.1.1 + dev: true + /ylru@1.3.2: resolution: {integrity: sha512-RXRJzMiK6U2ye0BlGGZnmpwJDPgakn6aNQ0A7gHRbD4I0uvK4TW6UqkK1V0pp9jskjJBAXd3dRrbzWkqJ+6cxA==} engines: {node: '>= 4.0.0'} diff --git a/web/src/shared/fonts/Poppins/Poppins-Black.woff2 b/web/public/fonts/Poppins/Poppins-Black.woff2 similarity index 100% rename from web/src/shared/fonts/Poppins/Poppins-Black.woff2 rename to web/public/fonts/Poppins/Poppins-Black.woff2 diff --git a/web/public/fonts/Poppins/Poppins-BlackItalic.woff2 b/web/public/fonts/Poppins/Poppins-BlackItalic.woff2 new file mode 100644 index 000000000..c53e44b3b Binary files /dev/null and b/web/public/fonts/Poppins/Poppins-BlackItalic.woff2 differ diff --git a/web/src/shared/fonts/Poppins/Poppins-Bold.woff2 b/web/public/fonts/Poppins/Poppins-Bold.woff2 similarity index 100% rename from web/src/shared/fonts/Poppins/Poppins-Bold.woff2 rename to web/public/fonts/Poppins/Poppins-Bold.woff2 diff --git a/web/public/fonts/Poppins/Poppins-BoldItalic.woff2 b/web/public/fonts/Poppins/Poppins-BoldItalic.woff2 new file mode 100644 index 000000000..f7f7fe4bc Binary files /dev/null and b/web/public/fonts/Poppins/Poppins-BoldItalic.woff2 differ diff --git a/web/src/shared/fonts/Poppins/Poppins-ExtraBold.woff2 b/web/public/fonts/Poppins/Poppins-ExtraBold.woff2 similarity index 100% rename from web/src/shared/fonts/Poppins/Poppins-ExtraBold.woff2 rename to web/public/fonts/Poppins/Poppins-ExtraBold.woff2 diff --git a/web/public/fonts/Poppins/Poppins-ExtraBoldItalic.woff2 b/web/public/fonts/Poppins/Poppins-ExtraBoldItalic.woff2 new file mode 100644 index 000000000..9cf7164d8 Binary files /dev/null and b/web/public/fonts/Poppins/Poppins-ExtraBoldItalic.woff2 differ diff --git a/web/src/shared/fonts/Poppins/Poppins-ExtraLight.woff2 b/web/public/fonts/Poppins/Poppins-ExtraLight.woff2 similarity index 100% rename from web/src/shared/fonts/Poppins/Poppins-ExtraLight.woff2 rename to web/public/fonts/Poppins/Poppins-ExtraLight.woff2 diff --git a/web/public/fonts/Poppins/Poppins-ExtraLightItalic.woff2 b/web/public/fonts/Poppins/Poppins-ExtraLightItalic.woff2 new file mode 100644 index 000000000..8b7c5ef1f Binary files /dev/null and b/web/public/fonts/Poppins/Poppins-ExtraLightItalic.woff2 differ diff --git a/web/public/fonts/Poppins/Poppins-Italic.woff2 b/web/public/fonts/Poppins/Poppins-Italic.woff2 new file mode 100644 index 000000000..1db484df9 Binary files /dev/null and b/web/public/fonts/Poppins/Poppins-Italic.woff2 differ diff --git a/web/src/shared/fonts/Poppins/Poppins-Light.woff2 b/web/public/fonts/Poppins/Poppins-Light.woff2 similarity index 100% rename from web/src/shared/fonts/Poppins/Poppins-Light.woff2 rename to web/public/fonts/Poppins/Poppins-Light.woff2 diff --git a/web/public/fonts/Poppins/Poppins-LightItalic.woff2 b/web/public/fonts/Poppins/Poppins-LightItalic.woff2 new file mode 100644 index 000000000..748c1a34a Binary files /dev/null and b/web/public/fonts/Poppins/Poppins-LightItalic.woff2 differ diff --git a/web/src/shared/fonts/Poppins/Poppins-Medium.woff2 b/web/public/fonts/Poppins/Poppins-Medium.woff2 similarity index 100% rename from web/src/shared/fonts/Poppins/Poppins-Medium.woff2 rename to web/public/fonts/Poppins/Poppins-Medium.woff2 diff --git a/web/public/fonts/Poppins/Poppins-MediumItalic.woff2 b/web/public/fonts/Poppins/Poppins-MediumItalic.woff2 new file mode 100644 index 000000000..39177dc3f Binary files /dev/null and b/web/public/fonts/Poppins/Poppins-MediumItalic.woff2 differ diff --git a/web/src/shared/fonts/Poppins/Poppins-Regular.woff2 b/web/public/fonts/Poppins/Poppins-Regular.woff2 similarity index 100% rename from web/src/shared/fonts/Poppins/Poppins-Regular.woff2 rename to web/public/fonts/Poppins/Poppins-Regular.woff2 diff --git a/web/src/shared/fonts/Poppins/Poppins-SemiBold.woff2 b/web/public/fonts/Poppins/Poppins-SemiBold.woff2 similarity index 100% rename from web/src/shared/fonts/Poppins/Poppins-SemiBold.woff2 rename to web/public/fonts/Poppins/Poppins-SemiBold.woff2 diff --git a/web/public/fonts/Poppins/Poppins-SemiBoldItalic.woff2 b/web/public/fonts/Poppins/Poppins-SemiBoldItalic.woff2 new file mode 100644 index 000000000..605065152 Binary files /dev/null and b/web/public/fonts/Poppins/Poppins-SemiBoldItalic.woff2 differ diff --git a/web/src/shared/fonts/Poppins/Poppins-Thin.woff2 b/web/public/fonts/Poppins/Poppins-Thin.woff2 similarity index 100% rename from web/src/shared/fonts/Poppins/Poppins-Thin.woff2 rename to web/public/fonts/Poppins/Poppins-Thin.woff2 diff --git a/web/public/fonts/Poppins/Poppins-ThinItalic.woff2 b/web/public/fonts/Poppins/Poppins-ThinItalic.woff2 new file mode 100644 index 000000000..86ee4fd46 Binary files /dev/null and b/web/public/fonts/Poppins/Poppins-ThinItalic.woff2 differ diff --git a/web/src/shared/fonts/Roboto/Roboto-Black.woff2 b/web/public/fonts/Roboto/Roboto-Black.woff2 similarity index 100% rename from web/src/shared/fonts/Roboto/Roboto-Black.woff2 rename to web/public/fonts/Roboto/Roboto-Black.woff2 diff --git a/web/src/shared/fonts/Roboto/Roboto-BlackItalic.woff2 b/web/public/fonts/Roboto/Roboto-BlackItalic.woff2 similarity index 100% rename from web/src/shared/fonts/Roboto/Roboto-BlackItalic.woff2 rename to web/public/fonts/Roboto/Roboto-BlackItalic.woff2 diff --git a/web/src/shared/fonts/Roboto/Roboto-Bold.woff2 b/web/public/fonts/Roboto/Roboto-Bold.woff2 similarity index 100% rename from web/src/shared/fonts/Roboto/Roboto-Bold.woff2 rename to web/public/fonts/Roboto/Roboto-Bold.woff2 diff --git a/web/src/shared/fonts/Roboto/Roboto-BoldItalic.woff2 b/web/public/fonts/Roboto/Roboto-BoldItalic.woff2 similarity index 100% rename from web/src/shared/fonts/Roboto/Roboto-BoldItalic.woff2 rename to web/public/fonts/Roboto/Roboto-BoldItalic.woff2 diff --git a/web/src/shared/fonts/Roboto/Roboto-Italic.woff2 b/web/public/fonts/Roboto/Roboto-Italic.woff2 similarity index 100% rename from web/src/shared/fonts/Roboto/Roboto-Italic.woff2 rename to web/public/fonts/Roboto/Roboto-Italic.woff2 diff --git a/web/src/shared/fonts/Roboto/Roboto-Light.woff2 b/web/public/fonts/Roboto/Roboto-Light.woff2 similarity index 100% rename from web/src/shared/fonts/Roboto/Roboto-Light.woff2 rename to web/public/fonts/Roboto/Roboto-Light.woff2 diff --git a/web/src/shared/fonts/Roboto/Roboto-LightItalic.woff2 b/web/public/fonts/Roboto/Roboto-LightItalic.woff2 similarity index 100% rename from web/src/shared/fonts/Roboto/Roboto-LightItalic.woff2 rename to web/public/fonts/Roboto/Roboto-LightItalic.woff2 diff --git a/web/src/shared/fonts/Roboto/Roboto-Medium.woff2 b/web/public/fonts/Roboto/Roboto-Medium.woff2 similarity index 100% rename from web/src/shared/fonts/Roboto/Roboto-Medium.woff2 rename to web/public/fonts/Roboto/Roboto-Medium.woff2 diff --git a/web/src/shared/fonts/Roboto/Roboto-MediumItalic.woff2 b/web/public/fonts/Roboto/Roboto-MediumItalic.woff2 similarity index 100% rename from web/src/shared/fonts/Roboto/Roboto-MediumItalic.woff2 rename to web/public/fonts/Roboto/Roboto-MediumItalic.woff2 diff --git a/web/src/shared/fonts/Roboto/Roboto-Regular.woff2 b/web/public/fonts/Roboto/Roboto-Regular.woff2 similarity index 100% rename from web/src/shared/fonts/Roboto/Roboto-Regular.woff2 rename to web/public/fonts/Roboto/Roboto-Regular.woff2 diff --git a/web/src/shared/fonts/Roboto/Roboto-Thin.woff2 b/web/public/fonts/Roboto/Roboto-Thin.woff2 similarity index 100% rename from web/src/shared/fonts/Roboto/Roboto-Thin.woff2 rename to web/public/fonts/Roboto/Roboto-Thin.woff2 diff --git a/web/src/shared/fonts/Roboto/Roboto-ThinItalic.woff2 b/web/public/fonts/Roboto/Roboto-ThinItalic.woff2 similarity index 100% rename from web/src/shared/fonts/Roboto/Roboto-ThinItalic.woff2 rename to web/public/fonts/Roboto/Roboto-ThinItalic.woff2 diff --git a/web/src/shared/fonts/SourceCodePro/SourceCodePro-Italic.woff2 b/web/public/fonts/SourceCodePro/SourceCodePro-Italic.woff2 similarity index 100% rename from web/src/shared/fonts/SourceCodePro/SourceCodePro-Italic.woff2 rename to web/public/fonts/SourceCodePro/SourceCodePro-Italic.woff2 diff --git a/web/src/shared/fonts/SourceCodePro/SourceCodePro-Regular.woff2 b/web/public/fonts/SourceCodePro/SourceCodePro-Regular.woff2 similarity index 100% rename from web/src/shared/fonts/SourceCodePro/SourceCodePro-Regular.woff2 rename to web/public/fonts/SourceCodePro/SourceCodePro-Regular.woff2 diff --git a/web/src/components/Navigation/components/NavigationMobile/NavigationMobile.tsx b/web/src/components/Navigation/components/NavigationMobile/NavigationMobile.tsx index 9d3e39ad7..7bbb8ad09 100644 --- a/web/src/components/Navigation/components/NavigationMobile/NavigationMobile.tsx +++ b/web/src/components/Navigation/components/NavigationMobile/NavigationMobile.tsx @@ -62,6 +62,10 @@ export const NavigationMobile = ({ navItems, onLogout }: Props) => { path: '/admin/enrollment', title: LL.navigation.mobileTitles.enrollment(), }, + { + path: '/admin/openid', + title: LL.navigation.mobileTitles.openId(), + }, ], [LL.navigation.mobileTitles], ); diff --git a/web/src/i18n/en/index.ts b/web/src/i18n/en/index.ts index 41884e641..195660579 100644 --- a/web/src/i18n/en/index.ts +++ b/web/src/i18n/en/index.ts @@ -301,6 +301,8 @@ const en: BaseTranslation = { }, provisionKeys: { title: 'Yubikey provisioning:', + warning: + 'Please be advised that this operation wll wipe openpgp application on yubikey and reconfigure it.', infoBox: `The selected provisioner must have a clean YubiKey plugged in be provisioned. To clean a used YubiKey gpg --card-edit before provisioning.`, @@ -1077,17 +1079,11 @@ const en: BaseTranslation = { noLicenseMessage: "You don't have a license for this feature.", provisioningStation: { header: 'YubiKey provisioning station', - cardTitle: 'Provisioning station setup command', + cardTitle: 'Provisioning station docker setup command', content: `In order to be able to provision your YubiKeys, first you need to set up physical machine with USB slot. Run provided command on your chosen machine to register it and start provisioning your keys.`, }, - noLicenseBox: `

- YubiKey module -

-
-

This is enterprise module for YubiKey

-

management and provisioning.

`, list: { headers: { name: 'Name', diff --git a/web/src/i18n/i18n-types.ts b/web/src/i18n/i18n-types.ts index 51cec94cf..105cda6c6 100644 --- a/web/src/i18n/i18n-types.ts +++ b/web/src/i18n/i18n-types.ts @@ -619,6 +619,10 @@ type RootTranslation = { * Y​u​b​i​k​e​y​ ​p​r​o​v​i​s​i​o​n​i​n​g​: */ title: string + /** + * P​l​e​a​s​e​ ​b​e​ ​a​d​v​i​s​e​d​ ​t​h​a​t​ ​t​h​i​s​ ​o​p​e​r​a​t​i​o​n​ ​w​l​l​ ​w​i​p​e​ ​o​p​e​n​p​g​p​ ​a​p​p​l​i​c​a​t​i​o​n​ ​o​n​ ​y​u​b​i​k​e​y​ ​a​n​d​ ​r​e​c​o​n​f​i​g​u​r​e​ ​i​t​. + */ + warning: string /** * T​h​e​ ​s​e​l​e​c​t​e​d​ ​p​r​o​v​i​s​i​o​n​e​r​ ​m​u​s​t​ ​h​a​v​e​ ​a​ ​<​b​>​c​l​e​a​n​<​/​b​>​ ​Y​u​b​i​K​e​y​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​p​l​u​g​g​e​d​ ​i​n​ ​b​e​ ​p​r​o​v​i​s​i​o​n​e​d​.​ ​T​o​ ​c​l​e​a​n​ ​a​ ​u​s​e​d​ ​Y​u​b​i​K​e​y​ @@ -2461,7 +2465,7 @@ type RootTranslation = { */ header: string /** - * P​r​o​v​i​s​i​o​n​i​n​g​ ​s​t​a​t​i​o​n​ ​s​e​t​u​p​ ​c​o​m​m​a​n​d + * P​r​o​v​i​s​i​o​n​i​n​g​ ​s​t​a​t​i​o​n​ ​d​o​c​k​e​r​ ​s​e​t​u​p​ ​c​o​m​m​a​n​d */ cardTitle: string /** @@ -2471,15 +2475,6 @@ type RootTranslation = { */ content: string } - /** - * <​p​>​ - ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​<​s​t​r​o​n​g​>​Y​u​b​i​K​e​y​ ​m​o​d​u​l​e​<​/​s​t​r​o​n​g​>​ - ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​<​/​p​>​ - ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​<​b​r​ ​/​>​ - ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​<​p​>​T​h​i​s​ ​i​s​ ​e​n​t​e​r​p​r​i​s​e​ ​m​o​d​u​l​e​ ​f​o​r​ ​Y​u​b​i​K​e​y​<​/​p​>​ - ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​<​p​>​m​a​n​a​g​e​m​e​n​t​ ​a​n​d​ ​p​r​o​v​i​s​i​o​n​i​n​g​.​<​/​p​> - */ - noLicenseBox: string list: { headers: { /** @@ -3890,6 +3885,10 @@ export type TranslationFunctions = { * Yubikey provisioning: */ title: () => LocalizedString + /** + * Please be advised that this operation wll wipe openpgp application on yubikey and reconfigure it. + */ + warning: () => LocalizedString /** * The selected provisioner must have a clean YubiKey plugged in be provisioned. To clean a used YubiKey @@ -5721,7 +5720,7 @@ export type TranslationFunctions = { */ header: () => LocalizedString /** - * Provisioning station setup command + * Provisioning station docker setup command */ cardTitle: () => LocalizedString /** @@ -5731,15 +5730,6 @@ export type TranslationFunctions = { */ content: () => LocalizedString } - /** - *

- YubiKey module -

-
-

This is enterprise module for YubiKey

-

management and provisioning.

- */ - noLicenseBox: () => LocalizedString list: { headers: { /** diff --git a/web/src/i18n/pl/index.ts b/web/src/i18n/pl/index.ts index 2880e673c..0be9d0eae 100644 --- a/web/src/i18n/pl/index.ts +++ b/web/src/i18n/pl/index.ts @@ -300,6 +300,7 @@ const pl: Translation = { }, }, provisionKeys: { + warning: 'Ta operacja bezpowrotnie usunie dane z aplikacji openpgp klucza.', title: 'Provisionowanie YubiKeya:', infoBox: `Wybrany provisioner musi mieć podłączony pusty YubiKey. Aby zresetować YubiKey uruchom @@ -1080,12 +1081,6 @@ const pl: Translation = { fizyczną maszynę z gniazdem USB. Uruchom podane polecenie na wybranej maszynie aby zarejestrować maszynę i rozpocząć generowanie kluczy.`, }, - noLicenseBox: `

- YubiKey module -

-
-

Jest to moduł enterprise dla YubiKey

> -

zarządzania i provisioningu.

`, list: { headers: { name: 'Nazwa', diff --git a/web/src/pages/auth/Login/style.scss b/web/src/pages/auth/Login/style.scss index 1535e6214..46b746ad0 100644 --- a/web/src/pages/auth/Login/style.scss +++ b/web/src/pages/auth/Login/style.scss @@ -1,58 +1,43 @@ -@use '@shared/scss/base/variables' as v; -@use '@shared/scss/helpers/mixins' as mix; -@use '@shared/scss/helpers/bootstrap' as bs; +@use '@scssutils' as *; #login-container { + min-height: 100vh; + width: 100%; display: flex; - flex-direction: column; + flex-flow: column; align-items: center; - align-content: center; justify-content: center; - flex-grow: 1; - width: 100%; + box-sizing: border-box; + padding: 20px 0; - & > p { - color: v.$gray-light; - font-size: 1.2rem; - line-height: 1.4; - margin: 2rem 0; + @include media-breakpoint-up(lg) { + padding: 40px 0; } - & > h1 { - margin-bottom: 1.2rem; - font-size: 2.8rem; - line-height: 3.9rem; - @include mix.text-weight(semiBold); - } + h1 { + @include typography(app-welcome-1); - & > form { - display: flex; - flex-direction: column; - width: 284px; - height: auto; + color: var(--text-body-primary); + text-align: center; + width: 100%; + margin-bottom: 24px; + } - .input-container { - width: 284px; - } + form { + width: 100%; + max-width: 300px; + box-sizing: border-box; - button { - width: 284px; + @include media-breakpoint-down(lg) { + padding: 10px; } - input-container { - width: 284px; + & > .input { + margin-bottom: 5px; } - } - & > button { - width: 284px; - margin-bottom: 2rem; - - &:last-of-type { - margin: 0; + & > * { + width: 100%; } } - @include bs.media-breakpoint-up(lg) { - width: 50%; - } } diff --git a/web/src/pages/loader/LoaderPage.tsx b/web/src/pages/loader/LoaderPage.tsx index 699608c4f..2e3448500 100644 --- a/web/src/pages/loader/LoaderPage.tsx +++ b/web/src/pages/loader/LoaderPage.tsx @@ -6,7 +6,7 @@ import { LoaderSpinner } from '../../shared/defguard-ui/components/Layout/Loader export const LoaderPage = () => { return ( -
+
diff --git a/web/src/pages/loader/style.scss b/web/src/pages/loader/style.scss index d4e2186a4..a9eaa8b51 100644 --- a/web/src/pages/loader/style.scss +++ b/web/src/pages/loader/style.scss @@ -1,7 +1,4 @@ -@use '@shared/scss/base/variables' as v; -@use '@shared/scss/helpers/bootstrap' as bs; - -.loader-page { +#loader-page { width: 100%; height: 100%; display: flex; @@ -9,7 +6,7 @@ align-content: center; align-items: center; justify-content: center; - background-color: v.$primary; + background-color: var(--surface-main-primary); position: absolute; inset: 0; z-index: 10000000000000; diff --git a/web/src/pages/network/NetworkControls/NetworkControls.tsx b/web/src/pages/network/NetworkControls/NetworkControls.tsx index 7a74cd180..dbb6b64f5 100644 --- a/web/src/pages/network/NetworkControls/NetworkControls.tsx +++ b/web/src/pages/network/NetworkControls/NetworkControls.tsx @@ -15,7 +15,7 @@ import { ButtonSize, ButtonStyleVariant, } from '../../../shared/defguard-ui/components/Layout/Button/types'; -import ConfirmModal from '../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/ConfirmModal'; +import { ConfirmModal } from '../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/ConfirmModal'; import { ConfirmModalType } from '../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/types'; import { Select } from '../../../shared/defguard-ui/components/Layout/Select/Select'; import { diff --git a/web/src/pages/openid/OpenidClientsListPage/OpenidClientsListPage.tsx b/web/src/pages/openid/OpenidClientsListPage/OpenidClientsListPage.tsx index d855e44ec..568506efb 100644 --- a/web/src/pages/openid/OpenidClientsListPage/OpenidClientsListPage.tsx +++ b/web/src/pages/openid/OpenidClientsListPage/OpenidClientsListPage.tsx @@ -20,9 +20,9 @@ import { EditButton } from '../../../shared/defguard-ui/components/Layout/EditBu import { EditButtonOption } from '../../../shared/defguard-ui/components/Layout/EditButton/EditButtonOption'; import { EditButtonOptionStyleVariant } from '../../../shared/defguard-ui/components/Layout/EditButton/types'; import { LoaderSpinner } from '../../../shared/defguard-ui/components/Layout/LoaderSpinner/LoaderSpinner'; -import ConfirmModal from '../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/ConfirmModal'; +import { ConfirmModal } from '../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/ConfirmModal'; import { ConfirmModalType } from '../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/types'; -import NoData from '../../../shared/defguard-ui/components/Layout/NoData/NoData'; +import { NoData } from '../../../shared/defguard-ui/components/Layout/NoData/NoData'; import { Search } from '../../../shared/defguard-ui/components/Layout/Search/Search'; import { Select } from '../../../shared/defguard-ui/components/Layout/Select/Select'; import { @@ -316,7 +316,7 @@ export const OpenidClientsListPage = () => { size={ButtonSize.SMALL} styleVariant={ButtonStyleVariant.PRIMARY} icon={} - text={LL.openidOverview.addNewApp()} + text={breakpoint === 'desktop' ? LL.openidOverview.addNewApp() : undefined} disabled={!hasAccess} />
diff --git a/web/src/pages/openid/OpenidClientsListPage/style.scss b/web/src/pages/openid/OpenidClientsListPage/style.scss index 8bec79073..b2fe3875a 100644 --- a/web/src/pages/openid/OpenidClientsListPage/style.scss +++ b/web/src/pages/openid/OpenidClientsListPage/style.scss @@ -228,6 +228,12 @@ grid-row: 3; } + .no-data { + width: 100%; + margin-top: 20px; + text-align: center; + } + .list-loader { width: 100%; height: 100%; diff --git a/web/src/pages/overview/OverviewConnectedUsers/OverviewConnectedUsers.tsx b/web/src/pages/overview/OverviewConnectedUsers/OverviewConnectedUsers.tsx index e75f9e185..c61ffbcde 100644 --- a/web/src/pages/overview/OverviewConnectedUsers/OverviewConnectedUsers.tsx +++ b/web/src/pages/overview/OverviewConnectedUsers/OverviewConnectedUsers.tsx @@ -76,9 +76,6 @@ const RenderUserList = ({ data }: RenderUserListProps) => {
{LL.connectedUsersOverview.userList.deviceLocation()}
- {/*
- Connections -
*/}
{LL.connectedUsersOverview.userList.networkUsage()}
diff --git a/web/src/pages/overview/OverviewConnectedUsers/UserConnectionCard/UserConnectionCard.tsx b/web/src/pages/overview/OverviewConnectedUsers/UserConnectionCard/UserConnectionCard.tsx index e9ff6d457..e806c1e28 100644 --- a/web/src/pages/overview/OverviewConnectedUsers/UserConnectionCard/UserConnectionCard.tsx +++ b/web/src/pages/overview/OverviewConnectedUsers/UserConnectionCard/UserConnectionCard.tsx @@ -14,14 +14,12 @@ import SvgIconClip from '../../../../shared/components/svg/IconClip'; import SvgIconCollapse from '../../../../shared/components/svg/IconCollapse'; import SvgIconConnected from '../../../../shared/components/svg/IconConnected'; import SvgIconExpand from '../../../../shared/components/svg/IconExpand'; -import Badge from '../../../../shared/defguard-ui/components/Layout/Badge/Badge'; +import { Badge } from '../../../../shared/defguard-ui/components/Layout/Badge/Badge'; import { BadgeStyleVariant } from '../../../../shared/defguard-ui/components/Layout/Badge/types'; import { DeviceAvatar } from '../../../../shared/defguard-ui/components/Layout/DeviceAvatar/DeviceAvatar'; -import { DeviceAvatarVariants } from '../../../../shared/defguard-ui/components/Layout/DeviceAvatar/types'; import { NetworkSpeed } from '../../../../shared/defguard-ui/components/Layout/NetworkSpeed/NetworkSpeed'; import { NetworkDirection } from '../../../../shared/defguard-ui/components/Layout/NetworkSpeed/types'; -import { UserInitialsType } from '../../../../shared/defguard-ui/components/Layout/UserInitials/types'; -import UserInitials from '../../../../shared/defguard-ui/components/Layout/UserInitials/UserInitials'; +import { UserInitials } from '../../../../shared/defguard-ui/components/Layout/UserInitials/UserInitials'; import { getUserFullName } from '../../../../shared/helpers/getUserFullName'; import { NetworkDeviceStats, NetworkUserStats } from '../../../../shared/types'; import { titleCase } from '../../../../shared/utils/titleCase'; @@ -91,7 +89,6 @@ const MainCardContent = ({ data }: MainCardContentProps) => { { {LL.connectedUsersOverview.userList.device()}
{data.slice(0, getSliceEnd).map((device) => ( - + ))} {showCount && (
diff --git a/web/src/pages/overview/OverviewConnectedUsers/UserConnectionCard/style.scss b/web/src/pages/overview/OverviewConnectedUsers/UserConnectionCard/style.scss index e765e37e8..ce3a9423f 100644 --- a/web/src/pages/overview/OverviewConnectedUsers/UserConnectionCard/style.scss +++ b/web/src/pages/overview/OverviewConnectedUsers/UserConnectionCard/style.scss @@ -174,17 +174,10 @@ grid-template-columns: 30px 30px 30px; grid-template-rows: 30px; column-gap: 5px; - .avatar-box { + + .avatar-icon { width: 30px; height: 30px; - display: flex; - flex-direction: column; - align-items: center; - align-content: center; - justify-content: center; - border-radius: 10px; - box-sizing: border-box; - background-color: var(--bg-light); } .count-box { diff --git a/web/src/pages/overview/OverviewConnectedUsers/UserConnectionListItem/UserConnectionListItem.tsx b/web/src/pages/overview/OverviewConnectedUsers/UserConnectionListItem/UserConnectionListItem.tsx index 29d8f0a73..fe19b1512 100644 --- a/web/src/pages/overview/OverviewConnectedUsers/UserConnectionListItem/UserConnectionListItem.tsx +++ b/web/src/pages/overview/OverviewConnectedUsers/UserConnectionListItem/UserConnectionListItem.tsx @@ -11,16 +11,14 @@ import IconPacketsOut from '../../../../shared/components/svg/IconPacketsOut'; import SvgIconUserList from '../../../../shared/components/svg/IconUserList'; import SvgIconUserListElement from '../../../../shared/components/svg/IconUserListElement'; import SvgIconUserListExpanded from '../../../../shared/components/svg/IconUserListExpanded'; -import Badge from '../../../../shared/defguard-ui/components/Layout/Badge/Badge'; +import { Badge } from '../../../../shared/defguard-ui/components/Layout/Badge/Badge'; import { BadgeStyleVariant } from '../../../../shared/defguard-ui/components/Layout/Badge/types'; import { Button } from '../../../../shared/defguard-ui/components/Layout/Button/Button'; import { ButtonStyleVariant } from '../../../../shared/defguard-ui/components/Layout/Button/types'; import { DeviceAvatar } from '../../../../shared/defguard-ui/components/Layout/DeviceAvatar/DeviceAvatar'; -import { DeviceAvatarVariants } from '../../../../shared/defguard-ui/components/Layout/DeviceAvatar/types'; import { NetworkSpeed } from '../../../../shared/defguard-ui/components/Layout/NetworkSpeed/NetworkSpeed'; import { NetworkDirection } from '../../../../shared/defguard-ui/components/Layout/NetworkSpeed/types'; -import { UserInitialsType } from '../../../../shared/defguard-ui/components/Layout/UserInitials/types'; -import UserInitials from '../../../../shared/defguard-ui/components/Layout/UserInitials/UserInitials'; +import { UserInitials } from '../../../../shared/defguard-ui/components/Layout/UserInitials/UserInitials'; import { getUserFullName } from '../../../../shared/helpers/getUserFullName'; import { NetworkDeviceStats, NetworkUserStats } from '../../../../shared/types'; import { summarizeDeviceStats } from '../../helpers/stats'; @@ -82,11 +80,7 @@ const UserRow = ({ data }: UserRowProps) => { return (
- + {getUserFullName(data.user)}
@@ -142,11 +136,7 @@ const DeviceRow = ({ data }: DeviceRowProps) => {
- + {data.name}
@@ -194,11 +184,7 @@ const ActiveDevices = ({ data }: ActiveDevicesProps) => { return (
{data.slice(0, getSliceEnd).map((device) => ( - + ))} {showCount && (
diff --git a/web/src/pages/overview/OverviewPage.tsx b/web/src/pages/overview/OverviewPage.tsx index b717ba32d..338737e89 100644 --- a/web/src/pages/overview/OverviewPage.tsx +++ b/web/src/pages/overview/OverviewPage.tsx @@ -10,7 +10,7 @@ import { PageContainer } from '../../shared/components/Layout/PageContainer/Page import { GatewaysStatus } from '../../shared/components/network/GatewaysStatus/GatewaysStatus'; import { deviceBreakpoints } from '../../shared/constants'; import { LoaderSpinner } from '../../shared/defguard-ui/components/Layout/LoaderSpinner/LoaderSpinner'; -import NoData from '../../shared/defguard-ui/components/Layout/NoData/NoData'; +import { NoData } from '../../shared/defguard-ui/components/Layout/NoData/NoData'; import useApi from '../../shared/hooks/useApi'; import { QueryKeys } from '../../shared/queries'; import { NetworkUserStats, OverviewLayoutType } from '../../shared/types'; diff --git a/web/src/pages/overview/style.scss b/web/src/pages/overview/style.scss index f57b50cb8..e7efb29dc 100644 --- a/web/src/pages/overview/style.scss +++ b/web/src/pages/overview/style.scss @@ -162,6 +162,12 @@ padding-right: 6rem; } + & > .no-data { + width: 100%; + padding-top: 20px; + text-align: center; + } + & > .overview-connected-users { @include media-breakpoint-down(xl) { & > header, diff --git a/web/src/pages/provisioners/ProvisionersList/ProvisionersList.tsx b/web/src/pages/provisioners/ProvisionersList/ProvisionersList.tsx index c30ca41b4..e2bb7f585 100644 --- a/web/src/pages/provisioners/ProvisionersList/ProvisionersList.tsx +++ b/web/src/pages/provisioners/ProvisionersList/ProvisionersList.tsx @@ -12,7 +12,7 @@ import { deviceBreakpoints } from '../../../shared/constants'; import { EditButton } from '../../../shared/defguard-ui/components/Layout/EditButton/EditButton'; import { EditButtonOption } from '../../../shared/defguard-ui/components/Layout/EditButton/EditButtonOption'; import { EditButtonOptionStyleVariant } from '../../../shared/defguard-ui/components/Layout/EditButton/types'; -import ConfirmModal from '../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/ConfirmModal'; +import { ConfirmModal } from '../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/ConfirmModal'; import { ConfirmModalType } from '../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/types'; import { ListHeader, diff --git a/web/src/pages/provisioners/ProvisionersPage.tsx b/web/src/pages/provisioners/ProvisionersPage.tsx index e20cd8365..c85010cc3 100644 --- a/web/src/pages/provisioners/ProvisionersPage.tsx +++ b/web/src/pages/provisioners/ProvisionersPage.tsx @@ -9,7 +9,7 @@ import { useI18nContext } from '../../i18n/i18n-react'; import { PageContainer } from '../../shared/components/Layout/PageContainer/PageContainer'; import { deviceBreakpoints } from '../../shared/constants'; import { LoaderSpinner } from '../../shared/defguard-ui/components/Layout/LoaderSpinner/LoaderSpinner'; -import NoData from '../../shared/defguard-ui/components/Layout/NoData/NoData'; +import { NoData } from '../../shared/defguard-ui/components/Layout/NoData/NoData'; import { Search } from '../../shared/defguard-ui/components/Layout/Search/Search'; import { Select } from '../../shared/defguard-ui/components/Layout/Select/Select'; import { diff --git a/web/src/pages/provisioners/ProvisioningStationSetup.tsx b/web/src/pages/provisioners/ProvisioningStationSetup.tsx index 174d138e7..583269bae 100644 --- a/web/src/pages/provisioners/ProvisioningStationSetup.tsx +++ b/web/src/pages/provisioners/ProvisioningStationSetup.tsx @@ -30,7 +30,7 @@ export const ProvisioningStationSetup = () => { const command = useMemo( () => - `docker run ghcr.io/defguard/yubi-bridge:current --worker-token ${data?.token} --id --grpc `, + `docker run --privileged ghcr.io/defguard/yubikey-provision:main -t ${data?.token} --id --grpc `, [data?.token], ); diff --git a/web/src/pages/provisioners/style.scss b/web/src/pages/provisioners/style.scss index 43a28a080..bdb19cefa 100644 --- a/web/src/pages/provisioners/style.scss +++ b/web/src/pages/provisioners/style.scss @@ -142,6 +142,8 @@ } & > .no-data { + width: 100%; + text-align: center; box-sizing: border-box; padding: 0 4rem 0 6rem; } diff --git a/web/src/pages/users/UserProfile/ProfileDetails/ProfileDetails.tsx b/web/src/pages/users/UserProfile/ProfileDetails/ProfileDetails.tsx index ab5eba106..687d4b74b 100644 --- a/web/src/pages/users/UserProfile/ProfileDetails/ProfileDetails.tsx +++ b/web/src/pages/users/UserProfile/ProfileDetails/ProfileDetails.tsx @@ -9,7 +9,7 @@ import { shallow } from 'zustand/shallow'; import { useI18nContext } from '../../../../i18n/i18n-react'; import { Card } from '../../../../shared/defguard-ui/components/Layout/Card/Card'; import { Label } from '../../../../shared/defguard-ui/components/Layout/Label/Label'; -import NoData from '../../../../shared/defguard-ui/components/Layout/NoData/NoData'; +import { NoData } from '../../../../shared/defguard-ui/components/Layout/NoData/NoData'; import { Tag } from '../../../../shared/defguard-ui/components/Layout/Tag/Tag'; import { useAppStore } from '../../../../shared/hooks/store/useAppStore'; import { useUserProfileStore } from '../../../../shared/hooks/store/useUserProfileStore'; diff --git a/web/src/pages/users/UserProfile/ProfileDetails/ProfileDetailsForm/ProfileDetailsFormAppsField.tsx b/web/src/pages/users/UserProfile/ProfileDetails/ProfileDetailsForm/ProfileDetailsFormAppsField.tsx index 6689764c2..11dd27388 100644 --- a/web/src/pages/users/UserProfile/ProfileDetails/ProfileDetailsForm/ProfileDetailsFormAppsField.tsx +++ b/web/src/pages/users/UserProfile/ProfileDetails/ProfileDetailsForm/ProfileDetailsFormAppsField.tsx @@ -1,6 +1,6 @@ import { useI18nContext } from '../../../../../i18n/i18n-react'; import { Label } from '../../../../../shared/defguard-ui/components/Layout/Label/Label'; -import NoData from '../../../../../shared/defguard-ui/components/Layout/NoData/NoData'; +import { NoData } from '../../../../../shared/defguard-ui/components/Layout/NoData/NoData'; import { Tag } from '../../../../../shared/defguard-ui/components/Layout/Tag/Tag'; import { OAuth2AuthorizedApps } from '../../../../../shared/types'; diff --git a/web/src/pages/users/UserProfile/UserAuthInfo/UserAuthInfoMFA.tsx b/web/src/pages/users/UserProfile/UserAuthInfo/UserAuthInfoMFA.tsx index 23ae4e7bc..330e13c09 100644 --- a/web/src/pages/users/UserProfile/UserAuthInfo/UserAuthInfoMFA.tsx +++ b/web/src/pages/users/UserProfile/UserAuthInfo/UserAuthInfoMFA.tsx @@ -169,13 +169,14 @@ export const UserAuthInfoMFA = () => { diff --git a/web/src/pages/users/UserProfile/UserDevices/DeviceCard/DeviceCard.tsx b/web/src/pages/users/UserProfile/UserDevices/DeviceCard/DeviceCard.tsx index 8eb2665ac..9fe4fb5e7 100644 --- a/web/src/pages/users/UserProfile/UserDevices/DeviceCard/DeviceCard.tsx +++ b/web/src/pages/users/UserProfile/UserDevices/DeviceCard/DeviceCard.tsx @@ -12,15 +12,14 @@ import IconClip from '../../../../../shared/components/svg/IconClip'; import SvgIconCollapse from '../../../../../shared/components/svg/IconCollapse'; import SvgIconExpand from '../../../../../shared/components/svg/IconExpand'; import { ColorsRGB } from '../../../../../shared/constants'; -import { AvatarBox } from '../../../../../shared/defguard-ui/components/Layout/AvatarBox/AvatarBox'; -import Badge from '../../../../../shared/defguard-ui/components/Layout/Badge/Badge'; +import { Badge } from '../../../../../shared/defguard-ui/components/Layout/Badge/Badge'; import { Card } from '../../../../../shared/defguard-ui/components/Layout/Card/Card'; import { DeviceAvatar } from '../../../../../shared/defguard-ui/components/Layout/DeviceAvatar/DeviceAvatar'; import { EditButton } from '../../../../../shared/defguard-ui/components/Layout/EditButton/EditButton'; import { EditButtonOption } from '../../../../../shared/defguard-ui/components/Layout/EditButton/EditButtonOption'; import { EditButtonOptionStyleVariant } from '../../../../../shared/defguard-ui/components/Layout/EditButton/types'; import { Label } from '../../../../../shared/defguard-ui/components/Layout/Label/Label'; -import NoData from '../../../../../shared/defguard-ui/components/Layout/NoData/NoData'; +import { NoData } from '../../../../../shared/defguard-ui/components/Layout/NoData/NoData'; import { useUserProfileStore } from '../../../../../shared/hooks/store/useUserProfileStore'; import { Device, DeviceNetworkInfo } from '../../../../../shared/types'; import { sortByDate } from '../../../../../shared/utils/sortByDate'; @@ -101,9 +100,7 @@ export const DeviceCard = ({ device }: Props) => { >
- - - +

{device.name}

diff --git a/web/src/pages/users/UserProfile/UserDevices/DeviceCard/style.scss b/web/src/pages/users/UserProfile/UserDevices/DeviceCard/style.scss index 0b7e020d3..051290c04 100644 --- a/web/src/pages/users/UserProfile/UserDevices/DeviceCard/style.scss +++ b/web/src/pages/users/UserProfile/UserDevices/DeviceCard/style.scss @@ -33,9 +33,16 @@ grid-template-rows: 40px; grid-template-columns: 40px 1fr 55px; - & > .avatar-box { + & > .avatar-icon { grid-row: 1; grid-column: 1 / 2; + height: 100%; + width: 100%; + + svg { + width: 30px; + height: 30px; + } } & > h3 { diff --git a/web/src/pages/users/UserProfile/UserDevices/modals/DeleteUserDeviceModal/DeleteUserDeviceModal.tsx b/web/src/pages/users/UserProfile/UserDevices/modals/DeleteUserDeviceModal/DeleteUserDeviceModal.tsx index cd9fc2236..3f953a6e3 100644 --- a/web/src/pages/users/UserProfile/UserDevices/modals/DeleteUserDeviceModal/DeleteUserDeviceModal.tsx +++ b/web/src/pages/users/UserProfile/UserDevices/modals/DeleteUserDeviceModal/DeleteUserDeviceModal.tsx @@ -4,7 +4,7 @@ import { isUndefined } from 'lodash-es'; import { shallow } from 'zustand/shallow'; import { useI18nContext } from '../../../../../../i18n/i18n-react'; -import ConfirmModal from '../../../../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/ConfirmModal'; +import { ConfirmModal } from '../../../../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/ConfirmModal'; import { ConfirmModalType } from '../../../../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/types'; import useApi from '../../../../../../shared/hooks/useApi'; import { useToaster } from '../../../../../../shared/hooks/useToaster'; diff --git a/web/src/pages/users/UserProfile/UserWallets/WalletCard/WalletCard.tsx b/web/src/pages/users/UserProfile/UserWallets/WalletCard/WalletCard.tsx index ca0addbb3..5daa3c443 100644 --- a/web/src/pages/users/UserProfile/UserWallets/WalletCard/WalletCard.tsx +++ b/web/src/pages/users/UserProfile/UserWallets/WalletCard/WalletCard.tsx @@ -8,7 +8,7 @@ import { useI18nContext } from '../../../../../i18n/i18n-react'; import IconEth from '../../../../../shared/components/svg/IconEth'; import { deviceBreakpoints } from '../../../../../shared/constants'; import { AvatarBox } from '../../../../../shared/defguard-ui/components/Layout/AvatarBox/AvatarBox'; -import Badge from '../../../../../shared/defguard-ui/components/Layout/Badge/Badge'; +import { Badge } from '../../../../../shared/defguard-ui/components/Layout/Badge/Badge'; import { BadgeStyleVariant } from '../../../../../shared/defguard-ui/components/Layout/Badge/types'; import { Card } from '../../../../../shared/defguard-ui/components/Layout/Card/Card'; import { EditButton } from '../../../../../shared/defguard-ui/components/Layout/EditButton/EditButton'; diff --git a/web/src/pages/users/UserProfile/UserYubiKeys/UserYubiKeys.tsx b/web/src/pages/users/UserProfile/UserYubiKeys/UserYubiKeys.tsx index 3369cc756..6281fb260 100644 --- a/web/src/pages/users/UserProfile/UserYubiKeys/UserYubiKeys.tsx +++ b/web/src/pages/users/UserProfile/UserYubiKeys/UserYubiKeys.tsx @@ -7,8 +7,7 @@ import { useAuthStore } from '../../../../shared/hooks/store/useAuthStore'; import { useModalStore } from '../../../../shared/hooks/store/useModalStore'; import { useUserProfileStore } from '../../../../shared/hooks/store/useUserProfileStore'; import { AddComponentBox } from '../../shared/components/AddComponentBox/AddComponentBox'; -import KeyBox from '../../shared/components/KeyBox/KeyBox'; -import { KeyDetailsModal } from './modals/KeyDetailsModal/KeyDetailsModal'; +import { KeyBox } from '../../shared/components/KeyBox/KeyBox'; export const UserYubiKeys = () => { const { LL } = useI18nContext(); @@ -56,7 +55,6 @@ export const UserYubiKeys = () => { text={LL.userPage.yubiKey.provision()} /> )} -
); }; diff --git a/web/src/pages/users/UserProfile/UserYubiKeys/modals/KeyDetailsModal/KeyDetailsModal.tsx b/web/src/pages/users/UserProfile/UserYubiKeys/modals/KeyDetailsModal/KeyDetailsModal.tsx deleted file mode 100644 index 2ecf7e435..000000000 --- a/web/src/pages/users/UserProfile/UserYubiKeys/modals/KeyDetailsModal/KeyDetailsModal.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import './style.scss'; - -import { saveAs } from 'file-saver'; -import { motion } from 'framer-motion'; -import { shallow } from 'zustand/shallow'; - -import { useI18nContext } from '../../../../../../i18n/i18n-react'; -import { Button } from '../../../../../../shared/defguard-ui/components/Layout/Button/Button'; -import { - ButtonSize, - ButtonStyleVariant, -} from '../../../../../../shared/defguard-ui/components/Layout/Button/types'; -import { Modal } from '../../../../../../shared/defguard-ui/components/Layout/modals/Modal/Modal'; -import { useModalStore } from '../../../../../../shared/hooks/store/useModalStore'; -import KeyBox from '../../../../shared/components/KeyBox/KeyBox'; - -export const KeyDetailsModal = () => { - const { LL } = useI18nContext(); - const [{ visible: isOpen, user }, setModalValues] = useModalStore( - (state) => [state.keyDetailModal, state.setKeyDetailModal], - shallow, - ); - - const setIsOpen = (v: boolean) => setModalValues({ visible: v }); - - if (!isOpen) return null; - - const handleDownloadAll = () => { - if (user && user.pgp_key && user.ssh_key) { - const pgp = new Blob([user.pgp_key], { - type: 'text/plain;charset=utf-8', - }); - const ssh = new Blob([user.ssh_key], { - type: 'text/plain;charset=utf-8', - }); - saveAs(pgp, `pgp_key.txt`); - saveAs(ssh, 'ssh_key.txt'); - } - }; - - return ( - -
-

{LL.modals.keyDetails.title()}

-
- {user ? ( - - {user.pgp_key && user.pgp_key !== '-' ? ( - - - - ) : null} - {user.ssh_key && user.ssh_key !== '-' ? ( - - - - ) : null} - - ) : null} -
-
-
- ); -}; diff --git a/web/src/pages/users/UserProfile/UserYubiKeys/modals/KeyDetailsModal/style.scss b/web/src/pages/users/UserProfile/UserYubiKeys/modals/KeyDetailsModal/style.scss deleted file mode 100644 index 3e4a086b4..000000000 --- a/web/src/pages/users/UserProfile/UserYubiKeys/modals/KeyDetailsModal/style.scss +++ /dev/null @@ -1,58 +0,0 @@ -@use '@shared/scss/base/variables' as v; - -.modal { - &.key-details { - transform: translateY(200px); - - .modal-content { - padding: 4rem 3rem; - width: 635px; - box-sizing: border-box; - align-self: flex-start; - - .header { - display: flex; - flex-direction: row; - width: 100%; - margin-bottom: 3.4rem; - - p { - @include v.poppins; - - font-size: 2rem; - line-height: 3rem; - color: v.$text-main; - font-weight: map-get($map: v.$text-weights, $key: 'semiBold'); - } - - button { - margin-left: auto; - width: 114px; - } - } - - .keys-list { - list-style: none; - width: 100%; - margin-bottom: 4rem; - - li { - &:not(:last-of-type) { - margin-bottom: 1rem; - } - } - } - - .controls { - display: flex; - flex-direction: row; - column-gap: 1rem; - width: 100%; - - .btn { - width: 100%; - } - } - } - } -} diff --git a/web/src/pages/users/UserProfile/UserYubiKeys/style.scss b/web/src/pages/users/UserProfile/UserYubiKeys/style.scss index d44ed89eb..e1f98ebc1 100644 --- a/web/src/pages/users/UserProfile/UserYubiKeys/style.scss +++ b/web/src/pages/users/UserProfile/UserYubiKeys/style.scss @@ -42,8 +42,9 @@ & > .keys { display: flex; - flex-flow: column nowrap; - row-gap: 1.5rem; + flex-flow: column; + row-gap: 15px; + margin-bottom: 20px; } & > .add-component { diff --git a/web/src/pages/users/UsersOverview/UsersOverview.tsx b/web/src/pages/users/UsersOverview/UsersOverview.tsx index d89ad55f4..5077d6e05 100644 --- a/web/src/pages/users/UsersOverview/UsersOverview.tsx +++ b/web/src/pages/users/UsersOverview/UsersOverview.tsx @@ -164,7 +164,7 @@ export const UsersOverview = () => { size={ButtonSize.SMALL} styleVariant={ButtonStyleVariant.PRIMARY} icon={} - text={LL.usersOverview.addNewUser()} + text={breakpoint === 'desktop' ? LL.usersOverview.addNewUser() : undefined} data-testid="add-user" />
diff --git a/web/src/pages/users/UsersOverview/components/UsersList/UsersList.tsx b/web/src/pages/users/UsersOverview/components/UsersList/UsersList.tsx index c0408a9e1..40e171628 100644 --- a/web/src/pages/users/UsersOverview/components/UsersList/UsersList.tsx +++ b/web/src/pages/users/UsersOverview/components/UsersList/UsersList.tsx @@ -6,7 +6,7 @@ import { useBreakpoint } from 'use-breakpoint'; import { useI18nContext } from '../../../../../i18n/i18n-react'; import { deviceBreakpoints } from '../../../../../shared/constants'; -import UserInitials from '../../../../../shared/defguard-ui/components/Layout/UserInitials/UserInitials'; +import { UserInitials } from '../../../../../shared/defguard-ui/components/Layout/UserInitials/UserInitials'; import { ListHeader, ListRowCell, diff --git a/web/src/pages/users/shared/components/KeyBox/KeyBox.tsx b/web/src/pages/users/shared/components/KeyBox/KeyBox.tsx index 660aa5463..6b5f19bd6 100644 --- a/web/src/pages/users/shared/components/KeyBox/KeyBox.tsx +++ b/web/src/pages/users/shared/components/KeyBox/KeyBox.tsx @@ -1,20 +1,9 @@ import './style.scss'; import { saveAs } from 'file-saver'; -import { AnimatePresence, motion, Variants } from 'framer-motion'; -import { useEffect, useState } from 'react'; -import { Subject, switchMap, timer } from 'rxjs'; -import SvgIconCopy from '../../../../../shared/components/svg/IconCopy'; -import SvgIconDownload from '../../../../../shared/components/svg/IconDownload'; -import SvgIconUserListExpanded from '../../../../../shared/components/svg/IconUserListExpanded'; -import SvgIconUserListHover from '../../../../../shared/components/svg/IconUserListHover'; -import { ColorsRGB } from '../../../../../shared/constants'; -import { Button } from '../../../../../shared/defguard-ui/components/Layout/Button/Button'; -import { - ButtonSize, - ButtonStyleVariant, -} from '../../../../../shared/defguard-ui/components/Layout/Button/types'; +import { ActionButton } from '../../../../../shared/defguard-ui/components/Layout/ActionButton/ActionButton'; +import { ActionButtonVariant } from '../../../../../shared/defguard-ui/components/Layout/ActionButton/types'; import { useClipboard } from '../../../../../shared/hooks/useClipboard'; interface Props { @@ -25,42 +14,12 @@ interface Props { initiallyOpen?: boolean; } -const collapsedVariants: Variants = { - collapsed: { - height: 0, - }, - active: { - height: 'auto', - }, -}; - -const titleVariants: Variants = { - collapsed: { - color: ColorsRGB.TextMain, - }, - active: { - color: ColorsRGB.GrayDark, - }, -}; - -const KeyBox = ({ - title, - keyValue, - collapsible = false, - disabled = false, - initiallyOpen, -}: Props) => { - const [collapsed, setCollapsed] = useState(initiallyOpen); - const [copiedVisible, setCopiedVisible] = useState(false); - const [copySubject, setCopySubject] = useState | undefined>(); +export const KeyBox = ({ title, keyValue }: Props) => { const { writeToClipboard } = useClipboard(); const handleCopy = () => { if (keyValue) { - writeToClipboard(keyValue).then(() => { - setCopiedVisible(true); - copySubject?.next(); - }); + writeToClipboard(keyValue); } }; @@ -71,93 +30,15 @@ const KeyBox = ({ saveAs(blob, `${title.replace(' ', '_').toLocaleLowerCase()}.txt`); }; - const handleClick = () => { - if (!disabled) { - setCollapsed((state) => !state); - } - }; - - useEffect(() => { - if (!copySubject) { - setCopySubject(new Subject()); - } else { - const sub = copySubject.pipe(switchMap(() => timer(2500))).subscribe(() => { - setCopiedVisible(false); - }); - return () => { - sub.unsubscribe(); - }; - } - }, [copySubject]); - if (!keyValue) return null; return ( -
- -
- {collapsible ? ( -
- {collapsed ? : } -
- ) : null} - - {title} - - - - - -
- {collapsible && collapsed ? ( - -

{keyValue}

-
- ) : null} -
- - {copiedVisible ? ( - - Copied to clipboard! - - ) : ( -
- )} - +
+ {title} +
+ + +
); }; - -export default KeyBox; diff --git a/web/src/pages/users/shared/components/KeyBox/style.scss b/web/src/pages/users/shared/components/KeyBox/style.scss index 256a47733..cd881190c 100644 --- a/web/src/pages/users/shared/components/KeyBox/style.scss +++ b/web/src/pages/users/shared/components/KeyBox/style.scss @@ -1,117 +1,28 @@ -@use '@shared/scss/base/variables' as v; -@use '@shared/scss/helpers/mixins' as mix; -@use '@shared/scss/helpers/bootstrap' as bs; +@use '@scssutils' as *; .key-box { - width: 100%; - min-height: 60px; - height: auto; - background-color: v.$white; - border-radius: 1.5rem; - border: 1px solid v.$gray-border; - box-shadow: 5px 5px 15px #00000005; - position: relative; - - .top { - width: 100%; - display: flex; - flex-direction: row; - align-items: center; - align-content: center; - justify-content: flex-start; - box-sizing: border-box; - padding: 1rem; - - .collapse-controller { - width: 2.2rem; - height: 2.2rem; - display: flex; - flex-direction: column; - align-content: center; - align-items: center; - justify-content: center; - border: 0 solid transparent; - background-color: transparent; - margin-left: 1rem; - margin-right: 2rem; - cursor: pointer; - - @include bs.media-breakpoint-down(md) { - display: none; - } - } - - .disabled { - cursor: not-allowed; - } - - .title { - font-size: 1.5rem; - line-height: 1.8rem; - display: block; - cursor: pointer; - flex: 1; - } - - .actions { - width: auto !important; - padding: 0 !important; - display: flex; - flex-direction: row; - align-items: center; - align-content: center; - justify-content: flex-start; - column-gap: 1rem; - margin-left: 1rem !important; + height: 60px; + display: flex; + flex-flow: row nowrap; + box-sizing: border-box; + border: 1px solid var(--border-primary); + border-radius: 10px; + align-items: center; + justify-content: flex-start; + padding: 0 10px 0 20px; + background-color: var(--surface-default-modal); - .clipboard-notification { - display: block; - font-size: 1.2rem; - font-weight: map-get($map: v.$text-weights, $key: 'medium'); - color: v.$gray-dark; - line-height: 1.8rem; - } + & > .title { + @include typography(app-side-bar); - .icon-button { - height: 40px; - width: 40px; - } - } + color: var(--text-body-primary); + user-select: none; } - .key-container { - border: 0 solid transparent; - border-top: 1px solid v.$gray-border; - padding: 2rem 2.1rem 2rem 2rem; + & > .actions { display: flex; - flex-direction: row; - align-items: center; - align-content: center; - justify-content: flex-start; - - .key { - font-family: 'Source Code Pro'; - font-size: 1.2rem; - line-height: 2.2rem; - color: v.$text-main; - display: block; - max-height: 140px; - word-break: break-all; - overflow-y: scroll; - overflow-y: auto; - overflow-wrap: break-word; - } + flex-flow: row nowrap; + column-gap: 15px; + margin-left: auto; } } - -.clipboard-notification { - display: block; - font-size: 1.2rem; - font-weight: map-get($map: v.$text-weights, $key: 'medium'); - color: v.$gray-dark; - line-height: 1.8rem; - justify-content: center; - align-items: center; - text-align: center; - margin-top: 5px; -} diff --git a/web/src/pages/users/shared/modals/DeleteUserModal/DeleteUserModal.tsx b/web/src/pages/users/shared/modals/DeleteUserModal/DeleteUserModal.tsx index fdfeb5b15..922cf7f83 100644 --- a/web/src/pages/users/shared/modals/DeleteUserModal/DeleteUserModal.tsx +++ b/web/src/pages/users/shared/modals/DeleteUserModal/DeleteUserModal.tsx @@ -3,7 +3,7 @@ import { useNavigate } from 'react-router'; import { shallow } from 'zustand/shallow'; import { useI18nContext } from '../../../../../i18n/i18n-react'; -import ConfirmModal from '../../../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/ConfirmModal'; +import { ConfirmModal } from '../../../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/ConfirmModal'; import { ConfirmModalType } from '../../../../../shared/defguard-ui/components/Layout/modals/ConfirmModal/types'; import { useModalStore } from '../../../../../shared/hooks/store/useModalStore'; import useApi from '../../../../../shared/hooks/useApi'; diff --git a/web/src/pages/users/shared/modals/KeyProvisioningModal/KeyProvisioningModal.tsx b/web/src/pages/users/shared/modals/KeyProvisioningModal/KeyProvisioningModal.tsx index d4f220959..10ec4fa6d 100644 --- a/web/src/pages/users/shared/modals/KeyProvisioningModal/KeyProvisioningModal.tsx +++ b/web/src/pages/users/shared/modals/KeyProvisioningModal/KeyProvisioningModal.tsx @@ -21,6 +21,7 @@ import { Modal } from '../../../../../shared/defguard-ui/components/Layout/modal import { useModalStore } from '../../../../../shared/hooks/store/useModalStore'; import useApi from '../../../../../shared/hooks/useApi'; import { useToaster } from '../../../../../shared/hooks/useToaster'; +import { messageIds } from '../../../../../shared/messageIds'; import { QueryKeys } from '../../../../../shared/queries'; import { WorkerJobStatus, WorkerJobStatusError } from '../../../../../shared/types'; import WorkerLoader from './WorkerLoader/WorkerLoader'; @@ -68,7 +69,9 @@ export const KeyProvisioningModal = () => { console.error(err); }, enabled: isOpen, + refetchInterval: 2 * 1000, }); + useQuery([QueryKeys.FETCH_WORKER_JOB_STATUS, jobId], () => getJobStatus(jobId), { enabled: typeof jobId === 'number' && isOpen, refetchOnWindowFocus: false, @@ -132,6 +135,7 @@ export const KeyProvisioningModal = () => { return ( { {breakpoint === 'desktop' ? : null} - -

-
+ {isLoading || !workers || (workers && !workers.length) ? (
diff --git a/web/src/pages/users/shared/modals/KeyProvisioningModal/WorkerLoader/WorkerLoader.tsx b/web/src/pages/users/shared/modals/KeyProvisioningModal/WorkerLoader/WorkerLoader.tsx index 743baed00..719452fdc 100644 --- a/web/src/pages/users/shared/modals/KeyProvisioningModal/WorkerLoader/WorkerLoader.tsx +++ b/web/src/pages/users/shared/modals/KeyProvisioningModal/WorkerLoader/WorkerLoader.tsx @@ -14,7 +14,7 @@ import { MessageBox } from '../../../../../../shared/defguard-ui/components/Layo import { MessageBoxType } from '../../../../../../shared/defguard-ui/components/Layout/MessageBox/types'; import { useModalStore } from '../../../../../../shared/hooks/store/useModalStore'; import { WorkerJobStatus } from '../../../../../../shared/types'; -import KeyBox from '../../../components/KeyBox/KeyBox'; +import { KeyBox } from '../../../components/KeyBox/KeyBox'; interface Props { setIsOpen: (v: boolean) => void; diff --git a/web/src/pages/users/shared/modals/KeyProvisioningModal/WorkerSelectionForm/WorkerSelectItem.tsx b/web/src/pages/users/shared/modals/KeyProvisioningModal/WorkerSelectionForm/WorkerSelectItem.tsx index 95efda411..28eaf067b 100644 --- a/web/src/pages/users/shared/modals/KeyProvisioningModal/WorkerSelectionForm/WorkerSelectItem.tsx +++ b/web/src/pages/users/shared/modals/KeyProvisioningModal/WorkerSelectionForm/WorkerSelectItem.tsx @@ -1,7 +1,7 @@ import { AnimatePresence, motion, Variants } from 'framer-motion'; import React, { useMemo } from 'react'; -import SvgIconCheckmarkGreen from '../../../../../../shared/components/svg/IconCheckmarkGreen'; +import SvgIconCheckmark from '../../../../../../shared/components/svg/IconCheckmark'; import SvgIconConnected from '../../../../../../shared/components/svg/IconConnected'; import SvgIconDisconnected from '../../../../../../shared/components/svg/IconDisconnected'; import { ColorsRGB } from '../../../../../../shared/constants'; @@ -100,7 +100,6 @@ const WorkerSelectItem = React.forwardRef( whileHover={{ borderColor: ColorsRGB.Primary, }} - layout > ( animate="animate" exit="exit" key="avatar" + className="avatar" > ) : ( - + )} diff --git a/web/src/pages/users/shared/modals/KeyProvisioningModal/WorkerSelectionForm/style.scss b/web/src/pages/users/shared/modals/KeyProvisioningModal/WorkerSelectionForm/style.scss index 38841f734..18207ad62 100644 --- a/web/src/pages/users/shared/modals/KeyProvisioningModal/WorkerSelectionForm/style.scss +++ b/web/src/pages/users/shared/modals/KeyProvisioningModal/WorkerSelectionForm/style.scss @@ -81,14 +81,21 @@ align-content: center; justify-content: center; - svg { - path { - fill: var(--white); + & > .avatar-icon { + background-color: transparent; + + svg { + width: 30px; + height: 30px; } + } - g { - rect { - fill: var(--white); + &.checkmark { + svg { + width: 20px; + height: 20px; + path { + fill: var(--surface-default-modal); } } } diff --git a/web/src/pages/users/shared/modals/KeyProvisioningModal/style.scss b/web/src/pages/users/shared/modals/KeyProvisioningModal/style.scss index c58df9063..5aadeeeca 100644 --- a/web/src/pages/users/shared/modals/KeyProvisioningModal/style.scss +++ b/web/src/pages/users/shared/modals/KeyProvisioningModal/style.scss @@ -16,7 +16,7 @@ min-width: 100%; } @include media-breakpoint-up(xl) { - width: 635px; + width: 640px; padding: 4rem 3rem; } @@ -96,12 +96,9 @@ margin-top: auto; margin-bottom: auto; - p { - margin-top: 4rem; - margin-bottom: 2rem; - color: var(--gray-dark); - font-size: 14px; - @include text-weight(semiBold); + & > .no-data { + width: 100%; + text-align: center; } } } diff --git a/web/src/pages/webhooks/WebhooksListPage.tsx b/web/src/pages/webhooks/WebhooksListPage.tsx index 734777eff..eef27ebe2 100644 --- a/web/src/pages/webhooks/WebhooksListPage.tsx +++ b/web/src/pages/webhooks/WebhooksListPage.tsx @@ -20,9 +20,9 @@ import { EditButton } from '../../shared/defguard-ui/components/Layout/EditButto import { EditButtonOption } from '../../shared/defguard-ui/components/Layout/EditButton/EditButtonOption'; import { EditButtonOptionStyleVariant } from '../../shared/defguard-ui/components/Layout/EditButton/types'; import { LoaderSpinner } from '../../shared/defguard-ui/components/Layout/LoaderSpinner/LoaderSpinner'; -import ConfirmModal from '../../shared/defguard-ui/components/Layout/modals/ConfirmModal/ConfirmModal'; +import { ConfirmModal } from '../../shared/defguard-ui/components/Layout/modals/ConfirmModal/ConfirmModal'; import { ConfirmModalType } from '../../shared/defguard-ui/components/Layout/modals/ConfirmModal/types'; -import NoData from '../../shared/defguard-ui/components/Layout/NoData/NoData'; +import { NoData } from '../../shared/defguard-ui/components/Layout/NoData/NoData'; import { Search } from '../../shared/defguard-ui/components/Layout/Search/Search'; import { Select } from '../../shared/defguard-ui/components/Layout/Select/Select'; import { @@ -304,7 +304,9 @@ export const WebhooksListPage = () => { onClick={() => setWebhookModalState({ visible: true, webhook: undefined })} size={ButtonSize.SMALL} styleVariant={ButtonStyleVariant.PRIMARY} - text={LL.webhooksOverview.addNewWebhook()} + text={ + breakpoint === 'desktop' ? LL.webhooksOverview.addNewWebhook() : undefined + } icon={} />
diff --git a/web/src/pages/webhooks/style.scss b/web/src/pages/webhooks/style.scss index 82565c18e..09d829397 100644 --- a/web/src/pages/webhooks/style.scss +++ b/web/src/pages/webhooks/style.scss @@ -217,6 +217,12 @@ grid-row: 3; } + .no-data { + width: 100%; + text-align: center; + margin-top: 20px; + } + .list-loader { width: 100%; height: 100%; diff --git a/web/src/shared/defguard-ui b/web/src/shared/defguard-ui index 0759e056e..6cb100122 160000 --- a/web/src/shared/defguard-ui +++ b/web/src/shared/defguard-ui @@ -1 +1 @@ -Subproject commit 0759e056eed6de2a0b1e78b89930e7277005c08b +Subproject commit 6cb10012258a9a8c11f81638a2b6514a5bea2a79 diff --git a/web/src/shared/messageIds.ts b/web/src/shared/messageIds.ts new file mode 100644 index 000000000..0b90b4296 --- /dev/null +++ b/web/src/shared/messageIds.ts @@ -0,0 +1,3 @@ +export const messageIds = { + ProvisioningWipeWarning: 'ProvisioningWipeWarning', +}; diff --git a/web/src/shared/scss/_fonts.scss b/web/src/shared/scss/_fonts.scss deleted file mode 100644 index 0cf74af04..000000000 --- a/web/src/shared/scss/_fonts.scss +++ /dev/null @@ -1,100 +0,0 @@ -// Poppins - -@font-face { - font-family: 'Poppins'; - font-weight: 600; - font-display: block; - src: url('/src/shared/fonts/Poppins/Poppins-SemiBold.woff2') format('woff2'); - font-style: normal; -} - -@font-face { - font-family: 'Poppins'; - font-weight: 500; - font-display: block; - src: url('/src/shared/fonts/Poppins/Poppins-Medium.woff2') format('woff2'); - font-style: normal; -} - -@font-face { - font-family: 'Poppins'; - font-weight: 400; - font-display: block; - src: url('/src/shared/fonts/Poppins/Poppins-Regular.woff2') format('woff2'); - font-style: normal; -} - -@font-face { - font-family: 'Poppins'; - font-weight: 300; - font-display: block; - src: url('/src/shared/fonts/Poppins/Poppins-Light.woff2') format('woff2'); - font-style: normal; -} - -// Roboto -@font-face { - font-family: 'Roboto'; - font-weight: 500; - font-display: block; - src: url('/src/shared/fonts/Roboto/Roboto-Medium.woff2') format('woff2'); - font-style: normal; -} - -@font-face { - font-family: 'Roboto'; - font-weight: 400; - font-display: block; - src: url('/src/shared/fonts/Roboto/Roboto-Regular.woff2') format('woff2'); - font-style: normal; -} - -@font-face { - font-family: 'Roboto'; - font-weight: 700; - font-display: block; - src: url('/src/shared/fonts/Roboto/Roboto-Bold.woff2') format('woff2'); - font-style: normal; -} - -@font-face { - font-family: 'Roboto'; - font-weight: 700; - font-display: block; - src: url('/src/shared/fonts/Roboto/Roboto-BoldItalic.woff2') format('woff2'); - font-style: italic; -} - -@font-face { - font-family: 'Roboto'; - font-weight: 500; - font-display: block; - src: url('/src/shared/fonts/Roboto/Roboto-MediumItalic.woff2') format('woff2'); - font-style: italic; -} - -@font-face { - font-family: 'Roboto'; - font-weight: 400; - font-display: block; - src: url('/src/shared/fonts/Roboto/Roboto-Italic.woff2') format('woff2'); - font-style: italic; -} - -// Source code pro - -@font-face { - font-family: 'Source Code Pro'; - font-weight: 400; - font-display: block; - src: url('/src/shared/fonts/SourceCodePro/SourceCodePro-Regular.woff2') format('woff2'); - font-style: normal; -} - -@font-face { - font-family: 'Source Code Pro'; - font-weight: 400; - font-display: block; - src: url('/src/shared/fonts/SourceCodePro/SourceCodePro-Italic.woff2') format('woff2'); - font-style: italic; -} diff --git a/web/src/shared/scss/components/_containers.scss b/web/src/shared/scss/components/_containers.scss deleted file mode 100644 index 6d44fa6c2..000000000 --- a/web/src/shared/scss/components/_containers.scss +++ /dev/null @@ -1,70 +0,0 @@ -@use '@shared/scss/base/variables' as v; -@use '@shared/scss/helpers/mixins' as mix; - -.container-with-title { - display: flex; - flex-direction: column; - align-items: flex-start; - align-content: center; - justify-content: flex-start; - gap: 2rem; - - .title { - @include mix.text-weight(semiBold); - - font-size: 2rem; - line-height: 3rem; - color: v.$text-main; - text-align: left; - font-family: Poppins; - - span { - font-size: 2rem; - line-height: 3rem; - font-family: Poppins; - color: v.$gray-light; - } - } -} - -.container-basic { - display: flex; - flex-direction: row; - align-content: center; - align-items: center; - justify-content: center; - background-color: v.$white; - border-radius: 1.5rem; - box-shadow: 5px 5px 15px #00000005; -} - -.container-label-info { - display: flex; - flex-direction: column; - align-items: flex-start; - align-content: flex-start; - justify-content: center; - height: auto; - width: auto; - gap: 1rem; - - label { - font-size: 1.2rem; - line-height: 1.4rem; - color: v.$gray-light; - font-family: Roboto; - display: block; - height: auto; - width: auto; - @include mix.text-weight(medium); - } - - span { - display: block; - color: v.$text-main; - font-size: 1.5rem; - font-family: Roboto; - line-height: 1.8rem; - @include mix.text-weight(regular); - } -} diff --git a/web/src/shared/scss/components/_forms.scss b/web/src/shared/scss/components/_forms.scss deleted file mode 100644 index 48496e368..000000000 --- a/web/src/shared/scss/components/_forms.scss +++ /dev/null @@ -1,68 +0,0 @@ -@use '@shared/scss/base/variables' as v; -@use '@shared/scss/helpers/mixins' as mix; -@use '@shared/scss/helpers/bootstrap' as bs; - -form { - display: flex; - flex-direction: column; - align-items: center; - align-content: center; - justify-content: center; - position: relative; - - .labeled-input { - display: flex; - flex-direction: column; - align-content: flex-start; - align-items: flex-start; - justify-content: center; - height: auto; - width: 100%; - position: relative; - @include bs.media-breakpoint-down(md) { - gap: 0.8rem; - } - @include bs.media-breakpoint-up(md) { - gap: 1.2rem; - } - - & > label { - color: v.$gray-light; - font-size: 1.2rem; - line-height: 1.4rem; - font-family: Roboto; - @include mix.text-weight(medium); - } - - & > .input-container { - flex: 1 1 auto; - width: 100%; - } - @include bs.media-breakpoint-up(md) { - &.half { - width: 50%; - - & > .input-container { - width: 100%; - } - } - } - } - - & > .input-group { - display: flex; - flex-flow: row wrap; - align-content: flex-start; - align-items: flex-start; - justify-content: flex-start; - row-gap: 2.5rem; - column-gap: 2rem; - margin-top: 1.5rem; - width: 100%; - - & > label { - display: block; - width: 100%; - } - } -} diff --git a/web/src/shared/scss/components/_formsDevtools.scss b/web/src/shared/scss/components/_formsDevtools.scss deleted file mode 100644 index bdd0b0a37..000000000 --- a/web/src/shared/scss/components/_formsDevtools.scss +++ /dev/null @@ -1,13 +0,0 @@ -.form-devtools { - span, - p, - h1, - h2, - h3, - h4, - tr, - th, - td { - color: white; - } -} diff --git a/web/src/shared/scss/components/_icons.scss b/web/src/shared/scss/components/_icons.scss deleted file mode 100644 index 6b391ed67..000000000 --- a/web/src/shared/scss/components/_icons.scss +++ /dev/null @@ -1,36 +0,0 @@ -@use '@shared/scss/base/variables' as v; -@use '@shared/scss/helpers/mixins' as mix; - -.icon-with-label { - display: flex; - flex-direction: row; - align-content: center; - align-items: center; - justify-content: flex-start; - gap: 1rem; -} - -.icon { - &.disconnected { - content: ''; - display: block; - width: 5px; - height: 5px; - background-color: v.$gray-light; - border-radius: 50%; - margin-right: 1.1rem; - } - - &.connected { - position: relative; - content: ''; - width: 7px; - height: 7px; - background-color: v.$white; - margin-right: 1rem; - display: block; - border-radius: 50%; - border: 2px solid v.$success; - box-sizing: border-box; - } -} diff --git a/web/src/shared/scss/components/_index.scss b/web/src/shared/scss/components/_index.scss deleted file mode 100644 index 5e3b494de..000000000 --- a/web/src/shared/scss/components/_index.scss +++ /dev/null @@ -1,4 +0,0 @@ -@forward './containers'; -@forward './forms'; -@forward './icons'; -@forward './modals'; diff --git a/web/src/shared/scss/components/_modals.scss b/web/src/shared/scss/components/_modals.scss deleted file mode 100644 index 0ebc6589f..000000000 --- a/web/src/shared/scss/components/_modals.scss +++ /dev/null @@ -1,4 +0,0 @@ -#modals-root { - z-index: 4; - position: relative; -} diff --git a/web/src/shared/scss/styles.scss b/web/src/shared/scss/styles.scss index be6b7ade6..47c701a7f 100644 --- a/web/src/shared/scss/styles.scss +++ b/web/src/shared/scss/styles.scss @@ -1,6 +1,4 @@ @use './base'; @use './helpers'; -@use './components'; @use './legacy-variables'; -@use './fonts.scss'; @use '../defguard-ui/scss'; diff --git a/web/src/shared/types.ts b/web/src/shared/types.ts index b726e6377..e1f2b0234 100644 --- a/web/src/shared/types.ts +++ b/web/src/shared/types.ts @@ -485,6 +485,7 @@ export interface WorkerJobStatus { pgp_key?: string; ssh_key?: string; success?: boolean; + errorMessage?: string; } export interface WorkerJobStatusError { diff --git a/web/vite.config.ts b/web/vite.config.ts index fcc2b62df..1a53a9f15 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -28,11 +28,9 @@ export default defineConfig({ }, }, envPrefix: ['VITE_'], - assetsInclude: ['./src/shared/fonts/**/*', './src/shared/assets/**/*'], + assetsInclude: ['./src/shared/assets/**/*'], resolve: { alias: { - '@fonts': path.resolve(__dirname, '/src/shared/fonts'), - '@shared': path.resolve(__dirname, '/src/shared'), '@scss': path.resolve(__dirname, '/src/shared/scss'), '@scssutils': path.resolve(__dirname, '/src/shared/scss/helpers'), },