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

Renamed proximity timestamps #135

Merged
merged 4 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
Loading