@magield/node 0.8.2 → 0.9.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/dist/client.js CHANGED
@@ -130,10 +130,10 @@ export class ShieldClient {
130
130
  token: Buffer.from(input.deviceId, 'utf8'),
131
131
  publicKey: input.publicKey,
132
132
  authContext: input.authContext ?? '',
133
- userId: '',
134
- label: '',
135
- ttlDays: 0,
136
- stableCore: '',
133
+ userId: input.userId,
134
+ label: input.label ?? '',
135
+ ttlDays: input.ttlDays ?? 0,
136
+ stableCore: input.stableCore ?? '',
137
137
  }), metadata, options, callback), undefined);
138
138
  return {
139
139
  deviceId: device.deviceId,
package/dist/types.d.ts CHANGED
@@ -298,9 +298,23 @@ export interface FeedbackInput {
298
298
  export interface TrustDeviceInput {
299
299
  readonly deviceId: string;
300
300
  readonly publicKey: string;
301
+ /**
302
+ * Your user id — the same value you send as `keys.userId` on evaluate.
303
+ *
304
+ * Required, because the gateway only trusts a device when the enrolled user
305
+ * matches the evaluation's `keys.userId`. Without it the device enrols and
306
+ * then never becomes trusted, which looks exactly like the feature working.
307
+ */
308
+ readonly userId: string;
301
309
  readonly appId?: string;
302
310
  /** What justified the enrolment — a password, a second factor, a session. */
303
311
  readonly authContext?: string;
312
+ /** User-editable, shown in "your devices" lists. Untrusted input wherever it is displayed. */
313
+ readonly label?: string;
314
+ /** How long trust lasts. Absent uses the server default (90 days). */
315
+ readonly ttlDays?: number;
316
+ /** `id.stableCore` from the same collection, so fingerprint drift has a baseline. */
317
+ readonly stableCore?: string;
304
318
  }
305
319
  export interface TrustedDevice {
306
320
  readonly deviceId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magield/node",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "description": "Magic Shield backend SDK",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "files": [
@@ -23,14 +23,16 @@
23
23
  "types": "./dist/index.d.ts",
24
24
  "dependencies": {
25
25
  "@grpc/grpc-js": "^1.12.4",
26
- "@magield/proto": "0.8.2"
26
+ "@magield/proto": "0.9.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^22.10.2",
30
30
  "typescript": "^5.7.2",
31
31
  "vitest": "^2.1.8",
32
- "@magield/gateway": "0.8.2",
33
- "@magield/storage": "0.8.2"
32
+ "@magield/shared": "0.9.0",
33
+ "@magield/limiter": "0.9.0",
34
+ "@magield/storage": "0.9.0",
35
+ "@magield/gateway": "0.9.0"
34
36
  },
35
37
  "scripts": {
36
38
  "build": "tsc -p tsconfig.json",