bitty-tui 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
File without changes
@@ -139,6 +139,7 @@ export declare class Client {
139
139
  syncCache: SyncResponse | null;
140
140
  constructor(uri?: ClientConfig);
141
141
  private patchObject;
142
+ isVaultWarden(): boolean;
142
143
  setUrls(uri: ClientConfig): void;
143
144
  /**
144
145
  * Authenticates a user with the Bitwarden server using their email and password.
@@ -375,6 +375,10 @@ export class Client {
375
375
  }
376
376
  return result;
377
377
  }
378
+ isVaultWarden() {
379
+ return (!this.apiUrl.endsWith("bitwarden.eu/api") &&
380
+ !this.apiUrl.endsWith("bitwarden.com/api"));
381
+ }
378
382
  setUrls(uri) {
379
383
  if (uri.baseUrl) {
380
384
  this.apiUrl = uri.baseUrl + "/api";
@@ -695,7 +699,12 @@ export class Client {
695
699
  decrypt(value, key) {
696
700
  if (!value)
697
701
  return value;
698
- return mcbw.decrypt(value, key ?? this.keys.userKey);
702
+ try {
703
+ return mcbw.decrypt(value, key ?? this.keys.userKey);
704
+ }
705
+ catch (error) {
706
+ return value;
707
+ }
699
708
  }
700
709
  encryptCipher(obj, key) {
701
710
  const { ...ret } = obj;
@@ -14,9 +14,7 @@ export function MainTab({ isFocused, selectedCipher, onChange, }) {
14
14
  interval = setInterval(() => {
15
15
  setOtpTimeout((t) => {
16
16
  if (t <= 1) {
17
- const totp = authenticator.generate(selectedCipher.login.totp);
18
- selectedCipher.login.currentTotp = totp;
19
- setOtpCode(totp);
17
+ setOtpCode(authenticator.generate(selectedCipher.login.totp));
20
18
  return 30;
21
19
  }
22
20
  return t - 1;
@@ -103,7 +103,9 @@ export function LoginView({ onLogin }) {
103
103
  })();
104
104
  }, []);
105
105
  return (_jsxs(Box, { flexDirection: "column", alignItems: "center", padding: 1, flexGrow: 1, minHeight: stdout.rows - 2, children: [_jsx(Box, { marginBottom: 2, children: _jsx(Text, { color: primary, children: art }) }), loading ? (_jsx(Text, { children: "Loading..." })) : askMfa ? (_jsx(Box, { flexDirection: "column", width: "50%", children: Object.values(askMfa).map((provider) => (_jsx(Button, { autoFocus: true, onClick: () => {
106
- if (provider === "1") {
106
+ if (provider === "1" &&
107
+ (Object.values(askMfa).length > 1 ||
108
+ !bwClient.isVaultWarden())) {
107
109
  bwClient.sendEmailMfaCode(email);
108
110
  }
109
111
  setMfaParams((p) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitty-tui",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "license": "MIT",
5
5
  "repository": "https://github.com/mceck/bitty",
6
6
  "keywords": [