Skip to content

Commit

Permalink
Prepare release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
purejava committed Sep 27, 2024
1 parent a1e783a commit 162ebb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.purejava</groupId>
<artifactId>cryptomator-bitwarden</artifactId>
<version>0.5.0-SNAPSHOT</version>
<version>1.0.0</version>

<name>cryptomator-bitwarden</name>
<description>Plug-in for Cryptomator to store vault passwords in Bitwarden</description>
Expand Down Expand Up @@ -35,8 +35,8 @@

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<api.version>1.4.0</api.version>
<bitwarden.version>0.5.0-SNAPSHOT</bitwarden.version>
<api.version>1.3.1</api.version>
<bitwarden.version>1.0.0</bitwarden.version>
<junit.version>5.11.0</junit.version>
<slf4j.version>2.0.16</slf4j.version>
</properties>
Expand All @@ -56,7 +56,7 @@
</dependency>
<dependency>
<groupId>com.bitwarden</groupId>
<artifactId>sdk</artifactId>
<artifactId>sdk-secrets</artifactId>
<version>${bitwarden.version}</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class BitwardenAccess implements KeychainAccessProvider {
private BitwardenClient bitwardenClient;
private final String accessToken;
private UUID organizationId = null;
private final String stateFile;
private boolean isSupported = false;
private final String boID;
private final String apiUrl = "https://api.bitwarden.com";
Expand All @@ -30,14 +31,15 @@ public class BitwardenAccess implements KeychainAccessProvider {
public BitwardenAccess() {
this.accessToken = System.getenv("BITWARDEN_ACCESS_TOKEN");
this.boID = System.getenv("BITWARDEN_ORGANIZATION_ID");
this.stateFile = System.getenv("BITWARDEN_STATE_FILE");

if (isEnvVarValid(accessToken) && isEnvVarValid(boID)) {
try {
this.organizationId = UUID.fromString(boID);
this.bitwardenSettings.setApiUrl(apiUrl);
this.bitwardenSettings.setIdentityUrl(identityUrl);
this.bitwardenClient = new BitwardenClient(bitwardenSettings);
this.bitwardenClient.accessTokenLogin(accessToken);
this.bitwardenClient.auth().loginAccessToken(accessToken, stateFile);
this.isSupported = true;

} catch (BitwardenClientException | IllegalArgumentException e) {
Expand Down Expand Up @@ -66,7 +68,7 @@ public void storePassphrase(String vault, String name, CharSequence password) th
var projectId = getprojectId();
var secret = getSecret(vault);
if (secret.isEmpty()) {
bitwardenClient.secrets().create(vault, password.toString(), "Password for vault: " + name, organizationId, new UUID[]{ projectId });
bitwardenClient.secrets().create(organizationId, vault, password.toString(), "Password for vault: " + name, new UUID[]{ projectId });
}
LOG.debug("Passphrase successfully stored");
} catch (BitwardenClientException | IllegalArgumentException e) {
Expand Down Expand Up @@ -119,7 +121,7 @@ public void changePassphrase(String vault, String name, CharSequence password) t
LOG.debug("Passphrase not found");
} else {
LOG.debug("Passphrase found and updated");
bitwardenClient.secrets().update(secret.get().getID(), vault, password.toString(), "Password for vault: " + name, organizationId, new UUID[]{ projectId });
bitwardenClient.secrets().update(organizationId, secret.get().getID(), vault, password.toString(), "Password for vault: " + name, new UUID[]{ projectId });
}
} catch (BitwardenClientException | IllegalArgumentException e) {
throw new KeychainAccessException("Updating the passphrase failed", e);
Expand Down

0 comments on commit 162ebb4

Please sign in to comment.