From 1cc270680cf391704657083ed1eef1a10bbfd310 Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Sun, 28 Jun 2020 11:12:51 +0200 Subject: [PATCH] Added docs on crypto/shortening decorator classes --- .../VaultFormat7/VaultFormat7ProviderDecorator.swift | 7 +++++++ .../VaultFormat7ShorteningProviderDecorator.swift | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/CloudAccess/VaultFormat7/VaultFormat7ProviderDecorator.swift b/CloudAccess/VaultFormat7/VaultFormat7ProviderDecorator.swift index 58a2c5f..53f917b 100644 --- a/CloudAccess/VaultFormat7/VaultFormat7ProviderDecorator.swift +++ b/CloudAccess/VaultFormat7/VaultFormat7ProviderDecorator.swift @@ -28,6 +28,13 @@ private extension URL { } } +/** + Cloud provider decorator for Cryptomator vaults in vault format 7 (without name shortening). + + With this decorator, you can call the cloud provider methods with cleartext URLs (relative to `vaultURL`) and the decorator passes ciphertext URLs (absolute) to the delegate. It transparently encrypts/decrypts filenames and file contents according to vault format 7, see the security architecture page on [docs.cryptomator.org](https://docs.cryptomator.org/en/1.5/security/architecture/). + + Use the factory methods to create a new crypto decorator. In order to be fully compatible with vault format 7, pass an instance of `VaultFormat7ShorteningProviderDecorator` (shortening decorator) as the delegate. + */ public class VaultFormat7ProviderDecorator: CloudProvider { let delegate: CloudProvider let vaultURL: URL diff --git a/CloudAccess/VaultFormat7/VaultFormat7ShorteningProviderDecorator.swift b/CloudAccess/VaultFormat7/VaultFormat7ShorteningProviderDecorator.swift index cc99836..6363d05 100644 --- a/CloudAccess/VaultFormat7/VaultFormat7ShorteningProviderDecorator.swift +++ b/CloudAccess/VaultFormat7/VaultFormat7ShorteningProviderDecorator.swift @@ -23,6 +23,13 @@ private extension URL { } } +/** + Cloud provider decorator for Cryptomator vaults in vault format 7 (only name shortening). + + With this decorator, it is expected that the cloud provider methods are being called with ciphertext URLs. It transparently deflates/inflates filenames according to vault format 7, see the name shortening section at the security architecture page on [docs.cryptomator.org](https://docs.cryptomator.org/en/1.5/security/architecture/#name-shortening). + + It's meaningless to use this shortening decorator without being decorated by an instance of `VaultFormat7ProviderDecorator` (crypto decorator). This shortening decorator explicitly only shortens the fourth path component relative `vaultURL`. + */ public class VaultFormat7ShorteningProviderDecorator: CloudProvider { let delegate: CloudProvider let shortenedNameCache: VaultFormat7ShortenedNameCache