private static function deriveKeys(string $key, string $salt, bool $password = false)
    {
        if ($password) {
            $preHash = \hash(self::HASH_TYPE, $key, true);
            $key = self::pbkdf2(
                self::HASH_TYPE,
                $preHash,
                $salt,
                self::PBKDF2_ITERATIONS,
                self::KEY_BYTE_SIZE,
                true
            );
        }

        $authKey = self::hkdf(
            self::HASH_TYPE,
            $key,
            self::KEY_BYTE_SIZE,
            self::AUTHENTICATION_INFO_STRING,
            $salt
        );

        $encryptKey = self::hkdf(
            self::HASH_TYPE,
            $key,
            self::KEY_BYTE_SIZE,
            self::ENCRYPTION_INFO_STRING,
            $salt
        );

        return [$authKey, $encryptKey];
    }