Skip to content
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

Add own device creation ts in crypto API #1848

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions MatrixSDK/Crypto/MXCrypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ extern NSString *const MXDeviceListDidUpdateUsersDevicesNotification;
*/
@property (nullable, nonatomic, readonly) NSString *deviceEd25519Key;


/**
* The user device creation in local timestamp, milliseconds since epoch.
*/
@property (nonatomic) UInt64 deviceCreationTs;

/**
The key backup manager.
*/
Expand Down
6 changes: 6 additions & 0 deletions MatrixSDK/Crypto/MXCrypto.m
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,12 @@ - (NSString *)olmVersion
#endif
}

- (uint64_t)deviceCreationTs
{
// Device creation timestamp is not support in legacy crypto
return 0;
}


#pragma mark - Gossipping

Expand Down
5 changes: 5 additions & 0 deletions MatrixSDK/Crypto/MXCryptoV2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/// An implementation of `MXCrypto` which uses [matrix-rust-sdk](https://github.com/matrix-org/matrix-rust-sdk/tree/main/crates/matrix-sdk-crypto)
/// under the hood.
class MXCryptoV2: NSObject, MXCrypto {

Check failure on line 22 in MatrixSDK/Crypto/MXCryptoV2.swift

View workflow job for this annotation

GitHub Actions / Integration Tests

type 'MXCryptoV2' does not conform to protocol 'MXCrypto'

Check failure on line 22 in MatrixSDK/Crypto/MXCryptoV2.swift

View workflow job for this annotation

GitHub Actions / Integration Tests

type 'MXCryptoV2' does not conform to protocol 'MXCrypto'

Check failure on line 22 in MatrixSDK/Crypto/MXCryptoV2.swift

View workflow job for this annotation

GitHub Actions / Unit Tests

type 'MXCryptoV2' does not conform to protocol 'MXCrypto'

Check failure on line 22 in MatrixSDK/Crypto/MXCryptoV2.swift

View workflow job for this annotation

GitHub Actions / Unit Tests

type 'MXCryptoV2' does not conform to protocol 'MXCrypto'
enum Error: Swift.Error {
case cannotUnsetTrust
case backupNotEnabled
Expand Down Expand Up @@ -56,6 +56,11 @@
return machine.deviceEd25519Key
}

var deviceCreationTs: UInt64 {
// own device always exists
return machine.device(userId: machine.userId, deviceId: machine.deviceId)!.firstTimeSeenTs
}

let backup: MXKeyBackup?
let keyVerificationManager: MXKeyVerificationManager
let crossSigning: MXCrossSigning
Expand Down
Loading