UNPKG

@rollercoaster-dev/rd-logger

Version:

A neurodivergent-friendly logger for Rollercoaster.dev projects

39 lines (38 loc) 1.24 kB
/** * A wrapper class for sensitive values that prevents them from being accidentally logged */ export declare class SensitiveValue<T> { private readonly value; private readonly redactedValue; /** * Create a new SensitiveValue * @param value The sensitive value to wrap * @param redactedValue The value to show instead of the actual value (default: '[REDACTED]') */ constructor(value: T, redactedValue?: string); /** * Get the actual sensitive value * Only use this method when you absolutely need the actual value for operations * @returns The actual sensitive value */ getValue(): T; /** * Override toString to return the redacted value */ toString(): string; /** * Override toJSON to return the redacted value */ toJSON(): string; /** * Override valueOf to return the redacted value */ valueOf(): string; /** * Factory method to create a new SensitiveValue * @param value The sensitive value to wrap * @param redactedValue The value to show instead of the actual value * @returns A new SensitiveValue instance */ static from<T>(value: T, redactedValue?: string): SensitiveValue<T>; }