Skip to content

Commit

Permalink
Renamed proximity timestamps (#135)
Browse files Browse the repository at this point in the history
* Rename proximity timestamps

* Fix typo

* Change timestamp names in docs
  • Loading branch information
Hopsaheysa authored Dec 13, 2023
1 parent 122eec9 commit ea46b73
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class WMTAuthorizationData: Codable {
self.proximityCheck = proximityCheck
}

init(operation: WMTOperation, timestampSigned: Date = Date()) {
init(operation: WMTOperation, timestampSent: Date = Date()) {
self.id = operation.id
self.data = operation.data

Expand All @@ -46,8 +46,8 @@ class WMTAuthorizationData: Codable {
self.proximityCheck = WMTProximityCheckData(
otp: proximityCheck.totp,
type: proximityCheck.type,
timestampRequested: proximityCheck.timestampRequested,
timestampSigned: timestampSigned
timestampReceived: proximityCheck.timestampReceived,
timestampSent: timestampSent
)
}
}
Expand All @@ -62,8 +62,8 @@ struct WMTProximityCheckData: Codable {
let type: WMTProximityCheckType

/// Timestamp when the operation was delivered to the app
let timestampRequested: Date
let timestampReceived: Date

/// Timestamp when the operation was signed
let timestampSigned: Date
let timestampSent: Date
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ public class WMTProximityCheck: Codable {
public let type: WMTProximityCheckType

/// Timestamp when the operation was scanned (qrCode) or delivered to the device (deeplink)
public let timestampRequested: Date
public let timestampReceived: Date

public init(totp: String, type: WMTProximityCheckType, timestampRequested: Date = Date()) {
public init(totp: String, type: WMTProximityCheckType, timestampReceived: Date = Date()) {
self.totp = totp
self.type = type
self.timestampRequested = timestampRequested
self.timestampReceived = timestampReceived
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class WMTOperationsImpl<T: WMTUserOperation>: WMTOperations, WMTService {
return nil
}

let data = WMTAuthorizationData(operation: operation, timestampSigned: currentServerDate ?? Date())
let data = WMTAuthorizationData(operation: operation, timestampSent: currentServerDate ?? Date())

return networking.post(data: .init(data), signedWith: authentication, to: WMTOperationEndpoints.Authorize.endpoint) { response, error in
self.processResult(response: response, error: error) { result in
Expand Down
6 changes: 3 additions & 3 deletions docs/Using-Operations-Service.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ public class WMTProximityCheck: Codable {
/// Type of the Proximity check
public let type: WMTProximityCheckType
/// Timestamp when the operation was scanned (QR Code) or delivered to the device (Deeplink)
public let timestampRequested: Date
public let timestampReceived: Date
}
```

Expand Down Expand Up @@ -617,10 +617,10 @@ When the app is launched via a deeplink, preserve the data from the deeplink and
Once the QR code is scanned or match from the deeplink is found, create a `WMTProximityCheck` with:
- `totp`: The actual Time-Based One-Time Password.
- `type`: Set to `WMTProximityCheckType.qrCode` or `WMTProximityCheckType.deeplink`.
- `timestampRequested`: The timestamp when the QR code was scanned (by default, it is created as the current timestamp).
- `timestampReceived`: The timestamp when the QR code was scanned (by default, it is created as the current timestamp).

- Authorizing the WMTProximityCheck
When authorization, the SDK will by default add `timestampSigned` to the `WMTProximityCheck` object. This timestamp indicates when the operation was signed.
When authorization, the SDK will by default add `timestampSent` to the `WMTProximityCheck` object. This timestamp indicates when the operation was signed.

### WMTPACUtils
- For convenience, utility class for parsing and extracting data from QR codes and deeplinks used in the PAC (Proximity Anti-fraud Check), is provided.
Expand Down

0 comments on commit ea46b73

Please sign in to comment.