diff --git a/MatrixSDK/Crypto/MXCrypto.h b/MatrixSDK/Crypto/MXCrypto.h index 3f12cdd45..348edddd0 100644 --- a/MatrixSDK/Crypto/MXCrypto.h +++ b/MatrixSDK/Crypto/MXCrypto.h @@ -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, readonly) UInt64 deviceCreationTs; + /** The key backup manager. */ diff --git a/MatrixSDK/Crypto/MXCrypto.m b/MatrixSDK/Crypto/MXCrypto.m index fc599496f..c75c39b8d 100644 --- a/MatrixSDK/Crypto/MXCrypto.m +++ b/MatrixSDK/Crypto/MXCrypto.m @@ -1422,6 +1422,12 @@ - (NSString *)olmVersion #endif } +- (uint64_t)deviceCreationTs +{ + // Device creation timestamp is not support in legacy crypto + return 0; +} + #pragma mark - Gossipping diff --git a/MatrixSDK/Crypto/MXCryptoV2.swift b/MatrixSDK/Crypto/MXCryptoV2.swift index 2e5c642b7..adea4ac92 100644 --- a/MatrixSDK/Crypto/MXCryptoV2.swift +++ b/MatrixSDK/Crypto/MXCryptoV2.swift @@ -56,6 +56,11 @@ class MXCryptoV2: NSObject, MXCrypto { 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