Import Export Settings API
This section describes technical implementation of Importing Setting from one Virtual Folder to another. For user's guide follow Import settings from another Virtual Folder.
Because user's credentials are transfered via network, the settings are encrypted. Virtual Folder API generates asymetric 2048 bytes long RSA key and random symetric AES key for each transfer.
The following workflow will export settings from Virtual Folder Exported (VFE) instance (at https://portal.west-life.eu/virtualfolder) into Virtual Folder Import (VFI) instance at http://localhost:8081/virtualfolder. During import process it's possible to rename imported aliases:
To get public key from VFI instance, send POST request to VFI
api/settings.
POST http://localhost:8081/virtualfolder/api/settingsThe public key is returned as plain text in response body:
<RSAKeyValue> <Modulus>pUPMWrEajQ2...</Modulus> <Exponent>AQAB</Exponent> </RSAKeyValue>To obtain selected file providers from VFE instance, put the names of aliases (e.g. dropbox and experiment_pcloud) into
SelectedAliasesquery parameter and VFI public key intoPublicKeyquery parameter and send it as GET request to VFE api/settings
GET https://portal.west-life.eu/virtualfolder/api/settings?PublicKey=
<RSAKeyValue><Modulus>pUPMWrEajQ2...</Modulus>
<Exponent>AQAB</Exponent></RSAKeyValue>
&SelectedAliases=dropbox;experiment_pcloudThe response body from VFE contain encrypted settings using the RSA public key and AES encryption
PBy4F6DjCDmUg1h3HxIpR2I6ABNl6kEDoVuN043C4f9GGFjmSd33tVZxWeC...To import the encrypted settings into VFI, attach public key, encrypted settings, old name aliases from VFE as parameter
ConflictedAliasesand new names of aliases in the same order which will appear in VFI as parameterNewNameAliasesand send it as PUT request with e.g. the following json body (this example will import VFE b2drop as VFI b2drop_test)
PUT http://localhost:8081/virtualfolder/api/settings
{
"PublicKey":"<RSAKeyValue><Modulus>pUPMWrEajQ2...",
"EncryptedSettings":"PBy4F6DjCDmUg1h3GGFjmSd33tVZxWeC...",
"ConflictedAliases":"b2drop",
"NewNameAliases":"b2drop_test"
}The PUT request will return array of all registered aliases, where a new alias should appear at the end.
[{"Id":76,"alias":"filesystem","type":"FileSystem"},
{"Id":77,"alias":"b2drop_test","type":"B2Drop","username":"...","output":"..."}]The above workflow is supported be backend web service wp6-virtualfolder/src/WP6Service2/WP6Service2/Services/Settings/SettingsExportImport.cs and VFI frontend ui wp6-virtualfolder/www/src/virtualfoldersetting/importprovider.html and VFE frontend ui wp6-virtualfolder/www/src/syncsetting/app.html.
Last updated