Skip to content

Commit d6295cf

Browse files
committed
fix: fixed citadelAllowParams for oauth audit flags
1 parent 3cef028 commit d6295cf

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/helpers/citadelUtils.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { BUILD_ENV_TYPE, CITADEL_SERVER_MAP, TORUS_NETWORK_TYPE } from "@torusla
22
import { get, put } from "@toruslabs/http-helpers";
33

44
import { RetrieveSharesParams } from "../interfaces";
5+
import { isNullOrUndefined } from "./common";
56

67
export interface CitadelAuthFlowAuditParams {
78
oauthInitiated?: boolean;
@@ -41,19 +42,19 @@ export function buildAllowUrl(params: CitadelAllowParams): string {
4142
if (params.source) {
4243
url.searchParams.set("source", params.source);
4344
}
44-
if (params.oauthInitiated) {
45+
if (!isNullOrUndefined(params.oauthInitiated)) {
4546
url.searchParams.set("oauthinitiated", params.oauthInitiated.toString());
4647
}
47-
if (params.oauthVerified) {
48+
if (!isNullOrUndefined(params.oauthVerified)) {
4849
url.searchParams.set("oauthverified", params.oauthVerified.toString());
4950
}
50-
if (params.oauthCompleted) {
51+
if (!isNullOrUndefined(params.oauthCompleted)) {
5152
url.searchParams.set("oauthcompleted", params.oauthCompleted.toString());
5253
}
53-
if (params.oauthVerificationFailed) {
54+
if (!isNullOrUndefined(params.oauthVerificationFailed)) {
5455
url.searchParams.set("oauthverificationfailed", params.oauthVerificationFailed.toString());
5556
}
56-
if (params.oauthFailed) {
57+
if (!isNullOrUndefined(params.oauthFailed)) {
5758
url.searchParams.set("oauthfailed", params.oauthFailed.toString());
5859
}
5960
return url.toString();

src/helpers/common.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,7 @@ export function retryCommitment(executionPromise: () => Promise<JRPCResponse<Com
161161

162162
return retryWithBackoff(0);
163163
}
164+
165+
export function isNullOrUndefined(value: unknown): value is null | undefined {
166+
return value === null || value === undefined;
167+
}

0 commit comments

Comments
 (0)