mirror of
https://github.com/keeweb/keeweb.git
synced 2024-06-26 07:39:04 +02:00
Added cordova calls
This commit is contained in:
parent
159d08d6c2
commit
ac723b7ef5
|
@ -181,12 +181,59 @@ const Launcher = {
|
||||||
// skip
|
// skip
|
||||||
},
|
},
|
||||||
|
|
||||||
fingerprints: {
|
openFileChooser: function(context) {
|
||||||
register: function(appModel, fileInfo, password) {
|
const onFileSelected = function(selected) {
|
||||||
|
window.resolveLocalFileSystemURL(selected.uri,
|
||||||
|
fileEntry => {
|
||||||
|
fileEntry.file(file => {
|
||||||
|
file.path = file.localURL;
|
||||||
|
file.name = selected.name;
|
||||||
|
context.processFile(file);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.cordova.exec(onFileSelected, e => { }, 'FileChooser', 'choose');
|
||||||
},
|
},
|
||||||
auth: function(fileInfo, callback) {
|
|
||||||
|
|
||||||
|
fingerprints: {
|
||||||
|
config: {
|
||||||
|
disableBackup: true,
|
||||||
|
clientId: 'keeweb'
|
||||||
|
},
|
||||||
|
|
||||||
|
register: function(appModel, fileInfo, password) {
|
||||||
|
FingerprintAuth.isAvailable(result => { // eslint-disable-line no-undef
|
||||||
|
if (!result.isAvailable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const encryptConfig = _.extend({}, this.config, {
|
||||||
|
username: fileInfo.id,
|
||||||
|
password: password.getText()
|
||||||
|
});
|
||||||
|
|
||||||
|
FingerprintAuth.encrypt(encryptConfig, result => { // eslint-disable-line no-undef
|
||||||
|
fileInfo.set('fingerprint', result.token);
|
||||||
|
appModel.fileInfos.save();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
auth: function(fileInfo, callback) {
|
||||||
|
if (!fileInfo.has('fingerprint')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const decryptConfig = _.extend({}, this.config, {
|
||||||
|
username: fileInfo.id,
|
||||||
|
token: fileInfo.get('fingerprint')
|
||||||
|
});
|
||||||
|
|
||||||
|
FingerprintAuth.decrypt(decryptConfig, result => { // eslint-disable-line no-undef
|
||||||
|
callback(result.password);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user