/// <summary> /// Create a new DateOfBirth string to be aliased within static vault /// </summary> /// <param name="dateOfBirth"></param> /// <param name="year"></param> /// <param name="month"></param> /// <param name="tags"></param> /// <returns>Returns a promise containing: id, dateOfBirth, dateOfBirthAlias, tags, iv, authTag, tags, createdAt</returns> public async Task <DateOfBirthResponse> Create(string dateOfBirth, int?year = null, int?month = null, List <string> tags = null) { var result = _vault.Encrypt(dateOfBirth); var payload = new DateOfBirthRequest { DateOfBirth = result.EncryptedData, DateOfBirthHash = _vault.Hash(dateOfBirth), Tags = tags, Iv = result.Iv, AuthTag = result.AuthTag }; var url = $"/vault/static/{_vault.VaultId}/dateofbirth?"; if (year != null) { url += $"year={year}"; } if (month != null) { url += year != null ? "&" : "" + $"month={month}"; } var response = await _vault.Client.Post <DateOfBirthRequest, DateOfBirthResponse>(url, payload); response.DateOfBirth = _vault.Decrypt(response.Iv, response.AuthTag, response.DateOfBirth); return(response); }
/// <summary> /// Create a new VehicleRegistration string to be aliased within static vault /// </summary> /// <param name="vehicleregistration"></param> /// <param name="tags"></param> /// <returns>Returns a promise containing: id, vehicleRegistration, vehicleRegistrationAlias, tags, iv, authTag, tags, createdAt</returns> public async Task <VehicleRegistrationResponse> Create(string vehicleregistration, List <string> tags = null) { var result = _vault.Encrypt(vehicleregistration); var payload = new VehicleRegistrationRequest { VehicleRegistration = result.EncryptedData, VehicleRegistrationHash = _vault.Hash(vehicleregistration), Iv = result.Iv, AuthTag = result.AuthTag }; var response = await _vault.Client.Post <VehicleRegistrationRequest, VehicleRegistrationResponse>($"/vault/static/{_vault.VaultId}/vehicleregistration", payload); response.VehicleRegistration = _vault.Decrypt(response.Iv, response.AuthTag, response.VehicleRegistration); return(response); }
/// <summary> /// Create a new TaxPayer string to be aliased within static vault /// </summary> /// <param name="taxpayer"></param> /// <param name="tags"></param> /// <returns>Returns a promise containing: id, taxPayer, taxPayerAlias, tags, iv, authTag, tags, createdAt</returns> public async Task <TaxPayerResponse> Create(string taxpayer, List <string> tags = null) { var result = _vault.Encrypt(taxpayer); var payload = new TaxPayerRequest { TaxPayer = result.EncryptedData, TaxPayerHash = _vault.Hash(taxpayer), Tags = tags, Iv = result.Iv, AuthTag = result.AuthTag }; var response = await _vault.Client.Post <TaxPayerRequest, TaxPayerResponse>($"/vault/static/{_vault.VaultId}/taxpayer", payload); response.TaxPayer = _vault.Decrypt(response.Iv, response.AuthTag, response.TaxPayer); return(response); }
/// <summary> /// Create a new Race string to be aliased within static vault /// </summary> /// <param name="race"></param> /// <param name="tags"></param> /// <returns>Returns a promise containing: id, race, raceAlias, tags, iv, authTag, tags, createdAt</returns> public async Task <RaceResponse> Create(string race, List <string> tags = null) { var result = _vault.Encrypt(race); var payload = new RaceRequest { Race = result.EncryptedData, RaceHash = _vault.Hash(race), Tags = tags, Iv = result.Iv, AuthTag = result.AuthTag }; var response = await _vault.Client.Post <RaceRequest, RaceResponse>($"/vault/static/{_vault.VaultId}/race", payload); response.Race = _vault.Decrypt(response.Iv, response.AuthTag, response.Race); return(response); }
/// <summary> /// Create a new LastName string to be aliased within static vault /// </summary> /// <param name="passport"></param> /// <param name="tags"></param> /// <returns>Returns a promise containing: id, passport, passportAlias, tags, iv, authTag, tags, createdAt</returns> public async Task <PassportResponse> Create(string passport, List <string> tags = null) { var result = _vault.Encrypt(passport); var payload = new PassportRequest { Passport = result.EncryptedData, PassportHash = _vault.Hash(passport), Tags = tags, Iv = result.Iv, AuthTag = result.AuthTag }; var response = await _vault.Client.Post <PassportRequest, PassportResponse>($"/vault/static/{_vault.VaultId}/passport", payload); response.Passport = _vault.Decrypt(response.Iv, response.AuthTag, response.Passport); return(response); }
/// <summary> /// Create a new Random string to be aliased within static vault /// </summary> /// <param name="data"></param> /// <param name="tags"></param> /// <returns>Returns a promise containing: id, random, randomAlias, tags, iv, authTag, tags, createdAt</returns> public async Task <RandomResponse> Create(string data, List <string> tags = null) { var result = _vault.Encrypt(data); var payload = new RandomRequest { Data = result.EncryptedData, DataHash = _vault.Hash(data), Tags = tags, Iv = result.Iv, AuthTag = result.AuthTag }; var response = await _vault.Client.Post <RandomRequest, RandomResponse>($"/vault/static/{_vault.VaultId}/random", payload); response.Data = _vault.Decrypt(response.Iv, response.AuthTag, response.Data); return(response); }
/// <summary> /// Create a new Gender string to be aliased within static vault /// </summary> /// <param name="data"></param> /// <param name="regexTemplate"></param> /// <param name="tags"></param> /// <returns>Returns a promise containing: id, generic, genericAlias, tags, iv, authTag, tags, createdAt</returns> public async Task <GenericResponse> Create(string data, string regexTemplate, List <string> tags = null) { var result = _vault.Encrypt(data); var payload = new GenericRequest { Data = result.EncryptedData, DataHash = _vault.Hash(data), Template = regexTemplate, Tags = tags, Iv = result.Iv, AuthTag = result.AuthTag }; var response = await _vault.Client.Post <GenericRequest, GenericResponse>($"/vault/static/{_vault.VaultId}/generic", payload); response.Data = _vault.Decrypt(response.Iv, response.AuthTag, response.Data); return(response); }
/// <summary> /// Create a new Address string to be aliased for static vault /// </summary> /// <param name="address"></param> /// <param name="state"></param> /// <param name="tags"></param> /// <returns>Returns a promise containing: id, address, addressAlias, tags, iv, authTag, tags, createdAt</returns> public async Task <AddressResponse> Create(string address, string state = null, List <string> tags = null) { var result = _vault.Encrypt(address); var payload = new AddressRequest { Address = result.EncryptedData, AddressHash = _vault.Hash(address), Tags = tags, Iv = result.Iv, AuthTag = result.AuthTag }; var url = $"/vault/static/{_vault.VaultId}/address"; if (state != null) { url += $"/{state}"; } var response = await _vault.Client.Post <AddressRequest, AddressResponse>(url, payload); response.Address = _vault.Decrypt(response.Iv, response.AuthTag, response.Address); return(response); }
/// <summary> /// Create a new DriversLicense string to be aliased within static vault /// </summary> /// <param name="driversLicense"></param> /// <param name="state"></param> /// <param name="tags"></param> /// <returns>Returns a promise containing: id, driversLicense, driversLicenseAlias, tags, iv, authTag, tags, createdAt</returns> public async Task <DriversLicenseResponse> Create(string driversLicense, string state = null, List <string> tags = null) { var result = _vault.Encrypt(driversLicense); var payload = new DriversLicenseRequest { DriversLicense = result.EncryptedData, DriversLicenseHash = _vault.Hash(driversLicense), Tags = tags, Iv = result.Iv, AuthTag = result.AuthTag }; var url = $"/vault/static/{_vault.VaultId}/driverslicense"; if (state != null) { url += $"/{state}"; } var response = await _vault.Client.Post <DriversLicenseRequest, DriversLicenseResponse>(url, payload); response.DriversLicense = _vault.Decrypt(response.Iv, response.AuthTag, response.DriversLicense); return(response); }
/// <summary> /// Create a new SSN string to be aliased within static vault /// </summary> /// <param name="ssn"></param> /// <param name="state"></param> /// <param name="tags"></param> /// <returns>Returns a promise containing: id, ssn, ssnAlias, tags, iv, authTag, tags, createdAt</returns> public async Task <SsnResponse> Create(string ssn, string state = null, List <string> tags = null) { var result = _vault.Encrypt(ssn); var payload = new SsnRequest { Ssn = result.EncryptedData, SsnHash = _vault.Hash(ssn), Tags = tags, Iv = result.Iv, AuthTag = result.AuthTag }; var url = $"/vault/static/{_vault.VaultId}/ssn"; if (state != null) { url += $"/{state}"; } var response = await _vault.Client.Post <SsnRequest, SsnResponse>(url, payload); response.Ssn = _vault.Decrypt(response.Iv, response.AuthTag, response.Ssn); return(response); }
/// <summary> /// Create a new LastName string to be aliased within static vault /// </summary> /// <param name="lastname"></param> /// <param name="gender"></param> /// <param name="tags"></param> /// <returns>Returns a promise containing: id, lastName, lastNameAlias, tags, iv, authTag, tags, createdAt</returns> public async Task <LastNameResponse> Create(string lastname, string gender = null, List <string> tags = null) { var result = _vault.Encrypt(lastname); var payload = new LastNameRequest { LastName = result.EncryptedData, LastNameHash = _vault.Hash(lastname), Tags = tags, Iv = result.Iv, AuthTag = result.AuthTag }; var url = $"/vault/static/{_vault.VaultId}/lastname"; if (gender != null) { url += $"/{gender}"; } var response = await _vault.Client.Post <LastNameRequest, LastNameResponse>(url, payload); response.LastName = _vault.Decrypt(response.Iv, response.AuthTag, response.LastName); return(response); }
/// <summary> /// Create a new PlaceOfBirth string to be aliased within static vault /// </summary> /// <param name="placeofbirth"></param> /// <param name="state"></param> /// <param name="tags"></param> /// <returns>Returns a promise containing: id, placeOfBirth, placeOfBirthAlias, tags, iv, authTag, tags, createdAt</returns> public async Task <PlaceOfBirthResponse> Create(string placeofbirth, string state = null, List <string> tags = null) { var result = _vault.Encrypt(placeofbirth); var payload = new PlaceOfBirthRequest { PlaceOfBirth = result.EncryptedData, PlaceOfBirthHash = _vault.Hash(placeofbirth), Tags = tags, Iv = result.Iv, AuthTag = result.AuthTag }; var url = $"/vault/static/{_vault.VaultId}/placeofbirth"; if (state != null) { url += $"/{state}"; } var response = await _vault.Client.Post <PlaceOfBirthRequest, PlaceOfBirthResponse>(url, payload); response.PlaceOfBirth = _vault.Decrypt(response.Iv, response.AuthTag, response.PlaceOfBirth); return(response); }