private static IStorage InitStorageWithEncryptionSecret() { var config = CredentialsHelper.GetConfigWithOauth(); var secretData = SecretsDataGenerator.FromPassword("<Str0ng_p@ssworD!"); config.SecretKeyAccessor = () => secretData; return(Storage.NewStorage(config)); }
private static IStorage InitStorageWithoutHashing() { var config = CredentialsHelper.GetConfigWithOauth(); var secretData = SecretsDataGenerator.FromPassword("<vEry-Str0ng_p@ssworD!_StorageWithoutHashing"); config.SecretKeyAccessor = () => secretData; config.HashSearchKeys = false; return(Storage.NewStorage(config)); }
private static IStorage InitStorageWithEncryptionKey() { var config = CredentialsHelper.GetConfigWithOauth(); var encryptionKey = new EncryptionKey(1, Encoding.UTF8.GetBytes("123456789012345678901234567890Ab")); var secretData = new SecretsData(new List <Secret> { encryptionKey }, encryptionKey); config.SecretKeyAccessor = () => secretData; return(Storage.NewStorage(config)); }
private static IStorage InitStorageWithCustomCipher() { var cipher = new FernetCipher("Fernet cipher demo"); using var provider = new CryptoProvider(cipher); var key = new CustomEncryptionKey(7, Encoding.UTF8.GetBytes("Custom Encryption Key 32 symbols")); var secretData = new SecretsData(new List <Secret> { key }, key); var config = CredentialsHelper.GetConfigWithOauth(); config.CryptoProvider = provider; config.SecretKeyAccessor = () => secretData; return(Storage.NewStorage(config)); }
public LowLevelHttpTest() { _client = new HttpClient(); _client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(VersionInfo.ProductName, VersionInfo.ProductVersion)); var config = CredentialsHelper.GetConfigWithOauth(); var tokenClient = new OAuthTokenClient(config.DefaultAuthEndpoint, null, config.EnvironmentId, config.ClientId, config.ClientSecret, _client); var endpoint = "https://" + CredentialsHelper.GetMidPopCountry() + config.EndpointMask; var token = tokenClient.RefreshTokenAsync(true, endpoint, "emea").Result; _client.DefaultRequestHeaders.TryAddWithoutValidation("x-env-id", config.EnvironmentId); _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); _endpoint = endpoint + "/v2/storage/records/" + CredentialsHelper.GetMidPopCountry(); _countiesEndpoint = config.CountriesEndPoint; }
private static IStorage InitPteStorage() { var config = CredentialsHelper.GetConfigWithOauth(); return(Storage.NewStorage(config)); }