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

airgap.toggle() and airgap.status APIs #114

Merged
merged 1 commit into from
Nov 24, 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Transcend Inc.",
"name": "@transcend-io/airgap.js-types",
"description": "TypeScript types for airgap.js interoperability with custom consent UIs",
"version": "10.8.0",
"version": "10.9.0",
"homepage": "https://github.com/transcend-io/airgap.js-types",
"repository": {
"type": "git",
Expand Down
25 changes: 25 additions & 0 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,27 @@ export interface ConsentOptions {
timestamp?: string;
}

/** airgap.toggle() options */
export type AirgapToggleOptions =
/** Protection state */
| boolean
| {
/** Protection state */
protection?: boolean;
};

/** airgap.status format */
export interface AirgapSystemStatus {
/** Protection system active state */
protection: boolean;
/** Have any CSPs been activated? */
csp: boolean;
/** Monitoring system active state */
monitoring: boolean;
/** Telemetry system active state */
telemetry: boolean;
}

/** airgap.js API */
export type AirgapAPI = Readonly<{
/** Airgap ready event subscriber */
Expand Down Expand Up @@ -211,6 +232,10 @@ export type AirgapAPI = Readonly<{
getRegimes(): Set<PrivacyRegime>;
/** Get a list of detected active user agent privacy signals */
getPrivacySignals(): Set<UserPrivacySignal>;
/** Toggle all airgap.js protections. Auth must be a pre-airgap.js or airgap.js script 'load' event. Returns success status */
toggle(auth: AirgapAuth, options?: AirgapToggleOptions): boolean;
/** Current airgap.js system flags */
status: AirgapSystemStatus;
/** airgap.js version number */
version: string;
/** override the event listener signature for consent change events */
Expand Down
Loading