UNPKG

@snap/camera-kit

Version:
52 lines 2.01 kB
import type { Lens } from "./Lens"; /** * Callback for determining user data access levels on a per-lens basis. * * @param lens - The lens for which the data access level is being determined. * @returns * - `"unrestricted"`: The lens can access sensitive user data if needed. * - `"restricted"`: The lens is denied access to sensitive user data, like location. * - A `Promise` that resolves to one of these values. * * @internal */ export type UserDataAccessResolver = (lens: Lens) => "restricted" | "unrestricted" | Promise<"restricted" | "unrestricted">; /** * Service for determining user data access levels on a per-lens basis. * Can be overridden by applications to control access for individual lenses. * * Some lenses may require access to sensitive user data, such as location, to function properly. * APIs marked with the `Exposes User Data` tag (e.g., those in * [UserContextSystem](https://developers.snap.com/lens-studio/api/lens-scripting/interfaces/Built_In.UserContextSystem.html)) * expose this sensitive data, and access to these APIs is managed through this resolver to ensure * proper control and privacy. * * The access level determines whether a lens can access such data: * - `"unrestricted"` (default): The lens can access sensitive user data if needed. * - `"restricted"`: The lens is denied access to sensitive user data, like location. * * Example usage: * * ```ts * const cameraKit = bootstrapCameraKit(config, (container) => { * container.provides( * Injectable( * lensUserDataAccessResolverFactory.token, * (): LensUserDataAccessResolver => (lens: Lens) => { * return doesLensRequireStrictAccess(lens) * ? "restricted" * : "unrestricted"; * } * ) * ); * }); * ``` * * @internal */ export declare const userDataAccessResolverFactory: { (): UserDataAccessResolver; token: "userDataAccessResolver"; dependencies: []; }; //# sourceMappingURL=userDataAccessResolver.d.ts.map