socio
Version:
A WebSocket Real-Time Communication (RTC) API framework.
41 lines (40 loc) • 1.79 kB
TypeScript
import MagicString from 'magic-string';
import { type CipherGCMTypes } from 'crypto';
import { LogHandler } from './logging.js';
import type { LoggingOpts } from './types.d.ts';
export type SocioSecurityOptions = {
secure_private_key: Buffer | string;
rand_int_gen?: ((min: number, max: number) => number);
} & LoggingOpts;
export type SocioSecurityPluginOptions = {
include_file_types?: string[];
exclude_file_types?: string[];
exclude_svelte_server_files?: boolean;
exclude_regex?: RegExp;
};
export declare function SocioSecurityVitePlugin(SocioSecurityOptions: SocioSecurityOptions, { include_file_types, exclude_file_types, exclude_svelte_server_files, exclude_regex }?: SocioSecurityPluginOptions): {
name: string;
enforce: string;
transform(code: string, id: string): {
code: string;
map: import("magic-string").SourceMap;
} | undefined;
};
export declare class SocioSecurity extends LogHandler {
#private;
static iv_counter: number;
verbose: boolean;
constructor({ secure_private_key, rand_int_gen, logging }: SocioSecurityOptions);
SecureSouceCode(source_code?: string, file_path?: string): MagicString;
EncryptString(str?: string): string;
DecryptString(iv_base64: string, cipher_text: string, auth_tag_base64: string): string;
EncryptSocioString(sql?: string): string;
RemoveRandInts(randint_sql?: string): string;
GenRandInt(min?: number, max?: number): number;
get supportedCiphers(): string[];
get defaultCipher(): CipherGCMTypes;
get_next_iv(): Buffer;
}
export declare function StringToByteBuffer(str: string): Buffer;
export declare function GenRandomBytes(size: number): Buffer;
export declare function UUID(): `${string}-${string}-${string}-${string}-${string}`;