Updates
This commit is contained in:
Vendored
+5
-1
@@ -29,11 +29,12 @@ export = githubAuth;
|
||||
* @param {string} params.encryptionKey - Encryption key
|
||||
* @param {string} params.encryptionSalt - Encryption salt
|
||||
* @param {string[]} [params.additionalFields] - Additional Fields to be added to the user object
|
||||
* @param {Object<string,string|number>} [params.additionalData] - Additional Data to by added on creation of User
|
||||
* @param {boolean} [params.user_id] - User ID
|
||||
*
|
||||
* @returns { Promise<FunctionReturn | undefined> }
|
||||
*/
|
||||
declare function githubAuth({ key, code, email, database, clientId, clientSecret, response, encryptionKey, encryptionSalt, additionalFields, user_id, }: {
|
||||
declare function githubAuth({ key, code, email, database, clientId, clientSecret, response, encryptionKey, encryptionSalt, additionalFields, user_id, additionalData, }: {
|
||||
key: string;
|
||||
code: string;
|
||||
email: string | null;
|
||||
@@ -44,6 +45,9 @@ declare function githubAuth({ key, code, email, database, clientId, clientSecret
|
||||
encryptionKey: string;
|
||||
encryptionSalt: string;
|
||||
additionalFields?: string[];
|
||||
additionalData?: {
|
||||
[x: string]: string | number;
|
||||
};
|
||||
user_id?: boolean;
|
||||
}): Promise<FunctionReturn | undefined>;
|
||||
declare namespace githubAuth {
|
||||
|
||||
@@ -45,6 +45,7 @@ const apiGithubLogin = require("../../package-shared/functions/api/users/social/
|
||||
* @param {string} params.encryptionKey - Encryption key
|
||||
* @param {string} params.encryptionSalt - Encryption salt
|
||||
* @param {string[]} [params.additionalFields] - Additional Fields to be added to the user object
|
||||
* @param {Object<string,string|number>} [params.additionalData] - Additional Data to by added on creation of User
|
||||
* @param {boolean} [params.user_id] - User ID
|
||||
*
|
||||
* @returns { Promise<FunctionReturn | undefined> }
|
||||
@@ -61,6 +62,7 @@ async function githubAuth({
|
||||
encryptionSalt,
|
||||
additionalFields,
|
||||
user_id,
|
||||
additionalData,
|
||||
}) {
|
||||
/**
|
||||
* Check inputs
|
||||
@@ -70,14 +72,6 @@ async function githubAuth({
|
||||
const grabedHostNames = grabHostNames();
|
||||
const { host, port, scheme } = grabedHostNames;
|
||||
|
||||
if (!key || key?.match(/ /)) {
|
||||
return {
|
||||
success: false,
|
||||
user: null,
|
||||
msg: "Please enter API full access Key",
|
||||
};
|
||||
}
|
||||
|
||||
if (!code || code?.match(/ /)) {
|
||||
return {
|
||||
success: false,
|
||||
@@ -102,30 +96,6 @@ async function githubAuth({
|
||||
};
|
||||
}
|
||||
|
||||
if (!response || !response?.setHeader) {
|
||||
return {
|
||||
success: false,
|
||||
user: null,
|
||||
msg: "Please provide a valid HTTPS response object",
|
||||
};
|
||||
}
|
||||
|
||||
if (!encryptionKey || encryptionKey?.match(/ /)) {
|
||||
return {
|
||||
success: false,
|
||||
user: null,
|
||||
msg: "Please provide a valid encryption key",
|
||||
};
|
||||
}
|
||||
|
||||
if (!encryptionSalt || encryptionSalt?.match(/ /)) {
|
||||
return {
|
||||
success: false,
|
||||
user: null,
|
||||
msg: "Please provide a valid encryption salt",
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
@@ -173,8 +143,8 @@ async function githubAuth({
|
||||
clientId,
|
||||
clientSecret,
|
||||
additionalFields,
|
||||
res: response,
|
||||
database: DSQL_DB_NAME,
|
||||
additionalData,
|
||||
});
|
||||
} else {
|
||||
/**
|
||||
@@ -191,6 +161,7 @@ async function githubAuth({
|
||||
clientSecret,
|
||||
database,
|
||||
additionalFields,
|
||||
additionalData,
|
||||
});
|
||||
|
||||
const httpsRequest = scheme.request(
|
||||
|
||||
Vendored
+5
-1
@@ -13,12 +13,13 @@ export = googleAuth;
|
||||
* @param {string} [params.encryptionKey] - Encryption key
|
||||
* @param {string} [params.encryptionSalt] - Encryption salt
|
||||
* @param {string[]} [params.additionalFields] - Additional Fields to be added to the user object
|
||||
* @param {Object<string,string|number>} [params.additionalData] - Additional Data to by added on creation of User
|
||||
* @param {string | number} [params.apiUserID] - API user ID
|
||||
* @param {boolean} [params.useLocal] - Whether to use a remote database instead of API
|
||||
*
|
||||
* @returns { Promise<import("../../package-shared/types").APILoginFunctionReturn> }
|
||||
*/
|
||||
declare function googleAuth({ key, token, database, response, encryptionKey, encryptionSalt, additionalFields, apiUserID, useLocal, }: {
|
||||
declare function googleAuth({ key, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, useLocal, }: {
|
||||
key?: string;
|
||||
token: string;
|
||||
database?: string;
|
||||
@@ -26,6 +27,9 @@ declare function googleAuth({ key, token, database, response, encryptionKey, enc
|
||||
encryptionKey?: string;
|
||||
encryptionSalt?: string;
|
||||
additionalFields?: string[];
|
||||
additionalData?: {
|
||||
[x: string]: string | number;
|
||||
};
|
||||
apiUserID?: string | number;
|
||||
useLocal?: boolean;
|
||||
}): Promise<import("../../package-shared/types").APILoginFunctionReturn>;
|
||||
|
||||
@@ -23,6 +23,7 @@ const {
|
||||
* @param {string} [params.encryptionKey] - Encryption key
|
||||
* @param {string} [params.encryptionSalt] - Encryption salt
|
||||
* @param {string[]} [params.additionalFields] - Additional Fields to be added to the user object
|
||||
* @param {Object<string,string|number>} [params.additionalData] - Additional Data to by added on creation of User
|
||||
* @param {string | number} [params.apiUserID] - API user ID
|
||||
* @param {boolean} [params.useLocal] - Whether to use a remote database instead of API
|
||||
*
|
||||
@@ -36,6 +37,7 @@ async function googleAuth({
|
||||
encryptionKey,
|
||||
encryptionSalt,
|
||||
additionalFields,
|
||||
additionalData,
|
||||
apiUserID,
|
||||
useLocal,
|
||||
}) {
|
||||
@@ -106,6 +108,7 @@ async function googleAuth({
|
||||
token,
|
||||
additionalFields,
|
||||
database: DSQL_DB_NAME,
|
||||
additionalData,
|
||||
});
|
||||
} else {
|
||||
/**
|
||||
@@ -119,6 +122,7 @@ async function googleAuth({
|
||||
token,
|
||||
database,
|
||||
additionalFields,
|
||||
additionalData,
|
||||
});
|
||||
|
||||
const httpsRequest = scheme.request(
|
||||
|
||||
Reference in New Issue
Block a user