---
title: "exportBytes(completion:)"
framework: localauthentication
role: symbol
role_heading: Instance Method
path: "localauthentication/lapublickey/exportbytes(completion:)"
---

# exportBytes(completion:)

Exports the data that represents a public key.

## Declaration

```swift
func exportBytes(completion handler: @escaping @Sendable (Data?, (any Error)?) -> Void)
```

```swift
var bytes: Data { get async throws }
```

## Parameters

- `handler`: A completion handler to call when the export operation completes.

## Discussion

Discussion important: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: var bytes: Data { get async throws } For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously.

## See Also

### Performing cryptographic operations

- [encrypt(_:algorithm:completion:)](localauthentication/lapublickey/encrypt(_:algorithm:completion:).md)
- [verify(_:signature:algorithm:completion:)](localauthentication/lapublickey/verify(_:signature:algorithm:completion:).md)
