---
title: "saveRight(_:identifier:secret:completion:)"
framework: localauthentication
role: symbol
role_heading: Instance Method
path: "localauthentication/larightstore/saveright(_:identifier:secret:completion:)"
---

# saveRight(_:identifier:secret:completion:)

Saves a right to a persistent store along with secret data you supply.

## Declaration

```swift
func saveRight(_ right: LARight, identifier: String, secret: Data, completion handler: @escaping @Sendable (LAPersistedRight?, (any Error)?) -> Void)
```

```swift
func saveRight(_ right: LARight, identifier: String, secret: Data) async throws -> LAPersistedRight
```

## Parameters

- `right`: The right to store.
- `identifier`: A unique identifier for the right.
- `secret`: Secret data that’s stored with the right.
- `handler`: A completion handler to call when the save 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: func saveRight(_ right: LARight, identifier: String, secret: Data) async throws -> LAPersistedRight For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously.

## See Also

### Storing rights

- [saveRight(_:identifier:completion:)](localauthentication/larightstore/saveright(_:identifier:completion:).md)
