/* ======================================================================== * Copyright (c) 2005-2025 The OPC Foundation, Inc. All rights reserved. * * OPC Foundation MIT License 1.00 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * The complete license agreement can be found here: * http://opcfoundation.org/License/MIT/1.00/ * ======================================================================*/ using System; using System.Threading; using System.Threading.Tasks; namespace Opc.Ua { /// /// Provider of material for a single /// . The store decides how the bytes are /// persisted, materialised, and released. /// /// /// /// Stores are typically registered with an /// which dispatches lookups by /// . /// /// /// is intentionally NOT /// in this API revision; secure-memory /// management of cached secrets is the implementation's concern and /// will be expanded in a follow-up phase. /// /// public interface ISecretStore { /// /// The store-type discriminator — must match /// for entries this /// store serves (e.g. "InMemory"). /// string StoreType { get; } /// /// Synchronous fast-path lookup. Returns a fresh /// when the secret is materially present /// without I/O (e.g. cache hit), or if a /// store call would be required. /// /// /// Callers that want guaranteed lookup (cache + cold path) should /// use instead. The returned secret MUST /// be disposed by the caller. /// ISecret? TryGet(SecretIdentifier id); /// /// Resolves a secret, falling through to the store's cold path /// when no in-memory copy is available. Implementations that can /// answer synchronously should return a completed /// with no allocation. /// /// /// A fresh the caller must dispose, or /// when the identifier is unknown. /// ValueTask GetAsync( SecretIdentifier id, CancellationToken ct = default); /// /// Stores or replaces the bytes for the supplied identifier. /// ValueTask SetAsync( SecretIdentifier id, ReadOnlyMemory bytes, CancellationToken ct = default); /// /// Removes the secret if present. /// /// /// when an entry was removed, /// when the identifier was unknown. /// ValueTask RemoveAsync( SecretIdentifier id, CancellationToken ct = default); } }