How to get Informations ?
AlFalahTaieb opened this issue · 1 comments
AlFalahTaieb commented
First of all thank you so much for making this package, it's saving my life,
I got some questions :
At the moment i'm able to lad the Database, my only concern didn't figure out how i can display all my titles/username/passwords ?
Thank you soo much
antelle commented
Hi! Something like this:
kdbxweb.Kdbx.load(file, credentials).then(db => {
for (const group of db.groups) {
processGroup(group);
}
}).catch(e => {
console.error('Error', e);
});
function processGroup(group) {
console.log(`Group: ${group.name}`);
for (const entry of group.entries) {
console.log(`Entry: ${field(entry, 'Title')}: ${field(entry, 'UserName')}/${field(entry, 'Password')}`);
}
for (const subGroup of group.groups) {
processGroup(subGroup);
}
}
function field(entry, name) {
const field = entry.fields[name];
if (field && field.getText) {
return field.getText();
}
return field;
}