Skip to content
Meshline
SDK 1.1.0 · TypeView source on GitHub

Developer guide · API index

Members on this page

Meshline.Sdk

Meshline.Interactions

ISecretProtector Interface

Protects and restores locally stored secrets using an application-defined protection mechanism.

public interface ISecretProtector

Remarks

Protection applies to selected stored secrets, not to the entire SQLite database. The application must preserve the ability to unprotect persisted data across restarts and enforce the purpose binding in its implementation.

Methods

ISecretProtector.ProtectAsync(ReadOnlyMemory<byte>, string, CancellationToken) Method

Protects plaintext secret bytes for local storage under the specified purpose.

System.Threading.Tasks.Task<byte[]> ProtectAsync(System.ReadOnlyMemory<byte> plaintext, string purpose, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters

plaintext System.ReadOnlyMemory<System.Byte>

The plaintext content bytes.

purpose System.String

A stable purpose string binding protection to its intended use; pass the same value when restoring the secret.

cancellationToken System.Threading.CancellationToken

A token that can cancel the operation.

Returns

System.Threading.Tasks.Task<System.Byte[]>
The opaque protected representation to persist instead of the plaintext secret.

Exceptions

System.OperationCanceledException
The operation observes cancellation of cancellationToken.

ISecretProtector.UnprotectAsync(ReadOnlyMemory<byte>, string, CancellationToken) Method

Restores plaintext secret bytes previously protected under the same purpose.

System.Threading.Tasks.Task<byte[]> UnprotectAsync(System.ReadOnlyMemory<byte> protectedData, string purpose, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters

protectedData System.ReadOnlyMemory<System.Byte>

The opaque bytes produced by the matching protection operation.

purpose System.String

A stable purpose string binding protection to its intended use; pass the same value when restoring the secret.

cancellationToken System.Threading.CancellationToken

A token that can cancel the operation.

Returns

System.Threading.Tasks.Task<System.Byte[]>
The restored plaintext secret bytes; the caller is responsible for their lifetime.

Exceptions

System.OperationCanceledException
The operation observes cancellation of cancellationToken.