# IWRecoveryManager

## Constructor

## Constructor

### initWithName

```
- (instancetype)initWithKeyManager:(IWKeyManager *)keyManager
```

Description

* Initialize the IWRecoveryManager object by letting IWKeyManager be a parameter.

Parameters

| Type           | Parameter  |         Description |
| -------------- | ---------- | ------------------: |
| `IWKeyManager` | keyManager | IWKeyManager object |

Return Value

* Initialized IWRecoveryManager object

## Back Up

### backUpStoredData

```objectivec
- (void)backUpStoredData:(BACKUP_OPTION)range
          encryptionType:(ENCRYPTION_TYPE)type
               backUpKey:(NSString *)key
             extraString:(nullable NSString *)extraString
            successBlock:(void(^)(NSData *backedUpData))successBlock
            failureBlock:(void(^)(NSString *errorMessage,NSUInteger errorCode))failureBlock
```

Description

* Creates recoverable back-up data

  Status of Key Manager must be unlocked state

Parameters

| Type             | Parameter    | Description                                      |
| ---------------- | ------------ | ------------------------------------------------ |
| `BACKUP_OPTION`  | range        | Scope of recovery                                |
| `encryptionType` | type         | encryption type                                  |
| `NSString`       | key          | Encryption key                                   |
| `NSString`       | extraString  | additional data to back-up. Cannot input a `nil` |
| `successBlock`   | successBlock | Back-up completion block                         |
| `failureBlock`   | failureBlock | Back-up failure block                            |

successBlock

| Type       | Parameter    | Description    |
| ---------- | ------------ | -------------- |
| `NSString` | backedUpData | backed-up data |

failureBlock

| Type         | Parameter    | Description        |
| ------------ | ------------ | ------------------ |
| `NSString`   | errorMessage | failure message    |
| `NSUInteger` | errorCode    | failure error code |

For Errorcode and other  relevant message, please refer to BACKUP\_Option and EXCRYPTION\_TYPE.

## Restore

### restoreBackedUpData

```
- (void)restoreBackedUpData:(NSData *)backedUpData
                        key:(NSString *)key
               successBlock:(void(^)(NSString * _Nullable extraString))successBlock
               failureBlock:(void(^)(NSString *errorMessage, NSUInteger errorCode))failureBlock
```

Description

* Restoes data by using the recoverable back-up data.\
  Status of Key Manager must be in unlocked status.

Parameters

| Type           | Parameter    | Description               |
| -------------- | ------------ | ------------------------- |
| `NSData`       | backedUpData | Scope of recovery         |
| `NSString`     | key          | Recovery key              |
| `successBlock` | successBlock | Recovery completion block |
| `failureBlock` | failureBlock | Recovery failure block    |

successBlock

| Type       | Parameter   | Description                                         |
| ---------- | ----------- | --------------------------------------------------- |
| `NSString` | extraString | Additional data message to back up, it may be `nil` |

failureBlock

| Type         | Parameter    | Description        |
| ------------ | ------------ | ------------------ |
| `NSString`   | errorMessage | failure message    |
| `NSUInteger` | errorCode    | failure error code |

For error code and message, please refer to IWErrorDef.h.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev-en.omnione.net/sdk-instruction-guide/core-sdk-guide/ios-wallet/untitled.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
