# tKey SDK
## State of tKey (2/3)
- Read mode (1 share available) - `initialize()`
- Write mode (atleast 2 shares available) - `recontructKey()` will check whether it has 2 shares or not.
> Suggestions and Improvements
## Main Packages
`@tkey/default-web`
* To include Web Storage Module, by default.
* And inputs Share from WebStorage upon initialize.
* Login
* Initialize
* inputShareFromWebStorage
* ReconstructKey
* ---> can this be done in one function.
* createDefaultWebTKey()
* tKey instance.
`@tkey/core`
* `initialize()`
* `recontructKey()`
* `generateNewShare()` -> `generateShare()`
* `_refreshShare()` -> `updateThreshold()`
* `outputShare()` -> `exportShare()`: This can be used in mobile devices to store this share.
* `inputShare()` -> `importShare()`: The same share, or web/chrome device storage share can be inserted back to tKey. To enable tKey in write mode.
* `deleteShare()`
## StorageLayer
## ServiceProvider
## Modules
1. WebStorage
1. `inputShareFromWebStorage()` -> `importShare()`
1. `getDeviceShare()` -> `exportShare()`
1. `storeDeviceShare()` -> `storeShare()`
1. ChromeExtensionStorage
1. `inputShareFromChromeExtensionStorage()` -> `importShare()`
1. `storeDeviceShare()` -> `storeShare()`
1. ShareSerialization -> No change.
1. ShareTransfer
1. `requestNewShare()` -> `request()`
1. `approveRequest()` -> `approve()`
1. `resetShareTransferStore` -> `reject()`
1. `_cleanUpCurrentRequest()` -> `cancel()`
1. PrivateKey
1. `setPrivateKey()`
1. `getPrivateKey()`
1. `getAllPrivateKeys()`
1. SeedPhrase
1. `setSeedPhrase()` -> `setPhrase()` -> in write mode
1. `getSeedPharses()` -> `getPhrase()` / `getAllPhrase()` -> in write mode.
1. SecurityQuestions
1. `generateNewShareWithSecurityQuestions()` and `changeSecurityQuestionAndAnswer()` can be clubbed together as `generateShare()` -> in write mode. / `setQuestionAnswer()`
1. `getSecurityQuestions()` -> `getQuestion()`
3. `getAnswer()` -> remains same, but only in write mode.
4. `inputShareFromSecurityQuestions(answer)` -> `importShare(answer)`
## Error Handling
1. getSecurityQuestions() : If no question/answer exists, please return a proper error with msg. Currently it throws, Module doesn't exist.