@atlasauth/backend 0.17.0 → 0.19.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 +40 -0
- package/dist/backchannel-handlers.d.ts +87 -0
- package/dist/backchannel-handlers.js +137 -0
- package/dist/backchannel-handlers.js.map +1 -0
- package/dist/client/activity.d.ts +13 -2
- package/dist/client/activity.js.map +1 -1
- package/dist/client/audit-logs.d.ts +7 -0
- package/dist/client/audit-logs.js.map +1 -1
- package/dist/client/compliance.d.ts +216 -0
- package/dist/client/compliance.js +77 -0
- package/dist/client/compliance.js.map +1 -0
- package/dist/client/credentials.d.ts +409 -0
- package/dist/client/credentials.js +158 -0
- package/dist/client/credentials.js.map +1 -0
- package/dist/client/data-subject-requests.d.ts +36 -1
- package/dist/client/data-subject-requests.js.map +1 -1
- package/dist/client/design.d.ts +48 -0
- package/dist/client/design.js +9 -0
- package/dist/client/design.js.map +1 -1
- package/dist/client/entitlement-overrides.d.ts +30 -0
- package/dist/client/entitlement-overrides.js +9 -0
- package/dist/client/entitlement-overrides.js.map +1 -1
- package/dist/client/env.d.ts +16 -0
- package/dist/client/env.js +38 -0
- package/dist/client/env.js.map +1 -0
- package/dist/client/error.d.ts +10 -0
- package/dist/client/error.js +4 -0
- package/dist/client/error.js.map +1 -1
- package/dist/client/index.d.ts +382 -7
- package/dist/client/index.js +44 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/instance.d.ts +401 -3
- package/dist/client/instance.js +77 -3
- package/dist/client/instance.js.map +1 -1
- package/dist/client/integrations.d.ts +107 -0
- package/dist/client/integrations.js +25 -0
- package/dist/client/integrations.js.map +1 -0
- package/dist/client/messaging.d.ts +18 -4
- package/dist/client/messaging.js +6 -2
- package/dist/client/messaging.js.map +1 -1
- package/dist/client/oauth-clients.d.ts +11 -3
- package/dist/client/oauth-clients.js +4 -2
- package/dist/client/oauth-clients.js.map +1 -1
- package/dist/client/operator.d.ts +100 -0
- package/dist/client/operator.js +132 -0
- package/dist/client/operator.js.map +1 -0
- package/dist/client/platform.d.ts +233 -9
- package/dist/client/platform.js +74 -6
- package/dist/client/platform.js.map +1 -1
- package/dist/client/policies.d.ts +316 -0
- package/dist/client/policies.js +103 -0
- package/dist/client/policies.js.map +1 -0
- package/dist/client/privacy.d.ts +127 -0
- package/dist/client/privacy.js +44 -0
- package/dist/client/privacy.js.map +1 -0
- package/dist/client/referrals.d.ts +53 -6
- package/dist/client/referrals.js +9 -0
- package/dist/client/referrals.js.map +1 -1
- package/dist/client/request.d.ts +38 -1
- package/dist/client/request.js +6 -2
- package/dist/client/request.js.map +1 -1
- package/dist/client/sealed-box.d.ts +7 -0
- package/dist/client/sealed-box.js +62 -0
- package/dist/client/sealed-box.js.map +1 -0
- package/dist/client/sessions.d.ts +16 -5
- package/dist/client/sessions.js +7 -10
- package/dist/client/sessions.js.map +1 -1
- package/dist/client/status.d.ts +200 -0
- package/dist/client/status.js +54 -0
- package/dist/client/status.js.map +1 -0
- package/dist/client/users.d.ts +15 -0
- package/dist/client/webhooks.d.ts +244 -11
- package/dist/client/webhooks.js +52 -3
- package/dist/client/webhooks.js.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/dist/oidc.d.ts +65 -1
- package/dist/oidc.js +46 -0
- package/dist/oidc.js.map +1 -1
- package/dist/policy-source.d.ts +104 -0
- package/dist/policy-source.js +99 -0
- package/dist/policy-source.js.map +1 -0
- package/dist/referral-test-calls.d.ts +26 -13
- package/dist/referral-test-calls.js +40 -14
- package/dist/referral-test-calls.js.map +1 -1
- package/dist/testing.d.ts +41 -6
- package/dist/testing.js +34 -2
- package/dist/testing.js.map +1 -1
- package/dist/webhooks.d.ts +8 -0
- package/dist/webhooks.js +13 -4
- package/dist/webhooks.js.map +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { type RequestFn } from './request';
|
|
2
|
+
import type { ListPage } from './types';
|
|
3
|
+
import { type VerifyWebhookInput, type WebhookVerifyResult } from '../webhooks';
|
|
4
|
+
/**
|
|
5
|
+
* The instance's own credentials (scoped secret keys, the standard key list,
|
|
6
|
+
* whoami), partner links, and Sign in with Atlas grant revocation for apps
|
|
7
|
+
* the instance manages.
|
|
8
|
+
*/
|
|
9
|
+
export type KeyKind = 'secret_key' | 'platform_key' | 'account_key' | 'webhook_secret' | 'partner_link' | 'access_token';
|
|
10
|
+
/** The standard key shape every credential listing uses. */
|
|
11
|
+
export interface StandardKey {
|
|
12
|
+
object: 'key' | 'secret_key';
|
|
13
|
+
id: string;
|
|
14
|
+
kind: KeyKind;
|
|
15
|
+
/** `atlas` = `atlas_<env>_<kind>_…`; `legacy` = `sk_` / `psk_` / `whsec_` / `dsk_`. */
|
|
16
|
+
format: 'atlas' | 'legacy';
|
|
17
|
+
prefix: string;
|
|
18
|
+
name: string | null;
|
|
19
|
+
owner: string | null;
|
|
20
|
+
scopes: string[];
|
|
21
|
+
environment: 'live' | 'test' | null;
|
|
22
|
+
resource: {
|
|
23
|
+
type: 'instance' | 'account' | 'application' | 'webhook_endpoint';
|
|
24
|
+
id: string;
|
|
25
|
+
};
|
|
26
|
+
expires_at: number | null;
|
|
27
|
+
expires_in_days: number | null;
|
|
28
|
+
status: 'active' | 'expiring' | 'expired' | 'revoked';
|
|
29
|
+
ip_allowlist: string[];
|
|
30
|
+
origin_allowlist: string[];
|
|
31
|
+
last_used_at: number | null;
|
|
32
|
+
last_used_ip: string | null;
|
|
33
|
+
created_at: number;
|
|
34
|
+
revoked_at: number | null;
|
|
35
|
+
}
|
|
36
|
+
export interface SecretKey extends StandardKey {
|
|
37
|
+
object: 'secret_key';
|
|
38
|
+
allowed_ips: string[];
|
|
39
|
+
/** Alias of `origin_allowlist`: browser origins the key may be used from (empty = any). */
|
|
40
|
+
allowed_origins: string[];
|
|
41
|
+
rotated_from: string | null;
|
|
42
|
+
/** Provisioning tags (filter the list with `metadata`). */
|
|
43
|
+
metadata?: Record<string, string | number | boolean>;
|
|
44
|
+
/** The idempotent-create key the key was created with, if any. */
|
|
45
|
+
external_ref?: string | null;
|
|
46
|
+
}
|
|
47
|
+
/** A create/rotate response: the secret is present once (or sealed, with a secret recipient). */
|
|
48
|
+
export interface SecretKeyWithSecret extends SecretKey {
|
|
49
|
+
/** Absent on an `external_ref` replay (`idempotent_replay: true`): the secret was shown at the first create. */
|
|
50
|
+
secret?: string;
|
|
51
|
+
sealed_secret?: string;
|
|
52
|
+
idempotent_replay?: boolean;
|
|
53
|
+
note: string;
|
|
54
|
+
}
|
|
55
|
+
export interface CreateSecretKeyBody {
|
|
56
|
+
name?: string;
|
|
57
|
+
/** Instance scopes, or presets `read_only`, `privacy:execute`, `privacy:grants:revoke`. */
|
|
58
|
+
scopes: string[];
|
|
59
|
+
/** Unix ms or ISO 8601; at most one year away. Default: one year. Every new key expires. */
|
|
60
|
+
expires_at?: number | string;
|
|
61
|
+
/** CIDRs the key may be used from. */
|
|
62
|
+
allowed_ips?: string[];
|
|
63
|
+
/** Browser origins (`https://app.example.com`, `https://*.example.com`) a request with an Origin must come from. */
|
|
64
|
+
allowed_origins?: string[];
|
|
65
|
+
/** The person or service responsible. Default: whoever creates the key. */
|
|
66
|
+
owner?: string | null;
|
|
67
|
+
/** `atlas` (default) or `legacy`. */
|
|
68
|
+
key_format?: 'atlas' | 'legacy';
|
|
69
|
+
/** Idempotent create: a second create with the same ref returns the existing key (without its secret). */
|
|
70
|
+
external_ref?: string;
|
|
71
|
+
/** Provisioning tags (up to 20; string, number or boolean values). */
|
|
72
|
+
metadata?: Record<string, string | number | boolean>;
|
|
73
|
+
}
|
|
74
|
+
export interface Whoami {
|
|
75
|
+
object: 'whoami';
|
|
76
|
+
key: {
|
|
77
|
+
id: string | null;
|
|
78
|
+
type: 'secret' | 'publishable' | 'platform' | 'partner_link' | 'access_token';
|
|
79
|
+
prefix: string | null;
|
|
80
|
+
environment: 'live' | 'test' | null;
|
|
81
|
+
scopes: string[];
|
|
82
|
+
effective_scopes: string[];
|
|
83
|
+
owner: string | null;
|
|
84
|
+
created_at: number | null;
|
|
85
|
+
expires_at: number | null;
|
|
86
|
+
last_used_at: number | null;
|
|
87
|
+
last_used_ip?: string | null;
|
|
88
|
+
application_ids?: string[];
|
|
89
|
+
};
|
|
90
|
+
instance: {
|
|
91
|
+
id: string;
|
|
92
|
+
environment: string | null;
|
|
93
|
+
issuer?: string;
|
|
94
|
+
discovery_url?: string;
|
|
95
|
+
jwks_uri?: string;
|
|
96
|
+
} | null;
|
|
97
|
+
account: {
|
|
98
|
+
id: string | null;
|
|
99
|
+
};
|
|
100
|
+
platform?: {
|
|
101
|
+
id: string;
|
|
102
|
+
};
|
|
103
|
+
partner?: {
|
|
104
|
+
link_id: string;
|
|
105
|
+
id: string;
|
|
106
|
+
name: string | null;
|
|
107
|
+
};
|
|
108
|
+
operator?: {
|
|
109
|
+
sub: string;
|
|
110
|
+
auth_time: number | null;
|
|
111
|
+
acr: string | null;
|
|
112
|
+
amr: string[];
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
export interface PartnerLink {
|
|
116
|
+
object: 'partner_link';
|
|
117
|
+
id: string;
|
|
118
|
+
client_id: string;
|
|
119
|
+
/** Any lowercase id; cookiemunch, chatly, forumulate and referalli are presets. */
|
|
120
|
+
partner: string;
|
|
121
|
+
name: string;
|
|
122
|
+
preset: boolean;
|
|
123
|
+
resource: string;
|
|
124
|
+
scopes: string[];
|
|
125
|
+
client_secret_prefix: string;
|
|
126
|
+
token_endpoint: string;
|
|
127
|
+
/** mTLS: client-certificate SHA-256 fingerprints (base64url) every use must present; [] = none. */
|
|
128
|
+
cert_fingerprints: string[];
|
|
129
|
+
auth_methods: string[];
|
|
130
|
+
/** The partner link request this link was approved from; null when created by hand. */
|
|
131
|
+
request_id: string | null;
|
|
132
|
+
status: 'active' | 'expired' | 'revoked';
|
|
133
|
+
expires_at: number | null;
|
|
134
|
+
revoked_at: number | null;
|
|
135
|
+
last_used_at: number | null;
|
|
136
|
+
last_used_ip: string | null;
|
|
137
|
+
calls_30d: number;
|
|
138
|
+
created_at: number;
|
|
139
|
+
client_secret?: string;
|
|
140
|
+
sealed_client_secret?: string;
|
|
141
|
+
}
|
|
142
|
+
/** A consent manager's script the hosted pages load (any CMP). */
|
|
143
|
+
export interface PartnerLinkCmp {
|
|
144
|
+
script_url: string;
|
|
145
|
+
script_id?: string | null;
|
|
146
|
+
site_id?: string | null;
|
|
147
|
+
blocking_mode?: string | null;
|
|
148
|
+
extra_origins?: string[];
|
|
149
|
+
settings_preset?: 'cookiemunch' | 'cookiebot' | 'onetrust' | 'custom' | null;
|
|
150
|
+
}
|
|
151
|
+
/** A partner link request: a partner asking this instance (inbound), or Atlas asking a partner (outbound). */
|
|
152
|
+
export interface PartnerLinkRequest {
|
|
153
|
+
object: 'partner_link_request';
|
|
154
|
+
id: string;
|
|
155
|
+
direction: 'inbound' | 'outbound';
|
|
156
|
+
partner: string;
|
|
157
|
+
name: string;
|
|
158
|
+
preset: boolean;
|
|
159
|
+
resource: string | null;
|
|
160
|
+
scopes: string[];
|
|
161
|
+
callback_url: string | null;
|
|
162
|
+
callback_host: string | null;
|
|
163
|
+
cert_fingerprints: string[];
|
|
164
|
+
status: 'pending' | 'approved' | 'denied' | 'expired' | 'delivery_failed' | 'installed' | 'failed';
|
|
165
|
+
link_id: string | null;
|
|
166
|
+
remote_request_id: string | null;
|
|
167
|
+
decided_by: string | null;
|
|
168
|
+
decided_at: number | null;
|
|
169
|
+
delivery_attempts: number;
|
|
170
|
+
delivered_at: number | null;
|
|
171
|
+
last_error: string | null;
|
|
172
|
+
expires_at: number;
|
|
173
|
+
created_at: number;
|
|
174
|
+
}
|
|
175
|
+
export interface PartnerLinkRequestApproval extends PartnerLinkRequest {
|
|
176
|
+
delivered: boolean;
|
|
177
|
+
link: PartnerLink | null;
|
|
178
|
+
note: string;
|
|
179
|
+
}
|
|
180
|
+
export interface OutboundPartnerLink {
|
|
181
|
+
object: 'outbound_partner_link';
|
|
182
|
+
id: string;
|
|
183
|
+
partner: string;
|
|
184
|
+
name: string;
|
|
185
|
+
preset: boolean;
|
|
186
|
+
resource: string | null;
|
|
187
|
+
scopes: string[];
|
|
188
|
+
base_url: string;
|
|
189
|
+
token_url: string;
|
|
190
|
+
client_id: string;
|
|
191
|
+
auth_method: 'client_credentials' | 'bearer_secret';
|
|
192
|
+
has_client_secret: true;
|
|
193
|
+
source: 'manual' | 'oauth_install';
|
|
194
|
+
status: 'active' | 'revoked' | 'failing';
|
|
195
|
+
/** The consent manager this partner brings to the hosted pages, or null. */
|
|
196
|
+
cmp: PartnerLinkCmp | null;
|
|
197
|
+
/** True when `cmp` is derived (a Cookie Munch link with a `site:<id>` resource). */
|
|
198
|
+
cmp_default: boolean;
|
|
199
|
+
expires_at: number | null;
|
|
200
|
+
last_used_at: number | null;
|
|
201
|
+
last_error: string | null;
|
|
202
|
+
last_error_at: number | null;
|
|
203
|
+
calls_30d: number;
|
|
204
|
+
created_at: number;
|
|
205
|
+
updated_at: number;
|
|
206
|
+
}
|
|
207
|
+
export interface SaveOutboundPartnerLinkBody {
|
|
208
|
+
client_id: string;
|
|
209
|
+
client_secret: string;
|
|
210
|
+
scopes?: string[];
|
|
211
|
+
resource?: string;
|
|
212
|
+
/** Required for a partner that is not a preset. */
|
|
213
|
+
base_url?: string;
|
|
214
|
+
token_url?: string;
|
|
215
|
+
auth_method?: 'client_credentials' | 'bearer_secret';
|
|
216
|
+
name?: string;
|
|
217
|
+
expires_at?: number | string | null;
|
|
218
|
+
/**
|
|
219
|
+
* A consent-manager partner's script for the hosted pages. Used while the
|
|
220
|
+
* instance has no cookie_consent setting of its own. Null clears it; absent
|
|
221
|
+
* keeps it.
|
|
222
|
+
*/
|
|
223
|
+
cmp?: PartnerLinkCmp | null;
|
|
224
|
+
}
|
|
225
|
+
export interface AtlasIdGrantLookup {
|
|
226
|
+
object: 'atlas_id_user';
|
|
227
|
+
sub: string;
|
|
228
|
+
grant_id: string;
|
|
229
|
+
scopes: string[];
|
|
230
|
+
granted_at: number;
|
|
231
|
+
}
|
|
232
|
+
export interface InstanceAtlasIdGrantRevocation {
|
|
233
|
+
object: 'atlas_id_grant';
|
|
234
|
+
id: string;
|
|
235
|
+
sub: string;
|
|
236
|
+
revoked: true;
|
|
237
|
+
tokens_revoked: number;
|
|
238
|
+
backchannel_logouts: number;
|
|
239
|
+
}
|
|
240
|
+
export declare function whoamiResource(request: RequestFn): () => Promise<Whoami>;
|
|
241
|
+
export declare function secretKeysResource(request: RequestFn): {
|
|
242
|
+
create(body: CreateSecretKeyBody): Promise<SecretKeyWithSecret>;
|
|
243
|
+
/** `metadata` filters on provisioning tags (`?metadata[key]=value`). */
|
|
244
|
+
list(params?: {
|
|
245
|
+
metadata?: Record<string, string>;
|
|
246
|
+
}): Promise<ListPage<SecretKey>>;
|
|
247
|
+
get(id: string): Promise<SecretKey>;
|
|
248
|
+
update(id: string, body: {
|
|
249
|
+
name?: string | null;
|
|
250
|
+
owner?: string | null;
|
|
251
|
+
expires_at?: number | string | null;
|
|
252
|
+
allowed_ips?: string[];
|
|
253
|
+
allowed_origins?: string[];
|
|
254
|
+
metadata?: Record<string, string | number | boolean> | null;
|
|
255
|
+
}): Promise<SecretKey>;
|
|
256
|
+
/** New key with the same scopes; the old one works for `overlap_seconds` (default 72 h, 0 = now). */
|
|
257
|
+
rotate(id: string, body?: {
|
|
258
|
+
overlap_seconds?: number;
|
|
259
|
+
key_format?: "atlas" | "legacy";
|
|
260
|
+
}): Promise<SecretKeyWithSecret & {
|
|
261
|
+
replaces: string;
|
|
262
|
+
previous_key_expires_at: number | null;
|
|
263
|
+
}>;
|
|
264
|
+
revoke(id: string): Promise<SecretKey & {
|
|
265
|
+
revoked: true;
|
|
266
|
+
}>;
|
|
267
|
+
};
|
|
268
|
+
export declare function keysResource(request: RequestFn): {
|
|
269
|
+
/** Every credential on the instance, standard shape. */
|
|
270
|
+
list(): Promise<ListPage<StandardKey>>;
|
|
271
|
+
};
|
|
272
|
+
export declare function partnerLinksResource(request: RequestFn): {
|
|
273
|
+
/** Create a link by hand (the secret is returned once). Prefer approving a partner's request: no secret to hand over. */
|
|
274
|
+
create(body: {
|
|
275
|
+
partner: string;
|
|
276
|
+
name?: string;
|
|
277
|
+
scopes: string[];
|
|
278
|
+
expires_at?: number | string;
|
|
279
|
+
cert_fingerprints?: string[];
|
|
280
|
+
}): Promise<PartnerLink>;
|
|
281
|
+
/** Lock a link to client certificates (mTLS); [] removes the lock. */
|
|
282
|
+
setCertificates(id: string, certFingerprints: string[]): Promise<PartnerLink>;
|
|
283
|
+
requests: {
|
|
284
|
+
list(params?: {
|
|
285
|
+
direction?: "inbound" | "outbound";
|
|
286
|
+
status?: PartnerLinkRequest["status"][];
|
|
287
|
+
}): Promise<ListPage<PartnerLinkRequest>>;
|
|
288
|
+
get(id: string): Promise<PartnerLinkRequest>;
|
|
289
|
+
/** Approve: Atlas creates the link and delivers its credentials to the partner, signed. */
|
|
290
|
+
approve(id: string, body?: {
|
|
291
|
+
scopes?: string[];
|
|
292
|
+
expires_at?: number | string;
|
|
293
|
+
}): Promise<PartnerLinkRequestApproval>;
|
|
294
|
+
deny(id: string): Promise<PartnerLinkRequest>;
|
|
295
|
+
};
|
|
296
|
+
list(): Promise<ListPage<PartnerLink>>;
|
|
297
|
+
get(id: string): Promise<PartnerLink>;
|
|
298
|
+
rotateSecret(id: string): Promise<PartnerLink>;
|
|
299
|
+
revoke(id: string): Promise<PartnerLink & {
|
|
300
|
+
revoked: true;
|
|
301
|
+
}>;
|
|
302
|
+
outbound: {
|
|
303
|
+
list(): Promise<ListPage<OutboundPartnerLink>>;
|
|
304
|
+
save(partner: string, body: SaveOutboundPartnerLinkBody): Promise<OutboundPartnerLink>;
|
|
305
|
+
test(partner: string): Promise<{
|
|
306
|
+
object: "partner_link_test";
|
|
307
|
+
partner: string;
|
|
308
|
+
ok: boolean;
|
|
309
|
+
error?: string;
|
|
310
|
+
}>;
|
|
311
|
+
remove(partner: string): Promise<{
|
|
312
|
+
object: "outbound_partner_link";
|
|
313
|
+
partner: string;
|
|
314
|
+
deleted: true;
|
|
315
|
+
}>;
|
|
316
|
+
/** Ask a partner for a link; its credentials arrive by themselves once the partner approves. */
|
|
317
|
+
request(partner: string, body: {
|
|
318
|
+
scopes: string[];
|
|
319
|
+
resource?: string;
|
|
320
|
+
base_url?: string;
|
|
321
|
+
token_url?: string;
|
|
322
|
+
name?: string;
|
|
323
|
+
}): Promise<PartnerLinkRequest & {
|
|
324
|
+
note: string;
|
|
325
|
+
}>;
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
export declare function atlasIdGrantsResource(request: RequestFn): {
|
|
329
|
+
/** Sign in with Atlas apps this instance manages. */
|
|
330
|
+
listApps(): Promise<ListPage<{
|
|
331
|
+
object: "atlas_id_app";
|
|
332
|
+
id: string;
|
|
333
|
+
client_id: string;
|
|
334
|
+
name: string;
|
|
335
|
+
managed_by_instance_id: string;
|
|
336
|
+
}>>;
|
|
337
|
+
/** Is this verified email a user of the app? Empty list otherwise. */
|
|
338
|
+
lookup(appId: string, email: string): Promise<ListPage<AtlasIdGrantLookup>>;
|
|
339
|
+
revoke(appId: string, grantId: string): Promise<InstanceAtlasIdGrantRevocation>;
|
|
340
|
+
};
|
|
341
|
+
export interface PartnerLinkRequestInput {
|
|
342
|
+
/** Your product id (lowercase, 2–40 characters). */
|
|
343
|
+
partner: string;
|
|
344
|
+
name?: string;
|
|
345
|
+
/** The Atlas instance: its `ins_…` id or publishable key. */
|
|
346
|
+
resource: string;
|
|
347
|
+
scopes: string[];
|
|
348
|
+
/** Where Atlas delivers the credentials (https). */
|
|
349
|
+
callback_url: string;
|
|
350
|
+
state?: string;
|
|
351
|
+
/** Ask for a certificate-locked (mTLS) link. */
|
|
352
|
+
cert_fingerprints?: string[];
|
|
353
|
+
}
|
|
354
|
+
export interface PartnerLinkRequestCreated {
|
|
355
|
+
object: 'partner_link_request';
|
|
356
|
+
protocol: 'atlas.partner_link_request.v1';
|
|
357
|
+
id: string;
|
|
358
|
+
status: 'pending';
|
|
359
|
+
resource: string;
|
|
360
|
+
scopes: string[];
|
|
361
|
+
/** Keep it: it verifies the delivery and reads the request. Shown once. */
|
|
362
|
+
request_secret: string;
|
|
363
|
+
expires_at: number;
|
|
364
|
+
}
|
|
365
|
+
/** What Atlas POSTs to your callback once the owner decides. */
|
|
366
|
+
export type PartnerLinkDelivery = {
|
|
367
|
+
object: 'partner_link.credentials';
|
|
368
|
+
protocol: 'atlas.partner_link_request.v1';
|
|
369
|
+
request_id: string;
|
|
370
|
+
state: string | null;
|
|
371
|
+
partner: string;
|
|
372
|
+
instance_id: string;
|
|
373
|
+
resource: string;
|
|
374
|
+
client_id: string;
|
|
375
|
+
client_secret: string;
|
|
376
|
+
scopes: string[];
|
|
377
|
+
token_endpoint: string;
|
|
378
|
+
api_base_url: string;
|
|
379
|
+
auth_methods: string[];
|
|
380
|
+
cert_fingerprints: string[];
|
|
381
|
+
expires_at: number | null;
|
|
382
|
+
issued_at: number;
|
|
383
|
+
} | {
|
|
384
|
+
object: 'partner_link.denied';
|
|
385
|
+
protocol: 'atlas.partner_link_request.v1';
|
|
386
|
+
request_id: string;
|
|
387
|
+
state: string | null;
|
|
388
|
+
partner: string;
|
|
389
|
+
instance_id: string;
|
|
390
|
+
issued_at: number;
|
|
391
|
+
};
|
|
392
|
+
/**
|
|
393
|
+
* For a PARTNER product: ask an Atlas instance for a link (no Atlas credential
|
|
394
|
+
* needed). The owner approves it; the credentials then arrive at
|
|
395
|
+
* `callback_url`, signed with the returned `request_secret`
|
|
396
|
+
* (verify with {@link verifyPartnerLinkDelivery}).
|
|
397
|
+
*/
|
|
398
|
+
export declare function requestPartnerLink(input: PartnerLinkRequestInput, opts?: {
|
|
399
|
+
apiUrl?: string;
|
|
400
|
+
fetch?: typeof fetch;
|
|
401
|
+
}): Promise<PartnerLinkRequestCreated>;
|
|
402
|
+
/**
|
|
403
|
+
* For a PARTNER product: verify and parse the credentials (or denial) Atlas
|
|
404
|
+
* delivered to your callback. `secret` is the request's `request_secret`;
|
|
405
|
+
* pass `url` (your callback URL) to also check the URL-bound signature.
|
|
406
|
+
*/
|
|
407
|
+
export declare function verifyPartnerLinkDelivery(input: Omit<VerifyWebhookInput, 'secret'> & {
|
|
408
|
+
requestSecret: string;
|
|
409
|
+
}): WebhookVerifyResult<PartnerLinkDelivery>;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.whoamiResource = whoamiResource;
|
|
4
|
+
exports.secretKeysResource = secretKeysResource;
|
|
5
|
+
exports.keysResource = keysResource;
|
|
6
|
+
exports.partnerLinksResource = partnerLinksResource;
|
|
7
|
+
exports.atlasIdGrantsResource = atlasIdGrantsResource;
|
|
8
|
+
exports.requestPartnerLink = requestPartnerLink;
|
|
9
|
+
exports.verifyPartnerLinkDelivery = verifyPartnerLinkDelivery;
|
|
10
|
+
const request_1 = require("./request");
|
|
11
|
+
const webhooks_1 = require("../webhooks");
|
|
12
|
+
const enc = encodeURIComponent;
|
|
13
|
+
function whoamiResource(request) {
|
|
14
|
+
/** Introspect the key this client uses. */
|
|
15
|
+
return () => request({ method: 'GET', path: '/v1/whoami' });
|
|
16
|
+
}
|
|
17
|
+
function secretKeysResource(request) {
|
|
18
|
+
return {
|
|
19
|
+
create(body) {
|
|
20
|
+
return request({ method: 'POST', path: '/v1/secret_keys', body });
|
|
21
|
+
},
|
|
22
|
+
/** `metadata` filters on provisioning tags (`?metadata[key]=value`). */
|
|
23
|
+
list(params = {}) {
|
|
24
|
+
const query = {};
|
|
25
|
+
for (const [k, v] of Object.entries(params.metadata ?? {}))
|
|
26
|
+
query[`metadata[${k}]`] = v;
|
|
27
|
+
return request({ method: 'GET', path: '/v1/secret_keys', ...(Object.keys(query).length ? { query } : {}) });
|
|
28
|
+
},
|
|
29
|
+
get(id) {
|
|
30
|
+
return request({ method: 'GET', path: `/v1/secret_keys/${enc(id)}` });
|
|
31
|
+
},
|
|
32
|
+
update(id, body) {
|
|
33
|
+
return request({ method: 'PATCH', path: `/v1/secret_keys/${enc(id)}`, body });
|
|
34
|
+
},
|
|
35
|
+
/** New key with the same scopes; the old one works for `overlap_seconds` (default 72 h, 0 = now). */
|
|
36
|
+
rotate(id, body = {}) {
|
|
37
|
+
return request({ method: 'POST', path: `/v1/secret_keys/${enc(id)}/rotate`, body });
|
|
38
|
+
},
|
|
39
|
+
revoke(id) {
|
|
40
|
+
return request({ method: 'POST', path: `/v1/secret_keys/${enc(id)}/revoke` });
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function keysResource(request) {
|
|
45
|
+
return {
|
|
46
|
+
/** Every credential on the instance, standard shape. */
|
|
47
|
+
list() {
|
|
48
|
+
return request({ method: 'GET', path: '/v1/keys' });
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function partnerLinksResource(request) {
|
|
53
|
+
return {
|
|
54
|
+
/** Create a link by hand (the secret is returned once). Prefer approving a partner's request: no secret to hand over. */
|
|
55
|
+
create(body) {
|
|
56
|
+
return request({ method: 'POST', path: '/v1/partner_links', body });
|
|
57
|
+
},
|
|
58
|
+
/** Lock a link to client certificates (mTLS); [] removes the lock. */
|
|
59
|
+
setCertificates(id, certFingerprints) {
|
|
60
|
+
return request({ method: 'PATCH', path: `/v1/partner_links/${enc(id)}`, body: { cert_fingerprints: certFingerprints } });
|
|
61
|
+
},
|
|
62
|
+
requests: {
|
|
63
|
+
list(params = {}) {
|
|
64
|
+
const query = {};
|
|
65
|
+
if (params.direction)
|
|
66
|
+
query.direction = params.direction;
|
|
67
|
+
if (params.status?.length)
|
|
68
|
+
query.status = params.status.join(',');
|
|
69
|
+
return request({ method: 'GET', path: '/v1/partner_links/requests', ...(Object.keys(query).length ? { query } : {}) });
|
|
70
|
+
},
|
|
71
|
+
get(id) {
|
|
72
|
+
return request({ method: 'GET', path: `/v1/partner_links/requests/${enc(id)}` });
|
|
73
|
+
},
|
|
74
|
+
/** Approve: Atlas creates the link and delivers its credentials to the partner, signed. */
|
|
75
|
+
approve(id, body = {}) {
|
|
76
|
+
return request({ method: 'POST', path: `/v1/partner_links/requests/${enc(id)}/approve`, body });
|
|
77
|
+
},
|
|
78
|
+
deny(id) {
|
|
79
|
+
return request({ method: 'POST', path: `/v1/partner_links/requests/${enc(id)}/deny` });
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
list() {
|
|
83
|
+
return request({ method: 'GET', path: '/v1/partner_links' });
|
|
84
|
+
},
|
|
85
|
+
get(id) {
|
|
86
|
+
return request({ method: 'GET', path: `/v1/partner_links/${enc(id)}` });
|
|
87
|
+
},
|
|
88
|
+
rotateSecret(id) {
|
|
89
|
+
return request({ method: 'POST', path: `/v1/partner_links/${enc(id)}/rotate_secret` });
|
|
90
|
+
},
|
|
91
|
+
revoke(id) {
|
|
92
|
+
return request({ method: 'DELETE', path: `/v1/partner_links/${enc(id)}` });
|
|
93
|
+
},
|
|
94
|
+
outbound: {
|
|
95
|
+
list() {
|
|
96
|
+
return request({ method: 'GET', path: '/v1/partner_links/outbound' });
|
|
97
|
+
},
|
|
98
|
+
save(partner, body) {
|
|
99
|
+
return request({ method: 'PUT', path: `/v1/partner_links/outbound/${enc(partner)}`, body });
|
|
100
|
+
},
|
|
101
|
+
test(partner) {
|
|
102
|
+
return request({ method: 'POST', path: `/v1/partner_links/outbound/${enc(partner)}/test` });
|
|
103
|
+
},
|
|
104
|
+
remove(partner) {
|
|
105
|
+
return request({ method: 'DELETE', path: `/v1/partner_links/outbound/${enc(partner)}` });
|
|
106
|
+
},
|
|
107
|
+
/** Ask a partner for a link; its credentials arrive by themselves once the partner approves. */
|
|
108
|
+
request(partner, body) {
|
|
109
|
+
return request({ method: 'POST', path: `/v1/partner_links/outbound/${enc(partner)}/request`, body });
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function atlasIdGrantsResource(request) {
|
|
115
|
+
return {
|
|
116
|
+
/** Sign in with Atlas apps this instance manages. */
|
|
117
|
+
listApps() {
|
|
118
|
+
return request({ method: 'GET', path: '/v1/atlas_id_apps' });
|
|
119
|
+
},
|
|
120
|
+
/** Is this verified email a user of the app? Empty list otherwise. */
|
|
121
|
+
lookup(appId, email) {
|
|
122
|
+
return request({ method: 'GET', path: `/v1/atlas_id_apps/${enc(appId)}/users`, query: { email } });
|
|
123
|
+
},
|
|
124
|
+
revoke(appId, grantId) {
|
|
125
|
+
return request({ method: 'DELETE', path: `/v1/atlas_id_apps/${enc(appId)}/grants/${enc(grantId)}` });
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* For a PARTNER product: ask an Atlas instance for a link (no Atlas credential
|
|
131
|
+
* needed). The owner approves it; the credentials then arrive at
|
|
132
|
+
* `callback_url`, signed with the returned `request_secret`
|
|
133
|
+
* (verify with {@link verifyPartnerLinkDelivery}).
|
|
134
|
+
*/
|
|
135
|
+
async function requestPartnerLink(input, opts = {}) {
|
|
136
|
+
const base = (opts.apiUrl ?? request_1.DEFAULT_API_URL).replace(/\/+$/, '');
|
|
137
|
+
const res = await (opts.fetch ?? fetch)(`${base}/v1/partner_link_requests`, {
|
|
138
|
+
method: 'POST',
|
|
139
|
+
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
|
140
|
+
body: JSON.stringify(input),
|
|
141
|
+
});
|
|
142
|
+
const body = (await res.json().catch(() => ({})));
|
|
143
|
+
if (!res.ok) {
|
|
144
|
+
const first = body.errors?.[0];
|
|
145
|
+
throw new Error(`Atlas refused the partner link request (HTTP ${res.status}${first?.message ? `: ${first.message}` : ''}).`);
|
|
146
|
+
}
|
|
147
|
+
return body;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* For a PARTNER product: verify and parse the credentials (or denial) Atlas
|
|
151
|
+
* delivered to your callback. `secret` is the request's `request_secret`;
|
|
152
|
+
* pass `url` (your callback URL) to also check the URL-bound signature.
|
|
153
|
+
*/
|
|
154
|
+
function verifyPartnerLinkDelivery(input) {
|
|
155
|
+
const { requestSecret, ...rest } = input;
|
|
156
|
+
return (0, webhooks_1.verifyWebhook)({ ...rest, secret: requestSecret });
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/client/credentials.ts"],"names":[],"mappings":";;AA2OA,wCAGC;AAED,gDAmCC;AAED,oCAOC;AAED,oDA8DC;AAED,sDAcC;AA0DD,gDAgBC;AAOD,8DAKC;AAlcD,uCAA4D;AAE5D,0CAA+F;AAuO/F,MAAM,GAAG,GAAG,kBAAkB,CAAC;AAE/B,SAAgB,cAAc,CAAC,OAAkB;IAC/C,2CAA2C;IAC3C,OAAO,GAAoB,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED,SAAgB,kBAAkB,CAAC,OAAkB;IACnD,OAAO;QACL,MAAM,CAAC,IAAyB;YAC9B,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;QACpE,CAAC;QACD,wEAAwE;QACxE,IAAI,CAAC,SAAgD,EAAE;YACrD,MAAM,KAAK,GAA2B,EAAE,CAAC;YACzC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;gBAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxF,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,CAAC,MAAM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,2BAA2B,EAAE;QAC1E,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAE;QAC3E,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;KAC5B,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAA4B,CAAC;IAC7E,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,KAAK,GAAI,IAAI,CAAC,MAAkD,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5E,MAAM,IAAI,KAAK,CAAC,gDAAgD,GAAG,CAAC,MAAM,GAAG,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC/H,CAAC;IACD,OAAO,IAA4C,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,SAAgB,yBAAyB,CACvC,KAAqE;IAErE,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACzC,OAAO,IAAA,wBAAa,EAAsB,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -10,9 +10,43 @@ import type { CursorPage, CursorParams } from './types';
|
|
|
10
10
|
export interface DataSubjectRequest {
|
|
11
11
|
object: 'data_subject_request';
|
|
12
12
|
id: string;
|
|
13
|
+
/** Atlas's kind: `export` | `erasure` | `restriction` | `rectification`. */
|
|
13
14
|
type: string;
|
|
15
|
+
/** The shared data-rights word: `access` | `deletion` | `closure` | `restriction` | `rectification`. */
|
|
16
|
+
canonical_type?: string;
|
|
17
|
+
/** Alias of `canonical_type` in the executor protocol spelling. */
|
|
18
|
+
canonicalType?: string;
|
|
19
|
+
/** What opened it: `user` | `api` | `admin` | `orchestrator` | `atlas_id`. */
|
|
20
|
+
source?: string;
|
|
14
21
|
status: string;
|
|
15
22
|
user_id: string;
|
|
23
|
+
detail?: string | null;
|
|
24
|
+
/** The orchestrator's case id, when an orchestrator drives this request. */
|
|
25
|
+
case_id?: string | null;
|
|
26
|
+
/** The case Atlas opened at the instance's data-rights orchestrator. */
|
|
27
|
+
external_case?: {
|
|
28
|
+
product: string;
|
|
29
|
+
id: string | null;
|
|
30
|
+
status: string;
|
|
31
|
+
attempts: number;
|
|
32
|
+
last_error: string | null;
|
|
33
|
+
opened_at: number | null;
|
|
34
|
+
atlas_id_app_id?: string;
|
|
35
|
+
} | null;
|
|
36
|
+
trace_id?: string | null;
|
|
37
|
+
steps?: Array<{
|
|
38
|
+
name: string;
|
|
39
|
+
status: string;
|
|
40
|
+
reason?: string;
|
|
41
|
+
at?: number;
|
|
42
|
+
}>;
|
|
43
|
+
retention?: Array<{
|
|
44
|
+
category: string;
|
|
45
|
+
basis: string;
|
|
46
|
+
until: string;
|
|
47
|
+
}>;
|
|
48
|
+
/** Erasures: when the account is erased (epoch ms). */
|
|
49
|
+
deletion_effective_at?: number | null;
|
|
16
50
|
requested_by_type: string | null;
|
|
17
51
|
requested_by_id: string | null;
|
|
18
52
|
reason: string | null;
|
|
@@ -32,7 +66,8 @@ export interface ListDataSubjectRequestsParams extends CursorParams {
|
|
|
32
66
|
}
|
|
33
67
|
/** Identify the subject by `user_id` OR `subject_email` (`user_id` wins if both are given). */
|
|
34
68
|
export interface CreateDataSubjectRequestBody {
|
|
35
|
-
|
|
69
|
+
/** Atlas's words or the canonical vocabulary; the answer echoes `canonical_type`. */
|
|
70
|
+
type: 'export' | 'erasure' | 'erase' | 'access' | 'deletion' | 'closure' | 'restriction' | 'rectification';
|
|
36
71
|
user_id?: string;
|
|
37
72
|
/** The subject's email (verified, else unverified), resolved to the user. */
|
|
38
73
|
subject_email?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-subject-requests.js","sourceRoot":"","sources":["../../src/client/data-subject-requests.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"data-subject-requests.js","sourceRoot":"","sources":["../../src/client/data-subject-requests.ts"],"names":[],"mappings":";;AA8EA,kEAkDC;AAhID,uCAAgD;AA8EhD,SAAgB,2BAA2B,CAAC,OAAkB;IAC5D,OAAO;QACL;;;;WAIG;QACH,MAAM,CACJ,IAAkC,EAClC,cAAuB;YAEvB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;QAC9F,CAAC;QACD;;;WAGG;QACH,MAAM,CAAC,EAAU;YACf,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,6BAA6B,IAAA,aAAG,EAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QAC1F,CAAC;QACD,IAAI,CACF,SAAwC,EAAE;YAE1C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,2BAA2B,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC;QAC7F,CAAC;QACD,GAAG,CAAC,EAAU;YACZ,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,6BAA6B,IAAA,aAAG,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAClF,CAAC;QACD,+FAA+F;QAC/F,OAAO,CAAC,EAAU,EAAE,cAAuB;YACzC,OAAO,OAAO,CAAC;gBACb,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,6BAA6B,IAAA,aAAG,EAAC,EAAE,CAAC,UAAU;gBACpD,cAAc;aACf,CAAC,CAAC;QACL,CAAC;QACD,oFAAoF;QACpF,MAAM,CACJ,EAAU,EACV,OAA4B,EAAE,EAC9B,cA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