@noresponse/node 0.0.0-stage → 1.0.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/LICENSE +202 -0
- package/README.md +34 -2
- package/dist/generated/models.d.ts +248 -0
- package/dist/generated/models.js +2 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +126 -0
- package/dist/webhooks.d.ts +17 -0
- package/dist/webhooks.js +87 -0
- package/package.json +33 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 NoResponse
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @noresponse/node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Server-side Node / TypeScript client for the provider-facing NoResponse signup API. Install it with `npm install @noresponse/node` (Node 20 or later). To work on the SDK, run `npm ci && npm test` in this folder; builds emit `dist/index.js` and type declarations.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { NoResponse, type Assessment } from "@noresponse/node";
|
|
7
|
+
|
|
8
|
+
const nr = new NoResponse({
|
|
9
|
+
apiKey: process.env.NORESPONSE_API_KEY!, // server-only
|
|
10
|
+
baseUrl: process.env.NORESPONSE_API_URL!, // https://api.noresponse.org in production
|
|
11
|
+
timeoutMs: 5000, // transport timeout; configurable per deployment
|
|
12
|
+
});
|
|
13
|
+
const assessment: Assessment = await nr.assess({
|
|
14
|
+
accountId: "usr_123",
|
|
15
|
+
email: "person@example.com", // email, username or phone: at least one
|
|
16
|
+
name: "Jane A. Doe", // optional, used only for matching
|
|
17
|
+
ip: "73.162.18.45", // optional, the signup's public IP
|
|
18
|
+
idempotencyKey: "signup-usr_123-0000001",
|
|
19
|
+
});
|
|
20
|
+
if (assessment.status === "pending") {
|
|
21
|
+
// No recommendation yet: never allow. Apply YOUR fallback, then wait for the webhook or poll.
|
|
22
|
+
} else if (assessment.risk?.recommendation === "step_up") {
|
|
23
|
+
// Your app decides whether to request an additional verification step.
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Also provides `getAssessment(assessmentId, { responseMode })` and `queryAssessments({ account_id, limit, cursor, responseMode })`. `responseMode: "detailed"` (with the `detailed` key scope) adds `risk.details` and `signals[]`; `raw` is refused.
|
|
28
|
+
|
|
29
|
+
Webhooks: `verifyWebhook(rawBody, headerPairs, secrets, nowSeconds?)` checks the `v1=` HMAC-SHA256 signature over the exact raw request bytes, the 300-second timestamp window and the event id, and returns the typed `WebhookEvent`. It takes **raw header pairs** so it can refuse a repeated header, including a case variant. Never parse then re-stringify the body before verifying. An `assessment.updated` event's `data` is the full assessment, exactly as `getAssessment` returns it: `webhookAssessment(event)` returns it as a typed `Assessment`. Keep the highest `assessment_version` per assessment. When receiving `endpoint.verification`, respond with `webhookVerificationResponse(event)`.
|
|
30
|
+
|
|
31
|
+
See [example rules](../docs/example-rules.md) for turning an assessment into an action, for example "step up when `breach_name_mismatch` or `proxy_ip` fired".
|
|
32
|
+
|
|
33
|
+
This SDK never makes the allow/deny decision for a provider. `pending`, HTTP 429/503 and network timeouts must follow provider-defined fail-open/step-up policy; idempotency keys must be reused for retries of the **same request body**. No tenant keys in browser bundles, environment values in logs, or production traffic before the API release GO decision.
|
|
34
|
+
|
|
35
|
+
Every request, response, summary, detail, signal and webhook type is generated from the provider OpenAPI contract into `src/generated/models.ts` and re-exported from the package (for example `Assessment`, `Risk`, `RiskReason`, `RiskSummary`, `Signal`, `WebhookEvent`). The committed package-lock.json makes the TypeScript toolchain reproducible; use npm ci in CI and local validation. See [provider onboarding](../docs/provider-onboarding.md) for key rotation, webhook verification, retries and staging setup.
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
export type AssessmentRequest = {
|
|
2
|
+
account_id: string;
|
|
3
|
+
identifiers: AssessmentRequestIdentifiers;
|
|
4
|
+
policy_context?: AssessmentRequestPolicyContext;
|
|
5
|
+
request_id?: string;
|
|
6
|
+
deadline_ms?: number;
|
|
7
|
+
response_mode?: AssessmentRequestResponseMode;
|
|
8
|
+
};
|
|
9
|
+
export type AssessmentRequestIdentifiers = {
|
|
10
|
+
email?: string;
|
|
11
|
+
username?: string;
|
|
12
|
+
phone?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
ip?: string;
|
|
15
|
+
};
|
|
16
|
+
export type AssessmentRequestPolicyContext = {
|
|
17
|
+
flow?: AssessmentRequestPolicyContextFlow;
|
|
18
|
+
region?: string;
|
|
19
|
+
};
|
|
20
|
+
export type AssessmentRequestPolicyContextFlow = "signup" | "login" | "recovery" | "profile_change";
|
|
21
|
+
export type AssessmentRequestResponseMode = "standard" | "detailed";
|
|
22
|
+
export type Assessment = {
|
|
23
|
+
schema_version: "1";
|
|
24
|
+
assessment_id: string;
|
|
25
|
+
account_id: string;
|
|
26
|
+
request_id?: string;
|
|
27
|
+
status: Status;
|
|
28
|
+
recommendation?: Recommendation;
|
|
29
|
+
confidence: Confidence;
|
|
30
|
+
risk?: Risk;
|
|
31
|
+
signals?: Signal[];
|
|
32
|
+
incomplete_sources: IncompleteSource[];
|
|
33
|
+
policy_version: string;
|
|
34
|
+
policy_basis: "heuristic_unvalidated";
|
|
35
|
+
assessment_version: number;
|
|
36
|
+
created_at: string;
|
|
37
|
+
updated_at: string;
|
|
38
|
+
expires_at: string;
|
|
39
|
+
assessment_url?: string;
|
|
40
|
+
timing: AssessmentTiming;
|
|
41
|
+
};
|
|
42
|
+
export type Status = "complete" | "partial" | "pending";
|
|
43
|
+
export type Recommendation = "allow" | "step_up" | "review";
|
|
44
|
+
export type Confidence = "low" | "medium" | "high" | "unavailable";
|
|
45
|
+
export type Risk = {
|
|
46
|
+
score: number;
|
|
47
|
+
band: RiskBand;
|
|
48
|
+
recommendation: Recommendation;
|
|
49
|
+
confidence: RiskConfidence;
|
|
50
|
+
policy_version: string;
|
|
51
|
+
policy_basis: "heuristic_unvalidated";
|
|
52
|
+
reasons: RiskReason[];
|
|
53
|
+
summary?: RiskSummary;
|
|
54
|
+
coverage: RiskCoverage;
|
|
55
|
+
details?: RiskDetails;
|
|
56
|
+
};
|
|
57
|
+
export type RiskBand = "low" | "medium" | "high" | "critical";
|
|
58
|
+
export type RiskConfidence = "low" | "medium" | "high";
|
|
59
|
+
export type RiskReason = {
|
|
60
|
+
code: ReasonCode;
|
|
61
|
+
weight: number;
|
|
62
|
+
identifier?: ReasonIdentifier;
|
|
63
|
+
};
|
|
64
|
+
export type ReasonCode = "no_digital_footprint" | "voip_number" | "disposable_email" | "new_email" | "spam_reports" | "fraud_flag" | "identity_mismatch" | "country_mismatch" | "proxy_ip" | "seen_before" | "shared_ip" | "many_recent_signups" | "whatsapp_absent" | "established_accounts" | "aged_identity" | "breach_name_match" | "breach_cooccurrence" | "breach_name_mismatch" | "breach_phone_mismatch" | "recent_password_exposure" | "credential_list_exposure" | "abuse_ecosystem_member" | "no_breach_history";
|
|
65
|
+
export type ReasonIdentifier = "email" | "username" | "phone" | "name" | "ip";
|
|
66
|
+
export type RiskSummary = {
|
|
67
|
+
phone?: RiskSummaryPhone;
|
|
68
|
+
email?: RiskSummaryEmail;
|
|
69
|
+
username?: RiskSummaryUsername;
|
|
70
|
+
ip?: IpSummary;
|
|
71
|
+
consistency?: Consistency;
|
|
72
|
+
};
|
|
73
|
+
export type RiskSummaryPhone = {
|
|
74
|
+
line_type?: RiskSummaryPhoneLineType;
|
|
75
|
+
country?: string;
|
|
76
|
+
on_whatsapp?: boolean;
|
|
77
|
+
report_count?: number;
|
|
78
|
+
carrier?: string;
|
|
79
|
+
};
|
|
80
|
+
export type RiskSummaryPhoneLineType = "mobile" | "voip" | "landline" | "toll_free" | "other";
|
|
81
|
+
export type RiskSummaryEmail = {
|
|
82
|
+
disposable?: boolean;
|
|
83
|
+
accounts_found?: number;
|
|
84
|
+
breach?: BreachSummary;
|
|
85
|
+
};
|
|
86
|
+
export type BreachSummary = {
|
|
87
|
+
found: boolean;
|
|
88
|
+
breach_count?: number;
|
|
89
|
+
first_year?: number;
|
|
90
|
+
last_year?: number;
|
|
91
|
+
exposed?: BreachExposed[];
|
|
92
|
+
in_credential_lists?: boolean;
|
|
93
|
+
recent_password_exposure?: boolean;
|
|
94
|
+
truncated?: boolean;
|
|
95
|
+
};
|
|
96
|
+
export type BreachExposed = "email" | "username" | "name" | "password" | "password_hash" | "phone" | "address" | "dob" | "ip" | "payment" | "security_qa";
|
|
97
|
+
export type RiskSummaryUsername = {
|
|
98
|
+
accounts_found?: number;
|
|
99
|
+
breach?: BreachSummary;
|
|
100
|
+
};
|
|
101
|
+
export type IpSummary = {
|
|
102
|
+
country?: string;
|
|
103
|
+
type?: IpSummaryType;
|
|
104
|
+
seen_in_tenant?: number;
|
|
105
|
+
};
|
|
106
|
+
export type IpSummaryType = "residential" | "hosting" | "vpn" | "proxy" | "tor" | "mobile" | "unknown";
|
|
107
|
+
export type Consistency = {
|
|
108
|
+
name?: ConsistencyValue;
|
|
109
|
+
phone?: ConsistencyValue;
|
|
110
|
+
ip?: ConsistencyValue;
|
|
111
|
+
country?: ConsistencyCountry;
|
|
112
|
+
};
|
|
113
|
+
export type ConsistencyValue = "match" | "partial" | "mismatch" | "unknown";
|
|
114
|
+
export type ConsistencyCountry = "consistent" | "mismatch" | "unknown";
|
|
115
|
+
export type RiskCoverage = {
|
|
116
|
+
answered: number;
|
|
117
|
+
failed: number;
|
|
118
|
+
pending: number;
|
|
119
|
+
};
|
|
120
|
+
export type RiskDetails = {
|
|
121
|
+
phone_names?: RiskDetailsPhoneName[];
|
|
122
|
+
breaches?: Breach[];
|
|
123
|
+
breach_names?: RiskDetailsBreachName[];
|
|
124
|
+
};
|
|
125
|
+
export type RiskDetailsPhoneName = {
|
|
126
|
+
value: string;
|
|
127
|
+
seen_by: number;
|
|
128
|
+
};
|
|
129
|
+
export type Breach = {
|
|
130
|
+
name: string;
|
|
131
|
+
domain?: string;
|
|
132
|
+
category?: string;
|
|
133
|
+
kind: BreachKind;
|
|
134
|
+
year?: number;
|
|
135
|
+
month?: number;
|
|
136
|
+
matched_on: BreachSelector;
|
|
137
|
+
exposed?: BreachExposed[];
|
|
138
|
+
};
|
|
139
|
+
export type BreachKind = "site_breach" | "credential_list" | "stealer_log" | "scrape" | "hacking_forum" | "abuse_service" | "darkweb_site";
|
|
140
|
+
export type BreachSelector = "email" | "username" | "ip";
|
|
141
|
+
export type RiskDetailsBreachName = {
|
|
142
|
+
value: string;
|
|
143
|
+
seen_in: number;
|
|
144
|
+
};
|
|
145
|
+
export type Signal = {
|
|
146
|
+
type: string;
|
|
147
|
+
identifier: IdentifierKind;
|
|
148
|
+
outcome: SignalOutcome;
|
|
149
|
+
source_id: string;
|
|
150
|
+
reason?: FailureReason;
|
|
151
|
+
evidence_ref?: string;
|
|
152
|
+
observed_at?: string;
|
|
153
|
+
last_checked_at?: string;
|
|
154
|
+
freshness: Freshness;
|
|
155
|
+
enrichment?: PhoneEnrichment;
|
|
156
|
+
};
|
|
157
|
+
export type IdentifierKind = "email" | "username" | "phone" | "ip";
|
|
158
|
+
export type SignalOutcome = "found" | "not_found" | "inconclusive" | "blocked" | "unavailable";
|
|
159
|
+
export type FailureReason = "timed_out" | "rate_limited" | "blocked" | "source_error" | "unavailable" | "deferred" | "insufficient_evidence";
|
|
160
|
+
export type Freshness = "fresh" | "stale" | "unknown";
|
|
161
|
+
export type PhoneEnrichment = {
|
|
162
|
+
fields: PhoneEnrichmentFields;
|
|
163
|
+
};
|
|
164
|
+
export type PhoneEnrichmentFields = {
|
|
165
|
+
phone?: string;
|
|
166
|
+
name?: string;
|
|
167
|
+
carrier?: string;
|
|
168
|
+
line_type?: string;
|
|
169
|
+
entity_type?: string;
|
|
170
|
+
country_code?: string;
|
|
171
|
+
country?: string;
|
|
172
|
+
state?: string;
|
|
173
|
+
city?: string;
|
|
174
|
+
location?: string;
|
|
175
|
+
national_format?: string;
|
|
176
|
+
job_title?: string;
|
|
177
|
+
company_name?: string;
|
|
178
|
+
email?: string;
|
|
179
|
+
website?: string;
|
|
180
|
+
first_call_at?: string;
|
|
181
|
+
last_call_at?: string;
|
|
182
|
+
matched_name?: string;
|
|
183
|
+
alternate_names?: Array<string | number | boolean | Record<string, unknown> | unknown[]>;
|
|
184
|
+
name_candidates?: Array<string | number | boolean | Record<string, unknown> | unknown[]>;
|
|
185
|
+
timezones?: Array<string | number | boolean | Record<string, unknown> | unknown[]>;
|
|
186
|
+
emails?: Array<string | number | boolean | Record<string, unknown> | unknown[]>;
|
|
187
|
+
websites?: Array<string | number | boolean | Record<string, unknown> | unknown[]>;
|
|
188
|
+
locations?: Array<string | number | boolean | Record<string, unknown> | unknown[]>;
|
|
189
|
+
social_profiles?: Array<string | number | boolean | Record<string, unknown> | unknown[]>;
|
|
190
|
+
report_count?: number;
|
|
191
|
+
tag_count?: number;
|
|
192
|
+
total_calls?: number;
|
|
193
|
+
calls_60_days?: number;
|
|
194
|
+
reports_60_days?: number;
|
|
195
|
+
searches_60_days?: number;
|
|
196
|
+
comment_count?: number;
|
|
197
|
+
names_count?: number;
|
|
198
|
+
spam_report_count?: number;
|
|
199
|
+
};
|
|
200
|
+
export type IncompleteSource = {
|
|
201
|
+
lane: Lane;
|
|
202
|
+
reason: IncompleteReason;
|
|
203
|
+
};
|
|
204
|
+
export type Lane = "accounts" | "phone" | "breach" | "ip";
|
|
205
|
+
export type IncompleteReason = "timed_out" | "rate_limited" | "blocked" | "source_error" | "unavailable" | "deferred";
|
|
206
|
+
export type AssessmentTiming = {
|
|
207
|
+
deadline_ms: number;
|
|
208
|
+
elapsed_ms: number;
|
|
209
|
+
};
|
|
210
|
+
export type AssessmentList = {
|
|
211
|
+
schema_version: "1";
|
|
212
|
+
account_id: string;
|
|
213
|
+
items: Assessment[];
|
|
214
|
+
next_cursor?: string;
|
|
215
|
+
retention_days: number;
|
|
216
|
+
};
|
|
217
|
+
export type WebhookEvent = {
|
|
218
|
+
id: string;
|
|
219
|
+
type: WebhookEventType;
|
|
220
|
+
created_at: string;
|
|
221
|
+
data: unknown;
|
|
222
|
+
};
|
|
223
|
+
export type WebhookEventType = "assessment.updated" | "endpoint.verification";
|
|
224
|
+
export type Problem = {
|
|
225
|
+
type: string;
|
|
226
|
+
title: string;
|
|
227
|
+
status: number;
|
|
228
|
+
detail: string;
|
|
229
|
+
instance?: string;
|
|
230
|
+
code: string;
|
|
231
|
+
request_id: string;
|
|
232
|
+
invalid_params?: ProblemInvalidParam[];
|
|
233
|
+
};
|
|
234
|
+
export type ProblemInvalidParam = {
|
|
235
|
+
field: string;
|
|
236
|
+
reason: string;
|
|
237
|
+
example?: string;
|
|
238
|
+
};
|
|
239
|
+
export type AssessmentQuery = {
|
|
240
|
+
account_id: string;
|
|
241
|
+
limit?: number;
|
|
242
|
+
cursor?: string;
|
|
243
|
+
response_mode?: AssessmentQueryResponseMode;
|
|
244
|
+
};
|
|
245
|
+
export type AssessmentQueryResponseMode = "standard" | "detailed";
|
|
246
|
+
export type WebhookVerificationResponse = {
|
|
247
|
+
challenge: string;
|
|
248
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Server-side NoResponse signup client. Never expose the API key in browser code. */
|
|
2
|
+
import type { Assessment, AssessmentList, AssessmentQuery, AssessmentRequest } from "./generated/models.js";
|
|
3
|
+
export type * from "./generated/models.js";
|
|
4
|
+
export { verifyWebhook, webhookAssessment, webhookVerificationResponse } from "./webhooks.js";
|
|
5
|
+
/** standard or detailed; raw is never served. Derived from the generated request type. */
|
|
6
|
+
export type ResponseMode = NonNullable<AssessmentRequest["response_mode"]>;
|
|
7
|
+
export declare class NoResponseError extends Error {
|
|
8
|
+
readonly status: number;
|
|
9
|
+
readonly type?: string | undefined;
|
|
10
|
+
readonly code?: string | undefined;
|
|
11
|
+
readonly detail?: string | undefined;
|
|
12
|
+
constructor(status: number, message: string, type?: string | undefined, code?: string | undefined, detail?: string | undefined);
|
|
13
|
+
}
|
|
14
|
+
export declare class NoResponse {
|
|
15
|
+
private readonly config;
|
|
16
|
+
private readonly baseUrl;
|
|
17
|
+
constructor(config: {
|
|
18
|
+
apiKey: string;
|
|
19
|
+
baseUrl: string;
|
|
20
|
+
fetch?: typeof fetch;
|
|
21
|
+
timeoutMs?: number;
|
|
22
|
+
});
|
|
23
|
+
assess(input: {
|
|
24
|
+
accountId: string;
|
|
25
|
+
email?: string;
|
|
26
|
+
username?: string;
|
|
27
|
+
phone?: string;
|
|
28
|
+
/** Full name as typed. Used only for matching; never looked up. Needs email, username or phone. */
|
|
29
|
+
name?: string;
|
|
30
|
+
/** Signup IPv4 or IPv6 address (public ranges only). Needs email, username or phone. */
|
|
31
|
+
ip?: string;
|
|
32
|
+
requestId?: string;
|
|
33
|
+
region?: string;
|
|
34
|
+
deadlineMs?: number;
|
|
35
|
+
responseMode?: ResponseMode;
|
|
36
|
+
idempotencyKey: string;
|
|
37
|
+
}): Promise<Assessment>;
|
|
38
|
+
getAssessment(assessmentId: string, options?: {
|
|
39
|
+
responseMode?: ResponseMode;
|
|
40
|
+
}): Promise<Assessment>;
|
|
41
|
+
queryAssessments(query: AssessmentQuery & {
|
|
42
|
+
responseMode?: ResponseMode;
|
|
43
|
+
}): Promise<AssessmentList>;
|
|
44
|
+
private request;
|
|
45
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export { verifyWebhook, webhookAssessment, webhookVerificationResponse } from "./webhooks.js";
|
|
2
|
+
const LOOKUP_IDENTIFIERS = ["email", "username", "phone"];
|
|
3
|
+
const MATCH_IDENTIFIERS = ["name", "ip"];
|
|
4
|
+
export class NoResponseError extends Error {
|
|
5
|
+
status;
|
|
6
|
+
type;
|
|
7
|
+
code;
|
|
8
|
+
detail;
|
|
9
|
+
constructor(status, message, type, code, detail) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.status = status;
|
|
12
|
+
this.type = type;
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.detail = detail;
|
|
15
|
+
this.name = "NoResponseError";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class NoResponse {
|
|
19
|
+
config;
|
|
20
|
+
baseUrl;
|
|
21
|
+
constructor(config) {
|
|
22
|
+
this.config = config;
|
|
23
|
+
if (!config.apiKey)
|
|
24
|
+
throw new Error("NoResponse API key required");
|
|
25
|
+
if (config.timeoutMs !== undefined && (!Number.isInteger(config.timeoutMs) || config.timeoutMs <= 0)) {
|
|
26
|
+
throw new Error("timeoutMs must be a positive integer");
|
|
27
|
+
}
|
|
28
|
+
const url = new URL(config.baseUrl);
|
|
29
|
+
if (url.search || url.hash || /[?#]$/.test(config.baseUrl)) {
|
|
30
|
+
throw new Error("baseUrl must not include a query or fragment");
|
|
31
|
+
}
|
|
32
|
+
if (url.protocol !== "https:" && url.hostname !== "localhost" && url.hostname !== "127.0.0.1") {
|
|
33
|
+
throw new Error("NoResponse requires HTTPS outside localhost");
|
|
34
|
+
}
|
|
35
|
+
this.baseUrl = url.toString().replace(/\/$/, "");
|
|
36
|
+
}
|
|
37
|
+
async assess(input) {
|
|
38
|
+
const identifiers = {};
|
|
39
|
+
for (const key of LOOKUP_IDENTIFIERS)
|
|
40
|
+
if (input[key] !== undefined)
|
|
41
|
+
identifiers[key] = input[key];
|
|
42
|
+
if (!Object.keys(identifiers).length)
|
|
43
|
+
throw new Error("At least one of email, username or phone required");
|
|
44
|
+
for (const key of MATCH_IDENTIFIERS)
|
|
45
|
+
if (input[key] !== undefined)
|
|
46
|
+
identifiers[key] = input[key];
|
|
47
|
+
if (input.name !== undefined && (input.name.length < 1 || input.name.length > 128))
|
|
48
|
+
throw new Error("name must be 1-128 characters");
|
|
49
|
+
if (!/^[A-Za-z0-9._:-]{16,128}$/.test(input.idempotencyKey))
|
|
50
|
+
throw new Error("Valid 16-128 character idempotencyKey required");
|
|
51
|
+
const body = { account_id: input.accountId, identifiers: identifiers };
|
|
52
|
+
if (input.requestId !== undefined)
|
|
53
|
+
body.request_id = input.requestId;
|
|
54
|
+
if (input.deadlineMs !== undefined) {
|
|
55
|
+
if (!Number.isInteger(input.deadlineMs) || input.deadlineMs < 50 || input.deadlineMs > 500)
|
|
56
|
+
throw new Error("deadlineMs must be 50–500");
|
|
57
|
+
body.deadline_ms = input.deadlineMs;
|
|
58
|
+
}
|
|
59
|
+
if (input.region !== undefined)
|
|
60
|
+
body.policy_context = { flow: "signup", region: input.region };
|
|
61
|
+
if (input.responseMode !== undefined) {
|
|
62
|
+
if (input.responseMode !== "standard" && input.responseMode !== "detailed")
|
|
63
|
+
throw new Error("responseMode must be standard or detailed; raw is never served");
|
|
64
|
+
body.response_mode = input.responseMode;
|
|
65
|
+
}
|
|
66
|
+
return this.request("/v1/assessments", { method: "POST", body: JSON.stringify(body), headers: { "Idempotency-Key": input.idempotencyKey } });
|
|
67
|
+
}
|
|
68
|
+
async getAssessment(assessmentId, options = {}) {
|
|
69
|
+
if (!/^asm_[0-9A-HJKMNP-TV-Z]{26}$/.test(assessmentId))
|
|
70
|
+
throw new Error("Invalid assessment ID");
|
|
71
|
+
if (options.responseMode !== undefined && options.responseMode !== "standard" && options.responseMode !== "detailed")
|
|
72
|
+
throw new Error("responseMode must be standard or detailed");
|
|
73
|
+
const suffix = options.responseMode ? `?response_mode=${options.responseMode}` : "";
|
|
74
|
+
return this.request(`/v1/assessments/${assessmentId}${suffix}`, { method: "GET" });
|
|
75
|
+
}
|
|
76
|
+
async queryAssessments(query) {
|
|
77
|
+
if (!query.account_id || (query.limit !== undefined && (!Number.isInteger(query.limit) || query.limit < 1 || query.limit > 50)))
|
|
78
|
+
throw new Error("Invalid assessment query");
|
|
79
|
+
if (query.responseMode !== undefined && query.response_mode !== undefined)
|
|
80
|
+
throw new Error("Supply only one response mode");
|
|
81
|
+
const mode = query.responseMode ?? query.response_mode;
|
|
82
|
+
if (mode !== undefined && mode !== "standard" && mode !== "detailed")
|
|
83
|
+
throw new Error("responseMode must be standard or detailed; raw is never served");
|
|
84
|
+
const body = { account_id: query.account_id };
|
|
85
|
+
if (query.limit !== undefined)
|
|
86
|
+
body.limit = query.limit;
|
|
87
|
+
if (query.cursor !== undefined)
|
|
88
|
+
body.cursor = query.cursor;
|
|
89
|
+
if (mode !== undefined)
|
|
90
|
+
body.response_mode = mode;
|
|
91
|
+
return this.request("/v1/assessments/query", { method: "POST", body: JSON.stringify(body) });
|
|
92
|
+
}
|
|
93
|
+
async request(path, options) {
|
|
94
|
+
const transport = this.config.fetch ?? fetch;
|
|
95
|
+
const response = await transport(this.baseUrl + path, {
|
|
96
|
+
method: options.method,
|
|
97
|
+
headers: {
|
|
98
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
99
|
+
Accept: "application/json",
|
|
100
|
+
...(options.body ? { "Content-Type": "application/json" } : {}),
|
|
101
|
+
...options.headers,
|
|
102
|
+
},
|
|
103
|
+
body: options.body,
|
|
104
|
+
signal: AbortSignal.timeout(this.config.timeoutMs ?? 5000),
|
|
105
|
+
});
|
|
106
|
+
if (!response.ok) {
|
|
107
|
+
let problem = {};
|
|
108
|
+
try {
|
|
109
|
+
const parsed = await response.json();
|
|
110
|
+
if (parsed !== null && typeof parsed === "object") {
|
|
111
|
+
const body = parsed;
|
|
112
|
+
problem = {
|
|
113
|
+
...(typeof body.type === "string" ? { type: body.type } : {}),
|
|
114
|
+
...(typeof body.code === "string" ? { code: body.code } : {}),
|
|
115
|
+
...(typeof body.detail === "string" ? { detail: body.detail } : {}),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// Preserve NoResponseError when the error body is empty or invalid JSON.
|
|
121
|
+
}
|
|
122
|
+
throw new NoResponseError(response.status, `NoResponse request failed (HTTP ${response.status})`, problem.type, problem.code, problem.detail);
|
|
123
|
+
}
|
|
124
|
+
return response.json();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Assessment, WebhookEvent } from "./generated/models.js";
|
|
2
|
+
/**
|
|
3
|
+
* Verify a delivery against the raw request bytes and return the typed event.
|
|
4
|
+
* Header pairs retain duplicates, so a repeated or case-variant header is refused.
|
|
5
|
+
* For assessment.updated, `data` is the assessment exactly as GET returns it;
|
|
6
|
+
* webhookAssessment(event) returns it as a typed Assessment.
|
|
7
|
+
*/
|
|
8
|
+
export declare function verifyWebhook(rawBody: Uint8Array, headerPairs: ReadonlyArray<readonly [string, string]>, secrets: Readonly<Record<string, string | Uint8Array>>, nowSeconds?: number): WebhookEvent;
|
|
9
|
+
/**
|
|
10
|
+
* The typed assessment carried by a verified assessment.updated event. Throws for
|
|
11
|
+
* any other event, and for data that is not a full assessment (for example an
|
|
12
|
+
* expiry notice or a pre-v1 pointer payload).
|
|
13
|
+
*/
|
|
14
|
+
export declare function webhookAssessment(event: WebhookEvent): Assessment;
|
|
15
|
+
export declare function webhookVerificationResponse(event: WebhookEvent): {
|
|
16
|
+
challenge: string;
|
|
17
|
+
};
|
package/dist/webhooks.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
2
|
+
const EVENT_TYPES = new Set(["assessment.updated", "endpoint.verification"]);
|
|
3
|
+
function isRecord(value) {
|
|
4
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5
|
+
}
|
|
6
|
+
/** The envelope fields, read from the v1 names (id, type) or the earlier event_id/event_type. */
|
|
7
|
+
function envelope(event) {
|
|
8
|
+
const body = isRecord(event) ? event : {};
|
|
9
|
+
return { id: body.id ?? body.event_id, type: body.type ?? body.event_type, data: body.data };
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Verify a delivery against the raw request bytes and return the typed event.
|
|
13
|
+
* Header pairs retain duplicates, so a repeated or case-variant header is refused.
|
|
14
|
+
* For assessment.updated, `data` is the assessment exactly as GET returns it;
|
|
15
|
+
* webhookAssessment(event) returns it as a typed Assessment.
|
|
16
|
+
*/
|
|
17
|
+
export function verifyWebhook(rawBody, headerPairs, secrets, nowSeconds = Math.floor(Date.now() / 1000)) {
|
|
18
|
+
const required = ["nr-webhook-id", "nr-webhook-timestamp", "nr-webhook-key-id", "nr-webhook-signature"];
|
|
19
|
+
const headers = new Map();
|
|
20
|
+
for (const [key, value] of headerPairs) {
|
|
21
|
+
const name = key.toLowerCase();
|
|
22
|
+
if (!required.includes(name))
|
|
23
|
+
continue;
|
|
24
|
+
if (headers.has(name))
|
|
25
|
+
throw new Error("Duplicate webhook header");
|
|
26
|
+
headers.set(name, value);
|
|
27
|
+
}
|
|
28
|
+
if (required.some(name => !headers.get(name)))
|
|
29
|
+
throw new Error("Missing webhook header");
|
|
30
|
+
const timestamp = headers.get("nr-webhook-timestamp");
|
|
31
|
+
if (!/^[0-9]{1,12}$/.test(timestamp) || Math.abs(nowSeconds - Number(timestamp)) > 300) {
|
|
32
|
+
throw new Error("Invalid webhook timestamp");
|
|
33
|
+
}
|
|
34
|
+
const keyId = headers.get("nr-webhook-key-id");
|
|
35
|
+
if (!/^whk_[A-Za-z0-9]{8,64}$/.test(keyId) || !Object.prototype.hasOwnProperty.call(secrets, keyId)) {
|
|
36
|
+
throw new Error("Unknown webhook key");
|
|
37
|
+
}
|
|
38
|
+
const signature = headers.get("nr-webhook-signature");
|
|
39
|
+
if (!/^v1=[0-9a-f]{64}$/.test(signature))
|
|
40
|
+
throw new Error("Malformed webhook signature");
|
|
41
|
+
const expected = createHmac("sha256", secrets[keyId]).update(timestamp).update(".").update(rawBody).digest();
|
|
42
|
+
if (!timingSafeEqual(expected, Buffer.from(signature.slice(3), "hex")))
|
|
43
|
+
throw new Error("Invalid webhook signature");
|
|
44
|
+
let event;
|
|
45
|
+
try {
|
|
46
|
+
event = JSON.parse(Buffer.from(rawBody).toString("utf8"));
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
throw new Error("Invalid webhook JSON");
|
|
50
|
+
}
|
|
51
|
+
const { id, type } = envelope(event);
|
|
52
|
+
if (!isRecord(event) || id !== headers.get("nr-webhook-id")) {
|
|
53
|
+
throw new Error("Webhook event ID mismatch");
|
|
54
|
+
}
|
|
55
|
+
if (typeof type !== "string" || !EVENT_TYPES.has(type)) {
|
|
56
|
+
throw new Error("Unknown webhook event");
|
|
57
|
+
}
|
|
58
|
+
return event;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The typed assessment carried by a verified assessment.updated event. Throws for
|
|
62
|
+
* any other event, and for data that is not a full assessment (for example an
|
|
63
|
+
* expiry notice or a pre-v1 pointer payload).
|
|
64
|
+
*/
|
|
65
|
+
export function webhookAssessment(event) {
|
|
66
|
+
const { type, data } = envelope(event);
|
|
67
|
+
if (type !== "assessment.updated")
|
|
68
|
+
throw new Error("Not an assessment event");
|
|
69
|
+
if (!isRecord(data) ||
|
|
70
|
+
typeof data.assessment_id !== "string" ||
|
|
71
|
+
typeof data.assessment_version !== "number" ||
|
|
72
|
+
typeof data.status !== "string" ||
|
|
73
|
+
typeof data.created_at !== "string" ||
|
|
74
|
+
!Array.isArray(data.incomplete_sources) ||
|
|
75
|
+
!isRecord(data.timing)) {
|
|
76
|
+
throw new Error("Webhook data is not a full assessment");
|
|
77
|
+
}
|
|
78
|
+
return data;
|
|
79
|
+
}
|
|
80
|
+
export function webhookVerificationResponse(event) {
|
|
81
|
+
const { type, data } = envelope(event);
|
|
82
|
+
const challenge = isRecord(data) ? data.challenge : undefined;
|
|
83
|
+
if (type !== "endpoint.verification" || typeof challenge !== "string" || !/^[A-Za-z0-9_-]{43}$/.test(challenge)) {
|
|
84
|
+
throw new Error("Invalid endpoint verification event");
|
|
85
|
+
}
|
|
86
|
+
return { challenge };
|
|
87
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noresponse/node",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Server-only NoResponse signup and webhook SDK",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/noresponsehq/noresponse.git",
|
|
10
|
+
"directory": "sdks/typescript"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=20"
|
|
14
|
+
},
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc --project tsconfig.json",
|
|
28
|
+
"typecheck": "tsc --noEmit",
|
|
29
|
+
"test": "npm run build && tsc --project tests/tsconfig.json && node --test tests/*.test.mjs"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"typescript": "5.9.3",
|
|
33
|
+
"@types/node": "22.15.30"
|
|
34
|
+
}
|
|
35
|
+
}
|