Skip to content

Commit

Permalink
Merge pull request #57 from Liftric/fix/js-exports
Browse files Browse the repository at this point in the history
Fix: JS exports
  • Loading branch information
gaebel authored Aug 9, 2022
2 parents 44cb29e + 7d475b0 commit dded317
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/commonMain/kotlin/com/liftric/cognito/idp/core/Payload.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package com.liftric.cognito.idp.core

import kotlinx.serialization.Serializable
import kotlin.js.JsExport

@Serializable
internal data class SignIn(
Expand Down Expand Up @@ -130,6 +131,7 @@ internal data class SetUserMFAPreference(
val SoftwareTokenMfaSettings: MfaSettings?
)

@JsExport
@Serializable
data class MfaSettings(
val Enabled: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package com.liftric.cognito.idp.core

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlin.js.JsExport

@Serializable
data class RequestError(
@SerialName("__type")
Expand Down Expand Up @@ -85,12 +87,14 @@ data class ForgotPasswordResponse(
val CodeDeliveryDetails: CodeDeliveryDetails
)

@JsExport
@Serializable
data class AssociateSoftwareTokenResponse(
val SecretCode: String,
val Session: String? = null
)

@JsExport
@Serializable
data class VerifySoftwareTokenResponse(
val Session: String? = null,
Expand Down
5 changes: 2 additions & 3 deletions src/jsMain/kotlin/IdentityProviderJS.kt
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ class IdentityProviderClientJS(region: String, clientId: String) {

fun respondToAuthChallenge(
challengeName: String,
challengeResponses: Map<String, String>,
challengeResponses: Array<MapEntry>,
session: String
): Promise<SignInResponseJS> = MainScope().promise {
provider.respondToAuthChallenge(
challengeName,
challengeResponses,
challengeResponses.associate { it.key to it.value },
session
).getOrThrow().let {
SignInResponseJS(
Expand Down Expand Up @@ -196,4 +196,3 @@ private fun AuthenticationResult.toJs(): AuthenticationResultJS =

private fun CodeDeliveryDetails.toJs(): CodeDeliveryDetailsJS =
CodeDeliveryDetailsJS(AttributeName = AttributeName, DeliveryMedium = DeliveryMedium, Destination = Destination)

0 comments on commit dded317

Please sign in to comment.