Skip to content

Commit b94ea4b

Browse files
committed
feat(MyAccount): Add support for authn_method
1 parent bc6240c commit b94ea4b

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

src/helper.ts

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -113,26 +113,6 @@ export function generateConfigs(configs: ConfigsOptions = {}): string {
113113
});
114114
}
115115

116-
function isAuthnMethod(x: unknown): x is AuthnMethod {
117-
return supportedAuthnMethod.includes(x as AuthnMethod);
118-
}
119-
120-
function parseAuthnMethod(x: unknown): AuthnMethod | undefined {
121-
if (Array.isArray(x)) {
122-
throw new TypeError('Array is not allowed for authnMethod');
123-
}
124-
125-
return isAuthnMethod(x) ? x : undefined;
126-
}
127-
128-
function isAuthAction(x: unknown): x is AuthAction {
129-
return supportedAuthAction.includes(x as AuthAction);
130-
}
131-
132-
function parseAuthAction(x: unknown): AuthAction | undefined {
133-
return isAuthAction(x) ? x : undefined;
134-
}
135-
136116
export function generateCodeChallenge(): string {
137117
const codeVerifier = uuid();
138118

@@ -154,3 +134,24 @@ export function generateSdkHeaderInfo(): {
154134
export function openWindow(url: string, windowName: string): Window | null {
155135
return window.open(url, windowName, 'noreferrer');
156136
}
137+
138+
// Validators
139+
function isAuthnMethod(x: unknown): x is AuthnMethod {
140+
return supportedAuthnMethod.includes(x as AuthnMethod);
141+
}
142+
143+
function parseAuthnMethod(x: unknown): AuthnMethod | undefined {
144+
if (Array.isArray(x)) {
145+
throw new TypeError('Array is not allowed for authnMethod');
146+
}
147+
148+
return isAuthnMethod(x) ? x : undefined;
149+
}
150+
151+
function isAuthAction(x: unknown): x is AuthAction {
152+
return supportedAuthAction.includes(x as AuthAction);
153+
}
154+
155+
function parseAuthAction(x: unknown): AuthAction | undefined {
156+
return isAuthAction(x) ? x : undefined;
157+
}

0 commit comments

Comments
 (0)