diff --git a/change/@passageidentity-passage-react-native-3a720931-6df3-48eb-b954-be482da63068.json b/change/@passageidentity-passage-react-native-3a720931-6df3-48eb-b954-be482da63068.json new file mode 100644 index 0000000..231ac60 --- /dev/null +++ b/change/@passageidentity-passage-react-native-3a720931-6df3-48eb-b954-be482da63068.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Add `AppInfo.authMethods` mapping from iOS structs.", + "packageName": "@passageidentity/passage-react-native", + "email": "rickycpadilla@gmail.com", + "dependentChangeType": "patch" +} diff --git a/ios/PassageReactNativeExtensions.swift b/ios/PassageReactNativeExtensions.swift index 75c058d..9de27bd 100644 --- a/ios/PassageReactNativeExtensions.swift +++ b/ios/PassageReactNativeExtensions.swift @@ -90,7 +90,8 @@ internal extension AppInfo { "requireEmailVerification": requireEmailVerification, "requireIdentifierVerification": requireIdentifierVerification, "sessionTimeoutLength": sessionTimeoutLength, - "userMetadataSchema": userMetadataSchema?.map { $0.toDictionary() } + "userMetadataSchema": userMetadataSchema?.map { $0.toDictionary() }, + "authMethods": authMethods?.toDictionary(), ] return appInfoDict } @@ -120,3 +121,18 @@ internal extension UserMetadataSchema { } } + +internal extension AuthMethods { + func toDictionary() -> [String: Any] { + var dict: [String : Any] = [ + "passkeys": passkeys == nil ? nil : [:] as [String: String], + "otp": otp == nil ? nil : ["ttl": otp?.ttl, "ttlDisplayUnit": otp?.ttlDisplayUnit?.rawValue], + "magicLink": magicLink == nil ? nil : ["ttl": magicLink?.ttl, "ttlDisplayUnit": magicLink?.ttlDisplayUnit?.rawValue], + ] + return dict + } + + func toJsonString() -> String { + return dictToJsonString(toDictionary()) + } +} diff --git a/package.json b/package.json index ab5775d..e740e88 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@passageidentity/passage-react-native", - "version": "0.4.0", + "version": "0.4.1", "description": "test", "main": "lib/commonjs/index", "module": "lib/module/index",