Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AppInfo.authMethods mapping from iOS structs. #15

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Add `AppInfo.authMethods` mapping from iOS structs.",
"packageName": "@passageidentity/passage-react-native",
"email": "[email protected]",
"dependentChangeType": "patch"
}
18 changes: 17 additions & 1 deletion ios/PassageReactNativeExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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())
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down