Skip to content

Commit

Permalink
prettier update
Browse files Browse the repository at this point in the history
  • Loading branch information
ksrichard committed Feb 14, 2025
1 parent 5eacc60 commit fa899e1
Show file tree
Hide file tree
Showing 29 changed files with 78 additions and 16 deletions.
4 changes: 2 additions & 2 deletions applications/tari_dan_wallet_daemon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ pub async fn run_tari_dan_wallet_daemon(
let webauthn_service = Arc::new(WebauthnService::new(wallet_store, Duration::from_secs(60 * 60)));

// webauthn
let rp_origin = match config.dan_wallet_daemon.http_ui_address {
let rp_origin = match config.dan_wallet_daemon.web_ui_address {
Some(ui_address) => Url::parse(format!("http://localhost:{}", ui_address.port()).as_str())?,
None => {
let ui_address = WalletDaemonConfig::default().http_ui_address.unwrap();
let ui_address = WalletDaemonConfig::default().web_ui_address.unwrap();
Url::parse(format!("http://localhost:{}", ui_address.port()).as_str())?
},
};
Expand Down
23 changes: 10 additions & 13 deletions applications/tari_dan_wallet_web_ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import {Navigate, Route, Routes} from "react-router-dom";
import { Navigate, Route, Routes } from "react-router-dom";
import Accounts from "./routes/Accounts/Accounts";
import AccountDetails from "./routes/AccountDetails/AccountDetails";
import Keys from "./routes/Keys/Keys";
Expand All @@ -32,11 +32,11 @@ import Transactions from "./routes/Transactions/TransactionsLayout";
import TransactionDetails from "./routes/Transactions/TransactionDetails";
import AssetVault from "./routes/AssetVault/AssetVault";
import SettingsPage from "./routes/Settings/Settings";
import Auth, {AUTH_TOKEN_FOR_NONE_AUTH} from "./routes/Auth/Auth";
import Auth, { AUTH_TOKEN_FOR_NONE_AUTH } from "./routes/Auth/Auth";
import Webauthn from "./routes/WebauthnRegistration/Webauthn";
import useAuthStore from "./store/authStore";
import {useEffect} from "react";
import {useAuthMethod} from "./api/hooks/useAuth";
import { useEffect } from "react";
import { useAuthMethod } from "./api/hooks/useAuth";

export const breadcrumbRoutes = [
{
Expand Down Expand Up @@ -97,24 +97,21 @@ export const breadcrumbRoutes = [
];

// @ts-ignore
const GuardedRoute = ({ component: Component, redirect = "/auth", auth = false, ...rest }) => (
auth
? <Component {...rest} />
: <Navigate replace to={redirect} />
)
const GuardedRoute = ({ component: Component, redirect = "/auth", auth = false, ...rest }) =>
auth ? <Component {...rest} /> : <Navigate replace to={redirect} />;

function App() {
const { data: authMethod, isError: authMethodsIsError, error: authMethodsError } = useAuthMethod();
const {authToken, setAuthToken} = useAuthStore();
const { authToken, setAuthToken } = useAuthStore();
let auth = !!authToken;

useEffect(() => {
if (!authMethodsIsError && authMethod) {
if (authMethod.method !== 'none' && authToken === AUTH_TOKEN_FOR_NONE_AUTH) {
if (authMethod.method !== "none" && authToken === AUTH_TOKEN_FOR_NONE_AUTH) {
setAuthToken("");
}

if (authMethod.method === 'none') {
if (authMethod.method === "none") {
useAuthStore.getState().setAuthToken(AUTH_TOKEN_FOR_NONE_AUTH);
}
}
Expand All @@ -135,7 +132,7 @@ function App() {
<Route path="accounts" element={<GuardedRoute auth={auth} component={Accounts} />} />
<Route path="accounts/:id" element={<GuardedRoute auth={auth} component={AccountDetails} />} />
<Route path="keys" element={<GuardedRoute auth={auth} component={Keys} />} />
<Route path="access-tokens" element={<GuardedRoute auth={auth} component={AccessTokensLayout}/>} />
<Route path="access-tokens" element={<GuardedRoute auth={auth} component={AccessTokensLayout} />} />
<Route path="transactions" element={<GuardedRoute auth={auth} component={Transactions} />} />
<Route path="wallet" element={<GuardedRoute auth={auth} component={Wallet} />} />
<Route path="transactions/:id" element={<GuardedRoute auth={auth} component={TransactionDetails} />} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ impl ProcessDefinition for WalletDaemon {
.arg(format!("--json-rpc-address={json_rpc_address}"))
.arg(format!("--indexer-url={indexer_url}"))
.arg(format!("--ui-connect-address={json_rpc_public_address}"))
.arg(format!("-pdan_wallet_daemon.http_ui_address={web_ui_address}"))
.arg(format!("-pdan_wallet_daemon.web_ui_address={web_ui_address}"))
.arg(format!("-pdan_wallet_daemon.authentication={}", auth));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type AuthGetMethodRequest = Record<string, never>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { AuthMethod } from "./AuthMethod";
export interface AuthGetMethodResponse {
method: AuthMethod;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions bindings/dist/types/wallet-daemon-client/AuthMethod.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type AuthMethod = "none" | "webauthn";
2 changes: 2 additions & 0 deletions bindings/dist/types/wallet-daemon-client/AuthMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type WebauthnAlreadyRegisteredRequest = Record<string, never>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface WebauthnAlreadyRegisteredResponse {
registered: boolean;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface WebauthnFinishAuthRequest {
session_id: string;
credential: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface WebauthnFinishRegisterRequest {
session_id: string;
credential: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface WebauthnFinishRegisterResponse {
success: boolean;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface WebauthnStartAuthRequest {
username: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface WebauthnStartAuthResponse {
session_id: string;
challenge: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface WebauthnStartRegisterRequest {
username: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface WebauthnStartRegisterResponse {
session_id: string;
public_key: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

export type WebauthnAlreadyRegisteredRequest = Record<string, never>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

export interface WebauthnAlreadyRegisteredResponse {
registered: boolean;
}

0 comments on commit fa899e1

Please sign in to comment.