Files
airllm-fork-nodejs/node_modules/@octokit/auth-token/dist-src/auth.js
2026-02-05 15:27:49 +08:00

16 lines
421 B
JavaScript

import { isJWT } from "./is-jwt.js";
async function auth(token) {
const isApp = isJWT(token);
const isInstallation = token.startsWith("v1.") || token.startsWith("ghs_");
const isUserToServer = token.startsWith("ghu_");
const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
return {
type: "token",
token,
tokenType
};
}
export {
auth
};