| Call |
Gives |
| KdbxFile.parse(bytes) |
lib/keepass/kdbx.js. The unencrypted part: header,
kdfCost ({ type, rounds } or { type, memoryKiB, iterations, parallelism, blocks }),
layout [{ offset, length, label, kind }], supported,
problems. Throws KdbxError notKeePass, keePass1 (details: the 1.x
header), unsupportedVersion, damaged. |
| file.decrypt(credentials, { onProgress }) |
A KdbxDatabase: innerHeader, randomStream,
xml (an XmlTree), model, protectedValues
(Map element → bytes), checks, payload, problems,
xmlText({ protectedValues: "stored" | "masked" | "revealed" }). onProgress(stage,
done, total), stage kdf, decrypt, xml. Throws wrongCredentials, keyFile, damaged, unsupported.
|
| new KdbxCredentials({ password, keyFile, challengeResponse }) |
lib/keepass/kdbx-credentials.js. keyFileInfo,
compositeKey(challenge); KdbxCredentials.readKeyFile(bytes) → { key,
type: xml-v1 | xml-v2 | binary | hex | hashed, version, hashChecked }. |
| KdbxHeader.parse(bytes) |
lib/keepass/kdbx-header.js. major, minor, version, fields [{ id, name, offset,
length, dataOffset, data }], length, bytes, cipher, compression, masterSeed, encryptionIv, kdf {
uuid, name, type, rounds, seed, salt, memory, iterations, parallelism, argonVersion, secret,
associatedData, parameters }, KDBX 3's transformSeed, transformRounds, protectedStreamKey,
streamStartBytes, innerRandomStream, KDBX 4's publicCustomData.
KdbxHeader.identify(bytes), readKeePass1(bytes);
VariantDictionary.parse(bytes) → { version, items [{ key, type, typeName, value,
bytes }] }. |
| KdbxModel.read(tree, { protectedValues, binaries }) |
lib/keepass/kdbx-model.js. meta (KdbxMeta), root, groups, entries (KdbxGroup,
KdbxEntry: every field of section 7, with element and the unknown
element names), deletedObjects, binaries, problems; groupByUuid,
entryByUuid; KdbxModel.parseTime(text), uuidText(base64).
|
| KeyDerivation, OuterCipher, BlockStream, InnerRandomStream |
lib/keepass/kdbx-crypto.js. derive(kdf, compositeKey, onProgress), cost(kdf);
decrypt(cipher, key, iv, data, { padding }); readHmacBlocks, readHashedBlocks, blockHmacKey; new
InnerRandomStream(id, key).process(bytes). |
| KdbxReview.header(file), KdbxReview.database(database, { now, credentials }) |
lib/keepass/kdbx-review.js. Findings [{ id, level: high | medium | info, title,
detail, items [{ entry, label }] }], never with secret values; THRESHOLDS;
passwordChanged(entry). |
| XmlTree.parse(text), XmlTree.serialize(tree, { declaration, text }) |
lib/xml-tree.js: XML without DOMParser (works in workers):
declaration, children, root; XmlElement name, attributes,
children, parent, attribute(), child(), childElements(),
text. |
| KdbxEditor.fromDatabase(database, { random, now }) |
lib/keepass/kdbx-editor.js. model, settings,
dirty, canUndo, undoLabel, undo(),
markSaved(), document() (for the writer), xmlText(mode),
requirements() → { major, minor, version, reasons [{ version, reason }] }. Entries:
createEntry(groupUuid, changes) → uuid, updateEntry(uuid, changes) →
changed (changes: strings [{ key, value, protected }] or fields / removeFields / protect, tags,
iconId, customIconUuid, foregroundColor, backgroundColor, overrideUrl, qualityCheck, expires,
expiry, autoType { enabled, obfuscation, defaultSequence }, attachments [{ name, data, protected
} | { name, from }]), deleteEntry(uuid) → "recycled" | "deleted",
moveEntry(uuid, groupUuid), restoreHistory(uuid, index),
deleteHistory(uuid, [index]). Groups:
createGroup(parentUuid, { name, notes, iconId }),
updateGroup(uuid, { name, notes, iconId, customIconUuid, tags, enableAutoType, enableSearching, defaultAutoTypeSequence, expires, expiry }),
deleteGroup(uuid), moveGroup(uuid, parentUuid),
emptyRecycleBin(). Database:
updateMeta({ databaseName, databaseDescription, defaultUserName, color, recycleBinEnabled, historyMaxItems, historyMaxSize, maintenanceHistoryDays, masterKeyChangeRec, masterKeyChangeForce, memoryProtection }),
recordMasterKeyChange(),
setSettings({ major, minor, cipher, compression, kdf }).
KdbxEditor.describe(model): every value as one canonical text, for comparisons.
UUIDs are the base64 text the model uses. |
| KdbxWriter.write(document, credentials, { random, onProgress }) |
lib/keepass/kdbx-writer.js. → { bytes, header, xmlLength, compressedLength,
binaries, settings }. settings: { major, minor, cipher: aes | chacha20 | twofish, compression,
kdf: { type: "aes", rounds } or { type: "argon2d" | "argon2id", memoryKiB, iterations,
parallelism, version }, kdfUuid, publicCustomData }. KdbxWriter.settingsOf(header),
check(settings) → problems, headerBytes(settings, random). onProgress
stages kdf, compress, encrypt. random(count) defaults to crypto.getRandomValues;
tests pass a seeded one. |
| KdbxCredentials.createKeyFile(random) |
A new XML key file v2 (.keyx): { bytes, key, hash } — 32 random bytes as hex in two lines of
four groups, with Hash = the first 4 bytes of their SHA-256. |
| PasswordGenerator.generate(options, random) |
lib/keepass/password-generator.js. options { length, upper, lower, digits, minus,
underline, space, special, brackets, latin1, excludeLookAlike, everyGroup, custom };
entropy(options) → bits; strength(password) → { bits, label }. |
| Deflate.compress(bytes, { level }), Deflate.gzip, Deflate.zlib |
lib/compression/deflate.js: DEFLATE (RFC 1951) and its gzip and zlib wrappers;
checked against Python's zlib by tests/check-deflate.py. |
| OuterCipher.encrypt, BlockStream.writeHmacBlocks / writeHashedBlocks,
VariantDictionary.serialize, KdbxModel.formatTime |
The writing halves of kdbx-crypto.js, kdbx-header.js,
kdbx-model.js. lib/xml-tree.js gained setText, setAttribute, append,
insertBefore, remove, ensureChild, XmlElement.build, XmlTree.indent
and XmlTree.clone. |
| Argon2.hash(options, onProgress) |
lib/crypto/argon2.js: { password, salt, memory (KiB), iterations, parallelism,
length, type d | i | id, version 0x10 | 0x13, secret, associatedData }. |
| Blake2b.digest(bytes, length, key) |
lib/crypto/blake2b.js; also
new Blake2b(length, key).update(bytes).finish(). |
| new ChaCha20(key, nonce, counter).process(bytes) |
lib/crypto/chacha20.js (RFC 8439);
ChaCha20.block(key, counter, nonce). |
| new Salsa20(key, nonce).process(bytes) |
lib/crypto/salsa20.js. |
| new Twofish(key) |
lib/crypto/twofish.js: encryptBlock, encryptBlockInto, decryptBlock,
decryptBlockInto, blockSize. |
| aes.encryptRepeated(block, count), aes.encryptBlockInto / decryptBlockInto |
Table-driven additions to lib/crypto/aes.js (same results as encryptBlock /
decryptBlock). |