From 4da4f36954176e81dc7d04c1e6c22fbf127622c0 Mon Sep 17 00:00:00 2001 From: Robby Stokoe Date: Sun, 17 Nov 2024 12:00:22 -0700 Subject: [PATCH 1/2] Add MSC3231 registration token login flow type https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/3231-token-authenticated-registration.md Signed-off-by: Robby Stokoe --- MatrixSDK/Contrib/Swift/JSONModels/MXJSONModels.swift | 4 +++- MatrixSDK/JSONModels/MXJSONModels.h | 1 + MatrixSDK/JSONModels/MXJSONModels.m | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/MatrixSDK/Contrib/Swift/JSONModels/MXJSONModels.swift b/MatrixSDK/Contrib/Swift/JSONModels/MXJSONModels.swift index 27654cdad4..76f368078a 100644 --- a/MatrixSDK/Contrib/Swift/JSONModels/MXJSONModels.swift +++ b/MatrixSDK/Contrib/Swift/JSONModels/MXJSONModels.swift @@ -21,6 +21,7 @@ import Foundation public enum MXLoginFlowType: Equatable, Hashable { case password case recaptcha + case registrationToken case OAuth2 case emailIdentity case msisdn @@ -33,6 +34,7 @@ public enum MXLoginFlowType: Equatable, Hashable { switch self { case .password: return kMXLoginFlowTypePassword case .recaptcha: return kMXLoginFlowTypeRecaptcha + case .registrationToken: return kMXLoginFlowTypeRegistrationToken case .OAuth2: return kMXLoginFlowTypeOAuth2 case .emailIdentity: return kMXLoginFlowTypeEmailIdentity case .msisdn: return kMXLoginFlowTypeMSISDN @@ -44,7 +46,7 @@ public enum MXLoginFlowType: Equatable, Hashable { } public init(identifier: String) { - let flowTypes: [MXLoginFlowType] = [.password, .recaptcha, .OAuth2, .emailIdentity, .msisdn, .token, .dummy, .emailCode] + let flowTypes: [MXLoginFlowType] = [.password, .recaptcha, .registrationToken, .OAuth2, .emailIdentity, .msisdn, .token, .dummy, .emailCode] self = flowTypes.first(where: { $0.identifier == identifier }) ?? .other(identifier) } } diff --git a/MatrixSDK/JSONModels/MXJSONModels.h b/MatrixSDK/JSONModels/MXJSONModels.h index 715faa2a9c..5232ecd2fc 100644 --- a/MatrixSDK/JSONModels/MXJSONModels.h +++ b/MatrixSDK/JSONModels/MXJSONModels.h @@ -137,6 +137,7 @@ FOUNDATION_EXPORT NSString *const kMX3PIDMediumMSISDN; typedef NSString* MXLoginFlowType NS_REFINED_FOR_SWIFT; FOUNDATION_EXPORT NSString *const kMXLoginFlowTypePassword; FOUNDATION_EXPORT NSString *const kMXLoginFlowTypeRecaptcha; +FOUNDATION_EXPORT NSString *const kMXLoginFlowTypeRegistrationToken; FOUNDATION_EXPORT NSString *const kMXLoginFlowTypeOAuth2; FOUNDATION_EXPORT NSString *const kMXLoginFlowTypeCAS; FOUNDATION_EXPORT NSString *const kMXLoginFlowTypeSSO; diff --git a/MatrixSDK/JSONModels/MXJSONModels.m b/MatrixSDK/JSONModels/MXJSONModels.m index 8b97ebd37e..be09d4f54d 100644 --- a/MatrixSDK/JSONModels/MXJSONModels.m +++ b/MatrixSDK/JSONModels/MXJSONModels.m @@ -122,6 +122,7 @@ + (id)modelFromJSON:(NSDictionary *)JSONDictionary NSString *const kMXLoginFlowTypePassword = @"m.login.password"; NSString *const kMXLoginFlowTypeRecaptcha = @"m.login.recaptcha"; +NSString *const kMXLoginFlowTypeRegistrationToken = @"m.login.registration_token"; NSString *const kMXLoginFlowTypeOAuth2 = @"m.login.oauth2"; NSString *const kMXLoginFlowTypeCAS = @"m.login.cas"; NSString *const kMXLoginFlowTypeSSO = @"m.login.sso"; From 0f2b124bdf57927dc4f62e3cac0f3f2fa08ece4c Mon Sep 17 00:00:00 2001 From: Robby Stokoe Date: Sun, 17 Nov 2024 12:18:24 -0700 Subject: [PATCH 2/2] Add changelog entry file Signed-off-by: Robby Stokoe --- changelog.d/6507.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/6507.feature diff --git a/changelog.d/6507.feature b/changelog.d/6507.feature new file mode 100644 index 0000000000..cc85338c61 --- /dev/null +++ b/changelog.d/6507.feature @@ -0,0 +1 @@ +Added types for MSC3231: registration tokens.