Skip to content

Commit

Permalink
Merge pull request #1848 from matrix-org/valere/expose_own_device_cre…
Browse files Browse the repository at this point in the history
…ation_ts

Add own device creation ts in crypto API
  • Loading branch information
BillCarsonFr authored Apr 4, 2024
2 parents 8639971 + e74124e commit 2b04dfd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
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, readonly) 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 @@ -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
Expand Down

0 comments on commit 2b04dfd

Please sign in to comment.