PeekRedactionPolicy class final

Which headers, query parameters and body keys Peek masks before storing a call, so secrets never sit in memory or reach the screen.

Peek masks nothing until it is asked to, through the redaction option; the default constructor is the policy worth asking for, since it covers the usual names. Names match case-insensitively and exactly, and your own go alongside the built-in ones:

PeekRedactionPolicy(
  headerNames: {...PeekRedactionPolicy.defaultHeaderNames, 'x-session'},
)
Annotations

Constructors

PeekRedactionPolicy({Set<String> headerNames = defaultHeaderNames, Set<String> queryKeys = defaultQueryKeys, Set<String> bodyKeys = defaultBodyKeys, String replacement = defaultReplacement})
Creates a policy; every set defaults to Peek's built-in list.
const

Properties

bodyKeys → Set<String>
Keys to mask in JSON bodies, at any depth, and in form fields.
final
hashCode → int
The hash code for this object.
no setteroverride
headerNames → Set<String>
Header names to mask. cookie and set-cookie keep their cookie names and attributes; only the values go.
final
isEmpty → bool
Whether the policy masks nothing at all.
no setter
queryKeys → Set<String>
Query parameter names to mask, in URLs and URL-encoded bodies.
final
replacement → String
The text a masked value becomes.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({Set<String>? headerNames, Set<String>? queryKeys, Set<String>? bodyKeys, String? replacement}) → PeekRedactionPolicy
A copy with the given fields replaced.
matchesBodyKey(String name) → bool
Whether the body key called name is masked.
matchesHeader(String name) → bool
Whether the header called name is masked.
matchesQuery(String name) → bool
Whether the query parameter called name is masked.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Constants

defaultBodyKeys → const Set<String>
JSON and form keys masked by default.
defaultHeaderNames → const Set<String>
Headers masked by default.
defaultQueryKeys → const Set<String>
Query parameters masked by default.
defaultReplacement → const String
What masked values are replaced with. ASCII, so it survives a URL.
none → const PeekRedactionPolicy
Masks nothing.