@atlasauth/backend 0.9.1 → 0.11.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 +17 -0
- package/README.md +55 -0
- package/dist/client/error.d.ts +4 -0
- package/dist/client/error.js +4 -0
- package/dist/client/error.js.map +1 -1
- package/dist/client/index.d.ts +18 -1
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/instance-security.d.ts +39 -2
- package/dist/client/instance-security.js +12 -0
- package/dist/client/instance-security.js.map +1 -1
- package/dist/client/messaging.d.ts +1 -1
- package/dist/client/platform.d.ts +50 -10
- package/dist/client/platform.js +23 -7
- package/dist/client/platform.js.map +1 -1
- package/dist/client/referrals.d.ts +210 -0
- package/dist/client/referrals.js +39 -0
- package/dist/client/referrals.js.map +1 -0
- package/dist/client/users.d.ts +85 -0
- package/dist/client/users.js +15 -0
- package/dist/client/users.js.map +1 -1
- package/dist/client/webhooks.d.ts +25 -2
- package/dist/client/webhooks.js +7 -3
- package/dist/client/webhooks.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/referrals.d.ts +199 -0
- package/dist/referrals.js +121 -0
- package/dist/referrals.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { type RequestFn } from './request';
|
|
2
|
+
import type { ListPage } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Referral attribution: the instance's connection to a referral platform.
|
|
5
|
+
*
|
|
6
|
+
* With referrals on, every interactive sign-up is reported to the platform
|
|
7
|
+
* before `user.created` is sent and before the session is issued. The
|
|
8
|
+
* platform's answer lands on the user (`referral`, `referral_code`,
|
|
9
|
+
* `referral_link`). A slow or failing platform never fails a sign-up: the
|
|
10
|
+
* call is retried, and `user.referral_attributed` is sent when it resolves.
|
|
11
|
+
*
|
|
12
|
+
* `provider` is `webhook` (the Atlas referral protocol, which any platform can
|
|
13
|
+
* implement; see {@link verifyReferralRequest}) or a built-in vendor adapter.
|
|
14
|
+
* `signing_secret` and `api_key` are write-only: reads return
|
|
15
|
+
* `signing_secret_set` / `api_key_set`.
|
|
16
|
+
*/
|
|
17
|
+
/** What a provider can do. An operation it lacks is recorded as `skipped`. */
|
|
18
|
+
export interface ReferralProviderCapabilities {
|
|
19
|
+
signup: boolean;
|
|
20
|
+
erase: boolean;
|
|
21
|
+
export: boolean;
|
|
22
|
+
partner: boolean;
|
|
23
|
+
auto_enroll: boolean;
|
|
24
|
+
signal: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** A referral provider Atlas supports. */
|
|
27
|
+
export interface ReferralProviderInfo {
|
|
28
|
+
/** `webhook` (the Atlas referral protocol) or a vendor adapter id (`dub`, `firstpromoter`, …). */
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
capabilities: ReferralProviderCapabilities;
|
|
32
|
+
/** What must be set before `enabled` can be true. */
|
|
33
|
+
needs: Array<'endpoint_url' | 'signing_secret' | 'api_key' | 'connection_id'>;
|
|
34
|
+
/** The vendor's own first-party tracking cookie, suggested when this provider is picked. */
|
|
35
|
+
default_context_cookie: string | null;
|
|
36
|
+
docs_url: string | null;
|
|
37
|
+
}
|
|
38
|
+
/** Fraud and bot protection for referred sign-ups (`security` on the settings). */
|
|
39
|
+
export interface ReferralSecuritySettings {
|
|
40
|
+
/**
|
|
41
|
+
* `always` (default): a sign-up carrying a referral code must pass the bot
|
|
42
|
+
* challenge, even where the captcha is otherwise off. `inherit`: the
|
|
43
|
+
* instance captcha policy decides. With no working captcha, `always` behaves
|
|
44
|
+
* as `inherit` and preflight reports `referrals_without_bot_protection`.
|
|
45
|
+
*/
|
|
46
|
+
challenge_referred_signups: 'always' | 'inherit';
|
|
47
|
+
/**
|
|
48
|
+
* `flag` (default): report the sign-up with its risk. `strip`: report it as
|
|
49
|
+
* not referred, with `rejected.reason`. `hold`: report nothing until the
|
|
50
|
+
* email is proven, then re-assess.
|
|
51
|
+
*/
|
|
52
|
+
on_high_risk: 'flag' | 'strip' | 'hold';
|
|
53
|
+
/** Hold every referred sign-up until the email is proven. Default false. */
|
|
54
|
+
hold_until_email_verified: boolean;
|
|
55
|
+
/** Referred sign-ups per code from one IP network or device per hour before a velocity signal (1-1000, default 5). */
|
|
56
|
+
max_referred_signups_per_ip_hour: number;
|
|
57
|
+
}
|
|
58
|
+
/** The connection's health, as the settings read reports it. */
|
|
59
|
+
export interface ReferralConnectionStatus {
|
|
60
|
+
/** The last connection test, or null when never tested. */
|
|
61
|
+
last_test: {
|
|
62
|
+
ok: boolean;
|
|
63
|
+
at: number;
|
|
64
|
+
http_status: number | null;
|
|
65
|
+
error: string | null;
|
|
66
|
+
} | null;
|
|
67
|
+
/** Calls that failed permanently in the last 7 days. */
|
|
68
|
+
failed_calls_7d: number;
|
|
69
|
+
/** Calls waiting for a retry. */
|
|
70
|
+
retrying_calls: number;
|
|
71
|
+
/** Epoch ms of the last successful call, or null. */
|
|
72
|
+
last_success_at: number | null;
|
|
73
|
+
}
|
|
74
|
+
/** `GET /v1/instance/referrals`. */
|
|
75
|
+
export interface ReferralSettings {
|
|
76
|
+
object: 'referral_settings';
|
|
77
|
+
enabled: boolean;
|
|
78
|
+
/** `webhook` (the Atlas referral protocol) or a built-in vendor adapter id. */
|
|
79
|
+
provider: string;
|
|
80
|
+
/** Base URL of the platform connection (Atlas referral protocol). */
|
|
81
|
+
endpoint_url: string | null;
|
|
82
|
+
/** Passed through to the platform. */
|
|
83
|
+
program_id: string | null;
|
|
84
|
+
/** Your label for the connection on the platform side. */
|
|
85
|
+
connection_id: string | null;
|
|
86
|
+
/** Whether a signing secret is stored (the value is never returned). */
|
|
87
|
+
signing_secret_set: boolean;
|
|
88
|
+
/** Whether a vendor API key is stored (the value is never returned). */
|
|
89
|
+
api_key_set: boolean;
|
|
90
|
+
/** Query parameters that carry a referral code, in priority order (default `ref`, `via`, `aff`). */
|
|
91
|
+
url_params: string[];
|
|
92
|
+
/** First-party tracking cookie read under consent; null = never read a cookie. */
|
|
93
|
+
context_cookie: string | null;
|
|
94
|
+
consent_category: string;
|
|
95
|
+
consent_fallback_category: string | null;
|
|
96
|
+
/** Every new user becomes a referrer (gets a code and link from the platform). */
|
|
97
|
+
auto_enroll_users: boolean;
|
|
98
|
+
/** e.g. `https://app.example.com/join?ref={code}`; builds `referral_link`. */
|
|
99
|
+
link_template: string | null;
|
|
100
|
+
/** How long a sign-up waits for the platform (100-5000 ms, default 3000). */
|
|
101
|
+
timeout_ms: number;
|
|
102
|
+
security: ReferralSecuritySettings;
|
|
103
|
+
/** What the chosen provider still needs before referrals can be enabled. */
|
|
104
|
+
missing?: string[];
|
|
105
|
+
connection?: ReferralConnectionStatus | null;
|
|
106
|
+
providers: ReferralProviderInfo[];
|
|
107
|
+
updated_at?: number | null;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* `PATCH /v1/instance/referrals`: only the fields sent change, `null` clears.
|
|
111
|
+
* Enabling without what the provider needs is `422 REFERRALS_NOT_CONFIGURED`.
|
|
112
|
+
*/
|
|
113
|
+
export interface UpdateReferralSettingsBody {
|
|
114
|
+
enabled?: boolean;
|
|
115
|
+
provider?: string;
|
|
116
|
+
/** https only (http only for localhost on a development instance). */
|
|
117
|
+
endpoint_url?: string | null;
|
|
118
|
+
program_id?: string | null;
|
|
119
|
+
connection_id?: string | null;
|
|
120
|
+
/** Write-only, 16-512 characters. */
|
|
121
|
+
signing_secret?: string | null;
|
|
122
|
+
/** Write-only vendor API key. */
|
|
123
|
+
api_key?: string | null;
|
|
124
|
+
/** 1-10 names of `[A-Za-z0-9_.-]{1,40}`. */
|
|
125
|
+
url_params?: string[];
|
|
126
|
+
context_cookie?: string | null;
|
|
127
|
+
consent_category?: string;
|
|
128
|
+
consent_fallback_category?: string | null;
|
|
129
|
+
auto_enroll_users?: boolean;
|
|
130
|
+
/** An https URL containing `{code}`. */
|
|
131
|
+
link_template?: string | null;
|
|
132
|
+
/** 100-5000. */
|
|
133
|
+
timeout_ms?: number;
|
|
134
|
+
/** Partial: only the security fields sent change. */
|
|
135
|
+
security?: Partial<ReferralSecuritySettings>;
|
|
136
|
+
}
|
|
137
|
+
/** `POST /v1/instance/referrals/test`. */
|
|
138
|
+
export interface ReferralConnectionTest {
|
|
139
|
+
ok: boolean;
|
|
140
|
+
http_status?: number | null;
|
|
141
|
+
latency_ms?: number | null;
|
|
142
|
+
/** e.g. `signature_rejected` (the platform answered 401/403), `timeout`, `network_error`, `url_blocked`, `http_500`. */
|
|
143
|
+
error?: {
|
|
144
|
+
code: string;
|
|
145
|
+
message: string;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export type ReferralCallKind = 'signup' | 'erase' | 'export' | 'partner' | 'signal' | 'test';
|
|
149
|
+
export type ReferralCallStatus = 'pending' | 'succeeded' | 'retrying' | 'failed' | 'held' | 'skipped';
|
|
150
|
+
/** The risk verdict sent with a sign-up (camelCase, as on the referral protocol). */
|
|
151
|
+
export interface ReferralRisk {
|
|
152
|
+
level: 'low' | 'medium' | 'high';
|
|
153
|
+
/** 0-100. */
|
|
154
|
+
score: number;
|
|
155
|
+
/**
|
|
156
|
+
* e.g. `self_referral`, `ip_velocity`, `device_velocity`, `disposable_email`,
|
|
157
|
+
* `datacenter_ip`, `tor_ip`, `captcha_not_passed`, `email_unverified`,
|
|
158
|
+
* `restricted_identifier`.
|
|
159
|
+
*/
|
|
160
|
+
signals: string[];
|
|
161
|
+
captcha: 'passed' | 'not_required' | 'not_configured';
|
|
162
|
+
emailVerified: boolean;
|
|
163
|
+
}
|
|
164
|
+
/** One call in the referral call log. */
|
|
165
|
+
export interface ReferralCall {
|
|
166
|
+
object: 'referral_call';
|
|
167
|
+
/** Also the signed `atlas-id` header of every attempt. */
|
|
168
|
+
id: string;
|
|
169
|
+
kind: ReferralCallKind;
|
|
170
|
+
status: ReferralCallStatus;
|
|
171
|
+
/** Sign-up calls: `referred`, `not_referred` or `stripped`. */
|
|
172
|
+
outcome?: string | null;
|
|
173
|
+
customer_ref: string;
|
|
174
|
+
user_id?: string | null;
|
|
175
|
+
http_status?: number | null;
|
|
176
|
+
last_error?: string | null;
|
|
177
|
+
attempts: number;
|
|
178
|
+
/** Epoch ms of the next retry, while pending or retrying. */
|
|
179
|
+
next_attempt_at?: number | null;
|
|
180
|
+
risk?: ReferralRisk | null;
|
|
181
|
+
/** What was sent (never secrets). */
|
|
182
|
+
payload?: Record<string, unknown>;
|
|
183
|
+
created_at: number;
|
|
184
|
+
updated_at?: number;
|
|
185
|
+
}
|
|
186
|
+
export interface ListReferralCallsParams {
|
|
187
|
+
/** 1-200, default 50, newest first. */
|
|
188
|
+
limit?: number;
|
|
189
|
+
status?: ReferralCallStatus;
|
|
190
|
+
kind?: ReferralCallKind;
|
|
191
|
+
user_id?: string;
|
|
192
|
+
}
|
|
193
|
+
export declare function referralsResource(request: RequestFn): {
|
|
194
|
+
/** `GET /v1/instance/referrals` — settings, connection status and the supported providers. */
|
|
195
|
+
get(): Promise<ReferralSettings>;
|
|
196
|
+
/** `PATCH /v1/instance/referrals` — partial update; secrets are write-only. */
|
|
197
|
+
update(body: UpdateReferralSettingsBody, idempotencyKey?: string): Promise<ReferralSettings>;
|
|
198
|
+
/**
|
|
199
|
+
* `POST /v1/instance/referrals/test` — a signed probe of the platform. `ok`
|
|
200
|
+
* when it answered 2xx or 404; `error.code` `signature_rejected` on 401/403.
|
|
201
|
+
*/
|
|
202
|
+
test(): Promise<ReferralConnectionTest>;
|
|
203
|
+
/** `GET /v1/instance/referrals/calls` — the call log, newest first. */
|
|
204
|
+
listCalls(params?: ListReferralCallsParams): Promise<ListPage<ReferralCall>>;
|
|
205
|
+
/**
|
|
206
|
+
* `POST /v1/instance/referrals/calls/:id/retry` — retry a failed, retrying
|
|
207
|
+
* or skipped call now (a connection test cannot be retried).
|
|
208
|
+
*/
|
|
209
|
+
retryCall(id: string, idempotencyKey?: string): Promise<ReferralCall>;
|
|
210
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.referralsResource = referralsResource;
|
|
4
|
+
const request_1 = require("./request");
|
|
5
|
+
function referralsResource(request) {
|
|
6
|
+
return {
|
|
7
|
+
/** `GET /v1/instance/referrals` — settings, connection status and the supported providers. */
|
|
8
|
+
get() {
|
|
9
|
+
return request({ method: 'GET', path: '/v1/instance/referrals' });
|
|
10
|
+
},
|
|
11
|
+
/** `PATCH /v1/instance/referrals` — partial update; secrets are write-only. */
|
|
12
|
+
update(body, idempotencyKey) {
|
|
13
|
+
return request({ method: 'PATCH', path: '/v1/instance/referrals', body, idempotencyKey });
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* `POST /v1/instance/referrals/test` — a signed probe of the platform. `ok`
|
|
17
|
+
* when it answered 2xx or 404; `error.code` `signature_rejected` on 401/403.
|
|
18
|
+
*/
|
|
19
|
+
test() {
|
|
20
|
+
return request({ method: 'POST', path: '/v1/instance/referrals/test' });
|
|
21
|
+
},
|
|
22
|
+
/** `GET /v1/instance/referrals/calls` — the call log, newest first. */
|
|
23
|
+
listCalls(params = {}) {
|
|
24
|
+
return request({ method: 'GET', path: '/v1/instance/referrals/calls', query: { ...params } });
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* `POST /v1/instance/referrals/calls/:id/retry` — retry a failed, retrying
|
|
28
|
+
* or skipped call now (a connection test cannot be retried).
|
|
29
|
+
*/
|
|
30
|
+
retryCall(id, idempotencyKey) {
|
|
31
|
+
return request({
|
|
32
|
+
method: 'POST',
|
|
33
|
+
path: `/v1/instance/referrals/calls/${(0, request_1.enc)(id)}/retry`,
|
|
34
|
+
idempotencyKey,
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=referrals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referrals.js","sourceRoot":"","sources":["../../src/client/referrals.ts"],"names":[],"mappings":";;AAqMA,8CAiCC;AAtOD,uCAAgD;AAqMhD,SAAgB,iBAAiB,CAAC,OAAkB;IAClD,OAAO;QACL,8FAA8F;QAC9F,GAAG;YACD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC,CAAC;QACpE,CAAC;QACD,+EAA+E;QAC/E,MAAM,CAAC,IAAgC,EAAE,cAAuB;YAC9D,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,wBAAwB,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QAC5F,CAAC;QACD;;;WAGG;QACH,IAAI;YACF,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,6BAA6B,EAAE,CAAC,CAAC;QAC1E,CAAC;QACD,uEAAuE;QACvE,SAAS,CAAC,SAAkC,EAAE;YAC5C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC;QAChG,CAAC;QACD;;;WAGG;QACH,SAAS,CAAC,EAAU,EAAE,cAAuB;YAC3C,OAAO,OAAO,CAAC;gBACb,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,gCAAgC,IAAA,aAAG,EAAC,EAAE,CAAC,QAAQ;gBACrD,cAAc;aACf,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/client/users.d.ts
CHANGED
|
@@ -22,6 +22,72 @@ export interface User {
|
|
|
22
22
|
* the one you hold. (Absent from servers older than this field.)
|
|
23
23
|
*/
|
|
24
24
|
version?: number;
|
|
25
|
+
/**
|
|
26
|
+
* How the user arrived through a referral program, when the instance has
|
|
27
|
+
* referral attribution on and the platform matched a referrer; null when not
|
|
28
|
+
* referred, not answered yet, or referrals are off. (Absent from servers
|
|
29
|
+
* older than this field.)
|
|
30
|
+
*/
|
|
31
|
+
referral?: UserReferral | null;
|
|
32
|
+
/** The user's own referral code, when they are a referrer. */
|
|
33
|
+
referral_code?: string | null;
|
|
34
|
+
/** The user's own referral link, when they are a referrer. */
|
|
35
|
+
referral_link?: string | null;
|
|
36
|
+
}
|
|
37
|
+
/** The inbound referral the referral platform matched for a user. */
|
|
38
|
+
export interface UserReferral {
|
|
39
|
+
/** The platform's id for the referring partner. */
|
|
40
|
+
partner_id: string | null;
|
|
41
|
+
/** The referrer as the platform knows them (your `external_id` for that user, or their Atlas id). */
|
|
42
|
+
referrer_external_id: string | null;
|
|
43
|
+
/** The referrer's Atlas user id, when they are a user of this instance. */
|
|
44
|
+
referrer_user_id: string | null;
|
|
45
|
+
/** How the platform matched the referral, e.g. `code`, `click`, `coupon`. */
|
|
46
|
+
matched_via: string | null;
|
|
47
|
+
/** The platform's own status for the referral. */
|
|
48
|
+
status: string | null;
|
|
49
|
+
/** The risk level Atlas assessed at sign-up, when one was. */
|
|
50
|
+
risk_level?: 'low' | 'medium' | 'high' | null;
|
|
51
|
+
/** An admin marked the referral fraudulent (`users.flagReferral`). */
|
|
52
|
+
flagged?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* An imported referral on `users.create`: how the user arrived. With referral
|
|
56
|
+
* attribution on, the user is reported to the referral platform. Each id is
|
|
57
|
+
* 3-64 characters of `A-Z a-z 0-9 _ -`.
|
|
58
|
+
*/
|
|
59
|
+
export interface CreateUserReferralInput {
|
|
60
|
+
code?: string;
|
|
61
|
+
click_id?: string;
|
|
62
|
+
anon_id?: string;
|
|
63
|
+
}
|
|
64
|
+
/** `POST /v1/users/:id/referral/flag`. */
|
|
65
|
+
export interface UserReferralFlag {
|
|
66
|
+
object: 'user_referral';
|
|
67
|
+
user_id: string;
|
|
68
|
+
/** `flagged` after this call. */
|
|
69
|
+
status: string;
|
|
70
|
+
flagged: boolean;
|
|
71
|
+
flag_reason: string | null;
|
|
72
|
+
/** Epoch ms. */
|
|
73
|
+
flagged_at: number | null;
|
|
74
|
+
risk_level: 'low' | 'medium' | 'high' | null;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The `data` of a `user.referral_attributed` webhook: the referral platform
|
|
78
|
+
* answered after `user.created` was sent.
|
|
79
|
+
*/
|
|
80
|
+
export interface UserReferralAttributedEvent {
|
|
81
|
+
object: 'user_referral';
|
|
82
|
+
user_id: string;
|
|
83
|
+
/** `attributed`, `not_referred`, `failed`, … (`not_referred`: the platform found no referrer). */
|
|
84
|
+
attribution_status: string;
|
|
85
|
+
referral: UserReferral | null;
|
|
86
|
+
referral_code: string | null;
|
|
87
|
+
referral_link: string | null;
|
|
88
|
+
/** Epoch ms. */
|
|
89
|
+
signed_up_at: number;
|
|
90
|
+
updated_at: number;
|
|
25
91
|
}
|
|
26
92
|
export interface EmailAddress {
|
|
27
93
|
object: 'email_address';
|
|
@@ -75,12 +141,21 @@ export interface CreateUserBody {
|
|
|
75
141
|
* guarantees no email, SMS or push is sent as a consequence of the create.
|
|
76
142
|
*/
|
|
77
143
|
notify?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Import a referral (how the user arrived). With referral attribution on,
|
|
146
|
+
* the user is reported to the referral platform.
|
|
147
|
+
*/
|
|
148
|
+
referral?: CreateUserReferralInput;
|
|
149
|
+
/** The user's own referral code; unique per instance (`409 REFERRAL_CODE_TAKEN`). */
|
|
150
|
+
referral_code?: string;
|
|
78
151
|
}
|
|
79
152
|
export interface UpdateUserBody {
|
|
80
153
|
first_name?: string;
|
|
81
154
|
last_name?: string;
|
|
82
155
|
public_metadata?: Metadata;
|
|
83
156
|
private_metadata?: Metadata;
|
|
157
|
+
/** The user's own referral code; `null` clears. Unique per instance (`409 REFERRAL_CODE_TAKEN`). */
|
|
158
|
+
referral_code?: string | null;
|
|
84
159
|
}
|
|
85
160
|
export interface ReplaceUserMetadataBody {
|
|
86
161
|
public_metadata?: Metadata;
|
|
@@ -101,6 +176,16 @@ export declare function usersResource(request: RequestFn): {
|
|
|
101
176
|
duration_in_seconds?: number;
|
|
102
177
|
}): Promise<User>;
|
|
103
178
|
unlock(id: string): Promise<User>;
|
|
179
|
+
/**
|
|
180
|
+
* `POST /v1/users/:id/referral/flag` — mark the user's referral fraudulent.
|
|
181
|
+
* The referral reads `flagged: true`, the referral platform is sent a
|
|
182
|
+
* `fraud_confirmed` signal (when referrals are on) and the action is
|
|
183
|
+
* audited. The user's account is not changed. 404 when the user has no
|
|
184
|
+
* referral. `reason` (at most 500 characters) is sent to the platform.
|
|
185
|
+
*/
|
|
186
|
+
flagReferral(id: string, body?: {
|
|
187
|
+
reason?: string;
|
|
188
|
+
}, idempotencyKey?: string): Promise<UserReferralFlag>;
|
|
104
189
|
delete(id: string): Promise<DeletedObject>;
|
|
105
190
|
resetMfa(id: string): Promise<{
|
|
106
191
|
object: "user";
|
package/dist/client/users.js
CHANGED
|
@@ -33,6 +33,21 @@ function usersResource(request) {
|
|
|
33
33
|
unlock(id) {
|
|
34
34
|
return request({ method: 'POST', path: `/v1/users/${(0, request_1.enc)(id)}/unlock` });
|
|
35
35
|
},
|
|
36
|
+
/**
|
|
37
|
+
* `POST /v1/users/:id/referral/flag` — mark the user's referral fraudulent.
|
|
38
|
+
* The referral reads `flagged: true`, the referral platform is sent a
|
|
39
|
+
* `fraud_confirmed` signal (when referrals are on) and the action is
|
|
40
|
+
* audited. The user's account is not changed. 404 when the user has no
|
|
41
|
+
* referral. `reason` (at most 500 characters) is sent to the platform.
|
|
42
|
+
*/
|
|
43
|
+
flagReferral(id, body = {}, idempotencyKey) {
|
|
44
|
+
return request({
|
|
45
|
+
method: 'POST',
|
|
46
|
+
path: `/v1/users/${(0, request_1.enc)(id)}/referral/flag`,
|
|
47
|
+
body,
|
|
48
|
+
idempotencyKey,
|
|
49
|
+
});
|
|
50
|
+
},
|
|
36
51
|
delete(id) {
|
|
37
52
|
return request({ method: 'DELETE', path: `/v1/users/${(0, request_1.enc)(id)}` });
|
|
38
53
|
},
|
package/dist/client/users.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/client/users.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/client/users.ts"],"names":[],"mappings":";;AA6KA,sCA8bC;AA3mBD,uCAAgD;AA6KhD,SAAgB,aAAa,CAAC,OAAkB;IAC9C,OAAO;QACL,0CAA0C;QAC1C,IAAI,CAAC,SAA0B,EAAE;YAC/B,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC;QAC7E,CAAC;QACD,GAAG,CAAC,EAAU;YACZ,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAClE,CAAC;QACD,MAAM,CAAC,IAAoB,EAAE,cAAuB;YAClD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QAC9E,CAAC;QACD,MAAM,CAAC,EAAU,EAAE,IAAoB;YACrC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1E,CAAC;QACD,wEAAwE;QACxE,eAAe,CAAC,EAAU,EAAE,IAA6B;YACvD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,IAAA,aAAG,EAAC,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;Q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C,EAAU,EAAE,IAA8B;gBACjD,OAAO,OAAO,CAAC;oBACb,MAAM,EAAE,MAAM;oBACd,IAAI,EAAE,aAAa,IAAA,aAAG,EAAC,EAAE,CAAC,qBAAqB;oBAC/C,IAAI;iBACL,CAAC,CAAC;YACL,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -8,6 +8,12 @@ export interface WebhookEndpoint {
|
|
|
8
8
|
/** Start of the current failure streak (epoch ms), or null when the last delivery succeeded. */
|
|
9
9
|
failing_since?: number | null;
|
|
10
10
|
disabled_at: number | null;
|
|
11
|
+
/**
|
|
12
|
+
* While a secret rotation overlap is open: when the previous secret stops
|
|
13
|
+
* signing deliveries (epoch ms). Until then every delivery carries two
|
|
14
|
+
* signatures, one per secret. Null otherwise.
|
|
15
|
+
*/
|
|
16
|
+
previous_secret_expires_at?: number | null;
|
|
11
17
|
created_at: number;
|
|
12
18
|
}
|
|
13
19
|
/** Create reveals the signing secret (`whsec_...`) exactly once. */
|
|
@@ -80,8 +86,21 @@ export interface WebhookSigningSecret {
|
|
|
80
86
|
object: 'webhook_secret';
|
|
81
87
|
/** The `whsec_...` signing secret. */
|
|
82
88
|
secret: string;
|
|
89
|
+
/** On a rotation: the overlap applied, in seconds. */
|
|
90
|
+
overlap_seconds?: number;
|
|
91
|
+
/** On a rotation: when the previous secret stops signing deliveries (epoch ms), or null when it already has. */
|
|
92
|
+
previous_secret_expires_at?: number | null;
|
|
83
93
|
warning?: string;
|
|
84
94
|
}
|
|
95
|
+
export interface RotateWebhookSecretBody {
|
|
96
|
+
/**
|
|
97
|
+
* How long the previous secret keeps signing deliveries (as a second
|
|
98
|
+
* `atlas-signature` entry), in seconds. Default 0: it stops at once. At most
|
|
99
|
+
* 604800 (7 days). Set it only once every receiver verifies with a verifier
|
|
100
|
+
* that accepts several signatures (this package 0.9.1+).
|
|
101
|
+
*/
|
|
102
|
+
overlap_seconds?: number;
|
|
103
|
+
}
|
|
85
104
|
/** A queued delivery (from `test` or `redeliver`). */
|
|
86
105
|
export interface WebhookDeliveryQueued {
|
|
87
106
|
object: 'webhook_delivery';
|
|
@@ -101,8 +120,12 @@ export declare function webhooksResource(request: RequestFn): {
|
|
|
101
120
|
update(id: string, body: UpdateWebhookEndpointBody): Promise<WebhookEndpoint>;
|
|
102
121
|
/** Show the current signing secret again. Audited. */
|
|
103
122
|
revealSecret(id: string): Promise<WebhookSigningSecret>;
|
|
104
|
-
/**
|
|
105
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Rotate the signing secret; the new one is revealed exactly once. By
|
|
125
|
+
* default the old secret stops signing at once; for `overlap_seconds`
|
|
126
|
+
* every delivery is signed with both, so a verifier holding either passes.
|
|
127
|
+
*/
|
|
128
|
+
rotateSecret(id: string, body?: RotateWebhookSecretBody): Promise<WebhookSigningSecret>;
|
|
106
129
|
/** Send a synthetic `webhook.test` event to this endpoint only. */
|
|
107
130
|
test(id: string): Promise<WebhookDeliveryQueued>;
|
|
108
131
|
/** Redeliver a past event as a fresh attempt (409 once past its retention). */
|
package/dist/client/webhooks.js
CHANGED
|
@@ -16,9 +16,13 @@ function webhooksResource(request) {
|
|
|
16
16
|
revealSecret(id) {
|
|
17
17
|
return request({ method: 'POST', path: `/v1/webhook_endpoints/${(0, request_1.enc)(id)}/reveal_secret` });
|
|
18
18
|
},
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Rotate the signing secret; the new one is revealed exactly once. By
|
|
21
|
+
* default the old secret stops signing at once; for `overlap_seconds`
|
|
22
|
+
* every delivery is signed with both, so a verifier holding either passes.
|
|
23
|
+
*/
|
|
24
|
+
rotateSecret(id, body) {
|
|
25
|
+
return request({ method: 'POST', path: `/v1/webhook_endpoints/${(0, request_1.enc)(id)}/rotate_secret`, body });
|
|
22
26
|
},
|
|
23
27
|
/** Send a synthetic `webhook.test` event to this endpoint only. */
|
|
24
28
|
test(id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../src/client/webhooks.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../src/client/webhooks.ts"],"names":[],"mappings":";;AA+HA,4CAgEC;AA/LD,uCAAgD;AA+HhD,SAAgB,gBAAgB,CAAC,OAAkB;IACjD,OAAO;QACL,SAAS,EAAE;YACT,IAAI;gBACF,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC,CAAC;YACnE,CAAC;YACD,wEAAwE;YACxE,MAAM,CAAC,EAAU,EAAE,IAA+B;gBAChD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,yBAAyB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YACtF,CAAC;YACD,sDAAsD;YACtD,YAAY,CAAC,EAAU;gBACrB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,IAAA,aAAG,EAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC;YAC7F,CAAC;YACD;;;;eAIG;YACH,YAAY,CAAC,EAAU,EAAE,IAA8B;gBACrD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,IAAA,aAAG,EAAC,EAAE,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;YACnG,CAAC;YACD,mEAAmE;YACnE,IAAI,CAAC,EAAU;gBACb,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,IAAA,aAAG,EAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YACpF,CAAC;YACD,+EAA+E;YAC/E,SAAS,CAAC,EAAU,EAAE,UAAkB;gBACtC,OAAO,OAAO,CAAC;oBACb,MAAM,EAAE,MAAM;oBACd,IAAI,EAAE,yBAAyB,IAAA,aAAG,EAAC,EAAE,CAAC,eAAe,IAAA,aAAG,EAAC,UAAU,CAAC,YAAY;iBACjF,CAAC,CAAC;YACL,CAAC;YACD,MAAM,CACJ,IAA+B,EAC/B,cAAuB;gBAEvB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;YAC1F,CAAC;YACD,MAAM,CACJ,EAAU;gBAEV,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,yBAAyB,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACjF,CAAC;SACF;QACD,oCAAoC;QACpC,UAAU,CACR,EAAU,EACV,SAAsC,EAAE;YAExC,OAAO,OAAO,CAAC;gBACb,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,yBAAyB,IAAA,aAAG,EAAC,EAAE,CAAC,aAAa;gBACnD,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE;aACrB,CAAC,CAAC;QACL,CAAC;QACD,8DAA8D;QAC9D,SAAS,CAAC,UAAkB,EAAE,UAAkB;YAC9C,OAAO,OAAO,CAAC;gBACb,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,yBAAyB,IAAA,aAAG,EAAC,UAAU,CAAC,eAAe,IAAA,aAAG,EAAC,UAAU,CAAC,YAAY;aACzF,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type { LogoutReplayStore, LogoutTokenCheckOptions, LogoutTokenClaims, Log
|
|
|
7
7
|
export { AtlasOidcError, OIDC_FLOW_COOKIE, OIDC_FLOW_MAX_AGE_SECONDS, oidc, oidcCallback, oidcClearCookie, oidcLogoutUrl, oidcStart, oidcVerifyIdToken, resetOidcCaches, } from './oidc';
|
|
8
8
|
export type { AtlasOidc, AtlasOidcErrorCode, OidcCallbackOptions, OidcClientAuth, OidcIdentity, OidcLogoutUrlOptions, OidcStartOptions, OidcStartResult, VerifyIdTokenOptions, } from './oidc';
|
|
9
9
|
export * from './webhooks';
|
|
10
|
+
export * from './referrals';
|
|
10
11
|
export { createAtlasClient } from './client';
|
|
11
12
|
export type { AtlasClient } from './client';
|
|
12
13
|
export * from './client';
|
package/dist/index.js
CHANGED
|
@@ -48,6 +48,8 @@ Object.defineProperty(exports, "oidcVerifyIdToken", { enumerable: true, get: fun
|
|
|
48
48
|
Object.defineProperty(exports, "resetOidcCaches", { enumerable: true, get: function () { return oidc_1.resetOidcCaches; } });
|
|
49
49
|
// §12.2 inbound webhook verification for consumers.
|
|
50
50
|
__exportStar(require("./webhooks"), exports);
|
|
51
|
+
// The Atlas referral protocol, for a referral platform receiving Atlas's signed calls.
|
|
52
|
+
__exportStar(require("./referrals"), exports);
|
|
51
53
|
// The typed management client for the secret-key Backend API.
|
|
52
54
|
var client_1 = require("./client");
|
|
53
55
|
Object.defineProperty(exports, "createAtlasClient", { enumerable: true, get: function () { return client_1.createAtlasClient; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6DAA6D;AAC7D,+CAA6B;AAC7B,mEAAmE;AACnE,yCAA2G;AAAlG,2GAAA,cAAc,OAAA;AAAE,0GAAA,aAAa,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,yHAAA,4BAA4B,OAAA;AACrF,2CAAyB;AACzB,8CAA4B;AAE5B,6EAA6E;AAC7E,+CAOwB;AANtB,wHAAA,wBAAwB,OAAA;AACxB,+HAAA,+BAA+B,OAAA;AAC/B,4HAAA,4BAA4B,OAAA;AAC5B,mHAAA,mBAAmB,OAAA;AACnB,uHAAA,uBAAuB,OAAA;AACvB,iHAAA,iBAAiB,OAAA;AAUnB,sE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