diff --git a/internal/bitwarden/embedded/testhelper_test_accounts_test.go b/internal/bitwarden/embedded/testhelper_test_accounts_test.go index cbcc886..f73da05 100644 --- a/internal/bitwarden/embedded/testhelper_test_accounts_test.go +++ b/internal/bitwarden/embedded/testhelper_test_accounts_test.go @@ -1,5 +1,14 @@ package embedded +import ( + "encoding/json" + "log" + "os" + + "github.com/maxlaverse/terraform-provider-bitwarden/internal/bitwarden/models" + "github.com/maxlaverse/terraform-provider-bitwarden/internal/bitwarden/webapi" +) + const ( ServerURL = "http://127.0.0.1:8080" @@ -35,13 +44,56 @@ GqwE00g9gizQ6CmsaNNJh7y6gNg0TBU2EGqTaQMz37fheAEt3NSt EncryptionKey = "Vr+KA/il3QX4z7EqFnhQ3U8TtETlQPKkXHCE2PiR75wwzDVRutR4rib/jMtgZ1S/gPyOEXbwKFju2oJq3njVLg==" TestPassword = "test12341234" - Pdkdf2Email = "test-kdf0@laverse.net" - Pdkdf2Mocks = "test-kdf0" - Pdkdf2ProtectedSymmetricKey = "2.fl6CmmK/o/THYg8Y3Z5fJw==|sEjr1DMSe+Hgg7DRU8Z2wqZiZWIySrY63E8ISwQ7Q9vpxUPDQPifTW9oW0ZjcnKE4Xl4fxP89LO5xce+y+yR1yAQpnVcm2wMBx0OXM1xaAU=|9wNu2sNXt7ECSXCYsDL1ctWw02GGT1y7Pkx2NxIyD0A=" - Pdkdf2ProtectedRSAPrivateKey = "2.11j1IvphccY0UkZov7ZbmQ==|4J34a16NM+krEXyDUkHVUNL2sSA7dph4EBCLWoDkmDoljqMZh5IxA7M51yZTNB6/uqGgJZJX0uU+B4RSn2s2JoFG/VizMmgSIJkTIr6WuA7taEzyIFRi7sY980W02pnLeb8fGV8EXrZk1Bj0UzAFukNGoeS2CHWbm0bZKRvDxl5Vw40V3Lt6GzHTb6X+4k4Ovg0UKgm2mqMWzxxjmCfy+G1R0vlsAtqg14n2ax5f3Jn4ajGDvT2BQia9EFYFkie/SfqgsYbtvou4DvyCTEWh0j9Cre1QI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0v/TFKGSmnV+qohWTL8I4WnHSZeKDLC5alqIMYgRkN6qUlVJLzILOFzeJcL9zeXsAeHemd3VZWe0OYiJRxVwBCYGHk6W7WA4pZ+Wq/C0JHaxNJhr9gx0kyFlMPBkwN/LEyUP+PxsqIuW+09f70qZdGE1r9bNjUSKmb53I6nqxwQhIwvpZZDGAOZjaxrfC8PE9rOOTkM3v6zsSWgjl4EJMPwJubHJb63w5hvW2DwS4h3t7lduTab9ykKInvfBsaWxLuBhJuX+fesGTM0KGXs=|BXz0QzgtArYQXICHbYvGqOeFVi9YGZRP0MASNlVwzzY=" + Pdkdf2Mocks = "test-kdf0" + Argon2Mocks = "test-kdf1" +) - Argon2Email = "test-kdf1@laverse.net" - Argon2Mocks = "test-kdf1" - Argon2ProtectedSymmetricKey = "2.Q+HxT8fkXKmM+irKC+1D6g==|hxmjLJ2RZUPM2uWk0gmPmNe0/OQrCbB49hKUIoqvXWbUaxricj62fATs81UZaKQoC5Re1LPyFsioRImDl1L+sv+EcBEhOx/0wqZ+JPNxXms=|t0G4kLfldPtNCg3wzXU81olAxgbe6sZHAMlQkjjJLck=" - Argon2ProtectedRSAPrivateKey = "2.fRqWht1SVjfmdTOYbLxbvw==|6nMLdGVZmXlnSjmDyJC94ljd/OYtCTflhVew0+uB4smS2YfFdmkfely/ZMU5UyDyuTCMp5ynw0ERTm3whVmwNGZkYHYT1iuU8I+N5zSQyuNPqnTREGFVslwcMSqkgINYUNoTnJYr/YkLjqzBLt4R5AvFY9Pxq20c+u+3obGcXVW2I11cxF47HVQde9pks72EvOw8KAQs6nQxx8CS/hWLmpZCh/f9yZ0PtNoeik+NxsnSI9veaLvr9yUwqWyhpF1+EI+PMpYZzUopyue8c0aihEUe5Pthz5z1KU+JXMWAAvtg/6eYFi8fQqT8Y6BOZh07makHPYIePQ2O/vgAETldiSlWwmjczZCQ5OXE4wromnzxKBYu1/K2uFUuQ0CD+xsleZImAyYR1W2zVslLFb/ILUX0RSKuqA2MlZizRldTY4nZ7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goHttfy43CpIIYvNzrqajZA0IvP22eWiF/FeZKO7zm0Myw33ARyHFw2yiBLNys4xxVuL3YmpolHRzOaUqtWA3bNJTmKWiBXxlJvL8+OvbfY+TYXJdVBUVzaATG4CL546j5hduhZfDxJQk=|1kt/ukROVrAIqC47wt8TLQYVh9jeZaCUE3/hHo8hCNA=" +var ( + OrganizationID string + AccountPbkdf2 Account + AccountArgon2 Account ) + +func init() { + data, err := os.ReadFile("fixtures/test-kdf0_GET_api_sync.json") + if err != nil { + log.Fatalf("Error reading file: %v", err) + } + + var resp webapi.SyncResponse + json.Unmarshal(data, &resp) + + OrganizationID = resp.Profile.Organizations[0].Id + AccountPbkdf2 = Account{ + AccountUUID: resp.Profile.Id, + Email: resp.Profile.Email, + VaultFormat: "API", + KdfConfig: models.KdfConfiguration{ + KdfType: models.KdfTypePBKDF2_SHA256, + KdfIterations: 600000, + }, + ProtectedSymmetricKey: resp.Profile.Key, + ProtectedRSAPrivateKey: resp.Profile.PrivateKey, + } + + data, err = os.ReadFile("fixtures/test-kdf1_GET_api_sync.json") + if err != nil { + log.Fatalf("Error reading file: %v", err) + } + + json.Unmarshal(data, &resp) + + AccountArgon2 = Account{ + AccountUUID: resp.Profile.Id, + Email: resp.Profile.Email, + VaultFormat: "API", + KdfConfig: models.KdfConfiguration{ + KdfType: models.KdfTypeArgon2, + KdfIterations: 3, + KdfMemory: 64, + KdfParallelism: 4, + }, + ProtectedSymmetricKey: resp.Profile.Key, + ProtectedRSAPrivateKey: resp.Profile.PrivateKey, + } +}