DataHandler.DataRequest
A system focused on creating a reliable system for data sharing between programs (outside of named pipes).
Types
SecuritySettings
Global configuration for directory- and session-related timeouts and keys.
-
Properties (static):
- SecureData PublicKey — Key used to encrypt/decrypt metadata (default "Default").
- double ExpiryDuration — Untrusted session/file validity in minutes (default 540).
- double TrustedExpiryDuration — Trusted validity in minutes (default 20160).
- int FailRecoveryCheck — Max allowed recovery failures before lockout (default 5).
- double TimeToNextRecovery — Lockout duration in minutes after too many failures (default 20).
-
Methods (static):
- SetPublicKey(string newKey, bool makeReadOnly = true)
- SetExpiryDuration(double minutes)
- SetTrustedExpiryDuration(double minutes)
- SetFailRecoveryCheck(int count)
- SetTimeToNextRecovery(double minutes)
DirectoryData
Holds common filesystem paths for a given “service” installation.
-
Properties:
- string CompanyPath
- string MainServicePath
- string ServiceParent
- string Author
- string Software
- string UserSharedResources
- string UserFolder
- string ExePath
- string Program
-
Constructors:
DirectoryData() { }
DirectoryData(
string companyPath,
string mainServicePath,
string serviceParent,
string author,
string software,
string userSharedResources,
string userFolder,
string exePath,
string program
)
EncryptedTier
Encapsulates a per-tier encrypted key and its signatures.
-
Properties:
- byte[] SignedEncryptedTier — Signature over the tier identifier.
- string EncryptedTierPass — AES-encrypted tier password (Base64).
- byte[] SignedTierPass — Signature over the raw tier password.
-
Constructors:
EncryptedTier() { }
EncryptedTier(byte[] signedEncryptedTier, string encryptedTierPass, byte[] signedTierPass)
Methods
GetExecutablePathAsync(string command)
Finds the full path of an executable on the system.
- Parameters:
- command: The program name (e.g. "dotnet").
- Returns: Task<string?> — First matching path, or null if not found.
IsFileWithinDirectoryAsync(string filePath, string baseDirectory)
Checks whether filePath resides under baseDirectory.
- Parameters:
- filePath, baseDirectory.
- Returns: Task.
GetPaths(SecureData identifier, string software, string author, string programName, string serviceParent, string basePath)
Builds standard folder layout under %LocalAppData%{author}.
- Parameters:
- identifier: User or instance ID.
- software, author, programName, serviceParent.
- basePath: Where the user's system is setup
- Returns: Task with all constructed paths.
CheckMainPathValidity(DirectoryData data, SecureData? PublicKey)
Verifies “CORE.json” integrity by checking a signed “mother path” entry.
- Parameters:
- data: DirectoryData containing MainServicePath.
- PublicKey: Key to decrypt and verify signatures.
- Returns: Task.
ValidateProgram(DirectoryData data, string programName, SecureData? PublicKey)
Ensures the executable for programName resides within MainServicePath.
- Returns: Task.
CreateNewSystem(string username, SecureData identifier, SecureData password, string software, string author, string exePath, string serviceParent, int tiers, SecureData? PublicKey, string basePath)
Bootstraps a brand-new “service” instance:
- Creates directory hierarchy under basePath{author}{serviceParent}{software}.
- Writes CORE.json containing public key and signatures for service path & author.
- Creates a secret-bank (SecretManager.CreateBank) under UserSharedResources.
- Generates tiers number of encrypted tier keys & signatures, saves to Data Tiers.json.
- Initializes Allowed Programs and Blacklisted Programs JSON files.
- Delegates user/account creation via AccountsWithSessions.
- Returns: Task — Recovery key or session identifier from the created account.
CreateNewApp(string username, SecureData password, string Directory, DirectoryData directories, string tier, SecureData? PublicKey)
Registers a new application under an existing “service”:
- Validates main service signature and path.
- Checks that directories.Software is not blacklisted.
- Verifies tier signature from Data Tiers.json.
- Adds the app to Allowed Programs.json.
- Invokes CreateUser in the service’s directory.
- Returns: Task — Recovery/session key for the new app account.
AddToBlacklist(string softwareName, ConnectedSessionReturn connSession, string mainServicePath, SecureData PublicKey)
Marks a program as blacklisted:
- Throws: if already blacklisted.
RemoveFromBlacklist(string softwareName, ConnectedSessionReturn connSession, string mainServicePath, SecureData PublicKey)
Removes a program from the blacklist:
- Throws: if not present.
RemoveAccount(string softwareName, ConnectedSessionReturn connSession, string mainServicePath, SecureData PublicKey)
Removes an allowed program entry:
- Throws: if the program is not in Allowed Programs.json.
VerifySessionIntegrity(DirectoryData data, ConnectedSessionReturn connSession, string mainServicePath, SecureData PublicKey)
Composite check that both:
- Main path validity (CheckMainPathValidity), and
- Session validity (ValidateSession from AccountsWithSessions),
are still intact. Throws on failure.