Expose the store passphrase as Data instead of a base64 string.

This commit is contained in:
Stefan Ceriu
2026-09-22 20:20:18 +03:00
parent 18201ac248
commit b1923b418f
11 changed files with 47 additions and 42 deletions
@@ -114,7 +114,7 @@ struct UserSessionStoreTests {
let sessionDirectories = SessionDirectories()
// When creating a user session for it.
guard case .success(let userSession) = await store.userSession(for: client, sessionDirectories: sessionDirectories, passphrase: "passphrase") else {
guard case .success(let userSession) = await store.userSession(for: client, sessionDirectories: sessionDirectories, passphrase: Data("passphrase".utf8)) else {
Issue.record("Creating the session should succeed.")
return
}
@@ -122,7 +122,7 @@ struct UserSessionStoreTests {
// Then the session should be built and its restoration token persisted.
#expect(userSession.clientProxy.userID == "@alice:matrix.org")
#expect(keychainController.setRestorationTokenForUsernameReceivedArguments?.forUsername == "@alice:matrix.org")
#expect(keychainController.setRestorationTokenForUsernameReceivedArguments?.restorationToken.passphrase == "passphrase")
#expect(keychainController.setRestorationTokenForUsernameReceivedArguments?.restorationToken.passphrase == Data("passphrase".utf8))
}
@Test
@@ -132,7 +132,7 @@ struct UserSessionStoreTests {
client.sessionThrowableError = TestError.generic
// When creating a user session for it.
guard case .failure(.failedSettingUpSession) = await store.userSession(for: client, sessionDirectories: .init(), passphrase: "passphrase") else {
guard case .failure(.failedSettingUpSession) = await store.userSession(for: client, sessionDirectories: .init(), passphrase: Data("passphrase".utf8)) else {
Issue.record("Creating the session should fail.")
return
}
@@ -177,7 +177,7 @@ struct UserSessionStoreTests {
slidingSyncVersion: .native)
let restorationToken = RestorationToken(session: session,
sessionDirectories: sessionDirectories,
passphrase: "passphrase",
passphrase: Data("passphrase".utf8),
pusherNotificationClientIdentifier: nil)
return KeychainCredentials(userID: userID, restorationToken: restorationToken)
}