Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/frontend/src/lib/stores/authorization.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type AuthorizationContext = {
};

export type Authorized = {
accountNumber: bigint | undefined;
accountNumber: Promise<bigint | undefined>;
};

const contextInternal = writable<AuthorizationContext | undefined>();
Expand All @@ -16,8 +16,10 @@ export const authorizationStore = {
setContext: (effectiveOrigin: string): void => {
contextInternal.set({ effectiveOrigin });
},
/** Called by the UI when the user authorizes with a specific account. */
authorize: (accountNumber: bigint | undefined): void => {
/** Called by the UI when the user authorizes with a specific account.
* Accepts a promise so the animation can start immediately while the
* account number resolves asynchronously. */
authorize: (accountNumber: Promise<bigint | undefined>): void => {
Comment thread
sea-snake marked this conversation as resolved.
Outdated
authorizedInternal.set({ accountNumber });
},
subscribe: contextInternal.subscribe,
Expand Down
7 changes: 5 additions & 2 deletions src/frontend/src/lib/stores/channelHandlers/delegation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,14 @@ export const handleDelegationRequest =

// Authorization is the commit point — the user may switch identities
// freely before this. Once authorized, the UI is no longer needed.
const { accountNumber } = await waitForStore(authorizedStore);
const authorized = await waitForStore(authorizedStore);

// Read the identity *after* authorization so we capture whichever
// identity the user settled on (they may have switched mid-flow).
const { identityNumber, actor } = await waitForStore(authenticationStore);
const [accountNumber, { identityNumber, actor }] = await Promise.all([
authorized.accountNumber,
waitForStore(authenticationStore),
]);

const sessionPublicKey = new Uint8Array(params.publicKey.toDer());

Expand Down
4 changes: 0 additions & 4 deletions src/frontend/src/lib/utils/reroute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ export const reroute: Reroute = ({ url }) => {
if (url.hash === "#authorize") {
return get(DISCOVERABLE_PASSKEY_FLOW) ? "/authorize" : "/legacy/authorize";
}
// Load direct authorization page instead if openid param is present
if (url.pathname === "/authorize" && url.searchParams.has("openid")) {
Comment thread
sea-snake marked this conversation as resolved.
return `/init-openid-authorize`;
}
if (url.pathname === "/") {
return get(DISCOVERABLE_PASSKEY_FLOW) || building ? "/" : "/legacy";
}
Expand Down
22 changes: 0 additions & 22 deletions src/frontend/src/routes/(new-styling)/(channel)/+layout.svelte

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading