@zyphr-dev/node-sdk 0.1.48 → 0.1.49
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/index.cjs +220 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +221 -34
- package/dist/index.d.ts +221 -34
- package/dist/index.js +199 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/.openapi-generator/FILES +4 -1
- package/src/client.ts +5 -0
- package/src/clientAuth.ts +9 -0
- package/src/src/apis/UtilityApi.ts +72 -4
- package/src/src/models/PasswordPolicy.ts +120 -0
- package/src/src/models/PasswordRequirementsResponseData.ts +20 -10
- package/src/src/models/{PasswordRequirements.ts → PasswordStrength.ts} +50 -49
- package/src/src/models/PasswordStrengthRequest.ts +74 -0
- package/src/src/models/PasswordStrengthResponse.ts +88 -0
- package/src/src/models/index.ts +4 -1
package/package.json
CHANGED
|
@@ -270,9 +270,12 @@ src/models/OrganizationMembershipResponse.ts
|
|
|
270
270
|
src/models/OrganizationMembershipWithUser.ts
|
|
271
271
|
src/models/OrganizationResponse.ts
|
|
272
272
|
src/models/PaginationMeta.ts
|
|
273
|
-
src/models/
|
|
273
|
+
src/models/PasswordPolicy.ts
|
|
274
274
|
src/models/PasswordRequirementsResponse.ts
|
|
275
275
|
src/models/PasswordRequirementsResponseData.ts
|
|
276
|
+
src/models/PasswordStrength.ts
|
|
277
|
+
src/models/PasswordStrengthRequest.ts
|
|
278
|
+
src/models/PasswordStrengthResponse.ts
|
|
276
279
|
src/models/PayloadTooLargeError.ts
|
|
277
280
|
src/models/PayloadTooLargeErrorError.ts
|
|
278
281
|
src/models/PayloadTooLargeErrorErrorDetails.ts
|
package/src/client.ts
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
AuthWebAuthnApi,
|
|
34
34
|
DevicesApi,
|
|
35
35
|
DomainsApi,
|
|
36
|
+
UtilityApi,
|
|
36
37
|
EmailsApi,
|
|
37
38
|
InboundEmailApi,
|
|
38
39
|
InboxApi,
|
|
@@ -98,6 +99,9 @@ export class Zyphr {
|
|
|
98
99
|
readonly webhooks: WebhooksApi;
|
|
99
100
|
readonly topics: TopicsApi;
|
|
100
101
|
readonly devices: DevicesApi;
|
|
102
|
+
|
|
103
|
+
/** Publishable-key-safe utilities: password policy + pre-submit strength check. */
|
|
104
|
+
readonly utility: UtilityApi;
|
|
101
105
|
readonly domains: DomainsApi;
|
|
102
106
|
/** Inbound (received) email — read access. Requires the `email:read` scope. */
|
|
103
107
|
readonly inbound: InboundEmailApi;
|
|
@@ -156,6 +160,7 @@ export class Zyphr {
|
|
|
156
160
|
this.webhooks = new WebhooksApi(config);
|
|
157
161
|
this.topics = new TopicsApi(config);
|
|
158
162
|
this.devices = new DevicesApi(config);
|
|
163
|
+
this.utility = new UtilityApi(config);
|
|
159
164
|
this.domains = new DomainsApi(config);
|
|
160
165
|
this.inbound = new InboundEmailApi(config);
|
|
161
166
|
|
package/src/clientAuth.ts
CHANGED
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
AuthUserProfileApi,
|
|
51
51
|
AuthWebAuthnApi,
|
|
52
52
|
DevicesApi,
|
|
53
|
+
UtilityApi,
|
|
53
54
|
} from './src/apis/index.js';
|
|
54
55
|
import { parseErrorResponse } from './errors.js';
|
|
55
56
|
|
|
@@ -138,6 +139,13 @@ export class ZyphrClient {
|
|
|
138
139
|
/** Device registration for push (takes an OS-acquired token). */
|
|
139
140
|
readonly devices: DevicesApi;
|
|
140
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Utility endpoints that are publishable-key-safe: the application's password
|
|
144
|
+
* policy (`getPasswordRequirements`) and a pre-submit password strength check
|
|
145
|
+
* (`checkPasswordStrength`). Useful for building a live registration UX.
|
|
146
|
+
*/
|
|
147
|
+
readonly utility: UtilityApi;
|
|
148
|
+
|
|
141
149
|
private readonly applicationKey: string;
|
|
142
150
|
private accessToken?: string;
|
|
143
151
|
|
|
@@ -196,6 +204,7 @@ export class ZyphrClient {
|
|
|
196
204
|
webauthn: new AuthWebAuthnApi(config),
|
|
197
205
|
};
|
|
198
206
|
this.devices = new DevicesApi(config);
|
|
207
|
+
this.utility = new UtilityApi(config);
|
|
199
208
|
}
|
|
200
209
|
|
|
201
210
|
/** Store the end-user access token; it is applied automatically to subsequent user-scoped calls. */
|
|
@@ -17,14 +17,24 @@ import * as runtime from '../runtime';
|
|
|
17
17
|
import type {
|
|
18
18
|
ApiError,
|
|
19
19
|
PasswordRequirementsResponse,
|
|
20
|
+
PasswordStrengthRequest,
|
|
21
|
+
PasswordStrengthResponse,
|
|
20
22
|
} from '../models/index';
|
|
21
23
|
import {
|
|
22
24
|
ApiErrorFromJSON,
|
|
23
25
|
ApiErrorToJSON,
|
|
24
26
|
PasswordRequirementsResponseFromJSON,
|
|
25
27
|
PasswordRequirementsResponseToJSON,
|
|
28
|
+
PasswordStrengthRequestFromJSON,
|
|
29
|
+
PasswordStrengthRequestToJSON,
|
|
30
|
+
PasswordStrengthResponseFromJSON,
|
|
31
|
+
PasswordStrengthResponseToJSON,
|
|
26
32
|
} from '../models/index';
|
|
27
33
|
|
|
34
|
+
export interface UtilityApiCheckPasswordStrengthRequest {
|
|
35
|
+
passwordStrengthRequest: PasswordStrengthRequest;
|
|
36
|
+
}
|
|
37
|
+
|
|
28
38
|
/**
|
|
29
39
|
* UtilityApi - interface
|
|
30
40
|
*
|
|
@@ -33,7 +43,23 @@ import {
|
|
|
33
43
|
*/
|
|
34
44
|
export interface UtilityApiInterface {
|
|
35
45
|
/**
|
|
36
|
-
*
|
|
46
|
+
* Pre-submit password check for a live registration/reset experience. Returns whether the password would be accepted by the server (`valid`), a strength `score` (0-100) and `label`, and actionable `feedback`. When an `email` is supplied, a password that resembles the email\'s local-part is flagged and marked invalid. The password is never logged or persisted.
|
|
47
|
+
* @summary Check password strength
|
|
48
|
+
* @param {PasswordStrengthRequest} passwordStrengthRequest
|
|
49
|
+
* @param {*} [options] Override http request option.
|
|
50
|
+
* @throws {RequiredError}
|
|
51
|
+
* @memberof UtilityApiInterface
|
|
52
|
+
*/
|
|
53
|
+
checkPasswordStrengthRaw(requestParameters: UtilityApiCheckPasswordStrengthRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PasswordStrengthResponse>>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Pre-submit password check for a live registration/reset experience. Returns whether the password would be accepted by the server (`valid`), a strength `score` (0-100) and `label`, and actionable `feedback`. When an `email` is supplied, a password that resembles the email\'s local-part is flagged and marked invalid. The password is never logged or persisted.
|
|
57
|
+
* Check password strength
|
|
58
|
+
*/
|
|
59
|
+
checkPasswordStrength(passwordStrengthRequest: PasswordStrengthRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PasswordStrengthResponse>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Get password requirements for the application. Returns both a structured `policy` object (for driving a live requirements checklist) and human-readable `requirements` display strings. Useful for client-side validation before registration.
|
|
37
63
|
* @summary Get password requirements
|
|
38
64
|
* @param {*} [options] Override http request option.
|
|
39
65
|
* @throws {RequiredError}
|
|
@@ -42,7 +68,7 @@ export interface UtilityApiInterface {
|
|
|
42
68
|
getPasswordRequirementsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PasswordRequirementsResponse>>;
|
|
43
69
|
|
|
44
70
|
/**
|
|
45
|
-
* Get password requirements for the application. Useful for client-side validation before registration.
|
|
71
|
+
* Get password requirements for the application. Returns both a structured `policy` object (for driving a live requirements checklist) and human-readable `requirements` display strings. Useful for client-side validation before registration.
|
|
46
72
|
* Get password requirements
|
|
47
73
|
*/
|
|
48
74
|
getPasswordRequirements(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PasswordRequirementsResponse>;
|
|
@@ -55,7 +81,49 @@ export interface UtilityApiInterface {
|
|
|
55
81
|
export class UtilityApi extends runtime.BaseAPI implements UtilityApiInterface {
|
|
56
82
|
|
|
57
83
|
/**
|
|
58
|
-
*
|
|
84
|
+
* Pre-submit password check for a live registration/reset experience. Returns whether the password would be accepted by the server (`valid`), a strength `score` (0-100) and `label`, and actionable `feedback`. When an `email` is supplied, a password that resembles the email\'s local-part is flagged and marked invalid. The password is never logged or persisted.
|
|
85
|
+
* Check password strength
|
|
86
|
+
*/
|
|
87
|
+
async checkPasswordStrengthRaw(requestParameters: UtilityApiCheckPasswordStrengthRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PasswordStrengthResponse>> {
|
|
88
|
+
if (requestParameters['passwordStrengthRequest'] == null) {
|
|
89
|
+
throw new runtime.RequiredError(
|
|
90
|
+
'passwordStrengthRequest',
|
|
91
|
+
'Required parameter "passwordStrengthRequest" was null or undefined when calling checkPasswordStrength().'
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const queryParameters: any = {};
|
|
96
|
+
|
|
97
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
98
|
+
|
|
99
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
100
|
+
|
|
101
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
102
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const response = await this.request({
|
|
106
|
+
path: `/auth/password-strength`,
|
|
107
|
+
method: 'POST',
|
|
108
|
+
headers: headerParameters,
|
|
109
|
+
query: queryParameters,
|
|
110
|
+
body: PasswordStrengthRequestToJSON(requestParameters['passwordStrengthRequest']),
|
|
111
|
+
}, initOverrides);
|
|
112
|
+
|
|
113
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => PasswordStrengthResponseFromJSON(jsonValue));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Pre-submit password check for a live registration/reset experience. Returns whether the password would be accepted by the server (`valid`), a strength `score` (0-100) and `label`, and actionable `feedback`. When an `email` is supplied, a password that resembles the email\'s local-part is flagged and marked invalid. The password is never logged or persisted.
|
|
118
|
+
* Check password strength
|
|
119
|
+
*/
|
|
120
|
+
async checkPasswordStrength(passwordStrengthRequest: PasswordStrengthRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PasswordStrengthResponse> {
|
|
121
|
+
const response = await this.checkPasswordStrengthRaw({ passwordStrengthRequest: passwordStrengthRequest }, initOverrides);
|
|
122
|
+
return await response.value();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Get password requirements for the application. Returns both a structured `policy` object (for driving a live requirements checklist) and human-readable `requirements` display strings. Useful for client-side validation before registration.
|
|
59
127
|
* Get password requirements
|
|
60
128
|
*/
|
|
61
129
|
async getPasswordRequirementsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PasswordRequirementsResponse>> {
|
|
@@ -78,7 +146,7 @@ export class UtilityApi extends runtime.BaseAPI implements UtilityApiInterface {
|
|
|
78
146
|
}
|
|
79
147
|
|
|
80
148
|
/**
|
|
81
|
-
* Get password requirements for the application. Useful for client-side validation before registration.
|
|
149
|
+
* Get password requirements for the application. Returns both a structured `policy` object (for driving a live requirements checklist) and human-readable `requirements` display strings. Useful for client-side validation before registration.
|
|
82
150
|
* Get password requirements
|
|
83
151
|
*/
|
|
84
152
|
async getPasswordRequirements(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PasswordRequirementsResponse> {
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Zyphr API
|
|
5
|
+
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@zyphr.dev
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
/**
|
|
17
|
+
* Structured password policy rules for the application. Use these fields to drive a live, client-side requirements checklist (e.g. a green/grey indicator per rule) before submitting a registration or reset.
|
|
18
|
+
* @export
|
|
19
|
+
* @interface PasswordPolicy
|
|
20
|
+
*/
|
|
21
|
+
export interface PasswordPolicy {
|
|
22
|
+
/**
|
|
23
|
+
* Minimum password length.
|
|
24
|
+
* @type {number}
|
|
25
|
+
* @memberof PasswordPolicy
|
|
26
|
+
*/
|
|
27
|
+
minLength: number;
|
|
28
|
+
/**
|
|
29
|
+
* Maximum password length.
|
|
30
|
+
* @type {number}
|
|
31
|
+
* @memberof PasswordPolicy
|
|
32
|
+
*/
|
|
33
|
+
maxLength: number;
|
|
34
|
+
/**
|
|
35
|
+
* Whether at least one uppercase letter (A-Z) is required.
|
|
36
|
+
* @type {boolean}
|
|
37
|
+
* @memberof PasswordPolicy
|
|
38
|
+
*/
|
|
39
|
+
requireUppercase: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether at least one lowercase letter (a-z) is required.
|
|
42
|
+
* @type {boolean}
|
|
43
|
+
* @memberof PasswordPolicy
|
|
44
|
+
*/
|
|
45
|
+
requireLowercase: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Whether at least one number (0-9) is required.
|
|
48
|
+
* @type {boolean}
|
|
49
|
+
* @memberof PasswordPolicy
|
|
50
|
+
*/
|
|
51
|
+
requireNumbers: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether at least one special character is required.
|
|
54
|
+
* @type {boolean}
|
|
55
|
+
* @memberof PasswordPolicy
|
|
56
|
+
*/
|
|
57
|
+
requireSpecial: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether commonly used passwords are rejected.
|
|
60
|
+
* @type {boolean}
|
|
61
|
+
* @memberof PasswordPolicy
|
|
62
|
+
*/
|
|
63
|
+
disallowCommon: boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Check if a given object implements the PasswordPolicy interface.
|
|
68
|
+
*/
|
|
69
|
+
export function instanceOfPasswordPolicy(value: object): value is PasswordPolicy {
|
|
70
|
+
if (!('minLength' in value) || value['minLength'] === undefined) return false;
|
|
71
|
+
if (!('maxLength' in value) || value['maxLength'] === undefined) return false;
|
|
72
|
+
if (!('requireUppercase' in value) || value['requireUppercase'] === undefined) return false;
|
|
73
|
+
if (!('requireLowercase' in value) || value['requireLowercase'] === undefined) return false;
|
|
74
|
+
if (!('requireNumbers' in value) || value['requireNumbers'] === undefined) return false;
|
|
75
|
+
if (!('requireSpecial' in value) || value['requireSpecial'] === undefined) return false;
|
|
76
|
+
if (!('disallowCommon' in value) || value['disallowCommon'] === undefined) return false;
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function PasswordPolicyFromJSON(json: any): PasswordPolicy {
|
|
81
|
+
return PasswordPolicyFromJSONTyped(json, false);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function PasswordPolicyFromJSONTyped(json: any, ignoreDiscriminator: boolean): PasswordPolicy {
|
|
85
|
+
if (json == null) {
|
|
86
|
+
return json;
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
|
|
90
|
+
'minLength': json['min_length'],
|
|
91
|
+
'maxLength': json['max_length'],
|
|
92
|
+
'requireUppercase': json['require_uppercase'],
|
|
93
|
+
'requireLowercase': json['require_lowercase'],
|
|
94
|
+
'requireNumbers': json['require_numbers'],
|
|
95
|
+
'requireSpecial': json['require_special'],
|
|
96
|
+
'disallowCommon': json['disallow_common'],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function PasswordPolicyToJSON(json: any): PasswordPolicy {
|
|
101
|
+
return PasswordPolicyToJSONTyped(json, false);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function PasswordPolicyToJSONTyped(value?: PasswordPolicy | null, ignoreDiscriminator: boolean = false): any {
|
|
105
|
+
if (value == null) {
|
|
106
|
+
return value;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
|
|
111
|
+
'min_length': value['minLength'],
|
|
112
|
+
'max_length': value['maxLength'],
|
|
113
|
+
'require_uppercase': value['requireUppercase'],
|
|
114
|
+
'require_lowercase': value['requireLowercase'],
|
|
115
|
+
'require_numbers': value['requireNumbers'],
|
|
116
|
+
'require_special': value['requireSpecial'],
|
|
117
|
+
'disallow_common': value['disallowCommon'],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { mapValues } from '../runtime';
|
|
16
|
-
import type {
|
|
16
|
+
import type { PasswordPolicy } from './PasswordPolicy';
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} from './
|
|
18
|
+
PasswordPolicyFromJSON,
|
|
19
|
+
PasswordPolicyFromJSONTyped,
|
|
20
|
+
PasswordPolicyToJSON,
|
|
21
|
+
PasswordPolicyToJSONTyped,
|
|
22
|
+
} from './PasswordPolicy';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
*
|
|
@@ -29,16 +29,24 @@ import {
|
|
|
29
29
|
export interface PasswordRequirementsResponseData {
|
|
30
30
|
/**
|
|
31
31
|
*
|
|
32
|
-
* @type {
|
|
32
|
+
* @type {PasswordPolicy}
|
|
33
33
|
* @memberof PasswordRequirementsResponseData
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
policy: PasswordPolicy;
|
|
36
|
+
/**
|
|
37
|
+
* Human-readable display strings for the active password rules (e.g. "At least 8 characters"). Backward-compatible with the original response shape.
|
|
38
|
+
* @type {Array<string>}
|
|
39
|
+
* @memberof PasswordRequirementsResponseData
|
|
40
|
+
*/
|
|
41
|
+
requirements: Array<string>;
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
/**
|
|
39
45
|
* Check if a given object implements the PasswordRequirementsResponseData interface.
|
|
40
46
|
*/
|
|
41
47
|
export function instanceOfPasswordRequirementsResponseData(value: object): value is PasswordRequirementsResponseData {
|
|
48
|
+
if (!('policy' in value) || value['policy'] === undefined) return false;
|
|
49
|
+
if (!('requirements' in value) || value['requirements'] === undefined) return false;
|
|
42
50
|
return true;
|
|
43
51
|
}
|
|
44
52
|
|
|
@@ -52,7 +60,8 @@ export function PasswordRequirementsResponseDataFromJSONTyped(json: any, ignoreD
|
|
|
52
60
|
}
|
|
53
61
|
return {
|
|
54
62
|
|
|
55
|
-
'
|
|
63
|
+
'policy': PasswordPolicyFromJSON(json['policy']),
|
|
64
|
+
'requirements': json['requirements'],
|
|
56
65
|
};
|
|
57
66
|
}
|
|
58
67
|
|
|
@@ -67,7 +76,8 @@ export function PasswordRequirementsResponseDataToJSONTyped(value?: PasswordRequ
|
|
|
67
76
|
|
|
68
77
|
return {
|
|
69
78
|
|
|
70
|
-
'
|
|
79
|
+
'policy': PasswordPolicyToJSON(value['policy']),
|
|
80
|
+
'requirements': value['requirements'],
|
|
71
81
|
};
|
|
72
82
|
}
|
|
73
83
|
|
|
@@ -16,90 +16,91 @@ import { mapValues } from '../runtime';
|
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
18
|
* @export
|
|
19
|
-
* @interface
|
|
19
|
+
* @interface PasswordStrength
|
|
20
20
|
*/
|
|
21
|
-
export interface
|
|
21
|
+
export interface PasswordStrength {
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @type {number}
|
|
25
|
-
* @memberof PasswordRequirements
|
|
26
|
-
*/
|
|
27
|
-
minLength?: number;
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @type {number}
|
|
31
|
-
* @memberof PasswordRequirements
|
|
32
|
-
*/
|
|
33
|
-
maxLength?: number;
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
23
|
+
* Whether the password would be accepted by the server's enforcement path. A password that is valid here is accepted by registration.
|
|
36
24
|
* @type {boolean}
|
|
37
|
-
* @memberof
|
|
25
|
+
* @memberof PasswordStrength
|
|
38
26
|
*/
|
|
39
|
-
|
|
27
|
+
valid: boolean;
|
|
40
28
|
/**
|
|
41
|
-
*
|
|
42
|
-
* @type {
|
|
43
|
-
* @memberof
|
|
29
|
+
* Strength score, 0-100.
|
|
30
|
+
* @type {number}
|
|
31
|
+
* @memberof PasswordStrength
|
|
44
32
|
*/
|
|
45
|
-
|
|
33
|
+
score: number;
|
|
46
34
|
/**
|
|
47
|
-
*
|
|
48
|
-
* @type {
|
|
49
|
-
* @memberof
|
|
35
|
+
* Strength label derived from the score.
|
|
36
|
+
* @type {string}
|
|
37
|
+
* @memberof PasswordStrength
|
|
50
38
|
*/
|
|
51
|
-
|
|
39
|
+
label: PasswordStrengthLabelEnum;
|
|
52
40
|
/**
|
|
53
|
-
*
|
|
54
|
-
* @type {
|
|
55
|
-
* @memberof
|
|
41
|
+
* Actionable feedback — policy errors plus strength-improvement suggestions.
|
|
42
|
+
* @type {Array<string>}
|
|
43
|
+
* @memberof PasswordStrength
|
|
56
44
|
*/
|
|
57
|
-
|
|
45
|
+
feedback: Array<string>;
|
|
58
46
|
}
|
|
59
47
|
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @export
|
|
51
|
+
*/
|
|
52
|
+
export const PasswordStrengthLabelEnum = {
|
|
53
|
+
WEAK: 'weak',
|
|
54
|
+
FAIR: 'fair',
|
|
55
|
+
GOOD: 'good',
|
|
56
|
+
STRONG: 'strong'
|
|
57
|
+
} as const;
|
|
58
|
+
export type PasswordStrengthLabelEnum = typeof PasswordStrengthLabelEnum[keyof typeof PasswordStrengthLabelEnum];
|
|
59
|
+
|
|
60
|
+
|
|
60
61
|
/**
|
|
61
|
-
* Check if a given object implements the
|
|
62
|
+
* Check if a given object implements the PasswordStrength interface.
|
|
62
63
|
*/
|
|
63
|
-
export function
|
|
64
|
+
export function instanceOfPasswordStrength(value: object): value is PasswordStrength {
|
|
65
|
+
if (!('valid' in value) || value['valid'] === undefined) return false;
|
|
66
|
+
if (!('score' in value) || value['score'] === undefined) return false;
|
|
67
|
+
if (!('label' in value) || value['label'] === undefined) return false;
|
|
68
|
+
if (!('feedback' in value) || value['feedback'] === undefined) return false;
|
|
64
69
|
return true;
|
|
65
70
|
}
|
|
66
71
|
|
|
67
|
-
export function
|
|
68
|
-
return
|
|
72
|
+
export function PasswordStrengthFromJSON(json: any): PasswordStrength {
|
|
73
|
+
return PasswordStrengthFromJSONTyped(json, false);
|
|
69
74
|
}
|
|
70
75
|
|
|
71
|
-
export function
|
|
76
|
+
export function PasswordStrengthFromJSONTyped(json: any, ignoreDiscriminator: boolean): PasswordStrength {
|
|
72
77
|
if (json == null) {
|
|
73
78
|
return json;
|
|
74
79
|
}
|
|
75
80
|
return {
|
|
76
81
|
|
|
77
|
-
'
|
|
78
|
-
'
|
|
79
|
-
'
|
|
80
|
-
'
|
|
81
|
-
'requireNumbers': json['require_numbers'] == null ? undefined : json['require_numbers'],
|
|
82
|
-
'requireSpecial': json['require_special'] == null ? undefined : json['require_special'],
|
|
82
|
+
'valid': json['valid'],
|
|
83
|
+
'score': json['score'],
|
|
84
|
+
'label': json['label'],
|
|
85
|
+
'feedback': json['feedback'],
|
|
83
86
|
};
|
|
84
87
|
}
|
|
85
88
|
|
|
86
|
-
export function
|
|
87
|
-
return
|
|
89
|
+
export function PasswordStrengthToJSON(json: any): PasswordStrength {
|
|
90
|
+
return PasswordStrengthToJSONTyped(json, false);
|
|
88
91
|
}
|
|
89
92
|
|
|
90
|
-
export function
|
|
93
|
+
export function PasswordStrengthToJSONTyped(value?: PasswordStrength | null, ignoreDiscriminator: boolean = false): any {
|
|
91
94
|
if (value == null) {
|
|
92
95
|
return value;
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
return {
|
|
96
99
|
|
|
97
|
-
'
|
|
98
|
-
'
|
|
99
|
-
'
|
|
100
|
-
'
|
|
101
|
-
'require_numbers': value['requireNumbers'],
|
|
102
|
-
'require_special': value['requireSpecial'],
|
|
100
|
+
'valid': value['valid'],
|
|
101
|
+
'score': value['score'],
|
|
102
|
+
'label': value['label'],
|
|
103
|
+
'feedback': value['feedback'],
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
106
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Zyphr API
|
|
5
|
+
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@zyphr.dev
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
/**
|
|
17
|
+
* Pre-submit password strength check request. The password is evaluated against the application's policy and never logged or persisted.
|
|
18
|
+
* @export
|
|
19
|
+
* @interface PasswordStrengthRequest
|
|
20
|
+
*/
|
|
21
|
+
export interface PasswordStrengthRequest {
|
|
22
|
+
/**
|
|
23
|
+
* The password to evaluate.
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof PasswordStrengthRequest
|
|
26
|
+
*/
|
|
27
|
+
password: string;
|
|
28
|
+
/**
|
|
29
|
+
* Optional. When provided, the password is checked for similarity to the email's local-part; a match is flagged and marks the password invalid.
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @memberof PasswordStrengthRequest
|
|
32
|
+
*/
|
|
33
|
+
email?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Check if a given object implements the PasswordStrengthRequest interface.
|
|
38
|
+
*/
|
|
39
|
+
export function instanceOfPasswordStrengthRequest(value: object): value is PasswordStrengthRequest {
|
|
40
|
+
if (!('password' in value) || value['password'] === undefined) return false;
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function PasswordStrengthRequestFromJSON(json: any): PasswordStrengthRequest {
|
|
45
|
+
return PasswordStrengthRequestFromJSONTyped(json, false);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function PasswordStrengthRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PasswordStrengthRequest {
|
|
49
|
+
if (json == null) {
|
|
50
|
+
return json;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
|
|
54
|
+
'password': json['password'],
|
|
55
|
+
'email': json['email'] == null ? undefined : json['email'],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function PasswordStrengthRequestToJSON(json: any): PasswordStrengthRequest {
|
|
60
|
+
return PasswordStrengthRequestToJSONTyped(json, false);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function PasswordStrengthRequestToJSONTyped(value?: PasswordStrengthRequest | null, ignoreDiscriminator: boolean = false): any {
|
|
64
|
+
if (value == null) {
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
|
|
70
|
+
'password': value['password'],
|
|
71
|
+
'email': value['email'],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|