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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/app/[language]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { DEFAULT_LANGUAGE_CODE } from "@/features/localization/localization.conf
import { cookies } from "next/headers";
import { PREFERRED_THEME_COOKIE_KEY } from "@/features/themes/theme.config";
import { PageLayoutComponent } from "@/features/common/components/layout/page-layout/page-layout.component";
import { UseHashWarningComponent } from "@/features/decoder/components/use-hash-warning/use-hash-warning.component";
import { PageMetadataProps } from "@/features/common/models/page-metadata.props";
import { getHomeDictionary } from "@/features/localization/services/language-dictionary.service";
import { generatePageMetadata } from "@/libs/metadata/metadata.service";
Expand Down Expand Up @@ -54,7 +53,6 @@ export default function RootLayout({
themeCode={initialThemeCookieValue}
>
{children}
<UseHashWarningComponent languageCode={languageCode} />
</PageLayoutComponent>
);
}
39 changes: 3 additions & 36 deletions src/features/decoder/components/token-decoder.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import { SecretKeyInputComponent } from "@/features/decoder/components/secret-ke
import { useDecoderStore } from "@/features/decoder/services/decoder.store";
import { useRouter } from "next/navigation";
import {
SupportedTokenHashParamValues,
WARNING_PARAM_KEY,
WARNING_PARAM_VALUE,
SupportedTokenHashParamValues
} from "@/libs/config/project.constants";
import { HomeDictionaryModel } from "@/features/localization/models/home-dictionary.model";
import { ClaimDescriptionVisibilityValues } from "@/features/common/values/claim-description-visibility.values";
Expand Down Expand Up @@ -50,9 +48,6 @@ export const TokenDecoderComponent: React.FC<TokenDecoderComponentProps> = ({

const loadDecoderInputs = useDecoderStore((state) => state.loadDecoderInputs);
const handleJwtChange$ = useDecoderStore((state) => state.handleJwtChange);
const showUseHashWarning$ = useDecoderStore(
(state) => state.showUseHashWarning
);

useEffect(() => {
const handleHashChange = () => {
Expand Down Expand Up @@ -93,42 +88,14 @@ export const TokenDecoderComponent: React.FC<TokenDecoderComponentProps> = ({
});
};

const handleWarning = () => {
const search = window.location.search;

const searchParams = new URLSearchParams(search);
const warning = searchParams.get(WARNING_PARAM_KEY);

if (warning === WARNING_PARAM_VALUE) {
showUseHashWarning$();

searchParams.delete(WARNING_PARAM_KEY);

const currentUrl = window.location.href.split("?")[0];

let newUrl = `${currentUrl}`;

if (searchParams.size > 0) {
newUrl += `?${searchParams.toString()}`;
}

if (window.location.hash) {
newUrl += window.location.hash;
}

router.push(newUrl);
}
};

window.addEventListener("hashchange", handleHashChange);

handleHashChange();
handleWarning();

return () => {
window.removeEventListener("hashchange", handleHashChange);
};
}, [handleJwtChange$, router, showUseHashWarning$]);
}, [handleJwtChange$, router]);

useEffect(() => {
if (isMounted.current) {
Expand Down

This file was deleted.

This file was deleted.

19 changes: 0 additions & 19 deletions src/features/decoder/services/decoder.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ import { AsymmetricKeyFormatValues } from "@/features/common/values/asymmetric-k
import { JwtSignatureStatusValues } from "@/features/common/values/jwt-signature-status.values";
import { DecoderInputsModel } from "@/features/debugger/models/decoder-inputs.model";

export enum HashWarningVisibilityValues {
VISIBLE = "VISIBLE",
HIDDEN = "HIDDEN",
}

export const DEFAULT_ALG_TYPE = "HS";
export const DEFAULT_ALG_SIZE = 256;
export const DEFAULT_ALG = `${DEFAULT_ALG_TYPE}${DEFAULT_ALG_SIZE}`;
Expand Down Expand Up @@ -63,7 +58,6 @@ export type DecoderStoreState = {
decodingErrors: string[] | null;
signatureWarnings: string[] | null;
verificationInputErrors: string[] | null;
useHashWarningVisibility: HashWarningVisibilityValues;
};

type DecoderStoreActions = {
Expand All @@ -79,8 +73,6 @@ type DecoderStoreActions = {
) => void;
resetControlledSymmetricSecretKey: () => void;
resetControlledAsymmetricPublicKey: () => void;
showUseHashWarning: () => void;
hideUseHashWarning: () => void;
loadDecoderInputs: (params: DecoderInputsModel) => void;
};

Expand All @@ -100,7 +92,6 @@ export const initialState: DecoderStoreState = {
controlledSymmetricSecretKey: null,
controlledAsymmetricPublicKey: null,
verificationInputErrors: null,
useHashWarningVisibility: HashWarningVisibilityValues.HIDDEN,
};

export type DecoderStore = DecoderStoreState & DecoderStoreActions;
Expand Down Expand Up @@ -204,16 +195,6 @@ export const useDecoderStore = create<DecoderStore>()(
format: state.asymmetricPublicKeyFormat,
},
})),
showUseHashWarning: () => {
set({
useHashWarningVisibility: HashWarningVisibilityValues.VISIBLE,
});
},
hideUseHashWarning: () => {
set({
useHashWarningVisibility: HashWarningVisibilityValues.HIDDEN,
});
},
loadDecoderInputs: async (params) => {
const update = await TokenDecoderService.loadDecoderInputs(params);

Expand Down
2 changes: 0 additions & 2 deletions src/libs/config/project.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export enum SupportedTokenHashParamValues {
ID_TOKEN = "id_token",
VALUE = "value",
}
export const WARNING_PARAM_KEY = "warning";
export const WARNING_PARAM_VALUE = "use_hash";

export const EBOOK_URL =
"https://auth0.com/resources/ebooks/jwt-handbook/?utm_source=jwtio&utm_medium=banner&utm_campaign=jwt-handbook";
Expand Down
2 changes: 0 additions & 2 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ export function middleware(request: NextRequest) {
request.nextUrl.searchParams.delete("access_token");
request.nextUrl.searchParams.delete("value");

request.nextUrl.searchParams.append("warning", "use_hash");

request.nextUrl.hash = `token=${tokenParam}`;

return NextResponse.redirect(request.nextUrl);
Expand Down