diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-09-23 04:25:08 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-09-23 04:25:08 +0800 |
commit | 4c971ebfd1fad18368ec418c36c4d05a6bb37e6d (patch) | |
tree | 6e3b19b480de241884ed2da0809f92a5c4593f31 /docs | |
parent | e9b7fd901862f57a92614b19f7f2caa969d4a282 (diff) | |
download | tangerine-wallet-browser-4c971ebfd1fad18368ec418c36c4d05a6bb37e6d.tar tangerine-wallet-browser-4c971ebfd1fad18368ec418c36c4d05a6bb37e6d.tar.gz tangerine-wallet-browser-4c971ebfd1fad18368ec418c36c4d05a6bb37e6d.tar.bz2 tangerine-wallet-browser-4c971ebfd1fad18368ec418c36c4d05a6bb37e6d.tar.lz tangerine-wallet-browser-4c971ebfd1fad18368ec418c36c4d05a6bb37e6d.tar.xz tangerine-wallet-browser-4c971ebfd1fad18368ec418c36c4d05a6bb37e6d.tar.zst tangerine-wallet-browser-4c971ebfd1fad18368ec418c36c4d05a6bb37e6d.zip |
Define encryptor in constructor params instead of platform object
Diffstat (limited to 'docs')
-rw-r--r-- | docs/porting_to_new_environment.md | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/docs/porting_to_new_environment.md b/docs/porting_to_new_environment.md index c6336b9f9..729a28e5d 100644 --- a/docs/porting_to_new_environment.md +++ b/docs/porting_to_new_environment.md @@ -11,7 +11,16 @@ The core functionality of MetaMask all lives in what we call [The MetaMask Contr When calling `new MetaMask(opts)`, many platform-specific options are configured. The keys on `opts` are as follows: - initState: The last emitted state, used for restoring persistent state between sessions. -- platform: The `platform` object defines a variety of platform-specific functions, including opening the confirmation view, and customizing the encryption method. +- platform: The `platform` object defines a variety of platform-specific functions, including opening the confirmation view, and opening web sites. +- encryptor - An object that provides access to the desired encryption methods. + +##### Encryptor + +An object that provides two simple methods, which can encrypt in any format you prefer. This parameter is optional, and will default to the browser-native WebCrypto API. + +- encrypt(password, object) - returns a Promise of a string that is ready for storage. +- decrypt(password, encryptedString) - Accepts the encrypted output of `encrypt` and returns a Promise of a restored `object` as it was encrypted. + ##### Platform Options @@ -20,9 +29,6 @@ The `platform` object has a variety of options: - reload (function) - Will be called when MetaMask would like to reload its own context. - openWindow ({ url }) - Will be called when MetaMask would like to open a web page. It will be passed a single `options` object with a `url` key, with a string value. - getVersion() - Should return the current MetaMask version, as described in the current `CHANGELOG.md` or `app/manifest.json`. -- encryptor - An object that includes two methods: - - encrypt(password, object) - returns a Promise of a string that is ready for storage. - - decrypt(password, encryptedString) - Accepts the encrypted output of `encrypt` and returns a Promise of a restored `object` as it was encrypted. #### [metamask.getState()](https://github.com/MetaMask/metamask-extension/blob/master/app/scripts/metamask-controller.js#L241) |