Skip to content

Commit

Permalink
Merge pull request #15 from passageidentity/appinfo-fix
Browse files Browse the repository at this point in the history
Add `AppInfo.authMethods` mapping from iOS structs.
  • Loading branch information
rickycpadilla authored Dec 4, 2023
2 parents 7f6fa3c + bb3d10d commit 7983ac4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
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

0 comments on commit 7983ac4

Please sign in to comment.