From d037caf3b90365e4fbd27a8b84d3b3117b38cbcd Mon Sep 17 00:00:00 2001 From: Nigel Breslaw Date: Thu, 15 Feb 2024 21:04:40 +0200 Subject: [PATCH] Tidy --- native_gg/src/account/Account.ts | 2 +- native_gg/src/authentication/AuthService.ts | 3 +-- native_gg/src/authentication/Types.ts | 13 ------------- native_gg/src/authentication/Utilities.ts | 13 ++++++++++++- 4 files changed, 14 insertions(+), 17 deletions(-) delete mode 100644 native_gg/src/authentication/Types.ts diff --git a/native_gg/src/account/Account.ts b/native_gg/src/account/Account.ts index cc5a322df..4e38fd57c 100644 --- a/native_gg/src/account/Account.ts +++ b/native_gg/src/account/Account.ts @@ -1,6 +1,6 @@ import * as v from "valibot"; import { apiKey } from "../constants/env.ts"; -import { RefreshToken } from "../authentication/Types.ts"; +import { RefreshToken } from "../authentication/Utilities.ts"; const PlatformSilverSchema = v.object({ itemHash: v.number(), diff --git a/native_gg/src/authentication/AuthService.ts b/native_gg/src/authentication/AuthService.ts index c372892b4..719b730cb 100644 --- a/native_gg/src/authentication/AuthService.ts +++ b/native_gg/src/authentication/AuthService.ts @@ -5,8 +5,7 @@ import * as WebBrowser from "expo-web-browser"; import * as v from "valibot"; import { clientID, redirectURL } from "../constants/env.ts"; import { Store } from "../constants/storage.ts"; -import { RefreshToken, refreshTokenSchema } from "./Types.ts"; -import { getAccessToken, getRefreshToken } from "./Utilities.ts"; +import { RefreshToken, refreshTokenSchema, getAccessToken, getRefreshToken } from "./Utilities.ts"; import { BungieUser, BungieUserSchema, diff --git a/native_gg/src/authentication/Types.ts b/native_gg/src/authentication/Types.ts deleted file mode 100644 index 455fd038c..000000000 --- a/native_gg/src/authentication/Types.ts +++ /dev/null @@ -1,13 +0,0 @@ -import * as v from "valibot"; - -export const refreshTokenSchema = v.object({ - access_token: v.string(), - expires_in: v.number(), - membership_id: v.string(), - refresh_expires_in: v.number(), - refresh_token: v.string(), - time_stamp: v.optional(v.string([v.isoTimestamp()])), - token_type: v.string(), -}); - -export type RefreshToken = v.Output; diff --git a/native_gg/src/authentication/Utilities.ts b/native_gg/src/authentication/Utilities.ts index 6f5b80fa2..5ace34c54 100644 --- a/native_gg/src/authentication/Utilities.ts +++ b/native_gg/src/authentication/Utilities.ts @@ -1,7 +1,18 @@ import * as base64 from "base-64"; import * as v from "valibot"; import { apiKey, clientID, clientSecret } from "../constants/env.ts"; -import { RefreshToken, refreshTokenSchema } from "./Types.ts"; + +export const refreshTokenSchema = v.object({ + access_token: v.string(), + expires_in: v.number(), + membership_id: v.string(), + refresh_expires_in: v.number(), + refresh_token: v.string(), + time_stamp: v.optional(v.string([v.isoTimestamp()])), + token_type: v.string(), +}); + +export type RefreshToken = v.Output; export function getRefreshToken(bungieCode: string): Promise { const headers = new Headers();