refactor: remove misc/secure-rndstr.ts
This commit is contained in:
parent
26cd2a68da
commit
4e63873fc1
5 changed files with 9 additions and 14 deletions
|
@ -1,5 +0,0 @@
|
|||
import { genString } from "native-utils/built/index.js";
|
||||
|
||||
export function secureRndstr(length = 32, _ = true): string {
|
||||
return genString(length);
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
import { secureRndstr } from "@/misc/secure-rndstr.js";
|
||||
import { genString } from "native-utils/built/index.js";
|
||||
|
||||
export default () => secureRndstr(16, true);
|
||||
export default () => genString(16);
|
||||
|
|
|
@ -2,7 +2,7 @@ import define from "@/server/api/define.js";
|
|||
import { Apps } from "@/models/index.js";
|
||||
import { genId } from "@/misc/gen-id.js";
|
||||
import { unique } from "@/prelude/array.js";
|
||||
import { secureRndstr } from "@/misc/secure-rndstr.js";
|
||||
import { genString } from "native-utils/built/index.js";
|
||||
|
||||
export const meta = {
|
||||
tags: ["app"],
|
||||
|
@ -41,7 +41,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||
includeSecret: true,
|
||||
});
|
||||
// Generate secret
|
||||
const secret = secureRndstr(32, true);
|
||||
const secret = genString(32);
|
||||
|
||||
// for backward compatibility
|
||||
const permission = unique(
|
||||
|
|
|
@ -3,7 +3,7 @@ import define from "@/server/api/define.js";
|
|||
import { ApiError } from "@/server/api/error.js";
|
||||
import { AuthSessions, AccessTokens, Apps } from "@/models/index.js";
|
||||
import { genId } from "@/misc/gen-id.js";
|
||||
import { secureRndstr } from "@/misc/secure-rndstr.js";
|
||||
import { genString } from "native-utils/built/index.js";
|
||||
|
||||
export const meta = {
|
||||
tags: ["auth"],
|
||||
|
@ -38,10 +38,10 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||
}
|
||||
|
||||
// Generate access token
|
||||
const accessToken = secureRndstr(32, true);
|
||||
const accessToken = genString(32);
|
||||
|
||||
// Fetch exist access token
|
||||
const exist = await AccessTokens.exist({
|
||||
const exist = await AccessTokens.exists({
|
||||
where: {
|
||||
appId: session.appId,
|
||||
userId: user.id,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import define from "@/server/api/define.js";
|
||||
import { AccessTokens } from "@/models/index.js";
|
||||
import { genId } from "@/misc/gen-id.js";
|
||||
import { secureRndstr } from "@/misc/secure-rndstr.js";
|
||||
import { genString } from "native-utils/built/index.js";
|
||||
|
||||
export const meta = {
|
||||
tags: ["auth"],
|
||||
|
@ -44,7 +44,7 @@ export const paramDef = {
|
|||
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
// Generate access token
|
||||
const accessToken = secureRndstr(32, true);
|
||||
const accessToken = genString(32);
|
||||
|
||||
const now = new Date();
|
||||
|
||||
|
|
Loading…
Reference in a new issue