Skip to main content
Table of Contents

Interface ISecureJsonSerializer

Namespace
Stratara.Abstractions.Security
Assembly
Stratara.Abstractions.dll

JSON serializer that automatically encrypts properties marked with EncryptDataAttribute using a key resolved from IKeyStore for the supplied tenant + user scope.

public interface ISecureJsonSerializer
Extension Methods

Methods

DeserializeAsync(string, Type, Guid?, Guid?, CancellationToken)

Task<object?> DeserializeAsync(string json, Type returnType, Guid? tenantId = null, Guid? userId = null, CancellationToken cancellationToken = default)

Parameters

json string
returnType Type
tenantId Guid?
userId Guid?
cancellationToken CancellationToken

Returns

Task<object>

DeserializeAsync<T>(string, Guid?, Guid?, CancellationToken)

Deserialise json, decrypting any encrypted properties for the given scope.

Task<T?> DeserializeAsync<T>(string json, Guid? tenantId = null, Guid? userId = null, CancellationToken cancellationToken = default)

Parameters

json string
tenantId Guid?
userId Guid?
cancellationToken CancellationToken

Returns

Task<T>

Type Parameters

T

SerializeAsync(object, Guid?, Guid?, CancellationToken)

Task<string> SerializeAsync(object obj, Guid? tenantId = null, Guid? userId = null, CancellationToken cancellationToken = default)

Parameters

obj object
tenantId Guid?
userId Guid?
cancellationToken CancellationToken

Returns

Task<string>

SerializeAsync<T>(T, Guid?, Guid?, CancellationToken)

Serialise obj to JSON, encrypting properties marked for the given scope.

Task<string> SerializeAsync<T>(T obj, Guid? tenantId = null, Guid? userId = null, CancellationToken cancellationToken = default)

Parameters

obj T
tenantId Guid?
userId Guid?
cancellationToken CancellationToken

Returns

Task<string>

Type Parameters

T