@zyphr-dev/node-sdk 0.1.50 → 0.1.51

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyphr-dev/node-sdk",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "description": "Official Zyphr SDK for Node.js, React, and React Native",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -61,6 +61,12 @@ export interface PasswordPolicy {
61
61
  * @memberof PasswordPolicy
62
62
  */
63
63
  disallowCommon: boolean;
64
+ /**
65
+ * Whether passwords found in the HaveIBeenPwned breach corpus are rejected at registration/reset. Checked via k-anonymity (only a 5-char SHA-1 prefix leaves our infrastructure) and fail-open: if the breach source is unavailable the password is allowed. Default false (advisory only — the breach signal is returned but does not gate acceptance unless enabled).
66
+ * @type {boolean}
67
+ * @memberof PasswordPolicy
68
+ */
69
+ disallowBreached: boolean;
64
70
  }
65
71
 
66
72
  /**
@@ -74,6 +80,7 @@ export function instanceOfPasswordPolicy(value: object): value is PasswordPolicy
74
80
  if (!('requireNumbers' in value) || value['requireNumbers'] === undefined) return false;
75
81
  if (!('requireSpecial' in value) || value['requireSpecial'] === undefined) return false;
76
82
  if (!('disallowCommon' in value) || value['disallowCommon'] === undefined) return false;
83
+ if (!('disallowBreached' in value) || value['disallowBreached'] === undefined) return false;
77
84
  return true;
78
85
  }
79
86
 
@@ -94,6 +101,7 @@ export function PasswordPolicyFromJSONTyped(json: any, ignoreDiscriminator: bool
94
101
  'requireNumbers': json['require_numbers'],
95
102
  'requireSpecial': json['require_special'],
96
103
  'disallowCommon': json['disallow_common'],
104
+ 'disallowBreached': json['disallow_breached'],
97
105
  };
98
106
  }
99
107
 
@@ -115,6 +123,7 @@ export function PasswordPolicyToJSONTyped(value?: PasswordPolicy | null, ignoreD
115
123
  'require_numbers': value['requireNumbers'],
116
124
  'require_special': value['requireSpecial'],
117
125
  'disallow_common': value['disallowCommon'],
126
+ 'disallow_breached': value['disallowBreached'],
118
127
  };
119
128
  }
120
129
 
@@ -20,13 +20,25 @@ import { mapValues } from '../runtime';
20
20
  */
21
21
  export interface PasswordStrength {
22
22
  /**
23
- * Whether the password would be accepted by the server's enforcement path. A password that is valid here is accepted by registration.
23
+ * Whether the password would be accepted by the server's enforcement path. A password that is valid here is accepted by registration. When the application enables `disallow_breached`, a breached password is `valid: false` here AND rejected by register/reset (no drift).
24
24
  * @type {boolean}
25
25
  * @memberof PasswordStrength
26
26
  */
27
27
  valid: boolean;
28
28
  /**
29
- * Strength score, 0-100.
29
+ * Whether the password appears in the HaveIBeenPwned breach corpus. This is a distinct signal from `valid` and is always returned regardless of the app's `disallow_breached` setting. Fail-open: if the breach source is unavailable this is `false`.
30
+ * @type {boolean}
31
+ * @memberof PasswordStrength
32
+ */
33
+ breached: boolean;
34
+ /**
35
+ * HIBP occurrence count for the password (0 if not breached or if the breach lookup failed/was unavailable).
36
+ * @type {number}
37
+ * @memberof PasswordStrength
38
+ */
39
+ breachCount: number;
40
+ /**
41
+ * Strength score, 0-100. A pure composition measure — independent of the breach signal.
30
42
  * @type {number}
31
43
  * @memberof PasswordStrength
32
44
  */
@@ -63,6 +75,8 @@ export type PasswordStrengthLabelEnum = typeof PasswordStrengthLabelEnum[keyof t
63
75
  */
64
76
  export function instanceOfPasswordStrength(value: object): value is PasswordStrength {
65
77
  if (!('valid' in value) || value['valid'] === undefined) return false;
78
+ if (!('breached' in value) || value['breached'] === undefined) return false;
79
+ if (!('breachCount' in value) || value['breachCount'] === undefined) return false;
66
80
  if (!('score' in value) || value['score'] === undefined) return false;
67
81
  if (!('label' in value) || value['label'] === undefined) return false;
68
82
  if (!('feedback' in value) || value['feedback'] === undefined) return false;
@@ -80,6 +94,8 @@ export function PasswordStrengthFromJSONTyped(json: any, ignoreDiscriminator: bo
80
94
  return {
81
95
 
82
96
  'valid': json['valid'],
97
+ 'breached': json['breached'],
98
+ 'breachCount': json['breach_count'],
83
99
  'score': json['score'],
84
100
  'label': json['label'],
85
101
  'feedback': json['feedback'],
@@ -98,6 +114,8 @@ export function PasswordStrengthToJSONTyped(value?: PasswordStrength | null, ign
98
114
  return {
99
115
 
100
116
  'valid': value['valid'],
117
+ 'breached': value['breached'],
118
+ 'breach_count': value['breachCount'],
101
119
  'score': value['score'],
102
120
  'label': value['label'],
103
121
  'feedback': value['feedback'],