@atlasauth/chrome-extension 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/posture.d.ts +46 -0
- package/dist/posture.js +52 -0
- package/dist/posture.js.map +1 -0
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlasauth/chrome-extension changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0 — 2026-10-28
|
|
4
|
+
|
|
5
|
+
- Reports device posture to Atlas (self-reported; never marks a device trusted)
|
|
6
|
+
|
|
7
|
+
## 0.3.1
|
|
8
|
+
- **Fixed:** depends on `@atlasauth/react` `^0.9.0` instead of one exact version. With an exact pin, an app that also
|
|
9
|
+
installed a newer `@atlasauth/react` got two copies, and hooks from one couldn't see the other's
|
|
10
|
+
`<AtlasProvider>` ("Atlas hooks must be used inside <AtlasProvider>").
|
|
11
|
+
|
|
3
12
|
## 0.3.0
|
|
4
13
|
|
|
5
14
|
### Changed
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -30,4 +30,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
__exportStar(require("./storage"), exports);
|
|
31
31
|
__exportStar(require("./client"), exports);
|
|
32
32
|
__exportStar(require("./native-session"), exports);
|
|
33
|
+
__exportStar(require("./posture"), exports);
|
|
33
34
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;GAYG;AACH,4CAA0B;AAC1B,2CAAyB;AACzB,mDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;GAYG;AACH,4CAA0B;AAC1B,2CAAyB;AACzB,mDAAiC;AACjC,4CAA0B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { FapiClient } from '@atlasauth/js';
|
|
2
|
+
import type { AtlasClient } from './client';
|
|
3
|
+
/** The slice of `navigator` read for posture, so it can be passed in and tested. */
|
|
4
|
+
export interface PostureNavigator {
|
|
5
|
+
userAgent?: string;
|
|
6
|
+
platform?: string;
|
|
7
|
+
userAgentData?: {
|
|
8
|
+
platform?: string;
|
|
9
|
+
brands?: Array<{
|
|
10
|
+
brand: string;
|
|
11
|
+
version: string;
|
|
12
|
+
}>;
|
|
13
|
+
getHighEntropyValues?(hints: string[]): Promise<{
|
|
14
|
+
platformVersion?: string;
|
|
15
|
+
uaFullVersion?: string;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface BrowserPosture {
|
|
20
|
+
platform: string;
|
|
21
|
+
os_version?: string;
|
|
22
|
+
browser?: string;
|
|
23
|
+
browser_version?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* What a browser can honestly say about itself: the OS family, its version (high-entropy client hints; for
|
|
27
|
+
* Windows the Windows-11 style `platformVersion` is the NT build and is passed through as reported), and the
|
|
28
|
+
* browser brand and version. No hardware, encryption or screen-lock facts: a browser cannot attest those,
|
|
29
|
+
* so Atlas never accepts them from here.
|
|
30
|
+
*/
|
|
31
|
+
export declare function collectBrowserPosture(nav?: PostureNavigator): Promise<BrowserPosture>;
|
|
32
|
+
/** A stable per-install id kept in extension storage (generated on first use). */
|
|
33
|
+
export declare function installId(storage: {
|
|
34
|
+
get(key: string): Promise<string | undefined>;
|
|
35
|
+
set(key: string, value: string): Promise<void>;
|
|
36
|
+
}, random?: () => string): Promise<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Report this browser's posture for the signed-in user (`POST /v1/client/me/device_posture`). Self-reported
|
|
39
|
+
* and unmanaged: it feeds platform and OS-version conditions, never device trust.
|
|
40
|
+
*/
|
|
41
|
+
export declare function reportDevicePosture(client: Pick<AtlasClient, 'fapi'> & {
|
|
42
|
+
fapi: Pick<FapiClient, 'post'>;
|
|
43
|
+
}, opts: {
|
|
44
|
+
installId: string;
|
|
45
|
+
navigator?: PostureNavigator;
|
|
46
|
+
}): Promise<void>;
|
package/dist/posture.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.collectBrowserPosture = collectBrowserPosture;
|
|
4
|
+
exports.installId = installId;
|
|
5
|
+
exports.reportDevicePosture = reportDevicePosture;
|
|
6
|
+
const BROWSER_BRANDS = ['Microsoft Edge', 'Google Chrome', 'Chromium', 'Brave', 'Opera'];
|
|
7
|
+
/**
|
|
8
|
+
* What a browser can honestly say about itself: the OS family, its version (high-entropy client hints; for
|
|
9
|
+
* Windows the Windows-11 style `platformVersion` is the NT build and is passed through as reported), and the
|
|
10
|
+
* browser brand and version. No hardware, encryption or screen-lock facts: a browser cannot attest those,
|
|
11
|
+
* so Atlas never accepts them from here.
|
|
12
|
+
*/
|
|
13
|
+
async function collectBrowserPosture(nav = globalThis.navigator ?? {}) {
|
|
14
|
+
const platform = nav.userAgentData?.platform || nav.platform || nav.userAgent || 'unknown';
|
|
15
|
+
const out = { platform };
|
|
16
|
+
const brand = nav.userAgentData?.brands?.find((b) => BROWSER_BRANDS.includes(b.brand));
|
|
17
|
+
if (brand) {
|
|
18
|
+
out.browser = brand.brand;
|
|
19
|
+
out.browser_version = brand.version;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const high = await nav.userAgentData?.getHighEntropyValues?.(['platformVersion', 'uaFullVersion']);
|
|
23
|
+
if (high?.platformVersion)
|
|
24
|
+
out.os_version = high.platformVersion;
|
|
25
|
+
if (high?.uaFullVersion)
|
|
26
|
+
out.browser_version = high.uaFullVersion;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Client hints can be blocked; the report still carries the platform.
|
|
30
|
+
}
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
/** A stable per-install id kept in extension storage (generated on first use). */
|
|
34
|
+
async function installId(storage, random = () => crypto.randomUUID()) {
|
|
35
|
+
const existing = await storage.get('atlas_install_id');
|
|
36
|
+
if (existing)
|
|
37
|
+
return existing;
|
|
38
|
+
const fresh = random();
|
|
39
|
+
await storage.set('atlas_install_id', fresh);
|
|
40
|
+
return fresh;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Report this browser's posture for the signed-in user (`POST /v1/client/me/device_posture`). Self-reported
|
|
44
|
+
* and unmanaged: it feeds platform and OS-version conditions, never device trust.
|
|
45
|
+
*/
|
|
46
|
+
async function reportDevicePosture(client, opts) {
|
|
47
|
+
const posture = await collectBrowserPosture(opts.navigator);
|
|
48
|
+
const res = await client.fapi.post('/v1/client/me/device_posture', { install_id: opts.installId, ...posture });
|
|
49
|
+
if (!res.ok)
|
|
50
|
+
throw new Error(`Posture report failed (${res.status}).`);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=posture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posture.js","sourceRoot":"","sources":["../src/posture.ts"],"names":[],"mappings":";;AA6BA,sDAgBC;AAGD,8BAMC;AAMD,kDAOC;AA9CD,MAAM,cAAc,GAAG,CAAC,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAEzF;;;;;GAKG;AACI,KAAK,UAAU,qBAAqB,CAAC,MAAyB,UAA+C,CAAC,SAAS,IAAI,EAAE;IAClI,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAa,EAAE,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,SAAS,IAAI,SAAS,CAAC;IAC3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B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5D,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,8BAA8B,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/G,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AACzE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlasauth/chrome-extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@atlasauth/
|
|
22
|
-
"@atlasauth/
|
|
21
|
+
"@atlasauth/js": "0.26.0",
|
|
22
|
+
"@atlasauth/react": "^0.23.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": ">=18"
|
|
@@ -40,12 +40,13 @@
|
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
42
|
"dist",
|
|
43
|
+
"!dist/*.tsbuildinfo",
|
|
43
44
|
"README.md",
|
|
44
45
|
"CHANGELOG.md"
|
|
45
46
|
],
|
|
46
47
|
"scripts": {
|
|
47
48
|
"build": "tsc -p tsconfig.build.json",
|
|
48
|
-
"typecheck": "
|
|
49
|
+
"typecheck": "tsgo -p tsconfig.json --noEmit --module preserve --moduleResolution bundler --incremental --tsBuildInfoFile node_modules/.cache/typecheck.tsbuildinfo",
|
|
49
50
|
"test": "vitest run"
|
|
50
51
|
}
|
|
51
52
|
}
|