-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crypto user and device identity #1531
Conversation
03fe387
to
e6b761c
Compare
Codecov Report
@@ Coverage Diff @@
## develop #1531 +/- ##
========================================
Coverage 45.27% 45.27%
========================================
Files 522 520 -2
Lines 84856 84763 -93
Branches 37532 37507 -25
========================================
- Hits 38416 38374 -42
+ Misses 45342 45290 -52
- Partials 1098 1099 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I just added some small suggestions
{ | ||
_userId = userIdentity.userId; | ||
NSMutableDictionary *keys = [NSMutableDictionary dictionary]; | ||
if (userIdentity.masterKeys) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small remark: We are usually making carriage return here in ObjC in this SDK:
if (userIdentity.masterKeys)
{
keys[MXCrossSigningKeyType.master] = userIdentity.masterKeys;
}
@@ -194,3 +194,40 @@ private var logger: SwiftyBeaver.Type = { | |||
return "\(message) - \(details)" | |||
} | |||
} | |||
|
|||
/// Convenience wrapper around `MXLog` which formats all logs as "[Name] function: <message>" | |||
struct MXNamedLog { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting! If we want global usage of same log naming we can also make a MXLogModule
like:
public enum LogModule: String {
case webService
case parsing
case database
case geolocation
}
extension LogModule {
// MARK: Public
func debug(_ message: String, function: String = #function) {
MXLog.debug(formattedMessage(message, function: function))
}
// MARK: Private
private func formattedMessage(_ message: String, function: String) -> String {
return "[\(self.rawValue))] \(function): \(message)"
}
}
And then use it like: MXLogModule.geolocation.debug("Test")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea that sounds good, thought perhaps yet another use case, as it assumes a smaller number of stable areas, as your examples above. In my case the context equals any given class, which would be too many areas to keep a track of in an enum. I think both these use cases are complimentary
func bootstrapCrossSigning(authParams: [AnyHashable: Any]) async throws { | ||
let result = try machine.bootstrapCrossSigning() | ||
try await requests.uploadSigningKeys(request: result.uploadSigningKeysRequest, authParams: authParams) | ||
try await requests.uploadSignatures(request: result.signatureRequest) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can parallelize if possible:
async let uploadSigningKeys = requests.uploadSigningKeys(request: result.uploadSigningKeysRequest, authParams: authParams)
async let uploadSignatures = requests.uploadSignatures(request: result.signatureRequest)
await (uploadSigningKeys, uploadSignatures)
e6b761c
to
c66166f
Compare
Add mechanisms to acquire
MXDeviceInfo
,MXCrossSigningInfo
and other related objects usingMatrixSDKCrypto
and bootstrap cross-signing keys.This is another pre-requisite for having all of the required pieces to implement device verification.
The (interrelated) changes in this PR:
MatrixSDK
objects fromMatrixSDKCrypto
definitionsMXDeviceInfo
andMXCrossSIgningInfo
from swift code even if some of the API is not exposed to swift, but is in_Private.h
header filesMXCrossSigningV2
(a subclass ofMXCrossSigning
) which overrides all functionality, similar toMXCryptoV2
MXNamedLog
to avoid verbose and repeating logs, this log will always print logs in the "[Name] function: message" formatRun iOS tests instead of macos tests, to run unit tests containingLeaving tests on macos target, will try to recompile MatrixSDKCrypto for all platforms asapMatrixSDKCrypto
objects (currently only compiled for iOS), and without loosing anything mac-os specific