| 1 | import type * as location from "@distilled.cloud/aws/location"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Tracker } from "./Tracker.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `VerifyDevicePosition` request with `TrackerName` injected from the bound |
| 8 | * resource. |
| 9 | */ |
| 10 | export interface VerifyDevicePositionRequest extends Omit< |
| 11 | location.VerifyDevicePositionRequest, |
| 12 | "TrackerName" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Verifies a reported device position against cellular, Wi-Fi, and IP signals to detect spoofed GPS locations. |
| 17 | * |
| 18 | * Runtime binding for the `VerifyDevicePosition` operation (IAM action |
| 19 | * `geo:VerifyDevicePosition`), scoped to one {@link Tracker}. Provide the implementation with |
| 20 | * `Effect.provide(AWS.Location.VerifyDevicePositionHttp)`. |
| 21 | * |
| 22 | * ### Verifying Device Positions |
| 23 | * **Example:** Verify a Position Against Wi-Fi Signals |
| 24 | * ```typescript |
| 25 | * const verifyPosition = yield* Location.VerifyDevicePosition(tracker); |
| 26 | * |
| 27 | * const verdict = yield* verifyPosition({ |
| 28 | * DeviceState: { |
| 29 | * DeviceId: "vehicle-1", |
| 30 | * SampleTime: new Date(), |
| 31 | * Position: [-122.3493, 47.6205], |
| 32 | * WiFiAccessPoints: [{ MacAddress: "A0:EC:F9:1E:32:C1", Rss: -66 }], |
| 33 | * }, |
| 34 | * }); |
| 35 | * // verdict.InferredState → inferred position + accuracy |
| 36 | * ``` |
| 37 | * |
| 38 | * @binding |
| 39 | */ |
| 40 | export interface VerifyDevicePosition extends Binding.Service< |
| 41 | VerifyDevicePosition, |
| 42 | "AWS.Location.VerifyDevicePosition", |
| 43 | ( |
| 44 | tracker: Tracker, |
| 45 | ) => Effect.Effect< |
| 46 | ( |
| 47 | request: VerifyDevicePositionRequest, |
| 48 | ) => Effect.Effect< |
| 49 | location.VerifyDevicePositionResponse, |
| 50 | location.VerifyDevicePositionError |
| 51 | > |
| 52 | > |
| 53 | > {} |
| 54 | export const VerifyDevicePosition = Binding.Service<VerifyDevicePosition>( |
| 55 | "AWS.Location.VerifyDevicePosition", |
| 56 | ); |