-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #797 from DataDog/maxep/RUMM-1870/data-encryption
RUMM-1870 Add data encryption interface
- Loading branch information
Showing
23 changed files
with
340 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
* This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
* Copyright 2019-2022 Datadog, Inc. | ||
*/ | ||
|
||
import Foundation | ||
|
||
/// Interface that allows storing data in encrypted format. Encryption/decryption round should | ||
/// return exactly the same data as it given for the encryption originally (even if decryption | ||
/// happens in another process/app launch). | ||
public protocol DataEncryption { | ||
/// Encrypts given `Data` with user-chosen encryption. | ||
/// | ||
/// - Parameter data: Data to encrypt. | ||
/// - Returns: The encrypted data. | ||
func encrypt(data: Data) throws -> Data | ||
|
||
/// Decrypts given `Data` with user-chosen encryption. | ||
/// | ||
/// Beware that data to decrypt could be encrypted in a previous app launch, so | ||
/// implementation should be aware of the case when decryption could fail (for example, | ||
/// key used for encryption is different from key used for decryption, if they are unique | ||
/// for every app launch). | ||
/// | ||
/// - Parameter data: Data to decrypt. | ||
/// - Returns: The decrypted data. | ||
func decrypt(data: Data) throws -> Data | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.