diff options
author | vnugent <public@vaughnnugent.com> | 2024-03-21 14:36:12 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-03-21 14:36:12 -0400 |
commit | 0103116bdc79d2ea8cfeba99d78fed976373f0da (patch) | |
tree | 8b91e29f749e0425327a42032de314724e29399c /lib/VNLib.Plugins.Extensions.Loading/src/Secrets/VaultSecrets.cs | |
parent | 2c07ebbbcfdbc0989685de2af85adb0dcf731d30 (diff) |
chore: Update core ReadonlyJWK deserialization
Diffstat (limited to 'lib/VNLib.Plugins.Extensions.Loading/src/Secrets/VaultSecrets.cs')
-rw-r--r-- | lib/VNLib.Plugins.Extensions.Loading/src/Secrets/VaultSecrets.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/VNLib.Plugins.Extensions.Loading/src/Secrets/VaultSecrets.cs b/lib/VNLib.Plugins.Extensions.Loading/src/Secrets/VaultSecrets.cs index a5ba550..9be74ee 100644 --- a/lib/VNLib.Plugins.Extensions.Loading/src/Secrets/VaultSecrets.cs +++ b/lib/VNLib.Plugins.Extensions.Loading/src/Secrets/VaultSecrets.cs @@ -214,7 +214,7 @@ namespace VNLib.Plugins.Extensions.Loading /// <exception cref="ArgumentNullException"></exception> public static PrivateKey GetPrivateKey(this ISecretResult secret) { - _ = secret ?? throw new ArgumentNullException(nameof(secret)); + ArgumentNullException.ThrowIfNull(secret); return new PrivateKey(secret); } @@ -228,15 +228,15 @@ namespace VNLib.Plugins.Extensions.Loading /// <exception cref="ArgumentNullException"></exception> public static ReadOnlyJsonWebKey GetJsonWebKey(this ISecretResult secret) { - _ = secret ?? throw new ArgumentNullException(nameof(secret)); - + ArgumentNullException.ThrowIfNull(secret); + //Alloc buffer, utf8 so 1 byte per char using IMemoryHandle<byte> buffer = MemoryUtil.SafeAlloc<byte>(secret.Result.Length); //Get utf8 bytes int count = Encoding.UTF8.GetBytes(secret.Result, buffer.Span); - return new ReadOnlyJsonWebKey(buffer.Span[..count]); + return ReadOnlyJsonWebKey.FromUtf8Bytes(buffer.Span[..count]); } #nullable disable |