|
|
| PasswordValue () noexcept=default |
| | Construct an unavailable identity without allocating protected storage.
|
| | PasswordValue (const PasswordValue &other) noexcept=default |
| | Retain the same identity without copying plaintext.
|
| PasswordValue & | operator= (const PasswordValue &other) noexcept=default |
| | Replace this handle with the same identity as other.
|
| | PasswordValue (PasswordValue &&other) noexcept=default |
| | Transfer identity, leaving other unavailable.
|
| PasswordValue & | operator= (PasswordValue &&other) noexcept |
| | Transfer identity, leaving other unavailable except on self-move.
|
|
| ~PasswordValue () noexcept=default |
| | Release this identity; the last owner wipes/releases protected storage.
|
| std::size_t | size () const noexcept |
| bool | empty () const noexcept |
| bool | available () const noexcept |
| SecureStringOptions | options () const noexcept |
| SecureStringCapabilities | capabilities () const noexcept |
| bool | operator== (const PasswordValue &other) const noexcept=default |
| | Compare identities without borrowing, decrypting or comparing secret bytes.
|
template<class F>
requires detail::SecretCallback<F> |
| auto | withPlaintext (F &&callback) const -> std::expected< void, PasswordValueAccessFailure< typename detail::SecretCallbackResult< std::invoke_result_t< std::decay_t< F > &, SecretView > >::Error > > |
| | Borrow read-only plaintext synchronously on the creating thread.
|
Copyable identity of immutable logical bytes in protected native storage.
Copies share one protected value; equal bytes created separately have different identities. Retained snapshots can outlive a widget or model. Replacing the last external handle during a callback does not end its active lease. Copy, move, comparison and destruction do not allocate or invoke application/UI callbacks.
Creation requires native guarded storage and idle encryption, without fallback. Bytes are opaque, including zeroes; Unicode validation belongs to the editor. Only the creating thread may borrow plaintext. Separate handles and immutable metadata may be retained on other threads; simultaneous access to the same handle still requires caller synchronization. A cryptographic failure can make every shared identity unavailable; immutable logical content does not promise immutable availability. Input bytes, callback copies and escaped views remain the caller's responsibility; length is public metadata.
template<class F>
requires detail::SecretCallback<F>
| auto portals::PasswordValue::withPlaintext |
( |
F && | callback | ) |
const -> std::expected< void, PasswordValueAccessFailure< typename detail::SecretCallbackResult< std::invoke_result_t< std::decay_t< F > &, SecretView > >::Error > > |
|
inlinenodiscard |
Borrow read-only plaintext synchronously on the creating thread.
- Template Parameters
-
| F | Copyable lvalue or movable rvalue callable returning void or expected<void,E>. |
- Parameters
-
| callback | Callable owned under the SecureString busy gate before decryption. |
- Returns
- Independent ownership, storage, typed callback and cleanup failures.
State is retained before callable capture or invocation, either of which may destroy the external owner. Wrong-thread calls do not touch protected storage or capture the callable. Nested access to the same identity returns BUSY. If this frame is the last owner after invocation, it checks final retirement. Other retained handles use ordinary noexcept destructor cleanup when released; a concurrent release after the ownership check can also take that path. Views are valid only during invocation. Callback and cleanup guarantees, including owning error constraints, are those of SecureString::withPlaintext.