xypriss-security
Version:
Advanced High-Performance Security Framework. Military-grade encryption, post-quantum resilience, and fortified data structures.
50 lines • 2.08 kB
TypeScript
/***************************************************************************
* XyPriss Security Core - Hash Class
****************************************************************************/
import { HashOptions, HMACAlgorithm } from "../types";
import { SecureBuffer } from "./SecureBuffer";
/**
* ### Hash Class
*
* Provides high-performance hashing and HMAC operations powered by the Go core.
*/
export declare class Hash {
/**
* Creates a secure hash of the provided input data.
*
* @param input - The string or buffer data to be hashed.
* @param options - Configuration for the hashing algorithm and output format.
* @returns The resulting hash as a string or SecureBuffer.
*/
static create(input: string | Uint8Array, options?: HashOptions): string | SecureBuffer;
/**
* Generates a PKCE code challenge from a code verifier.
*
* @param verifier - The code verifier string.
* @param method - The challenge method (default: 'S256').
* @returns The generated code challenge.
*/
static pkce(verifier: string, method?: "S256" | "plain"): string;
/**
* Creates a Message Authentication Code (HMAC) using a secret key.
*
* @param key - The secret key used for authentication.
* @param data - The data to be authenticated.
* @param algo - The HMAC algorithm (default: "sha256").
* @returns The resulting HMAC signature as a hex string.
*/
static hmac(key: string | Uint8Array, data: string | Uint8Array, algo?: string): string;
/**
* Compares two buffers in constant time to prevent timing attacks.
*
* @param a - First buffer to compare.
* @param b - Second buffer to compare.
* @returns True if buffers are equal, false otherwise.
*/
static timingSafeEqual(a: Uint8Array, b: Uint8Array): boolean;
/**
* Legacy alias for hmac with proper typing.
*/
static createSecureHMAC(algo: HMACAlgorithm | string, key: string | Uint8Array, data: string | Uint8Array): string;
}
//# sourceMappingURL=Hash.d.ts.map