1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 05:02:37 +01:00

add requestSignature to Config

This commit is contained in:
Flam3rboy 2021-05-29 23:42:06 +02:00
parent e1ec11d4b5
commit bff8f0f642
3 changed files with 8 additions and 3 deletions

View File

@ -20,7 +20,7 @@
"discord-open-source"
],
"author": "Fosscord",
"license": "ISC",
"license": "GPLV3",
"bugs": {
"url": "https://github.com/fosscord/fosscord-server-util/issues"
},

View File

@ -11,6 +11,7 @@ export const PublicUserProjection = {
public_flags: true,
avatar: true,
};
export interface User {
id: string;
username: string; // username max length 32, min 2
@ -22,6 +23,7 @@ export interface User {
premium: boolean; // if user bought nitro
premium_type: number; // nitro level
bot: boolean; // if user is bot
bio: string; // short description of the user (max 190 chars)
system: boolean; // shouldn't be used, the api sents this field type true, if the genetaed message comes from a system generated author
nsfw_allowed: boolean; // if the user is older than 18 (resp. Config)
mfa_enabled: boolean; // if multi factor authentication is enabled
@ -42,7 +44,7 @@ export interface User {
};
}
// Privat user data:
// Private user data:
export interface UserData {
valid_tokens_since: Date; // all tokens with a previous issue date are invalid
relationships: Relationship[];
@ -138,6 +140,7 @@ export const UserSchema = new Schema({
premium: Boolean,
premium_type: Number,
bot: Boolean,
bio: String,
system: Boolean,
nsfw_allowed: Boolean,
mfa_enabled: Boolean,

View File

@ -79,6 +79,7 @@ export interface DefaultOptions {
};
};
security: {
requestSignature: string;
jwtSecret: string;
forwadedFor: string | null; // header to get the real user ip address
captcha: {
@ -93,7 +94,7 @@ export interface DefaultOptions {
};
register: {
email: {
necessary: boolean;
necessary: boolean; // we have to use necessary instead of required as the cli tool uses json schema and can't use required
allowlist: boolean;
blocklist: boolean;
domains: string[];
@ -164,6 +165,7 @@ export const DefaultOptions: DefaultOptions = {
},
},
security: {
requestSignature: crypto.randomBytes(32).toString("base64"),
jwtSecret: crypto.randomBytes(256).toString("base64"),
forwadedFor: null,
// forwadedFor: "X-Forwarded-For" // nginx/reverse proxy