GithubHelp home page GithubHelp logo

Comments (9)

kspearrin avatar kspearrin commented on August 26, 2024 2

Resolved in #47

from cli.

Mange avatar Mange commented on August 26, 2024

That would be great. I had to end up guess from the error message string in my script, which is very brittle.

from cli.

blacs30 avatar blacs30 commented on August 26, 2024

Would like to see it too, would be very helpful

from cli.

ewjoachim avatar ewjoachim commented on August 26, 2024

Integrating the cli from a Python script and wondering all the same.

That being said, there has to be some information persisted on the disk when bitwarden is logged in, maybe we could check for that (while waiting for a proper --check to be implemented)

from cli.

ewjoachim avatar ewjoachim commented on August 26, 2024

Bingo :) Took me a while to explore the code base but allow me the occasion to say once I had found the jslib repo, it was really nice and readable. Many pointers, but at least, each module seems to have a unique dedicated purpose. Thank you.

cli/src/bw.ts

Lines 67 to 75 in 783e7fc

if (process.env.BITWARDENCLI_APPDATA_DIR) {
p = path.resolve(process.env.BITWARDENCLI_APPDATA_DIR);
} else if (process.platform === 'darwin') {
p = path.join(process.env.HOME, 'Library/Application Support/Bitwarden CLI');
} else if (process.platform === 'win32') {
p = path.join(process.env.APPDATA, 'Bitwarden CLI');
} else {
p = path.join(process.env.HOME, '.config/Bitwarden CLI');
}

You can check <dir>/data.json and search for a key "userId". If it's there, user is logged. If it's not (or if file doesn't exist), user is not.

from cli.

ewjoachim avatar ewjoachim commented on August 26, 2024

Hahaha the doc is actually giving this information too. I found it by googling for BITWARDENCLI_APPDATA_DIR 😂

https://help.bitwarden.com/article/where-is-data-stored-computer/#cli

(it's interesting to note that the doc is not synced with the code regarding windows location. Let's believe the code)

from cli.

andykais avatar andykais commented on August 26, 2024

in that case, I would still like to request that either a login check command is added, or the ability to ask the cli where the appdata is. A program built on top of bw should not have to keep track of four possible locations of internal config data. If its allowed, I am happy to take a stab at this and PR something

from cli.

ewjoachim avatar ewjoachim commented on August 26, 2024

(yes, of course, as mentionned, the solution I described was just a workaround)

from cli.

ewjoachim avatar ewjoachim commented on August 26, 2024

Yay thank you and @estheruary 👏 🎉 👍 ! Any idea when that might land in a release ?

from cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.