Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove refresh token schema #380

Merged
merged 1 commit into from
Feb 15, 2024
Merged
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: 1 addition & 1 deletion native_gg/src/account/Account.ts
Original file line number Diff line number Diff line change
@@ -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(),
Expand Down
3 changes: 1 addition & 2 deletions native_gg/src/authentication/AuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 0 additions & 13 deletions native_gg/src/authentication/Types.ts

This file was deleted.

13 changes: 12 additions & 1 deletion native_gg/src/authentication/Utilities.ts
Original file line number Diff line number Diff line change
@@ -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<typeof refreshTokenSchema>;

export function getRefreshToken(bungieCode: string): Promise<JSON> {
const headers = new Headers();
Expand Down
Loading