Skip to content

Commit b3f849e

Browse files
committed
Prepare release 1.0.0
1 parent a1e783a commit b3f849e

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.purejava</groupId>
88
<artifactId>cryptomator-bitwarden</artifactId>
9-
<version>0.5.0-SNAPSHOT</version>
9+
<version>1.0.0</version>
1010

1111
<name>cryptomator-bitwarden</name>
1212
<description>Plug-in for Cryptomator to store vault passwords in Bitwarden</description>
@@ -36,7 +36,7 @@
3636
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3737

3838
<api.version>1.4.0</api.version>
39-
<bitwarden.version>0.5.0-SNAPSHOT</bitwarden.version>
39+
<bitwarden.version>1.0.0</bitwarden.version>
4040
<junit.version>5.11.0</junit.version>
4141
<slf4j.version>2.0.16</slf4j.version>
4242
</properties>
@@ -56,7 +56,7 @@
5656
</dependency>
5757
<dependency>
5858
<groupId>com.bitwarden</groupId>
59-
<artifactId>sdk</artifactId>
59+
<artifactId>sdk-secrets</artifactId>
6060
<version>${bitwarden.version}</version>
6161
</dependency>
6262
<dependency>

src/main/java/org/purejava/integrations/keychain/BitwardenAccess.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class BitwardenAccess implements KeychainAccessProvider {
2121
private BitwardenClient bitwardenClient;
2222
private final String accessToken;
2323
private UUID organizationId = null;
24+
private final String stateFile;
2425
private boolean isSupported = false;
2526
private final String boID;
2627
private final String apiUrl = "https://api.bitwarden.com";
@@ -30,14 +31,15 @@ public class BitwardenAccess implements KeychainAccessProvider {
3031
public BitwardenAccess() {
3132
this.accessToken = System.getenv("BITWARDEN_ACCESS_TOKEN");
3233
this.boID = System.getenv("BITWARDEN_ORGANIZATION_ID");
34+
this.stateFile = System.getenv("BITWARDEN_STATE_FILE");
3335

3436
if (isEnvVarValid(accessToken) && isEnvVarValid(boID)) {
3537
try {
3638
this.organizationId = UUID.fromString(boID);
3739
this.bitwardenSettings.setApiUrl(apiUrl);
3840
this.bitwardenSettings.setIdentityUrl(identityUrl);
3941
this.bitwardenClient = new BitwardenClient(bitwardenSettings);
40-
this.bitwardenClient.accessTokenLogin(accessToken);
42+
this.bitwardenClient.auth().loginAccessToken(accessToken, stateFile);
4143
this.isSupported = true;
4244

4345
} catch (BitwardenClientException | IllegalArgumentException e) {
@@ -56,17 +58,17 @@ public BitwardenAccess() {
5658
public boolean isLocked() { return false; }
5759

5860
@Override
59-
public void storePassphrase(String vault, CharSequence password) throws KeychainAccessException {
60-
storePassphrase(vault, "Vault", password);
61+
public void storePassphrase(String vault, String displayName, CharSequence password) throws KeychainAccessException {
62+
storePassphrase(vault, displayName, password, false);
6163
}
6264

6365
@Override
64-
public void storePassphrase(String vault, String name, CharSequence password) throws KeychainAccessException {
66+
public void storePassphrase(String vault, String name, CharSequence password, boolean requireOsAuthentication) throws KeychainAccessException {
6567
try {
6668
var projectId = getprojectId();
6769
var secret = getSecret(vault);
6870
if (secret.isEmpty()) {
69-
bitwardenClient.secrets().create(vault, password.toString(), "Password for vault: " + name, organizationId, new UUID[]{ projectId });
71+
bitwardenClient.secrets().create(organizationId, vault, password.toString(), "Password for vault: " + name, new UUID[]{ projectId });
7072
}
7173
LOG.debug("Passphrase successfully stored");
7274
} catch (BitwardenClientException | IllegalArgumentException e) {
@@ -119,7 +121,7 @@ public void changePassphrase(String vault, String name, CharSequence password) t
119121
LOG.debug("Passphrase not found");
120122
} else {
121123
LOG.debug("Passphrase found and updated");
122-
bitwardenClient.secrets().update(secret.get().getID(), vault, password.toString(), "Password for vault: " + name, organizationId, new UUID[]{ projectId });
124+
bitwardenClient.secrets().update(organizationId, secret.get().getID(), vault, password.toString(), "Password for vault: " + name, new UUID[]{ projectId });
123125
}
124126
} catch (BitwardenClientException | IllegalArgumentException e) {
125127
throw new KeychainAccessException("Updating the passphrase failed", e);

0 commit comments

Comments
 (0)