<T>(self: Redacted<T>): booleanDeletes the stored value for a Redacted wrapper, making future
Redacted.value calls on that wrapper fail.
When to use
Use when a Redacted wrapper should no longer be able to reveal its stored
value.
Gotchas
This unsafe operation does not zero memory and does not affect other references to the original value. It only removes the value from the internal redacted registry.
Example (Wiping a redacted value)
import { Redacted } from "effect"
import * as assert from "node:assert"
const API_KEY = Redacted.make("1234567890")
assert.equal(Redacted.value(API_KEY), "1234567890")
Redacted.wipeUnsafe(API_KEY)
assert.throws(
() => Redacted.value(API_KEY),
new Error("Unable to get redacted value")
)export const const wipeUnsafe: <T>(
self: Redacted<T>
) => boolean
Deletes the stored value for a Redacted wrapper, making future
Redacted.value calls on that wrapper fail.
When to use
Use when a Redacted wrapper should no longer be able to reveal its stored
value.
Gotchas
This unsafe operation does not zero memory and does not affect other
references to the original value. It only removes the value from the
internal redacted registry.
Example (Wiping a redacted value)
import { Redacted } from "effect"
import * as assert from "node:assert"
const API_KEY = Redacted.make("1234567890")
assert.equal(Redacted.value(API_KEY), "1234567890")
Redacted.wipeUnsafe(API_KEY)
assert.throws(
() => Redacted.value(API_KEY),
new Error("Unable to get redacted value")
)
wipeUnsafe = <function (type parameter) T in <T>(self: Redacted<T>): booleanT>(self: Redacted<T>(parameter) self: {
label: string | undefined;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
self: interface Redacted<out A = string>A wrapper for sensitive values whose string, JSON, and inspection output is
redacted.
When to use
Use to carry sensitive values while reducing accidental exposure in string,
JSON, and inspection output.
Gotchas
The underlying value is still stored in memory and can be recovered with
Redacted.value until the wrapper is wiped or becomes unreachable. Use
Redacted to reduce accidental disclosure in logs and diagnostics, not as a
cryptographic protection mechanism.
Example (Creating redacted values)
import { Redacted } from "effect"
// Create a redacted value to protect sensitive information
const apiKey = Redacted.make("secret-key")
const userPassword = Redacted.make("user-password")
// TypeScript will infer the types as Redacted<string>
Namespace containing type-level members associated with Redacted values.
When to use
Use to access type-level helpers associated with Redacted.
Example (Using namespace utilities)
import { Redacted } from "effect"
// Use the Redacted namespace for type-level operations
const secret = Redacted.make("my-secret")
// The namespace contains utilities for working with Redacted values
const isRedacted = Redacted.isRedacted(secret) // true
Redacted<function (type parameter) T in <T>(self: Redacted<T>): booleanT>): boolean => import redactedredacted.const redactedRegistry: WeakMap<
Redacted<any>,
any
>
redactedRegistry.WeakMap<Redacted<any>, any>.delete(key: Redacted<any>): booleanRemoves the specified element from the WeakMap.
delete(self: Redacted<T>(parameter) self: {
label: string | undefined;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
self)