---
title: "AES (Advanced Electronic Signature)"
url: "https://developer.incode.com/sdk-reference/module-aes/"
section: "sdk-reference"
group: "iOS SDK / iOS Individual Modules"
version: "v1.1"
status: "live"
---
# AES (Advanced Electronic Signature)

The AES (Advanced Electronic Signature) module shows the user the documents to sign, collects their consent, and captures a certificate-backed electronic signature. That digital certificate verifies their identity, making the signed document legally binding and compliant.

For an overview of this module and how it works, see [Advanced Electronic Signature](/features-and-modules/advanced-electronic-signature/).

How you use this module depends on your integration pattern. When the app defines the steps in code, you add the module to an `IncdOnboardingFlowConfiguration` as shown below; when the flow is defined in Dashboard, you reference it by session token and let the back end drive the steps. See [Integration Approaches](/sdk-reference/ios-flow-configuration/).

**Availability**: All variants.

AES uses the Incode Design System V2 experience.



## Add AES

Add the module to your `IncdOnboardingFlowConfiguration` with `addAes(configuration:)`:

```swift
// Default configuration
flowConfig.addAes()

// With a custom configuration
flowConfig.addAes(configuration: AESConfiguration(uploadDocument: true, downloadDocument: true))
```

- `configuration` is optional. It defaults to `nil`. Pass an `AESConfiguration` to control document upload and download. See [Configuration Options](#configuration-options). 
  - `uploadDocument` lets the user pick and upload the PDF to be signed before the signing screen. 
  - `downloadDocument` adds a **Download document** action to the success screen, which then waits for the user instead of closing automatically. The document card on the signing screen opens a read-only preview either way.
- `showCertificateOnSuccess` was removed in iOS SDK 5.47.0. See the [Migration Guide](migration_guide#migration-to-5470) for the required call-site change.

### Example

The example below builds a custom `AESConfiguration` that shows the upload screen and downloads the signed PDF, adds the AES module to the flow, starts onboarding, and receives the outcome through the `onAESCompleted` delegate callback.

```swift
let flow = IncdOnboardingFlowConfiguration()
flow.addAes(
    configuration: AESConfiguration(uploadDocument: true, downloadDocument: true)
)

IncdOnboardingManager.shared.startOnboarding(
    sessionConfig: IncdOnboardingSessionConfiguration(token: "<SESSION_TOKEN>"),
    flowConfig: flow,
    delegate: self
)

// ...

extension MyViewController: IncdOnboardingDelegate {
    func onAESCompleted(result: AESResult) {
        if let error = result.error {
            // Handle AESError
        } else if result.success {
            // Documents signed successfully
        }
    }
}
```

## Configuration Options

Configure the module by passing an `AESConfiguration` to `addAes(configuration:)`.

| Option             | Type    | Description                                                                                                                                      |
| ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `uploadDocument`   | `Bool?` | When `true`, shows the AES upload screen before the standard AES screens. When left `nil`, treated as `false`.                                   |
| `downloadDocument` | `Bool?` | When `true`, the success screen offers a **Download document** action for the signed PDF. When left `nil`, treated as `false`.                  |



## Result

The module delivers an `AESResult` to the `onAESCompleted(result:)` callback on your `IncdOnboardingDelegate`. `onAESCompleted` is always called, whether or not signing succeeded, and the user then continues with the rest of the flow.

`AESResult` fields:

- `success: Bool`: `true` if the documents were signed successfully.
- `error: AESError?`: The signing error, or `nil` if there was no error.

## Errors

`AESError` cases:

- `noDocuments`: No documents were available for the session.
- `failedToSign`: Signing failed.

<br />