aboutsummaryrefslogtreecommitdiff
path: root/lib/VNLib.Plugins.Extensions.Loading/src
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-09-08 23:21:30 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2023-09-08 23:21:30 -0400
commit3cf5bf80e4feea06728947f20657d49268b785d5 (patch)
tree4f8d6b2269c5d7f7bfc148b6e41d831760f7c6b1 /lib/VNLib.Plugins.Extensions.Loading/src
parentbf01b244f3bf2aa3c236fb86c0d75c261f54b334 (diff)
Password hashing updates & async resource updates
Diffstat (limited to 'lib/VNLib.Plugins.Extensions.Loading/src')
-rw-r--r--lib/VNLib.Plugins.Extensions.Loading/src/ManagedPasswordHashing.cs23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/VNLib.Plugins.Extensions.Loading/src/ManagedPasswordHashing.cs b/lib/VNLib.Plugins.Extensions.Loading/src/ManagedPasswordHashing.cs
index 3489789..e382681 100644
--- a/lib/VNLib.Plugins.Extensions.Loading/src/ManagedPasswordHashing.cs
+++ b/lib/VNLib.Plugins.Extensions.Loading/src/ManagedPasswordHashing.cs
@@ -131,18 +131,22 @@ namespace VNLib.Plugins.Extensions.Loading
//Convert to dict
IReadOnlyDictionary<string, JsonElement> hashingArgs = el.EnumerateObject().ToDictionary(static k => k.Name, static v => v.Value);
- //Get hashing arguments
- uint saltLen = hashingArgs["salt_len"].GetUInt32();
- uint hashLen = hashingArgs["hash_len"].GetUInt32();
- uint timeCost = hashingArgs["time_cost"].GetUInt32();
- uint memoryCost = hashingArgs["memory_cost"].GetUInt32();
- uint parallelism = hashingArgs["parallelism"].GetUInt32();
+ Argon2ConfigParams p = new()
+ {
+ HashLen = hashingArgs["hash_len"].GetUInt32(),
+ MemoryCost = hashingArgs["memory_cost"].GetUInt32(),
+ Parallelism = hashingArgs["parallelism"].GetUInt32(),
+ SaltLen = (int)hashingArgs["salt_len"].GetUInt32(),
+ TimeCost = hashingArgs["time_cost"].GetUInt32()
+ };
+
//Load passwords
- Passwords = new(this, (int)saltLen, timeCost, memoryCost, parallelism, hashLen);
+ Passwords = PasswordHashing.Create(this, in p);
}
else
{
- Passwords = new(this);
+ //Load passwords with default config
+ Passwords = PasswordHashing.Create(this, new Argon2ConfigParams());
}
//Get the pepper from secret storage
@@ -152,7 +156,8 @@ namespace VNLib.Plugins.Extensions.Loading
public SecretProvider(PluginBase plugin)
{
- Passwords = new(this);
+ //Load passwords with default config
+ Passwords = PasswordHashing.Create(this, new Argon2ConfigParams());
//Get the pepper from secret storage
_pepper = plugin.GetSecretAsync(LoadingExtensions.PASSWORD_HASHING_KEY)