Remove uuid

This commit is contained in:
Samuel Elliott 2023-07-13 00:48:43 +01:00
parent 0a9e5d859d
commit 7bdf9f578a
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
6 changed files with 11 additions and 26 deletions

14
package-lock.json generated
View File

@ -25,7 +25,6 @@
"supports-color": "^8.1.1",
"tslib": "^2.4.1",
"undici": "^5.22.1",
"uuid": "^8.3.2",
"yargs": "^17.6.2"
},
"bin": {
@ -51,7 +50,6 @@
"@types/react": "^17.0.45",
"@types/react-native": "^0.67.7",
"@types/read": "^0.0.29",
"@types/uuid": "^8.3.4",
"@types/yargs": "^17.0.14",
"electron": "^21.3.1",
"electron-builder": "^23.6.0",
@ -632,12 +630,6 @@
"@types/node": "*"
}
},
"node_modules/@types/uuid": {
"version": "8.3.4",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz",
"integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==",
"dev": true
},
"node_modules/@types/verror": {
"version": "1.10.6",
"resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.6.tgz",
@ -5045,12 +5037,6 @@
"@types/node": "*"
}
},
"@types/uuid": {
"version": "8.3.4",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz",
"integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==",
"dev": true
},
"@types/verror": {
"version": "1.10.6",
"resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.6.tgz",

View File

@ -52,7 +52,6 @@
"supports-color": "^8.1.1",
"tslib": "^2.4.1",
"undici": "^5.22.1",
"uuid": "^8.3.2",
"yargs": "^17.6.2"
},
"devDependencies": {
@ -75,7 +74,6 @@
"@types/react": "^17.0.45",
"@types/react-native": "^0.67.7",
"@types/read": "^0.0.29",
"@types/uuid": "^8.3.4",
"@types/yargs": "^17.0.14",
"electron": "^21.3.1",
"electron-builder": "^23.6.0",

View File

@ -1,5 +1,5 @@
import { randomUUID } from 'node:crypto';
import { fetch, Response } from 'undici';
import { v4 as uuidgen } from 'uuid';
import createDebug from '../util/debug.js';
import { JwtPayload } from '../util/jwt.js';
import { timeoutSignal } from '../util/misc.js';
@ -185,7 +185,7 @@ export default class CoralApi implements CoralApiInterface {
url: string, parameter = {},
/** @internal */ _autoRenewToken = true
) {
const uuid = uuidgen();
const uuid = randomUUID();
return this.fetch<T>(url, 'POST', JSON.stringify({
parameter,

View File

@ -1,6 +1,6 @@
import process from 'node:process';
import { randomUUID } from 'node:crypto';
import { fetch, Headers } from 'undici';
import { v4 as uuidgen } from 'uuid';
import { defineResponse, ErrorResponse } from './util.js';
import createDebug from '../util/debug.js';
import { timeoutSignal } from '../util/misc.js';
@ -91,7 +91,7 @@ export type FlapgApiError = IminkFError;
export class ZncaApiFlapg extends ZncaApi {
async genf(token: string, hash_method: HashMethod) {
const request_id = uuidgen();
const request_id = randomUUID();
const result = await flapg(hash_method, token, undefined, request_id, this.useragent);
@ -174,7 +174,7 @@ export interface IminkFError {
export class ZncaApiImink extends ZncaApi {
async genf(token: string, hash_method: HashMethod, user?: {na_id: string; coral_user_id?: string;}) {
const request_id = uuidgen();
const request_id = randomUUID();
const result = await iminkf(hash_method, token, undefined, request_id, user, this.useragent);
@ -271,7 +271,7 @@ export class ZncaApiNxapi extends ZncaApi {
}
async genf(token: string, hash_method: HashMethod, user?: {na_id: string; coral_user_id?: string}) {
const request_id = uuidgen();
const request_id = randomUUID();
const result = await genf(this.url + '/f', hash_method, token, undefined, request_id,
user, this.app, this.useragent);

View File

@ -1,5 +1,5 @@
import { randomUUID } from 'node:crypto';
import { Cookie, fetch, FormData, getSetCookies } from 'undici';
import { v4 as uuidgen } from 'uuid';
import { WebServiceToken } from './coral-types.js';
import { NintendoAccountUser } from './na.js';
import { defineResponse, ErrorResponse } from './util.js';
@ -193,7 +193,7 @@ export default class SplatNet2Api {
}
async shareProfile(stage: string, colour: ShareColour) {
const boundary = uuidgen();
const boundary = randomUUID();
const data = `--${boundary}
Content-Disposition: form-data; name="stage"

View File

@ -1,9 +1,9 @@
import * as net from 'node:net';
import * as os from 'node:os';
import { randomUUID } from 'node:crypto';
import * as persist from 'node-persist';
import express, { Request, RequestHandler, Response } from 'express';
import bodyParser from 'body-parser';
import { v4 as uuidgen } from 'uuid';
import type { Arguments as ParentArguments } from '../nso.js';
import CoralApi, { CoralApiInterface, CoralErrorResponse } from '../../api/coral.js';
import { Announcement, CoralStatus, CurrentUser, Friend, FriendCodeUrl, FriendCodeUser, Presence } from '../../api/coral-types.js';
@ -361,7 +361,8 @@ class Server extends HttpServer {
}
async handleCreateTokenRequest({req, user}: RequestDataWithUser) {
const token = uuidgen();
const token = randomUUID();
const auth: AuthToken = {
user: user.data.user.id,
policy: req.body.policy,