public async Task RemoveValueAsync(string context, string key) { var ctx = DeserializeContext(context); key = key ?? throw new SecureStoreException(); _dsvClient = await _clientFactory.GetClient(ctx); await _dsvClient.DeleteSecretAsync(key); }
public async Task <string> GetValueAsync(string context, string key) { var ctx = DeserializeContext(context); key = key ?? throw new SecureStoreException(); _dsvClient = await _clientFactory.GetClient(ctx); var response = await _dsvClient.GetSecretAsync(key); return(response?.Data["password"].ToString()); }
public async Task <string> CreateValueAsync(string context, string key, string value) { var ctx = DeserializeContext(context); value = value ?? throw new ArgumentNullException(nameof(value)); _dsvClient = await _clientFactory.GetClient(ctx); var response = await _dsvClient.CreateSecretAsync(key, value); return(response); }
public async Task ValidateContextAsync(string context) { var id = Guid.NewGuid(); var ctx = DeserializeContext(context); _dsvClient = await _clientFactory.GetClient(ctx); var response = await _dsvClient.CreateSecretAsync($"validate:{id}", id.ToString()); await _dsvClient.DeleteSecretAsync(response); }
public async Task <string> UpdateValueAsync(string context, string key, string oldAugumentedKey, string value) { var ctx = DeserializeContext(context); key = key ?? throw new SecureStoreException(); _dsvClient = await _clientFactory.GetClient(ctx); var response = await _dsvClient.UpdateSecretAsync(key, oldAugumentedKey, value); return(response); }
public async Task <Credential> GetCredentialsAsync(string context, string key) { var ctx = DeserializeContext(context); key = key ?? throw new SecureStoreException(); _dsvClient = await _clientFactory.GetClient(ctx); var response = await _dsvClient.GetSecretAsync(key); return(new Credential() { Username = response.Data["username"].ToString(), Password = response.Data["password"].ToString(), }); }