AWS code-library documentation change
Summary
Added Swift SDK code example for ConfirmSignUp API implementation
Security assessment
The change adds a code example for user confirmation workflow but doesn't disclose or address any security vulnerabilities. This is a routine documentation update for SDK implementation guidance.
Diff
diff --git a/code-library/latest/ug/cognito-identity-provider_example_cognito-identity-provider_ConfirmSignUp_section.md b/code-library/latest/ug/cognito-identity-provider_example_cognito-identity-provider_ConfirmSignUp_section.md index 4b7b9d3ab..e7dfe73ff 100644 --- a//code-library/latest/ug/cognito-identity-provider_example_cognito-identity-provider_ConfirmSignUp_section.md +++ b//code-library/latest/ug/cognito-identity-provider_example_cognito-identity-provider_ConfirmSignUp_section.md @@ -292,0 +293,50 @@ There's more on GitHub. Find the complete example and learn how to set up and ru +Swift + + +**SDK for Swift** + + +###### Note + +There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/swift/example_code/cognito-identity-provider#code-examples). + + + import AWSCognitoIdentityProvider + + /// Submit a confirmation code for the specified user. This is the code as + /// entered by the user after they've received it by email or text + /// message. + /// + /// - Parameters: + /// - cipClient: The `CognitoIdentityProviderClient` to use. + /// - clientId: The app client ID the user is signing up for. + /// - userName: The username of the user whose code is being sent. + /// - code: The user's confirmation code. + /// + /// - Returns: `true` if the code was successfully confirmed; otherwise `false`. + func confirmSignUp(cipClient: CognitoIdentityProviderClient, clientId: String, + userName: String, code: String) async -> Bool { + do { + _ = try await cipClient.confirmSignUp( + input: ConfirmSignUpInput( + clientId: clientId, + confirmationCode: code, + username: userName + ) + ) + + print("=====> \(userName) has been confirmed.") + return true + } catch { + print("=====> \(userName)'s code was entered incorrectly.") + return false + } + } + + + + * For API details, see [ConfirmSignUp](https://sdk.amazonaws.com/swift/api/awscognitoidentityprovider/latest/documentation/awscognitoidentityprovider/cognitoidentityproviderclient/confirmsignup\(input:\)) in _AWS SDK for Swift API reference_. + + + +