mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-04-24 23:16:53 -05:00
Export nxapi/nintendo-account and fix error state validation
This commit is contained in:
parent
72c2927de8
commit
991a5f7a7c
|
|
@ -22,6 +22,7 @@
|
|||
],
|
||||
"exports": {
|
||||
".": "./dist/exports/index.js",
|
||||
"./nintendo-account": "./dist/exports/nintendo-account.js",
|
||||
"./coral": "./dist/exports/coral.js",
|
||||
"./moon": "./dist/exports/moon.js",
|
||||
"./splatnet2": "./dist/exports/splatnet2.js",
|
||||
|
|
|
|||
|
|
@ -25,12 +25,16 @@ export class NintendoAccountSessionAuthorisation {
|
|||
async getSessionToken(params: URLSearchParams): Promise<HasResponse<NintendoAccountSessionToken, Response>>
|
||||
async getSessionToken(code: string | URLSearchParams | null, state?: string | null) {
|
||||
if (code instanceof URLSearchParams) {
|
||||
if (code.get('state') !== this.state) {
|
||||
throw new TypeError('Invalid state');
|
||||
}
|
||||
|
||||
if (code.has('error')) {
|
||||
throw NintendoAccountSessionAuthorisationError.fromSearchParams(code);
|
||||
}
|
||||
|
||||
state = code.get('state') || null;
|
||||
code = code.get('session_token_code');
|
||||
state = undefined;
|
||||
}
|
||||
|
||||
if (typeof state !== 'undefined' && state !== this.state) {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
import { app, BrowserWindow, dialog, MessageBoxOptions, Notification, session, shell } from './electron.js';
|
||||
import process from 'node:process';
|
||||
import * as crypto from 'node:crypto';
|
||||
import * as persist from 'node-persist';
|
||||
import { protocol_registration_options } from './index.js';
|
||||
import { createModalWindow, createWindow } from './windows.js';
|
||||
import { createModalWindow } from './windows.js';
|
||||
import { tryGetNativeImageFromUrl } from './util.js';
|
||||
import { WindowType } from '../common/types.js';
|
||||
import { getNintendoAccountSessionToken, NintendoAccountAuthError, NintendoAccountSessionAuthorisation, NintendoAccountSessionAuthorisationError, NintendoAccountSessionToken } from '../../api/na.js';
|
||||
import { NintendoAccountSessionAuthorisationCoral, ZNCA_CLIENT_ID } from '../../api/coral.js';
|
||||
import { NintendoAccountSessionAuthorisationMoon, ZNMA_CLIENT_ID } from '../../api/moon.js';
|
||||
import { NintendoAccountAuthError, NintendoAccountSessionAuthorisation, NintendoAccountSessionAuthorisationError, NintendoAccountSessionToken } from '../../api/na.js';
|
||||
import { NintendoAccountSessionAuthorisationCoral } from '../../api/coral.js';
|
||||
import { NintendoAccountSessionAuthorisationMoon } from '../../api/moon.js';
|
||||
import { ErrorResponse } from '../../api/util.js';
|
||||
import { getToken } from '../../common/auth/coral.js';
|
||||
import { getPctlToken } from '../../common/auth/moon.js';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user