---
# System prepended metadata

title: ShareTransferModule

---

# ShareTransferModule

The ShareTransferModule is a Swift module that provides functions for requesting, approving and transfering a share to another device/ storage.

To use the ShareTransferModule in your Swift project, you will need to import the module as follows:
```
import tkey_pkg
```

| Function           | Description                | Arguments | Async     | return                                                                                                                                                                                   |
| ------------------- | ------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
`request_new_share` | request a new share  | `threshold_key: ThresholdKey, user_agent: String, available_share_indexes: String` | Yes | `String` |
`add_custom_info_to_request` | Add custom info to share request | `threshold_key: ThresholdKey, enc_pub_key_x: String, custom_info: String` | Yes | `void` |
`look_for_request` | Returns an array of indexes of pending requests | `threshold_key: ThresholdKey ` | Yes | `[String]` |
`approve_request` | approve the shareStore to be shared | `threshold_key: ThresholdKey, enc_pub_key_x: String, share_store: ShareStore` | Yes | `void` |
`approve_request_with_share_index` | approve sharing with share index | `tthreshold_key: ThresholdKey, enc_pub_key_x: String, share_index: String` | Yes | `void` |
`get_store` | Get share transfer store  | `threshold_key: ThresholdKey` | Yes | `ShareTransferStore` |
`set_store` | Set share transfer store  | `threshold_key: ThresholdKey, store: ShareTransferStore` | Yes | `Bool` |
`delete_store` | Delete share transfer store  | `threshold_key: ThresholdKey, enc_pub_key_x: String` | Yes | `Bool` |
`get_current_encryption_key` | Get security questions stored in tKey  | `threshold_key: ThresholdKey` | No | `String` |
`request_status_check` | start request status checking | `threshold_key: ThresholdKey, enc_pub_key_x: String, delete_request_on_completion: Bool` | Yes | `ShareStore` |
`cleanup_request` | cleanup the request  | `threshold_key: ThresholdKey` | No | `Bool` |


### `request_new_share`

Request a new share for the given user.

Parameters:
- threshold_key: A ThresholdKey object representing the user's threshold key.
- user_agent: A string representing the user's user agent.
- available_share_indexes: A string representing the available share indexes for the user.

Returns:
- String: A string representing the requested share.

### `add_custom_info_to_request`

Adds custom information to a share request.

Parameters:
- threshold_key: A ThresholdKey object representing the user's threshold key.
- enc_pub_key_x: A string representing the user's encryption public key.
- custom_info: A string representing the custom information to add to the request.
 
 ### `look_for_request`

 Check the status of the user's share request.

Parameters:
- threshold_key: A ThresholdKey object representing the user's threshold key.

Returns:
- [String]: An array of strings representing the status of the user's share request.

### `approve_request`

Approves a share request for the user.

Parameters:
- threshold_key: A ThresholdKey object representing the user's threshold key.
- enc_pub_key_x: A string representing the user's encryption public key.
- share_store: A ShareStore object representing the user's share store.

### `approve_request_with_share_index`

Approves a share request for the user using a specific share index.

Parameters:
- threshold_key: A ThresholdKey object representing the user's threshold key.
- enc_pub_key_x: A string representing the user's encryption public key.
- share_index: A string representing the specific share index to use for the share request.

### `get_store`

Get the user's share store.


Parameters:
- threshold_key: A ThresholdKey object representing the user's threshold key.

Returns:
- ShareTransferStore: A ShareTransferStore object representing the user's share store.

### `set_store`
Set the user's share store.

Parameters:
- threshold_key: A ThresholdKey object representing the user's threshold key.
- store: A ShareTransferStore object representing the user's share store.

Returns:
- Bool: A boolean value indicating whether the operation was successful.

### `delete_store`
Delete the user's share store.

Parameters:
- threshold_key: A ThresholdKey object representing the user's threshold key.
- enc_pub_key_x: A string representing the user's encryption public key.

Returns:
- Bool: A boolean value indicating whether the operation was successful.


### `get_current_encryption_key`
This method is used to get the current encryption key for the given threshold_key.

Parameters:
- threshold_key: A ThresholdKey object representing the user's threshold key.

Throws:

- ShareTransferError: If there is an issue with the underlying share transfer module.
- RuntimeError: If there is an issue with the runtime environment.

Returns:
- String: A string value representing the current encryption key.

### `request_status_check`
This method is used to check the status of a request for the specified enc_pub_key_x under the given threshold_key.
Parameters:

- threshold_key: The ThresholdKey object for the associated share transfer module.
- enc_pub_key_x: The encrypted public key X for the request to be checked.
- delete_request_on_completion: A boolean value indicating whether the request should be deleted upon completion.

Throws:

- ShareTransferError: If there is an issue with the underlying share transfer module.
- RuntimeError: If there is an issue with the runtime environment.

Returns:

- ShareStore: A ShareStore object representing the current status of the request.

### `cleanup_request`
This method is used to clean up any remaining requests for the specified threshold_key.

Parameters:

- threshold_key: The ThresholdKey object for the associated share transfer module.

Throws:

- ShareTransferError: If there is an issue with the underlying share transfer module.
- RuntimeError: If there is an issue with the runtime environment.