ServerProtector

open class ServerProtector

The ServerProtector class is useful to protect the server from the unauthorized accesses This class will generate a secret to share with the users allowed to use this server

Author

N7ghtm4r3 - Tecknobit

Since

2.2.0

Constructors

Link copied to clipboard
constructor(storagePath: String, saveMessage: String)
Constructor to init the ServerProtector

Properties

DELETE_SERVER_SECRET_AND_INTERRUPT_COMMAND command to delete the current server secret and interrupt the server workflow
Link copied to clipboard
DELETE_SERVER_SECRET_COMMAND command to delete the current server secret
Link copied to clipboard
preferences instance to manage the storage of the server secret
Link copied to clipboard
RECREATE_SERVER_SECRET_COMMAND command to recreate the server secret
Link copied to clipboard
private val saveMessage: String
saveMessage the message to print when the server secret has been generated the start of the message is "Note: is not an error, but is an alert!
Link copied to clipboard
val SERVER_SECRET_KEY: String = "server_secret"
SERVER_SECRET_KEY the server secret key

Functions

Link copied to clipboard
Method to delete the current server secret No-any params required
open fun deleteServerSecret(interruptRuntime: Boolean)
Method to delete the current server secret
Link copied to clipboard
Method to generate and store a new server secret No-any params required
Link copied to clipboard
private open fun getCurrentServerSecret(): String
Method to get the current server secret No-any params required
Link copied to clipboard
private open fun hash(serverSecret: String): String
Method to hash a server secret
Link copied to clipboard
open fun launch(args: Array<String>)
Method to launch the server protector
Link copied to clipboard
Method to regenerate and store a new server secret, overwriting the current secret No-any params required
Link copied to clipboard
open fun serverSecretMatches(serverSecretToCompare: String): Boolean
Method to compare a server secret with the current stored by the server
Link copied to clipboard
private open fun storeServerSecret(serverSecret: String)
Method to store a new server secret