Skip to content

Commit b977c43

Browse files
committed
Update docs.
fixes #157
1 parent 7142f36 commit b977c43

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,14 @@ For more information on the security details, visit [docs.cryptomator.org](https
3333
```java
3434
Path storageLocation = Paths.get("/home/cryptobot/vault");
3535
Files.createDirectories(storageLocation);
36-
CryptoFileSystemProvider.initialize(storageLocation, "masterkey.cryptomator", "password");
36+
Masterkey masterkey = Masterkey.generate(csprng));
37+
MasterkeyLoader loader = ignoredUri -> masterkey.copy(); //create a copy because the key handed over to init() method will be destroyed
38+
CryptoFileSystemProperties fsProps = CryptoFileSystemProperties.cryptoFileSystemProperties().withKeyLoader(loader).build();
39+
CryptoFileSystemProvider.initialize(storageLocation, fsProps, "myKeyId");
3740
```
3841

42+
The key material used for initialization and later de- & encryption is given by the [org.cryptomator.cryptolib.api.Masterkeyloader](https://github.com/cryptomator/cryptolib/blob/2.1.2/src/main/java/org/cryptomator/cryptolib/api/MasterkeyLoader.java) interface.
43+
3944
### Obtaining a FileSystem Instance
4045

4146
You have the option to use the convenience method `CryptoFileSystemProvider#newFileSystem` as follows:
@@ -44,7 +49,7 @@ You have the option to use the convenience method `CryptoFileSystemProvider#newF
4449
FileSystem fileSystem = CryptoFileSystemProvider.newFileSystem(
4550
storageLocation,
4651
CryptoFileSystemProperties.cryptoFileSystemProperties()
47-
.withPassphrase("password")
52+
.withKeyLoader(ignoredUri -> masterkey.copy())
4853
.withFlags(FileSystemFlags.READONLY) // readonly flag is optional of course
4954
.build());
5055
```
@@ -56,7 +61,7 @@ URI uri = CryptoFileSystemUri.create(storageLocation);
5661
FileSystem fileSystem = FileSystems.newFileSystem(
5762
uri,
5863
CryptoFileSystemProperties.cryptoFileSystemProperties()
59-
.withPassphrase("password")
64+
.withKeyLoader(ignoredUri -> masterkey.copy())
6065
.withFlags(FileSystemFlags.READONLY) // readonly flag is optional of course
6166
.build());
6267
```

0 commit comments

Comments
 (0)