requestToken appBridge

This commit is contained in:
Jay Sheen
2025-09-17 10:04:58 +09:00
parent 60f55c98eb
commit 1615fa3760
4 changed files with 30 additions and 1 deletions

View File

@@ -8,13 +8,13 @@ export interface MenuGrantsItem {
grant: number;
};
export interface LoginResponse {
usrid?: string;
tokenType?: string;
accessToken?: string;
refreshToken?: string;
accessTokenExpiresIn?: number;
refreshTokenExpiresIn?: number;
menuGrants?: Array<MenuGrantsItem>;
// usrid?: string;
clientAddressIP?: string;
tempToken?: string,
tempTokenExpiresIn?: number;

View File

@@ -38,6 +38,12 @@ interface UseAppBridgeReturn {
// 공유
shareContent: (content: ShareContent) => Promise<void>;
// 로그아웃
logout: () => Promise<void>;
// 토큰 요청
requestToken: () => Promise<any>;
// 간편 인증 등록
registerBiometric: () => Promise<void>;
@@ -157,6 +163,20 @@ export const useAppBridge = (): UseAppBridgeReturn => {
return appBridge.safeCall(() => appBridge.removeStorage(key));
}, [isNativeEnvironment]);
const logout = useCallback(async (): Promise<void> => {
if (!isNativeEnvironment) {
throw new Error('Logout is only available in native environment');
}
return appBridge.safeCall(() => appBridge.logout());
}, [isNativeEnvironment]);
const requestToken = useCallback(async (): Promise<any> => {
if (!isNativeEnvironment) {
throw new Error('Token request is only available in native environment');
}
return appBridge.safeCall(() => appBridge.requestToken());
}, [isNativeEnvironment]);
const registerBiometric = useCallback(async (): Promise<void> => {
if (!isNativeEnvironment) {
throw new Error('Biometric auth is only available in native environment');
@@ -296,6 +316,8 @@ export const useAppBridge = (): UseAppBridgeReturn => {
getContacts,
*/
shareContent,
logout,
requestToken,
registerBiometric,
openBiometricRegistrationPopup,
closeBiometricRegistrationPopup

View File

@@ -35,6 +35,9 @@ export enum BridgeMessageType {
GET_STORAGE = 'getStorage',
REMOVE_STORAGE = 'removeStorage',
// 토큰 요청
REQUEST_TOKEN = 'requestToken',
// 카메라/갤러리
OPEN_CAMERA = 'openCamera',
OPEN_GALLERY = 'openGallery',

View File

@@ -153,6 +153,10 @@ class AppBridge {
return this.sendMessage(BridgeMessageType.REMOVE_STORAGE, { key });
}
async requestToken(): Promise<any> {
return this.sendMessage(BridgeMessageType.REQUEST_TOKEN);
}
// 공유 관련
async shareContent(content: ShareContent): Promise<void> {
return this.sendMessage(BridgeMessageType.SHARE_CONTENT, content);