Add support for the new password generator

This commit is contained in:
varjolintu 2022-04-07 18:40:24 +03:00
parent f9a088882d
commit 4f94d4f7a3

View file

@ -334,12 +334,16 @@ keepass.generatePassword = async function(tab) {
const kpAction = kpActions.GENERATE_PASSWORD;
const [ nonce, incrementedNonce ] = keepass.getNonces();
const request = {
const messageData = {
action: kpAction,
nonce: nonce,
clientID: keepass.clientID
clientID: keepass.clientID,
requestID: keepass.getRequestId(),
};
const request = keepass.buildRequest(kpAction, keepass.encrypt(messageData, nonce), nonce, messageData.clientID);
request["requestID"] = messageData.requestID;
const response = await keepass.sendNativeMessage(request);
if (response.message && response.nonce) {
const res = keepass.decrypt(response.message, response.nonce);
@ -902,6 +906,11 @@ keepass.generateNewKeyPair = function() {
//console.log(nacl.util.encodeBase64(keepass.keyPair.publicKey) + ' ' + nacl.util.encodeBase64(keepass.keyPair.secretKey));
};
// Creates a random 8 character string for Request ID
keepass.getRequestId = function() {
return Math.random().toString(16).substring(2, 10);
};
keepass.isConfigured = async function() {
if (typeof(keepass.databaseHash) === 'undefined') {
const hash = keepass.getDatabaseHash();