Class BitwardenCLI

java.lang.Object
com.mwdle.bitwarden.cli.BitwardenCLI

public final class BitwardenCLI extends Object
A utility class for executing Bitwarden CLI commands.

This class contains only static methods and holds no state. It is a thin wrapper around the bw executable, responsible for the low-level logic of constructing and running ProcessBuilder commands and interpreting their results.

  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    configServer(String serverUrl)
    Configures the Bitwarden CLI to point to a specific server URL.
    getItem(Secret sessionToken, String itemId)
    Fetches a single, complete item from the vault by its ID.
    listItemsMetadata(Secret sessionToken)
    Fetches a list of all item metadata from the vault.
    static void
    login(com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials apiKey)
    Logs into the Bitwarden CLI using an API key.
    static void
    Logs out of the Bitwarden CLI.
    status(Secret sessionToken)
    Checks the status of the Bitwarden CLI session.
    static void
    sync(Secret sessionToken)
    Syncs the local CLI database with the remote Bitwarden vault.
    static Secret
    unlock(org.jenkinsci.plugins.plaincredentials.StringCredentials masterPassword)
    Unlocks the vault using the Master Password and returns the session token.
    static String
    Fetches the version of the installed Bitwarden CLI.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait