@atlasauth/js 0.41.0 → 0.43.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/dist/account-security.d.ts +156 -0
- package/dist/account-security.js +149 -0
- package/dist/account-security.js.map +1 -1
- package/dist/api-keys.d.ts +14 -1
- package/dist/api-keys.js +5 -0
- package/dist/api-keys.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/machine-enrolment.d.ts +26 -0
- package/dist/machine-enrolment.js +17 -0
- package/dist/machine-enrolment.js.map +1 -0
- package/dist/organizations.d.ts +64 -0
- package/dist/organizations.js +34 -1
- package/dist/organizations.js.map +1 -1
- package/dist/passkey-sign-in.d.ts +5 -0
- package/dist/passkey-sign-in.js +1 -1
- package/dist/passkey-sign-in.js.map +1 -1
- package/dist/security-section.d.ts +110 -0
- package/dist/security-section.js +273 -0
- package/dist/security-section.js.map +1 -0
- package/dist/sign-in-flow.d.ts +24 -2
- package/dist/sign-in-flow.js +37 -14
- package/dist/sign-in-flow.js.map +1 -1
- package/dist/sign-in-screen.d.ts +156 -0
- package/dist/sign-in-screen.js +298 -0
- package/dist/sign-in-screen.js.map +1 -0
- package/dist/step-up-flow.d.ts +59 -0
- package/dist/step-up-flow.js +83 -0
- package/dist/step-up-flow.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { FieldError } from './attempt';
|
|
8
8
|
import type { FapiClient } from './fapi';
|
|
9
|
+
import { type StepUpRequirement } from './step-up';
|
|
9
10
|
export type PasswordChangeResult = {
|
|
10
11
|
ok: true;
|
|
11
12
|
userId: string;
|
|
@@ -81,3 +82,158 @@ export type RevokeAllTrustedDevicesResult = {
|
|
|
81
82
|
};
|
|
82
83
|
/** Forget every device this user trusted: each must pass two-factor again on its next sign-in. `count` is how many were forgotten. */
|
|
83
84
|
export declare function revokeAllTrustedDevices(client: FapiClient): Promise<RevokeAllTrustedDevicesResult>;
|
|
85
|
+
/**
|
|
86
|
+
* A refused security-page call. `stepUpRequired` is true when the server answered `STEP_UP_REQUIRED` (the session
|
|
87
|
+
* must prove a credential again first); `stepUp` says which factors it accepts. Re-authenticate with `stepUp()`
|
|
88
|
+
* (or `retryWithStepUp`) and call again.
|
|
89
|
+
*/
|
|
90
|
+
export interface SecurityFailure {
|
|
91
|
+
ok: false;
|
|
92
|
+
errors: FieldError[];
|
|
93
|
+
status: number;
|
|
94
|
+
stepUpRequired: boolean;
|
|
95
|
+
stepUp?: StepUpRequirement;
|
|
96
|
+
}
|
|
97
|
+
/** One of the user's sessions (a signed-in device). */
|
|
98
|
+
export interface AccountSession {
|
|
99
|
+
id: string;
|
|
100
|
+
status: string;
|
|
101
|
+
/** The session making this call. Cookie and session-token (bearer) callers both get it marked. */
|
|
102
|
+
current: boolean;
|
|
103
|
+
lastActiveAt: number;
|
|
104
|
+
expiresAt: number;
|
|
105
|
+
createdAt: number;
|
|
106
|
+
ipAddress: string | null;
|
|
107
|
+
deviceLabel: string | null;
|
|
108
|
+
browser: string | null;
|
|
109
|
+
os: string | null;
|
|
110
|
+
deviceType: string | null;
|
|
111
|
+
location: string | null;
|
|
112
|
+
}
|
|
113
|
+
export type AccountSessionsResult = {
|
|
114
|
+
ok: true;
|
|
115
|
+
sessions: AccountSession[];
|
|
116
|
+
} | SecurityFailure;
|
|
117
|
+
/** The signed-in user's sessions, newest activity first as the server orders them. */
|
|
118
|
+
export declare function listSessions(client: FapiClient): Promise<AccountSessionsResult>;
|
|
119
|
+
export type RevokeSessionResult = {
|
|
120
|
+
ok: true;
|
|
121
|
+
} | SecurityFailure;
|
|
122
|
+
/** Sign one session out. Revoking the current session signs this device out too. */
|
|
123
|
+
export declare function revokeAccountSession(client: FapiClient, id: string): Promise<RevokeSessionResult>;
|
|
124
|
+
export type RevokeOtherSessionsResult = {
|
|
125
|
+
ok: true;
|
|
126
|
+
count: number;
|
|
127
|
+
} | SecurityFailure;
|
|
128
|
+
/** Sign every OTHER session out; this one stays. `count` is how many ended. */
|
|
129
|
+
export declare function revokeAllSessions(client: FapiClient): Promise<RevokeOtherSessionsResult>;
|
|
130
|
+
/** A second factor on the account. `phone` is masked; the secret is never returned after enrolment. */
|
|
131
|
+
export interface MfaFactorSummary {
|
|
132
|
+
id: string;
|
|
133
|
+
/** `totp`, `sms`, `hotp`, `yubikey`, `duo`, `push`, ... */
|
|
134
|
+
type: string;
|
|
135
|
+
verified: boolean;
|
|
136
|
+
phone?: string;
|
|
137
|
+
publicId?: string;
|
|
138
|
+
createdAt: number;
|
|
139
|
+
}
|
|
140
|
+
export type MfaFactorsResult = {
|
|
141
|
+
ok: true;
|
|
142
|
+
factors: MfaFactorSummary[];
|
|
143
|
+
backupCodesRemaining: number;
|
|
144
|
+
} | SecurityFailure;
|
|
145
|
+
/** The user's second factors and how many recovery codes are left. */
|
|
146
|
+
export declare function listMfaFactors(client: FapiClient): Promise<MfaFactorsResult>;
|
|
147
|
+
/** A started authenticator-app enrolment. The secret is shown once: render `qrSvg` (trusted markup from the server) or `uri`, then verify. */
|
|
148
|
+
export interface TotpEnrollment {
|
|
149
|
+
factorId: string;
|
|
150
|
+
secret: string;
|
|
151
|
+
/** The `otpauth://` URI. */
|
|
152
|
+
uri: string;
|
|
153
|
+
/** The URI as an inline SVG QR code. */
|
|
154
|
+
qrSvg: string;
|
|
155
|
+
/** How many consecutive codes {@link verifyTotp} must send (1 or 2). */
|
|
156
|
+
requiredCodes: number;
|
|
157
|
+
}
|
|
158
|
+
export type StartTotpResult = {
|
|
159
|
+
ok: true;
|
|
160
|
+
enrollment: TotpEnrollment;
|
|
161
|
+
} | SecurityFailure;
|
|
162
|
+
/** Begin adding an authenticator app. Needs a recent sign-in: a stale session answers `stepUpRequired`. */
|
|
163
|
+
export declare function startTotp(client: FapiClient): Promise<StartTotpResult>;
|
|
164
|
+
export type VerifyFactorResult = {
|
|
165
|
+
ok: true;
|
|
166
|
+
factor: MfaFactorSummary;
|
|
167
|
+
/** One-time recovery codes, present when this factor was the account's first: show them now, they are not shown again. */
|
|
168
|
+
backupCodes?: string[];
|
|
169
|
+
} | SecurityFailure;
|
|
170
|
+
/** Confirm an authenticator app with the code(s) it shows (`requiredCodes` consecutive ones). */
|
|
171
|
+
export declare function verifyTotp(client: FapiClient, factorId: string, codes: string[]): Promise<VerifyFactorResult>;
|
|
172
|
+
export type StartSmsResult = {
|
|
173
|
+
ok: true;
|
|
174
|
+
factorId: string; /** The number the code went to, masked. */
|
|
175
|
+
phone: string;
|
|
176
|
+
} | SecurityFailure;
|
|
177
|
+
/** Begin texted codes: texts a code to `phone` (E.164). Refused when the app offers no SMS factor. */
|
|
178
|
+
export declare function startSms(client: FapiClient, phone: string): Promise<StartSmsResult>;
|
|
179
|
+
/** Confirm the texted number with the code that arrived. */
|
|
180
|
+
export declare function verifySms(client: FapiClient, factorId: string, code: string): Promise<VerifyFactorResult>;
|
|
181
|
+
export type RemoveMfaFactorResult = {
|
|
182
|
+
ok: true;
|
|
183
|
+
} | SecurityFailure;
|
|
184
|
+
/** Remove a second factor. Always needs a recent sign-in. */
|
|
185
|
+
export declare function removeMfaFactor(client: FapiClient, factorId: string): Promise<RemoveMfaFactorResult>;
|
|
186
|
+
export type RegenerateBackupCodesResult = {
|
|
187
|
+
ok: true;
|
|
188
|
+
codes: string[];
|
|
189
|
+
} | SecurityFailure;
|
|
190
|
+
/** Replace the recovery codes with a new set (the old ones stop working at once). Show them now: they are not shown again. Always needs a recent sign-in. */
|
|
191
|
+
export declare function regenerateBackupCodes(client: FapiClient): Promise<RegenerateBackupCodesResult>;
|
|
192
|
+
/** A passkey on the account (the credential id and key are never exposed). */
|
|
193
|
+
export interface AccountPasskey {
|
|
194
|
+
id: string;
|
|
195
|
+
name: string | null;
|
|
196
|
+
backedUp: boolean;
|
|
197
|
+
lastUsedAt: number | null;
|
|
198
|
+
createdAt: number;
|
|
199
|
+
/** The authenticator model's name and icon, when the instance resolves them. */
|
|
200
|
+
authenticator: {
|
|
201
|
+
name: string | null;
|
|
202
|
+
icon: string | null;
|
|
203
|
+
} | null;
|
|
204
|
+
}
|
|
205
|
+
export type AccountPasskeysResult = {
|
|
206
|
+
ok: true;
|
|
207
|
+
passkeys: AccountPasskey[];
|
|
208
|
+
} | SecurityFailure;
|
|
209
|
+
/** The signed-in user's passkeys. */
|
|
210
|
+
export declare function listPasskeys(client: FapiClient): Promise<AccountPasskeysResult>;
|
|
211
|
+
export type RemovePasskeyResult = {
|
|
212
|
+
ok: true;
|
|
213
|
+
} | SecurityFailure;
|
|
214
|
+
/** Remove a passkey. Needs a recent sign-in. */
|
|
215
|
+
export declare function removePasskey(client: FapiClient, id: string): Promise<RemovePasskeyResult>;
|
|
216
|
+
export type UnlinkExternalAccountResult = {
|
|
217
|
+
ok: true;
|
|
218
|
+
} | SecurityFailure;
|
|
219
|
+
/**
|
|
220
|
+
* Unlink a connected sign-in provider. Needs a recent sign-in, and answers 409 `LAST_AUTH_METHOD`
|
|
221
|
+
* when it is the account's only way in (set a password or connect another provider first).
|
|
222
|
+
*/
|
|
223
|
+
export declare function unlinkExternalAccount(client: FapiClient, id: string): Promise<UnlinkExternalAccountResult>;
|
|
224
|
+
/** One security-notification category and whether this user gets it. */
|
|
225
|
+
export interface NotificationPreference {
|
|
226
|
+
category: string;
|
|
227
|
+
label: string;
|
|
228
|
+
enabled: boolean;
|
|
229
|
+
/** False for a category that cannot be turned off (grey the toggle out). */
|
|
230
|
+
optional: boolean;
|
|
231
|
+
}
|
|
232
|
+
export type NotificationPreferencesResult = {
|
|
233
|
+
ok: true;
|
|
234
|
+
preferences: NotificationPreference[];
|
|
235
|
+
} | SecurityFailure;
|
|
236
|
+
/** The user's security-notification preferences, every category included. */
|
|
237
|
+
export declare function getNotificationPreferences(client: FapiClient): Promise<NotificationPreferencesResult>;
|
|
238
|
+
/** Turn categories on or off, e.g. `{ new_device: false }`; returns the full resulting set. An unknown or non-optional category answers 400. */
|
|
239
|
+
export declare function updateNotificationPreferences(client: FapiClient, preferences: Record<string, boolean>): Promise<NotificationPreferencesResult>;
|
package/dist/account-security.js
CHANGED
|
@@ -5,6 +5,22 @@ exports.setPassword = setPassword;
|
|
|
5
5
|
exports.listTrustedDevices = listTrustedDevices;
|
|
6
6
|
exports.revokeTrustedDevice = revokeTrustedDevice;
|
|
7
7
|
exports.revokeAllTrustedDevices = revokeAllTrustedDevices;
|
|
8
|
+
exports.listSessions = listSessions;
|
|
9
|
+
exports.revokeAccountSession = revokeAccountSession;
|
|
10
|
+
exports.revokeAllSessions = revokeAllSessions;
|
|
11
|
+
exports.listMfaFactors = listMfaFactors;
|
|
12
|
+
exports.startTotp = startTotp;
|
|
13
|
+
exports.verifyTotp = verifyTotp;
|
|
14
|
+
exports.startSms = startSms;
|
|
15
|
+
exports.verifySms = verifySms;
|
|
16
|
+
exports.removeMfaFactor = removeMfaFactor;
|
|
17
|
+
exports.regenerateBackupCodes = regenerateBackupCodes;
|
|
18
|
+
exports.listPasskeys = listPasskeys;
|
|
19
|
+
exports.removePasskey = removePasskey;
|
|
20
|
+
exports.unlinkExternalAccount = unlinkExternalAccount;
|
|
21
|
+
exports.getNotificationPreferences = getNotificationPreferences;
|
|
22
|
+
exports.updateNotificationPreferences = updateNotificationPreferences;
|
|
23
|
+
const step_up_1 = require("./step-up");
|
|
8
24
|
/**
|
|
9
25
|
* Change the password of the signed-in user. Proves the CURRENT password (no recent sign-in needed),
|
|
10
26
|
* applies the sign-up password policy, and signs the user's other sessions out unless the instance opted out.
|
|
@@ -56,4 +72,137 @@ async function revokeAllTrustedDevices(client) {
|
|
|
56
72
|
const res = await client.request('/v1/client/me/trusted_devices', { method: 'DELETE' });
|
|
57
73
|
return res.ok ? { ok: true, count: typeof res.data?.count === 'number' ? res.data.count : 0 } : { ok: false, errors: res.errors, status: res.status };
|
|
58
74
|
}
|
|
75
|
+
function failure(res) {
|
|
76
|
+
const stepUp = (0, step_up_1.stepUpRequirement)(res.errors);
|
|
77
|
+
return { ok: false, errors: res.errors, status: res.status, stepUpRequired: stepUp !== null, ...(stepUp ? { stepUp } : {}) };
|
|
78
|
+
}
|
|
79
|
+
/** The signed-in user's sessions, newest activity first as the server orders them. */
|
|
80
|
+
async function listSessions(client) {
|
|
81
|
+
const res = await client.get('/v1/client/sessions');
|
|
82
|
+
if (!res.ok || !res.data)
|
|
83
|
+
return failure(res);
|
|
84
|
+
return {
|
|
85
|
+
ok: true,
|
|
86
|
+
sessions: res.data.data.map((s) => ({
|
|
87
|
+
id: s.id,
|
|
88
|
+
status: s.status,
|
|
89
|
+
current: s.current === true,
|
|
90
|
+
lastActiveAt: s.last_active_at,
|
|
91
|
+
expiresAt: s.expire_at,
|
|
92
|
+
createdAt: s.created_at,
|
|
93
|
+
ipAddress: s.ip_address ?? null,
|
|
94
|
+
deviceLabel: s.device_label ?? null,
|
|
95
|
+
browser: s.browser ?? null,
|
|
96
|
+
os: s.os ?? null,
|
|
97
|
+
deviceType: s.device_type ?? null,
|
|
98
|
+
location: s.location ?? null,
|
|
99
|
+
})),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** Sign one session out. Revoking the current session signs this device out too. */
|
|
103
|
+
async function revokeAccountSession(client, id) {
|
|
104
|
+
const res = await client.post(`/v1/client/sessions/${encodeURIComponent(id)}/revoke`, {});
|
|
105
|
+
return res.ok ? { ok: true } : failure(res);
|
|
106
|
+
}
|
|
107
|
+
/** Sign every OTHER session out; this one stays. `count` is how many ended. */
|
|
108
|
+
async function revokeAllSessions(client) {
|
|
109
|
+
const res = await client.post('/v1/client/sessions/revoke_all', {});
|
|
110
|
+
return res.ok ? { ok: true, count: typeof res.data?.sessions_revoked === 'number' ? res.data.sessions_revoked : 0 } : failure(res);
|
|
111
|
+
}
|
|
112
|
+
const factorOf = (f) => ({
|
|
113
|
+
id: f.id,
|
|
114
|
+
type: f.type,
|
|
115
|
+
verified: f.verified,
|
|
116
|
+
...(f.phone ? { phone: f.phone } : {}),
|
|
117
|
+
...(f.public_id ? { publicId: f.public_id } : {}),
|
|
118
|
+
createdAt: f.created_at,
|
|
119
|
+
});
|
|
120
|
+
/** The user's second factors and how many recovery codes are left. */
|
|
121
|
+
async function listMfaFactors(client) {
|
|
122
|
+
const res = await client.get('/v1/client/me/mfa');
|
|
123
|
+
if (!res.ok || !res.data)
|
|
124
|
+
return failure(res);
|
|
125
|
+
return { ok: true, factors: res.data.data.map(factorOf), backupCodesRemaining: res.data.backup_codes_remaining ?? 0 };
|
|
126
|
+
}
|
|
127
|
+
/** Begin adding an authenticator app. Needs a recent sign-in: a stale session answers `stepUpRequired`. */
|
|
128
|
+
async function startTotp(client) {
|
|
129
|
+
const res = await client.post('/v1/client/me/mfa/totp', {});
|
|
130
|
+
if (!res.ok || !res.data)
|
|
131
|
+
return failure(res);
|
|
132
|
+
const d = res.data;
|
|
133
|
+
return { ok: true, enrollment: { factorId: d.id, secret: d.secret, uri: d.uri, qrSvg: d.qr_svg, requiredCodes: d.required_codes ?? 1 } };
|
|
134
|
+
}
|
|
135
|
+
const verified = (d) => ({
|
|
136
|
+
ok: true,
|
|
137
|
+
factor: factorOf(d),
|
|
138
|
+
...(d.backup_codes?.length ? { backupCodes: d.backup_codes } : {}),
|
|
139
|
+
});
|
|
140
|
+
/** Confirm an authenticator app with the code(s) it shows (`requiredCodes` consecutive ones). */
|
|
141
|
+
async function verifyTotp(client, factorId, codes) {
|
|
142
|
+
const res = await client.post(`/v1/client/me/mfa/totp/${encodeURIComponent(factorId)}/verify`, { codes });
|
|
143
|
+
return res.ok && res.data ? verified(res.data) : failure(res);
|
|
144
|
+
}
|
|
145
|
+
/** Begin texted codes: texts a code to `phone` (E.164). Refused when the app offers no SMS factor. */
|
|
146
|
+
async function startSms(client, phone) {
|
|
147
|
+
const res = await client.post('/v1/client/me/mfa/sms', { phone });
|
|
148
|
+
return res.ok && res.data ? { ok: true, factorId: res.data.id, phone: res.data.phone ?? '' } : failure(res);
|
|
149
|
+
}
|
|
150
|
+
/** Confirm the texted number with the code that arrived. */
|
|
151
|
+
async function verifySms(client, factorId, code) {
|
|
152
|
+
const res = await client.post(`/v1/client/me/mfa/sms/${encodeURIComponent(factorId)}/verify`, { code });
|
|
153
|
+
return res.ok && res.data ? verified(res.data) : failure(res);
|
|
154
|
+
}
|
|
155
|
+
/** Remove a second factor. Always needs a recent sign-in. */
|
|
156
|
+
async function removeMfaFactor(client, factorId) {
|
|
157
|
+
const res = await client.request(`/v1/client/me/mfa/${encodeURIComponent(factorId)}`, { method: 'DELETE' });
|
|
158
|
+
return res.ok ? { ok: true } : failure(res);
|
|
159
|
+
}
|
|
160
|
+
/** Replace the recovery codes with a new set (the old ones stop working at once). Show them now: they are not shown again. Always needs a recent sign-in. */
|
|
161
|
+
async function regenerateBackupCodes(client) {
|
|
162
|
+
const res = await client.post('/v1/client/me/mfa/backup_codes', {});
|
|
163
|
+
return res.ok && res.data ? { ok: true, codes: res.data.codes } : failure(res);
|
|
164
|
+
}
|
|
165
|
+
/** The signed-in user's passkeys. */
|
|
166
|
+
async function listPasskeys(client) {
|
|
167
|
+
const res = await client.get('/v1/client/me/passkeys');
|
|
168
|
+
if (!res.ok || !res.data)
|
|
169
|
+
return failure(res);
|
|
170
|
+
return {
|
|
171
|
+
ok: true,
|
|
172
|
+
passkeys: res.data.data.map((p) => ({
|
|
173
|
+
id: p.id,
|
|
174
|
+
name: p.name,
|
|
175
|
+
backedUp: p.backed_up,
|
|
176
|
+
lastUsedAt: p.last_used_at,
|
|
177
|
+
createdAt: p.created_at,
|
|
178
|
+
authenticator: p.authenticator ?? null,
|
|
179
|
+
})),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/** Remove a passkey. Needs a recent sign-in. */
|
|
183
|
+
async function removePasskey(client, id) {
|
|
184
|
+
const res = await client.request(`/v1/client/me/passkeys/${encodeURIComponent(id)}`, { method: 'DELETE' });
|
|
185
|
+
return res.ok ? { ok: true } : failure(res);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Unlink a connected sign-in provider. Needs a recent sign-in, and answers 409 `LAST_AUTH_METHOD`
|
|
189
|
+
* when it is the account's only way in (set a password or connect another provider first).
|
|
190
|
+
*/
|
|
191
|
+
async function unlinkExternalAccount(client, id) {
|
|
192
|
+
const res = await client.request(`/v1/client/me/external_accounts/${encodeURIComponent(id)}`, { method: 'DELETE' });
|
|
193
|
+
return res.ok ? { ok: true } : failure(res);
|
|
194
|
+
}
|
|
195
|
+
/** The user's security-notification preferences, every category included. */
|
|
196
|
+
async function getNotificationPreferences(client) {
|
|
197
|
+
const res = await client.get('/v1/client/me/notification_preferences');
|
|
198
|
+
return res.ok && res.data ? { ok: true, preferences: res.data.preferences } : failure(res);
|
|
199
|
+
}
|
|
200
|
+
/** Turn categories on or off, e.g. `{ new_device: false }`; returns the full resulting set. An unknown or non-optional category answers 400. */
|
|
201
|
+
async function updateNotificationPreferences(client, preferences) {
|
|
202
|
+
const res = await client.request('/v1/client/me/notification_preferences', {
|
|
203
|
+
method: 'PATCH',
|
|
204
|
+
body: JSON.stringify({ preferences }),
|
|
205
|
+
});
|
|
206
|
+
return res.ok && res.data ? { ok: true, preferences: res.data.preferences } : failure(res);
|
|
207
|
+
}
|
|
59
208
|
//# sourceMappingURL=account-security.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-security.js","sourceRoot":"","sources":["../src/account-security.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"account-security.js","sourceRoot":"","sources":["../src/account-security.ts"],"names":[],"mappings":";;AA4BA,wCAYC;AASD,kCAIC;AAsBD,gDAOC;AAKD,kDAGC;AAKD,0DAGC;AAyDD,oCAoBC;AAKD,oDAGC;AAKD,8CAGC;AAoCD,wCAIC;AAiBD,8BAKC;AAsBD,gCAGC;AAKD,4BAGC;AAGD,8BAGC;AAKD,0CAGC;AAKD,sDAGC;AA2BD,oCAcC;AAKD,sCAGC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B,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC7H,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC9C,CAAC;AAeD,6EAA6E;AACtE,KAAK,UAAU,0BAA0B,CAAC,MAAkB;IACjE,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAA4C,wCAAwC,CAAC,CAAC;IAClH,OAAO,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC7F,CAAC;AAED,gJAAgJ;AACzI,KAAK,UAAU,6BAA6B,CAAC,MAAkB,EAAE,WAAoC;IAC1G,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAA4C,wCAAwC,EAAE;QACpH,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;KACtC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC7F,CAAC"}
|
package/dist/api-keys.d.ts
CHANGED
|
@@ -27,6 +27,12 @@ export interface UserApiKey {
|
|
|
27
27
|
last_used_at: number | null;
|
|
28
28
|
expires_at: number | null;
|
|
29
29
|
revoked_at: number | null;
|
|
30
|
+
/** Why it was revoked when you did not: `membership_ended`, `creator_departed` or `organization_deleted`. */
|
|
31
|
+
revoked_reason?: string | null;
|
|
32
|
+
/** The organization a key of yours is bound to (it ends when you leave that organization); null = unbound. */
|
|
33
|
+
organization_id?: string | null;
|
|
34
|
+
/** The member who created an organization key. */
|
|
35
|
+
created_by_user_id?: string | null;
|
|
30
36
|
created_at: number;
|
|
31
37
|
}
|
|
32
38
|
/** The create response: the key plus its one-time `secret`. */
|
|
@@ -61,8 +67,14 @@ export interface CreateUserApiKeyInput {
|
|
|
61
67
|
scopes?: string[];
|
|
62
68
|
/** Only claim names the application allows (`allowedClaims`). */
|
|
63
69
|
claims?: Record<string, unknown>;
|
|
64
|
-
/** Create the key for this (active) organization instead of the user. */
|
|
70
|
+
/** Create the key for this (active) organization instead of the user. With `bindToOrganization`, the id of the organization to bind YOUR key to instead. */
|
|
65
71
|
organizationId?: string;
|
|
72
|
+
/**
|
|
73
|
+
* With `organizationId`: make your own key BOUND to that organization (you must be a
|
|
74
|
+
* member) instead of the organization's key. It carries only what your role there
|
|
75
|
+
* allows and is revoked when you leave the organization.
|
|
76
|
+
*/
|
|
77
|
+
bindToOrganization?: boolean;
|
|
66
78
|
/** Key type (e.g. `sk`); required when the application sets `keyTypes`. */
|
|
67
79
|
type?: string;
|
|
68
80
|
}
|
|
@@ -87,6 +99,7 @@ export declare class ApiKeyRequestError extends Error {
|
|
|
87
99
|
export declare function listApiKeys(client: FapiClient, options?: {
|
|
88
100
|
organizationId?: string;
|
|
89
101
|
type?: string;
|
|
102
|
+
bound?: boolean;
|
|
90
103
|
}): Promise<UserApiKeyList>;
|
|
91
104
|
/** Create a key. The returned `secret` is shown exactly once. */
|
|
92
105
|
export declare function createApiKey(client: FapiClient, input?: CreateUserApiKeyInput): Promise<CreatedUserApiKey>;
|
package/dist/api-keys.js
CHANGED
|
@@ -51,6 +51,9 @@ async function listApiKeys(client, options = {}) {
|
|
|
51
51
|
const params = new URLSearchParams();
|
|
52
52
|
if (options.organizationId)
|
|
53
53
|
params.set('organization_id', options.organizationId);
|
|
54
|
+
// With organizationId: your own keys bound to that organization, not the organization's keys.
|
|
55
|
+
if (options.bound && options.organizationId)
|
|
56
|
+
params.set('subject_type', 'user');
|
|
54
57
|
if (options.type)
|
|
55
58
|
params.set('type', options.type);
|
|
56
59
|
const query = params.size ? `?${params}` : '';
|
|
@@ -79,6 +82,8 @@ async function createApiKey(client, input = {}) {
|
|
|
79
82
|
body.claims = input.claims;
|
|
80
83
|
if (input.organizationId !== undefined)
|
|
81
84
|
body.organization_id = input.organizationId;
|
|
85
|
+
if (input.bindToOrganization)
|
|
86
|
+
body.subject_type = 'user';
|
|
82
87
|
if (input.type !== undefined)
|
|
83
88
|
body.type = input.type;
|
|
84
89
|
return call(client, BASE, { method: 'POST', body: JSON.stringify(body) });
|
package/dist/api-keys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../src/api-keys.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../src/api-keys.ts"],"names":[],"mappings":";;;AA8IA,kCA0BC;AAGD,oCAcC;AAGD,oCASC;AAGD,oCASC;AAOD,sCAuBC;AAeD,8BAcC;AAtLD,mEAAmE;AACnE,MAAa,kBAAmB,SAAQ,KAAK;IAClC,IAAI,CAAS;IACb,MAAM,CAAS;IACf,KAAK,CAAU;IACxB;;;;OAIG;IACM,MAAM,CAAU;IACzB,mEAAmE;IAC1D,IAAI,CAA2B;IAExC,YACE,MAAc,EACd,IAAY,EACZ,OAAe,EACf,KAAc,EACd,MAAe,EACf,IAA8B;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,MAAM;YAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CA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,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC;QACnD,GAAG,CAAC,CAAC,CAAC,CAAC,CAAqB,CAAC,GAAG,KAAK,CAAC;QACtC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAE,EAAE,GAAG,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -89,3 +89,7 @@ export * from './delegated-ui';
|
|
|
89
89
|
export * from './external-passkeys';
|
|
90
90
|
export * from './credentials';
|
|
91
91
|
export * from './uma';
|
|
92
|
+
export * from './step-up-flow';
|
|
93
|
+
export * from './sign-in-screen';
|
|
94
|
+
export * from './security-section';
|
|
95
|
+
export * from './machine-enrolment';
|
package/dist/index.js
CHANGED
|
@@ -170,4 +170,11 @@ __exportStar(require("./external-passkeys"), exports);
|
|
|
170
170
|
// Wallet-side helpers for verifiable credentials (receive an offer, present an SD-JWT VC).
|
|
171
171
|
__exportStar(require("./credentials"), exports);
|
|
172
172
|
__exportStar(require("./uma"), exports);
|
|
173
|
+
// Step-up with no DOM: choose a held factor, re-verify, retry the refused call (bearer sessions included).
|
|
174
|
+
__exportStar(require("./step-up-flow"), exports);
|
|
175
|
+
// Sign-in and account-security screens as framework-free view-models (steps, methods, fields, human errors, step-up inside).
|
|
176
|
+
__exportStar(require("./sign-in-screen"), exports);
|
|
177
|
+
__exportStar(require("./security-section"), exports);
|
|
178
|
+
// Mint a short enrolment code for a device the signed-in user owns.
|
|
179
|
+
__exportStar(require("./machine-enrolment"), exports);
|
|
173
180
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","s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0B;AARxB,iGAAA,QAAQ,OAAA;AACR,sGAAA,aAAa,OAAA;AACb,0GAAA,iBAAiB,OAAA;AACjB,uGAAA,cAAc,OAAA;AACd,yGAAA,gBAAgB,OAAA;AAChB,+GAAA,sBAAsB,OAAA;AACtB,kGAAA,SAAS,OAAA;AACT,wGAAA,eAAe,OAAA;AAEjB,qDAAmC;AAEnC,yGAAyG;AACzG,iDAA+B;AAE/B,kFAAkF;AAClF,sDAAoC;AAEpC,2FAA2F;AAC3F,gDAA8B;AAC9B,wCAAsB;AAEtB,2GAA2G;AAC3G,iDAA+B;AAE/B,6HAA6H;AAC7H,mDAAiC;AACjC,qDAAmC;AACnC,oEAAoE;AACpE,sDAAoC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** A short code a signed-in user mints for a device of their own; the device redeems it to enrol. */
|
|
2
|
+
import type { FieldError } from './attempt';
|
|
3
|
+
import type { FapiClient } from './fapi';
|
|
4
|
+
import { type StepUpRequirement } from './step-up';
|
|
5
|
+
export type MachineEnrolmentCodeResult = {
|
|
6
|
+
ok: true;
|
|
7
|
+
/** The code to type on the device (`XXXX-XXXX`). Shown once. */
|
|
8
|
+
code: string;
|
|
9
|
+
id: string;
|
|
10
|
+
/** Epoch milliseconds. */
|
|
11
|
+
expiresAt: number;
|
|
12
|
+
expiresIn: number;
|
|
13
|
+
} | {
|
|
14
|
+
ok: false;
|
|
15
|
+
errors: FieldError[];
|
|
16
|
+
status: number;
|
|
17
|
+
stepUpRequired: boolean;
|
|
18
|
+
stepUp?: StepUpRequirement;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Mint a single-use enrolment code for a device the signed-in user owns. Needs a session (not a token);
|
|
22
|
+
* `expiresInSeconds` is 300 to 900 (default 600). A refused call that needs a fresh sign-in sets `stepUpRequired`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createMachineEnrolmentCode(client: FapiClient, opts?: {
|
|
25
|
+
expiresInSeconds?: number;
|
|
26
|
+
}): Promise<MachineEnrolmentCodeResult>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMachineEnrolmentCode = createMachineEnrolmentCode;
|
|
4
|
+
const step_up_1 = require("./step-up");
|
|
5
|
+
/**
|
|
6
|
+
* Mint a single-use enrolment code for a device the signed-in user owns. Needs a session (not a token);
|
|
7
|
+
* `expiresInSeconds` is 300 to 900 (default 600). A refused call that needs a fresh sign-in sets `stepUpRequired`.
|
|
8
|
+
*/
|
|
9
|
+
async function createMachineEnrolmentCode(client, opts = {}) {
|
|
10
|
+
const res = await client.post('/v1/client/me/machine_enrolment_codes', opts.expiresInSeconds === undefined ? {} : { expires_in_seconds: opts.expiresInSeconds });
|
|
11
|
+
if (!res.ok || !res.data) {
|
|
12
|
+
const stepUp = (0, step_up_1.stepUpRequirement)(res.errors);
|
|
13
|
+
return { ok: false, errors: res.errors, status: res.status, stepUpRequired: stepUp !== null, ...(stepUp ? { stepUp } : {}) };
|
|
14
|
+
}
|
|
15
|
+
return { ok: true, code: res.data.user_code, id: res.data.id, expiresAt: res.data.expires_at, expiresIn: res.data.expires_in };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=machine-enrolment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"machine-enrolment.js","sourceRoot":"","sources":["../src/machine-enrolment.ts"],"names":[],"mappings":";;AAqBA,gEAUC;AA5BD,uCAAsE;AActE;;;GAGG;AACI,KAAK,UAAU,0BAA0B,CAAC,MAAkB,EAAE,OAAsC,EAAE;IAC3G,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAC3B,uCAAuC,EACvC,IAAI,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,EAAE,CACzF,CAAC;IACF,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,IAAA,2BAAiB,EAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC7C,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IAC/H,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;AACjI,CAAC"}
|
package/dist/organizations.d.ts
CHANGED
|
@@ -36,6 +36,12 @@ export interface OrganizationMember {
|
|
|
36
36
|
last_name: string | null;
|
|
37
37
|
image_url: string | null;
|
|
38
38
|
} | null;
|
|
39
|
+
/** The seat's public metadata. */
|
|
40
|
+
public_metadata?: Record<string, unknown>;
|
|
41
|
+
/** Extra permissions on top of the role. Only for callers who manage members. */
|
|
42
|
+
permissions?: string[];
|
|
43
|
+
/** Sign-in methods whose sessions carry this organization's claims; null = any. Only for callers who manage members. */
|
|
44
|
+
allowed_sign_in_methods?: string[] | null;
|
|
39
45
|
}
|
|
40
46
|
export interface OrganizationInvitation {
|
|
41
47
|
object: 'organization_invitation';
|
|
@@ -47,6 +53,14 @@ export interface OrganizationInvitation {
|
|
|
47
53
|
inviter_user_id: string | null;
|
|
48
54
|
expires_at: number;
|
|
49
55
|
created_at: number;
|
|
56
|
+
delivery?: 'email' | 'link';
|
|
57
|
+
accept_by?: 'link' | 'verified_email' | null;
|
|
58
|
+
permissions?: string[];
|
|
59
|
+
allowed_sign_in_methods?: string[] | null;
|
|
60
|
+
/** Link delivery, on create and resend only, shown once: the single-use token. */
|
|
61
|
+
accept_token?: string;
|
|
62
|
+
/** Link delivery, on create only, shown once: `redirectUrl` with `?invitation_token=` appended. */
|
|
63
|
+
accept_url?: string | null;
|
|
50
64
|
}
|
|
51
65
|
/** What an accept page shows before the invitee signs in. */
|
|
52
66
|
export interface PublicOrganizationInvitation {
|
|
@@ -209,6 +223,24 @@ export declare function updateMemberRole(client: FapiClient, organizationId: str
|
|
|
209
223
|
user_id: string;
|
|
210
224
|
role: string;
|
|
211
225
|
}>;
|
|
226
|
+
/**
|
|
227
|
+
* Change what a member's seat carries beyond the role: the full list of extra
|
|
228
|
+
* `permissions` (you may add only permissions you hold yourself) and/or the
|
|
229
|
+
* `allowedSignInMethods` whose sessions carry this organization's claims
|
|
230
|
+
* (`null` clears the restriction). Needs member management.
|
|
231
|
+
*/
|
|
232
|
+
export declare function updateMemberAccess(client: FapiClient, organizationId: string, userId: string, input: {
|
|
233
|
+
role?: string;
|
|
234
|
+
permissions?: string[];
|
|
235
|
+
allowedSignInMethods?: string[] | null;
|
|
236
|
+
}): Promise<{
|
|
237
|
+
object: 'organization_membership';
|
|
238
|
+
organization_id: string;
|
|
239
|
+
user_id: string;
|
|
240
|
+
role: string;
|
|
241
|
+
permissions: string[];
|
|
242
|
+
allowed_sign_in_methods: string[] | null;
|
|
243
|
+
}>;
|
|
212
244
|
export declare function removeMember(client: FapiClient, organizationId: string, userId: string): Promise<unknown>;
|
|
213
245
|
export declare function listOrganizationInvitations(client: FapiClient, organizationId: string, options?: {
|
|
214
246
|
status?: string;
|
|
@@ -216,6 +248,15 @@ export declare function listOrganizationInvitations(client: FapiClient, organiza
|
|
|
216
248
|
export declare function inviteMember(client: FapiClient, organizationId: string, input: {
|
|
217
249
|
emailAddress: string;
|
|
218
250
|
role: string;
|
|
251
|
+
/** `link`: nothing is sent; `accept_token` (and `accept_url` with `redirectUrl`) come back once. Default `email`. */
|
|
252
|
+
delivery?: 'email' | 'link';
|
|
253
|
+
/** Link delivery: who may accept by link. Default: the instance setting. */
|
|
254
|
+
acceptBy?: 'link' | 'verified_email';
|
|
255
|
+
/** Link delivery: a page in your app (an allowed origin) that reads `invitation_token`. */
|
|
256
|
+
redirectUrl?: string;
|
|
257
|
+
/** Extra permissions on top of the role; only ones you hold yourself. */
|
|
258
|
+
permissions?: string[];
|
|
259
|
+
allowedSignInMethods?: string[] | null;
|
|
219
260
|
}): Promise<OrganizationInvitation>;
|
|
220
261
|
export declare function revokeInvitation(client: FapiClient, organizationId: string, invitationId: string): Promise<OrganizationInvitation>;
|
|
221
262
|
export declare function resendInvitation(client: FapiClient, organizationId: string, invitationId: string): Promise<OrganizationInvitation>;
|
|
@@ -223,6 +264,29 @@ export declare function resendInvitation(client: FapiClient, organizationId: str
|
|
|
223
264
|
export declare function getOrganizationInvitation(client: FapiClient, invitationId: string): Promise<PublicOrganizationInvitation>;
|
|
224
265
|
/** Accept an invitation by id as the signed-in user. */
|
|
225
266
|
export declare function acceptOrganizationInvitation(client: FapiClient, invitationId: string): Promise<unknown>;
|
|
267
|
+
/** The seat created by {@link acceptOrganizationInvitationByToken}. */
|
|
268
|
+
export interface AcceptedInvitationMembership {
|
|
269
|
+
object: 'organization_membership';
|
|
270
|
+
id: string;
|
|
271
|
+
organization_id: string;
|
|
272
|
+
user_id: string;
|
|
273
|
+
role_id: string;
|
|
274
|
+
invitation_id: string;
|
|
275
|
+
invited_email_address: string;
|
|
276
|
+
/** The verified address of the accepting user (null when they hold none). */
|
|
277
|
+
accepted_email_address: string | null;
|
|
278
|
+
/** True when the accepting user's address differs from the invited one (link-holder acceptance). */
|
|
279
|
+
email_mismatch: boolean;
|
|
280
|
+
created_at: number;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Accept an invitation by the single-use token from its link
|
|
284
|
+
* (`delivery: "link"`), as the signed-in user. Pass the `invitation_token`
|
|
285
|
+
* your accept page received. Rate limited; a used, expired or unknown token
|
|
286
|
+
* fails (404 / 400), and who may accept follows the instance's
|
|
287
|
+
* `organizations.invitationAccept` or the invitation's `accept_by`.
|
|
288
|
+
*/
|
|
289
|
+
export declare function acceptOrganizationInvitationByToken(client: FapiClient, token: string): Promise<AcceptedInvitationMembership>;
|
|
226
290
|
/** Invitations addressed to the signed-in user. */
|
|
227
291
|
export declare function listMyOrganizationInvitations(client: FapiClient): Promise<OrganizationPage<Record<string, unknown>>>;
|
|
228
292
|
export declare function acceptMyOrganizationInvitation(client: FapiClient, invitationId: string): Promise<unknown>;
|