How to use the kdbxweb.Consts function in kdbxweb

To help you get started, we’ve selected a few kdbxweb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iotaledger / trinity-wallet / src / desktop / native / libs / kdbx.js View on Github external
const checkFormat = (buffer) => {
    const signature = buffer.byteLength < 8 ? null : new Uint32Array(buffer, 0, 2);

    if (!signature || signature[0] !== kdbxweb.Consts.Signatures.FileMagic) {
        return false;
    }
    if (signature[1] === kdbxweb.Consts.Signatures.Sig2Kdb) {
        return false;
    }
    if (signature[1] !== kdbxweb.Consts.Signatures.Sig2Kdbx) {
        return false;
    }
    return true;
};
github keeweb / keeweb / app / scripts / models / group-model.js View on Github external
import kdbxweb from 'kdbxweb';
import { IconMap } from 'const/icon-map';
import { EntryModel } from 'models/entry-model';
import { MenuItemModel } from 'models/menu/menu-item-model';
import { IconUrlFormat } from 'util/formatting/icon-url-format';
import { GroupCollection } from 'collections/group-collection';
import { EntryCollection } from 'collections/entry-collection';

const KdbxIcons = kdbxweb.Consts.Icons;

const DefaultAutoTypeSequence = '{USERNAME}{TAB}{PASSWORD}{ENTER}';

class GroupModel extends MenuItemModel {
    setGroup(group, file, parentGroup) {
        const isRecycleBin = group.uuid.equals(file.db.meta.recycleBinUuid);
        const id = file.subId(group.uuid.id);
        this.set(
            {
                id,
                uuid: group.uuid.id,
                expanded: group.expanded,
                visible: !isRecycleBin,
                items: new GroupCollection(),
                entries: new EntryCollection(),
                filterValue: id,
github iotaledger / trinity-wallet / src / desktop / native / libs / kdbx.js View on Github external
const checkFormat = (buffer) => {
    const signature = buffer.byteLength < 8 ? null : new Uint32Array(buffer, 0, 2);

    if (!signature || signature[0] !== kdbxweb.Consts.Signatures.FileMagic) {
        return false;
    }
    if (signature[1] === kdbxweb.Consts.Signatures.Sig2Kdb) {
        return false;
    }
    if (signature[1] !== kdbxweb.Consts.Signatures.Sig2Kdbx) {
        return false;
    }
    return true;
};
github keeweb / keeweb / app / scripts / models / file-model.js View on Github external
.catch(err => {
                    if (
                        err.code === kdbxweb.Consts.ErrorCodes.InvalidKey &&
                        password &&
                        !password.byteLength
                    ) {
                        logger.info(
                            'Error opening file with empty password, try to open with null password'
                        );
                        return this.open(null, fileData, keyFileData, callback);
                    }
                    logger.error('Error opening file', err.code, err.message, err);
                    callback(err);
                });
        } catch (e) {
github keeweb / keeweb / app / scripts / models / file-model.js View on Github external
if (!kdfParameters) {
            return undefined;
        }
        let uuid = kdfParameters.get('$UUID');
        if (!uuid) {
            return undefined;
        }
        uuid = kdbxweb.ByteUtils.bytesToBase64(uuid);
        switch (uuid) {
            case kdbxweb.Consts.KdfId.Argon2:
                return {
                    parallelism: kdfParameters.get('P').valueOf(),
                    iterations: kdfParameters.get('I').valueOf(),
                    memory: kdfParameters.get('M').valueOf()
                };
            case kdbxweb.Consts.KdfId.Aes:
                return {
                    rounds: kdfParameters.get('R').valueOf()
                };
            default:
                return undefined;
        }
    }
github keeweb / keeweb / app / scripts / views / open-view.js View on Github external
getOpenFileFormat(fileData) {
        if (fileData.byteLength < 8) {
            return undefined;
        }
        const fileSig = new Uint32Array(fileData, 0, 2);
        if (fileSig[0] === kdbxweb.Consts.Signatures.FileMagic) {
            if (fileSig[1] === kdbxweb.Consts.Signatures.Sig2Kdb) {
                return 'kdb';
            } else if (fileSig[1] === kdbxweb.Consts.Signatures.Sig2Kdbx) {
                return 'kdbx';
            } else {
                return undefined;
            }
        } else if (this.model.settings.canImportXml) {
            try {
                const str = kdbxweb.ByteUtils.bytesToString(fileSig).trim();
                if (str.startsWith('
github keeweb / keeweb / app / scripts / models / entry-model.js View on Github external
_buildAutoType() {
        this.autoTypeEnabled = this.entry.autoType.enabled;
        this.autoTypeObfuscation =
            this.entry.autoType.obfuscation ===
            kdbxweb.Consts.AutoTypeObfuscationOptions.UseClipboard;
        this.autoTypeSequence = this.entry.autoType.defaultSequence;
        this.autoTypeWindows = this.entry.autoType.items.map(this._convertAutoTypeItem);
    }