Skip to content

Commit cd35bcd

Browse files
committed
Inherit from UVFVault.
1 parent d0b7c71 commit cd35bcd

File tree

1 file changed

+3
-35
lines changed

1 file changed

+3
-35
lines changed

hub/src/main/java/ch/iterate/hub/protocols/hub/HubCryptoVault.java

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
import ch.cyberduck.core.AbstractPath;
99
import ch.cyberduck.core.DisabledListProgressListener;
1010
import ch.cyberduck.core.ListService;
11-
import ch.cyberduck.core.LoginOptions;
12-
import ch.cyberduck.core.PasswordCallback;
1311
import ch.cyberduck.core.Path;
1412
import ch.cyberduck.core.Session;
1513
import ch.cyberduck.core.cryptomator.ContentWriter;
16-
import ch.cyberduck.core.cryptomator.CryptoVault;
14+
import ch.cyberduck.core.cryptomator.UVFVault;
1715
import ch.cyberduck.core.exception.BackgroundException;
1816
import ch.cyberduck.core.features.Directory;
1917
import ch.cyberduck.core.preferences.PreferencesFactory;
@@ -22,36 +20,19 @@
2220

2321
import org.apache.logging.log4j.LogManager;
2422
import org.apache.logging.log4j.Logger;
25-
import org.cryptomator.cryptolib.api.CryptorProvider;
26-
import org.cryptomator.cryptolib.api.Masterkey;
2723

2824
import java.nio.charset.StandardCharsets;
29-
import java.util.Base64;
3025
import java.util.EnumSet;
3126

3227
/**
3328
* Cryptomator vault implementation for Cipherduck (without masterkey file).
3429
*/
35-
public class HubCryptoVault extends CryptoVault { // TODO extend from UVFVault
30+
public class HubCryptoVault extends UVFVault {
3631
private static final Logger log = LogManager.getLogger(HubCryptoVault.class);
3732

38-
// See https://github.com/cryptomator/hub/blob/develop/frontend/src/common/vaultconfig.ts
39-
//const jwtPayload: VaultConfigPayload = {
40-
// jti: vaultId,
41-
// format: 8,
42-
// cipherCombo: 'SIV_GCM',
43-
// shorteningThreshold: 220
44-
//};
45-
//const header = JSON.stringify({
46-
// kid: kid,
47-
// typ: 'jwt',
48-
// alg: 'HS256',
49-
// hub: hubConfig
50-
//});
51-
private static final VaultConfig VAULT_CONFIG = new VaultConfig(8, 220, CryptorProvider.Scheme.SIV_GCM, "HS256", null);
5233

5334
public HubCryptoVault(final Path home) {
54-
super(home);
35+
super(home, null, null, null); // TODO cleanup
5536
}
5637

5738
public HubCryptoVault(final Path home, final String masterkey, final String config, final byte[] pepper) {
@@ -91,19 +72,6 @@ public synchronized Path create(final Session<?> session, final String region, f
9172
return home;
9273
}
9374

94-
@Override
95-
public HubCryptoVault load(final Session<?> session, final PasswordCallback prompt) throws BackgroundException {
96-
// no-interactive prompt in Cipherduck
97-
final String masterkey = prompt.prompt(session.getHost(), "", "", new LoginOptions()).getPassword();
98-
try {
99-
this.open(VAULT_CONFIG, new Masterkey(Base64.getDecoder().decode(masterkey)));
100-
}
101-
catch(IllegalArgumentException e) {
102-
throw new BackgroundException(e);
103-
}
104-
return this;
105-
}
106-
10775
public Path getMasterkey() {
10876
// No master key in vault
10977
return null;

0 commit comments

Comments
 (0)