summaryrefslogtreecommitdiffstats
path: root/src/home/homework-password-cache.h
blob: 6b4de15724e7b5911ad2be57c983e3a52307c693 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once

#include "strv.h"
#include "user-record.h"

typedef struct PasswordCache {
        /* Decoding passwords from security tokens is expensive and typically requires user interaction,
         * hence cache any we already figured out. */
        char **pkcs11_passwords;
        char **fido2_passwords;
} PasswordCache;

void password_cache_free(PasswordCache *cache);

static inline bool password_cache_contains(const PasswordCache *cache, const char *p) {
        if (!cache)
                return false;

        return strv_contains(cache->pkcs11_passwords, p) || strv_contains(cache->fido2_passwords, p);
}