|
8 | 8 | import ch.cyberduck.core.AbstractPath; |
9 | 9 | import ch.cyberduck.core.DisabledListProgressListener; |
10 | 10 | import ch.cyberduck.core.ListService; |
11 | | -import ch.cyberduck.core.LoginOptions; |
12 | | -import ch.cyberduck.core.PasswordCallback; |
13 | 11 | import ch.cyberduck.core.Path; |
14 | 12 | import ch.cyberduck.core.Session; |
15 | 13 | import ch.cyberduck.core.cryptomator.ContentWriter; |
16 | | -import ch.cyberduck.core.cryptomator.CryptoVault; |
| 14 | +import ch.cyberduck.core.cryptomator.UVFVault; |
17 | 15 | import ch.cyberduck.core.exception.BackgroundException; |
18 | 16 | import ch.cyberduck.core.features.Directory; |
19 | 17 | import ch.cyberduck.core.preferences.PreferencesFactory; |
|
22 | 20 |
|
23 | 21 | import org.apache.logging.log4j.LogManager; |
24 | 22 | import org.apache.logging.log4j.Logger; |
25 | | -import org.cryptomator.cryptolib.api.CryptorProvider; |
26 | | -import org.cryptomator.cryptolib.api.Masterkey; |
27 | 23 |
|
28 | 24 | import java.nio.charset.StandardCharsets; |
29 | | -import java.util.Base64; |
30 | 25 | import java.util.EnumSet; |
31 | 26 |
|
32 | 27 | /** |
33 | 28 | * Cryptomator vault implementation for Cipherduck (without masterkey file). |
34 | 29 | */ |
35 | | -public class HubCryptoVault extends CryptoVault { // TODO extend from UVFVault |
| 30 | +public class HubCryptoVault extends UVFVault { |
36 | 31 | private static final Logger log = LogManager.getLogger(HubCryptoVault.class); |
37 | 32 |
|
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); |
52 | 33 |
|
53 | 34 | public HubCryptoVault(final Path home) { |
54 | | - super(home); |
| 35 | + super(home, null, null, null); // TODO cleanup |
55 | 36 | } |
56 | 37 |
|
57 | 38 | 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 |
91 | 72 | return home; |
92 | 73 | } |
93 | 74 |
|
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 | | - |
107 | 75 | public Path getMasterkey() { |
108 | 76 | // No master key in vault |
109 | 77 | return null; |
|
0 commit comments