@proveanything/smartlinks 2.1.43 → 2.1.45
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/api/authKit.d.ts +8 -1
- package/dist/api/authKit.js +10 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/serviceAccounts.d.ts +18 -0
- package/dist/api/serviceAccounts.js +49 -0
- package/dist/docs/API_SUMMARY.md +99 -1
- package/dist/docs/auth-kit.md +7 -2
- package/dist/docs/overview.md +1 -0
- package/dist/docs/service-accounts.md +43 -0
- package/dist/openapi.yaml +150 -1
- package/dist/types/authKit.d.ts +22 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/serviceAccounts.d.ts +44 -0
- package/dist/types/serviceAccounts.js +2 -0
- package/docs/API_SUMMARY.md +99 -1
- package/docs/auth-kit.md +7 -2
- package/docs/overview.md +1 -0
- package/docs/service-accounts.md +43 -0
- package/openapi.yaml +150 -1
- package/package.json +1 -1
package/dist/api/authKit.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuthLoginResponse, AppleLoginOptions, MicrosoftLoginOptions, RefreshResponse, LogoutResponse, PhoneSendCodeResponse, PhoneVerifyResponse, PasswordResetRequestResponse, VerifyResetTokenResponse, PasswordResetCompleteResponse, EmailVerificationActionResponse, EmailVerifyTokenResponse, AuthKitConfig, AuthKitConfigInput, AuthKitSetIdentityResponse, AuthKitInviteRequest, AuthKitInviteResponse, AuthKitSchema, AuthKitSettingsResponse, AuthKitSetupRequest, AuthKitSetupResponse, AuthKitEmailKind, AuthKitEmailPreview, AuthKitSecretLink, MagicLinkSendResponse, MagicLinkVerifyResponse, UserProfile, UpdateProfileResponse, ProfileUpdateData, SuccessResponse, SendWhatsAppRequest, SendWhatsAppResponse, ExchangeWhatsAppSessionResponse, VerifyWhatsAppResponse, WhatsAppStatusResponse, SendSmsVerifyRequest, SendSmsVerifyResponse, VerifySmsResponse, UpsertContactRequest, UpsertContactResponse, MfaChallengeSendResponse, MfaFinalizeResponse, MfaEnrollSendResponse, MfaTotpEnrollResponse, MfaEnrolledResponse, MfaFactor, MfaFactorsResponse, TrustedDevice } from "../types/authKit.js";
|
|
1
|
+
import type { AuthLoginResponse, AppleLoginOptions, MicrosoftLoginOptions, RefreshResponse, LogoutResponse, PhoneSendCodeResponse, PhoneVerifyResponse, PasswordResetRequestResponse, VerifyResetTokenResponse, PasswordResetCompleteResponse, EmailVerificationActionResponse, EmailVerifyTokenResponse, AuthKitConfig, AuthKitConfigInput, AuthKitSetIdentityResponse, AuthKitInviteRequest, AuthKitInviteResponse, AuthKitSchema, AuthKitSettingsResponse, AuthKitRedirectDomainsResponse, AuthKitSetupRequest, AuthKitSetupResponse, AuthKitEmailKind, AuthKitEmailPreview, AuthKitSecretLink, MagicLinkSendResponse, MagicLinkVerifyResponse, UserProfile, UpdateProfileResponse, ProfileUpdateData, SuccessResponse, SendWhatsAppRequest, SendWhatsAppResponse, ExchangeWhatsAppSessionResponse, VerifyWhatsAppResponse, WhatsAppStatusResponse, SendSmsVerifyRequest, SendSmsVerifyResponse, VerifySmsResponse, UpsertContactRequest, UpsertContactResponse, MfaChallengeSendResponse, MfaFinalizeResponse, MfaEnrollSendResponse, MfaTotpEnrollResponse, MfaEnrolledResponse, MfaFactor, MfaFactorsResponse, TrustedDevice } from "../types/authKit.js";
|
|
2
2
|
/**
|
|
3
3
|
* Namespace containing helper functions for the new AuthKit API.
|
|
4
4
|
* Legacy collection-based authKit helpers retained (marked as *Legacy*).
|
|
@@ -333,6 +333,13 @@ export declare namespace authKit {
|
|
|
333
333
|
function setup(collectionId: string, body?: AuthKitSetupRequest): Promise<AuthKitSetupResponse>;
|
|
334
334
|
/** What sign-in does now: the stored config, every default filled in, which secrets are set (masked), and checks. */
|
|
335
335
|
function settings(collectionId: string, authKitId: string): Promise<AuthKitSettingsResponse>;
|
|
336
|
+
/**
|
|
337
|
+
* Where this sign-in may send emailed links (password reset, magic link, verification): the domains that
|
|
338
|
+
* are automatic (connected to its own collections), the extra ones in its settings, and the connected
|
|
339
|
+
* domains of the caller's other collections it could also allow (offered only to an Owner of both).
|
|
340
|
+
* A page on a domain that isn't allowed still gets its link, via the same page on smartlinks.app.
|
|
341
|
+
*/
|
|
342
|
+
function redirectDomains(collectionId: string, authKitId: string): Promise<AuthKitRedirectDomainsResponse>;
|
|
336
343
|
/**
|
|
337
344
|
* A one-time SmartLinks page where the PERSON types a secret (e.g. `linkedInClientSecret`) — so it never
|
|
338
345
|
* passes through a chat or your code. Give them the `url`; it works once, for 30 minutes. Asking again
|
package/dist/api/authKit.js
CHANGED
|
@@ -607,6 +607,16 @@ export var authKit;
|
|
|
607
607
|
return request(`/admin/collection/${encodeURIComponent(collectionId)}/authKit/${encodeURIComponent(authKitId)}/settings`);
|
|
608
608
|
}
|
|
609
609
|
authKit.settings = settings;
|
|
610
|
+
/**
|
|
611
|
+
* Where this sign-in may send emailed links (password reset, magic link, verification): the domains that
|
|
612
|
+
* are automatic (connected to its own collections), the extra ones in its settings, and the connected
|
|
613
|
+
* domains of the caller's other collections it could also allow (offered only to an Owner of both).
|
|
614
|
+
* A page on a domain that isn't allowed still gets its link, via the same page on smartlinks.app.
|
|
615
|
+
*/
|
|
616
|
+
async function redirectDomains(collectionId, authKitId) {
|
|
617
|
+
return request(`/admin/collection/${encodeURIComponent(collectionId)}/authKit/${encodeURIComponent(authKitId)}/redirect-domains`);
|
|
618
|
+
}
|
|
619
|
+
authKit.redirectDomains = redirectDomains;
|
|
610
620
|
/**
|
|
611
621
|
* A one-time SmartLinks page where the PERSON types a secret (e.g. `linkedInClientSecret`) — so it never
|
|
612
622
|
* passes through a chat or your code. Give them the `url`; it works once, for 30 minutes. Asking again
|
package/dist/api/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export { loyalty } from "./loyalty.js";
|
|
|
55
55
|
export { translations } from "./translations.js";
|
|
56
56
|
export { integrations } from "./integrations.js";
|
|
57
57
|
export { secrets } from "./secrets.js";
|
|
58
|
+
export { serviceAccounts } from "./serviceAccounts.js";
|
|
58
59
|
export { research } from "./research.js";
|
|
59
60
|
export { config } from "./config.js";
|
|
60
61
|
export { http } from "./http.js";
|
package/dist/api/index.js
CHANGED
|
@@ -58,6 +58,7 @@ export { loyalty } from "./loyalty.js";
|
|
|
58
58
|
export { translations } from "./translations.js";
|
|
59
59
|
export { integrations } from "./integrations.js";
|
|
60
60
|
export { secrets } from "./secrets.js";
|
|
61
|
+
export { serviceAccounts } from "./serviceAccounts.js";
|
|
61
62
|
export { research } from "./research.js";
|
|
62
63
|
export { config } from "./config.js";
|
|
63
64
|
export { http } from "./http.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ServiceAccount, ServiceAccountList, CreateServiceAccountInput, CreateServiceAccountResult, UpdateServiceAccountInput, ServiceAccountKeyResult } from "../types/serviceAccounts.js";
|
|
2
|
+
export declare namespace serviceAccounts {
|
|
3
|
+
/** The collection's service accounts (never their keys) and the access levels that can be given. GET /service-accounts */
|
|
4
|
+
function list(collectionId: string): Promise<ServiceAccountList>;
|
|
5
|
+
/**
|
|
6
|
+
* Make a service account → `{ serviceAccount, key }`. Show the key once — it can't be read again. You can't
|
|
7
|
+
* give it more access than you have. POST /service-accounts
|
|
8
|
+
*/
|
|
9
|
+
function create(collectionId: string, input: CreateServiceAccountInput): Promise<CreateServiceAccountResult>;
|
|
10
|
+
/** Rename it and/or change its access. PUT /service-accounts/:id */
|
|
11
|
+
function update(collectionId: string, id: string, input: UpdateServiceAccountInput): Promise<ServiceAccount>;
|
|
12
|
+
/** Give it a new key → `{ key }` (shown once); the old key stops working within a minute. POST /service-accounts/:id/key */
|
|
13
|
+
function newKey(collectionId: string, id: string): Promise<ServiceAccountKeyResult>;
|
|
14
|
+
/** Delete it: its key stops working and its access is removed. DELETE /service-accounts/:id */
|
|
15
|
+
function remove(collectionId: string, id: string): Promise<{
|
|
16
|
+
ok: true;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/api/serviceAccounts.ts
|
|
2
|
+
//
|
|
3
|
+
// A collection's service accounts: identities for the systems that work with it (an ERP, a warehouse
|
|
4
|
+
// system, an agency's integration), each with its own key and access level. A service account is a member of
|
|
5
|
+
// ONE collection, like a person on the team, and belongs to the collection — not to whoever made it — so it
|
|
6
|
+
// keeps working when people leave. Use its key as the bearer (`initializeApi({ bearerToken: key })` or an
|
|
7
|
+
// `Authorization: Bearer <key>` header); it can do what a person with the same access can on that collection
|
|
8
|
+
// only. It can't invite people, change anyone's access, make keys or other service accounts, make
|
|
9
|
+
// collections or hand the collection over.
|
|
10
|
+
//
|
|
11
|
+
// Managed by the collection's admins (Studio → Team → Service accounts). The key is shown ONCE, when the
|
|
12
|
+
// account is made or given a new key; only its hash is kept.
|
|
13
|
+
//
|
|
14
|
+
// Endpoints: /admin/collection/:collectionId/service-accounts
|
|
15
|
+
import { request, post, put, del } from "../http.js";
|
|
16
|
+
function enc(v) { return encodeURIComponent(v); }
|
|
17
|
+
export var serviceAccounts;
|
|
18
|
+
(function (serviceAccounts) {
|
|
19
|
+
const base = (collectionId) => `/admin/collection/${enc(collectionId)}/service-accounts`;
|
|
20
|
+
/** The collection's service accounts (never their keys) and the access levels that can be given. GET /service-accounts */
|
|
21
|
+
async function list(collectionId) {
|
|
22
|
+
return request(base(collectionId));
|
|
23
|
+
}
|
|
24
|
+
serviceAccounts.list = list;
|
|
25
|
+
/**
|
|
26
|
+
* Make a service account → `{ serviceAccount, key }`. Show the key once — it can't be read again. You can't
|
|
27
|
+
* give it more access than you have. POST /service-accounts
|
|
28
|
+
*/
|
|
29
|
+
async function create(collectionId, input) {
|
|
30
|
+
return post(base(collectionId), input);
|
|
31
|
+
}
|
|
32
|
+
serviceAccounts.create = create;
|
|
33
|
+
/** Rename it and/or change its access. PUT /service-accounts/:id */
|
|
34
|
+
async function update(collectionId, id, input) {
|
|
35
|
+
const out = await put(`${base(collectionId)}/${enc(id)}`, input);
|
|
36
|
+
return out.serviceAccount;
|
|
37
|
+
}
|
|
38
|
+
serviceAccounts.update = update;
|
|
39
|
+
/** Give it a new key → `{ key }` (shown once); the old key stops working within a minute. POST /service-accounts/:id/key */
|
|
40
|
+
async function newKey(collectionId, id) {
|
|
41
|
+
return post(`${base(collectionId)}/${enc(id)}/key`, {});
|
|
42
|
+
}
|
|
43
|
+
serviceAccounts.newKey = newKey;
|
|
44
|
+
/** Delete it: its key stops working and its access is removed. DELETE /service-accounts/:id */
|
|
45
|
+
async function remove(collectionId, id) {
|
|
46
|
+
return del(`${base(collectionId)}/${enc(id)}`);
|
|
47
|
+
}
|
|
48
|
+
serviceAccounts.remove = remove;
|
|
49
|
+
})(serviceAccounts || (serviceAccounts = {}));
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.45 | Generated: 2026-11-23T13:14:33.772Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -168,6 +168,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
168
168
|
- **realtime** - Functions for realtime operations
|
|
169
169
|
- **research** - Functions for research operations
|
|
170
170
|
- **secrets** - Functions for secrets operations
|
|
171
|
+
- **serviceAccounts** - Functions for serviceAccounts operations
|
|
171
172
|
- **shop** - Functions for shop operations
|
|
172
173
|
- **subscriptions** - Functions for subscriptions operations
|
|
173
174
|
- **tagCodes** - Functions for tagCodes operations
|
|
@@ -5349,6 +5350,25 @@ interface AuthKitSettingsResponse {
|
|
|
5349
5350
|
}
|
|
5350
5351
|
```
|
|
5351
5352
|
|
|
5353
|
+
**AuthKitRedirectDomain** (interface)
|
|
5354
|
+
```typescript
|
|
5355
|
+
interface AuthKitRedirectDomain {
|
|
5356
|
+
domain: string
|
|
5357
|
+
collectionId: string
|
|
5358
|
+
title: string
|
|
5359
|
+
}
|
|
5360
|
+
```
|
|
5361
|
+
|
|
5362
|
+
**AuthKitRedirectDomainsResponse** (interface)
|
|
5363
|
+
```typescript
|
|
5364
|
+
interface AuthKitRedirectDomainsResponse {
|
|
5365
|
+
automatic: AuthKitRedirectDomain[]
|
|
5366
|
+
allowed: string[]
|
|
5367
|
+
suggested: AuthKitRedirectDomain[]
|
|
5368
|
+
canSuggest: boolean
|
|
5369
|
+
}
|
|
5370
|
+
```
|
|
5371
|
+
|
|
5352
5372
|
**AuthKitSetupRequest** (interface)
|
|
5353
5373
|
```typescript
|
|
5354
5374
|
interface AuthKitSetupRequest {
|
|
@@ -11930,6 +11950,64 @@ interface SegmentRecipientsResponse {
|
|
|
11930
11950
|
|
|
11931
11951
|
**SegmentFilterRule** = ``
|
|
11932
11952
|
|
|
11953
|
+
### serviceAccounts
|
|
11954
|
+
|
|
11955
|
+
**ServiceAccount** (interface)
|
|
11956
|
+
```typescript
|
|
11957
|
+
interface ServiceAccount {
|
|
11958
|
+
id: string
|
|
11959
|
+
name: string
|
|
11960
|
+
access: ServiceAccountAccess | null
|
|
11961
|
+
active: boolean
|
|
11962
|
+
createdAt: string
|
|
11963
|
+
createdBy: string | null
|
|
11964
|
+
lastUsedAt: string | null
|
|
11965
|
+
keyCreatedAt: string
|
|
11966
|
+
keyHint: string
|
|
11967
|
+
}
|
|
11968
|
+
```
|
|
11969
|
+
|
|
11970
|
+
**ServiceAccountList** (interface)
|
|
11971
|
+
```typescript
|
|
11972
|
+
interface ServiceAccountList {
|
|
11973
|
+
serviceAccounts: ServiceAccount[]
|
|
11974
|
+
access: ServiceAccountAccess[]
|
|
11975
|
+
}
|
|
11976
|
+
```
|
|
11977
|
+
|
|
11978
|
+
**CreateServiceAccountInput** (interface)
|
|
11979
|
+
```typescript
|
|
11980
|
+
interface CreateServiceAccountInput {
|
|
11981
|
+
name: string
|
|
11982
|
+
access: ServiceAccountAccess
|
|
11983
|
+
}
|
|
11984
|
+
```
|
|
11985
|
+
|
|
11986
|
+
**UpdateServiceAccountInput** (interface)
|
|
11987
|
+
```typescript
|
|
11988
|
+
interface UpdateServiceAccountInput {
|
|
11989
|
+
name?: string
|
|
11990
|
+
access?: ServiceAccountAccess
|
|
11991
|
+
}
|
|
11992
|
+
```
|
|
11993
|
+
|
|
11994
|
+
**CreateServiceAccountResult** (interface)
|
|
11995
|
+
```typescript
|
|
11996
|
+
interface CreateServiceAccountResult {
|
|
11997
|
+
serviceAccount: ServiceAccount
|
|
11998
|
+
key: string
|
|
11999
|
+
}
|
|
12000
|
+
```
|
|
12001
|
+
|
|
12002
|
+
**ServiceAccountKeyResult** (interface)
|
|
12003
|
+
```typescript
|
|
12004
|
+
interface ServiceAccountKeyResult {
|
|
12005
|
+
key: string
|
|
12006
|
+
}
|
|
12007
|
+
```
|
|
12008
|
+
|
|
12009
|
+
**ServiceAccountAccess** = `"User" | "Reporter" | "Assigner" | "Admin"`
|
|
12010
|
+
|
|
11933
12011
|
### shop
|
|
11934
12012
|
|
|
11935
12013
|
**ShopPrice** (interface)
|
|
@@ -14390,6 +14468,9 @@ Set up the collection's sign-in in one call, safe to repeat: finds its sign-in (
|
|
|
14390
14468
|
**settings**(collectionId: string, authKitId: string) → `Promise<AuthKitSettingsResponse>`
|
|
14391
14469
|
What sign-in does now: the stored config, every default filled in, which secrets are set (masked), and checks.
|
|
14392
14470
|
|
|
14471
|
+
**redirectDomains**(collectionId: string, authKitId: string) → `Promise<AuthKitRedirectDomainsResponse>`
|
|
14472
|
+
Where this sign-in may send emailed links (password reset, magic link, verification): the domains that are automatic (connected to its own collections), the extra ones in its settings, and the connected domains of the caller's other collections it could also allow (offered only to an Owner of both). A page on a domain that isn't allowed still gets its link, via the same page on smartlinks.app.
|
|
14473
|
+
|
|
14393
14474
|
**secretEntryLink**(collectionId: string, authKitId: string, name: string, opts: { label?: string } = {}) → `Promise<AuthKitSecretLink>`
|
|
14394
14475
|
A one-time SmartLinks page where the PERSON types a secret (e.g. `linkedInClientSecret`) — so it never passes through a chat or your code. Give them the `url`; it works once, for 30 minutes. Asking again replaces the link. Check it landed with {@link settings} (`secrets.<name>.set`).
|
|
14395
14476
|
|
|
@@ -16189,6 +16270,23 @@ Soft-delete a secret. DELETE /secrets/:ref
|
|
|
16189
16270
|
id: string,
|
|
16190
16271
|
query: { limit?: number; offset?: number } = {}) → `Promise<SegmentRecipientsResponse>`
|
|
16191
16272
|
|
|
16273
|
+
### serviceAccounts
|
|
16274
|
+
|
|
16275
|
+
**list**(collectionId: string) → `Promise<ServiceAccountList>`
|
|
16276
|
+
The collection's service accounts (never their keys) and the access levels that can be given. GET /service-accounts
|
|
16277
|
+
|
|
16278
|
+
**create**(collectionId: string, input: CreateServiceAccountInput) → `Promise<CreateServiceAccountResult>`
|
|
16279
|
+
Make a service account → `{ serviceAccount, key }`. Show the key once — it can't be read again. You can't give it more access than you have. POST /service-accounts
|
|
16280
|
+
|
|
16281
|
+
**update**(collectionId: string, id: string, input: UpdateServiceAccountInput) → `Promise<ServiceAccount>`
|
|
16282
|
+
Rename it and/or change its access. PUT /service-accounts/:id
|
|
16283
|
+
|
|
16284
|
+
**newKey**(collectionId: string, id: string) → `Promise<ServiceAccountKeyResult>`
|
|
16285
|
+
Give it a new key → `{ key }` (shown once); the old key stops working within a minute. POST /service-accounts/:id/key
|
|
16286
|
+
|
|
16287
|
+
**remove**(collectionId: string, id: string) → `Promise<`
|
|
16288
|
+
Delete it: its key stops working and its access is removed. DELETE /service-accounts/:id
|
|
16289
|
+
|
|
16192
16290
|
### sessions
|
|
16193
16291
|
|
|
16194
16292
|
**stats**(collectionId: string) → `Promise<SessionStatistics>`
|
package/dist/docs/auth-kit.md
CHANGED
|
@@ -87,8 +87,13 @@ being asked; `always` asks everyone who has one at every sign-in.
|
|
|
87
87
|
|
|
88
88
|
**Redirects** — `redirectUrl`: the site's sign-in page (where invitations open; the default for
|
|
89
89
|
emailed links). `afterSignInUrl`: where the site sends people after they sign in (the screens hand the session to the
|
|
90
|
-
page's `onAuthSuccess`; the page reads `afterSignInUrl` from `authKit.load()` and goes there). `allowedRedirectDomains`: extra domains emailed links may return to (the
|
|
91
|
-
and
|
|
90
|
+
page's `onAuthSuccess`; the page reads `afterSignInUrl` from `authKit.load()` and goes there). `allowedRedirectDomains`: extra domains emailed links may return to (smartlinks.app, the connected
|
|
91
|
+
domains of the sign-in's own collections and their site addresses on smartlinks.host are always allowed).
|
|
92
|
+
`authKit.redirectDomains(collectionId, authKitId)` lists the automatic ones, the extra ones, and the
|
|
93
|
+
connected domains of your other collections you could add (offered only to an Owner of both — say a sister
|
|
94
|
+
collection's links domain where this collection's tags open). An emailed link for a page of one of the
|
|
95
|
+
sign-in's own collections (`/p/<collectionId>/…`) on a domain that isn't allowed is not refused: it opens
|
|
96
|
+
the same page on smartlinks.app.
|
|
92
97
|
|
|
93
98
|
**The screens' look** — `branding`: `title`, `subtitle`, `registerTitle`, `registerSubtitle`,
|
|
94
99
|
`logoUrl` (absent = SmartLinks logo, `''` = none), `primaryColor`, `secondaryColor`,
|
package/dist/docs/overview.md
CHANGED
|
@@ -78,6 +78,7 @@ The SmartLinks SDK (`@proveanything/smartlinks`) includes comprehensive document
|
|
|
78
78
|
| **AI Guide Template** | `docs/ai-guide-template.md` | Template for creating `public/ai-guide.md` — customise per app |
|
|
79
79
|
| **Forms** | `docs/forms.md` | Form definitions, schema-driven rendering, submission patterns |
|
|
80
80
|
| **Auth Kit** | `docs/auth-kit.md` | End-user sign-in: email/password, magic links, phone OTP, Google OAuth |
|
|
81
|
+
| **Service accounts** | `docs/service-accounts.md` | Identities for other systems (an ERP, a warehouse system) to work with one collection: own key, own access level, made and removed by the collection's admins |
|
|
81
82
|
| **Members** | `docs/members.md` | Signed-in members with a level (clubs, leagues, members' areas): the level field, members-only functions, joining rules |
|
|
82
83
|
| **Portal Request Login** | `docs/portal-request-login.md` | How sub-apps ask the portal to authenticate the user; hook and iframe postMessage contracts |
|
|
83
84
|
| **Portal Auth Broadcast** | `docs/portal-auth-broadcast.md` | Publishing custom auth flows to the portal; syncing sessions across containers and iframes |
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Service accounts
|
|
2
|
+
|
|
3
|
+
A **service account** is how another system works with a collection: an ERP sending stock levels, a
|
|
4
|
+
warehouse system recording shipments, an agency's integration. It's an identity of its own, with its own key
|
|
5
|
+
and access level. It is **not** a person's API key.
|
|
6
|
+
|
|
7
|
+
- It's a member of **one** collection with an access level (`User`, `Reporter`, `Assigner` or `Admin`), just
|
|
8
|
+
like a person on the team. Everything a person with that access can do on that collection, it can do.
|
|
9
|
+
It can reach nothing else.
|
|
10
|
+
- It belongs to the collection, not to whoever made it, so it keeps working when people leave the team.
|
|
11
|
+
- Its key (`slsvc_<id>.<secret>`) is shown **once**, when it's made or given a new key. Only a hash is kept.
|
|
12
|
+
- It **can't** invite people or change anyone's access. It can't make API keys or other service accounts,
|
|
13
|
+
make collections, or hand the collection over. A leaked key can't leave a way back in once it's deleted.
|
|
14
|
+
|
|
15
|
+
Collection admins manage them in **Studio → Team → Service accounts**, or with `serviceAccounts.*`:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { serviceAccounts } from "@proveanything/smartlinks"
|
|
19
|
+
|
|
20
|
+
// Make one: show the key once, then it's gone.
|
|
21
|
+
const { serviceAccount, key } = await serviceAccounts.create(collectionId, { name: "Warehouse system", access: "Assigner" })
|
|
22
|
+
|
|
23
|
+
await serviceAccounts.list(collectionId) // { serviceAccounts: [...], access: ["User", "Reporter", "Assigner", "Admin"] }
|
|
24
|
+
await serviceAccounts.update(collectionId, serviceAccount.id, { access: "Reporter" })
|
|
25
|
+
const { key: replacement } = await serviceAccounts.newKey(collectionId, serviceAccount.id) // the old key stops within a minute
|
|
26
|
+
await serviceAccounts.remove(collectionId, serviceAccount.id) // key stops, access removed
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
You can't give a service account more access than you have yourself, and never `Owner`.
|
|
30
|
+
|
|
31
|
+
## Using the key
|
|
32
|
+
|
|
33
|
+
The other system sends the key as its bearer token:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { initializeApi } from "@proveanything/smartlinks"
|
|
37
|
+
initializeApi({ baseURL: "https://smartlinks.app/api/v1", bearerToken: process.env.SMARTLINKS_KEY })
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
or, without the SDK, `Authorization: Bearer slsvc_…` on each request. Keep it in a secret store. To retire
|
|
41
|
+
a key, give the account a new one; delete the account when the system no longer needs it.
|
|
42
|
+
|
|
43
|
+
A list shows `lastUsedAt` (to within a few minutes) so you can see which accounts are still in use.
|
package/dist/openapi.yaml
CHANGED
|
@@ -2249,6 +2249,38 @@ paths:
|
|
|
2249
2249
|
application/json:
|
|
2250
2250
|
schema:
|
|
2251
2251
|
$ref: "#/components/schemas/AuthKitInviteRequest"
|
|
2252
|
+
/admin/collection/{collectionId}/authKit/{authKitId}/redirect-domains:
|
|
2253
|
+
get:
|
|
2254
|
+
tags:
|
|
2255
|
+
- authKit
|
|
2256
|
+
summary: "Where this sign-in may send emailed links (password reset, magic link, verification): the domains that are automatic (connected to its own collections), the extra ones in its settings, and the connected domains of the caller's other collections it could also allow (offered only to an Owner of both)."
|
|
2257
|
+
operationId: authKit_redirectDomains
|
|
2258
|
+
security:
|
|
2259
|
+
- bearerAuth: []
|
|
2260
|
+
parameters:
|
|
2261
|
+
- name: collectionId
|
|
2262
|
+
in: path
|
|
2263
|
+
required: true
|
|
2264
|
+
schema:
|
|
2265
|
+
type: string
|
|
2266
|
+
- name: authKitId
|
|
2267
|
+
in: path
|
|
2268
|
+
required: true
|
|
2269
|
+
schema:
|
|
2270
|
+
type: string
|
|
2271
|
+
responses:
|
|
2272
|
+
200:
|
|
2273
|
+
description: Success
|
|
2274
|
+
content:
|
|
2275
|
+
application/json:
|
|
2276
|
+
schema:
|
|
2277
|
+
$ref: "#/components/schemas/AuthKitRedirectDomainsResponse"
|
|
2278
|
+
400:
|
|
2279
|
+
description: Bad request
|
|
2280
|
+
401:
|
|
2281
|
+
description: Unauthorized
|
|
2282
|
+
404:
|
|
2283
|
+
description: Not found
|
|
2252
2284
|
/admin/collection/{collectionId}/authKit/{authKitId}/secrets/{name}/link:
|
|
2253
2285
|
post:
|
|
2254
2286
|
tags:
|
|
@@ -10148,7 +10180,7 @@ paths:
|
|
|
10148
10180
|
post:
|
|
10149
10181
|
tags:
|
|
10150
10182
|
- authKit
|
|
10151
|
-
summary:
|
|
10183
|
+
summary: Sign in with LinkedIn (OpenID Connect) via a server-side authorization code (public).
|
|
10152
10184
|
operationId: authKit_linkedInLogin
|
|
10153
10185
|
security: []
|
|
10154
10186
|
parameters:
|
|
@@ -26031,6 +26063,41 @@ components:
|
|
|
26031
26063
|
- effective
|
|
26032
26064
|
- secrets
|
|
26033
26065
|
- checks
|
|
26066
|
+
AuthKitRedirectDomain:
|
|
26067
|
+
type: object
|
|
26068
|
+
properties:
|
|
26069
|
+
domain:
|
|
26070
|
+
type: string
|
|
26071
|
+
collectionId:
|
|
26072
|
+
type: string
|
|
26073
|
+
title:
|
|
26074
|
+
type: string
|
|
26075
|
+
required:
|
|
26076
|
+
- domain
|
|
26077
|
+
- collectionId
|
|
26078
|
+
- title
|
|
26079
|
+
AuthKitRedirectDomainsResponse:
|
|
26080
|
+
type: object
|
|
26081
|
+
properties:
|
|
26082
|
+
automatic:
|
|
26083
|
+
type: array
|
|
26084
|
+
items:
|
|
26085
|
+
$ref: "#/components/schemas/AuthKitRedirectDomain"
|
|
26086
|
+
allowed:
|
|
26087
|
+
type: array
|
|
26088
|
+
items:
|
|
26089
|
+
type: string
|
|
26090
|
+
suggested:
|
|
26091
|
+
type: array
|
|
26092
|
+
items:
|
|
26093
|
+
$ref: "#/components/schemas/AuthKitRedirectDomain"
|
|
26094
|
+
canSuggest:
|
|
26095
|
+
type: boolean
|
|
26096
|
+
required:
|
|
26097
|
+
- automatic
|
|
26098
|
+
- allowed
|
|
26099
|
+
- suggested
|
|
26100
|
+
- canSuggest
|
|
26034
26101
|
AuthKitSetupRequest:
|
|
26035
26102
|
type: object
|
|
26036
26103
|
properties:
|
|
@@ -36914,6 +36981,88 @@ components:
|
|
|
36914
36981
|
SegmentFilterRule:
|
|
36915
36982
|
type: object
|
|
36916
36983
|
additionalProperties: true
|
|
36984
|
+
ServiceAccount:
|
|
36985
|
+
type: object
|
|
36986
|
+
properties:
|
|
36987
|
+
id:
|
|
36988
|
+
type: string
|
|
36989
|
+
name:
|
|
36990
|
+
type: string
|
|
36991
|
+
access:
|
|
36992
|
+
$ref: "#/components/schemas/ServiceAccountAccess"
|
|
36993
|
+
active:
|
|
36994
|
+
type: boolean
|
|
36995
|
+
createdAt:
|
|
36996
|
+
type: string
|
|
36997
|
+
createdBy:
|
|
36998
|
+
type: string
|
|
36999
|
+
lastUsedAt:
|
|
37000
|
+
type: string
|
|
37001
|
+
keyCreatedAt:
|
|
37002
|
+
type: string
|
|
37003
|
+
keyHint:
|
|
37004
|
+
type: string
|
|
37005
|
+
required:
|
|
37006
|
+
- id
|
|
37007
|
+
- name
|
|
37008
|
+
- access
|
|
37009
|
+
- active
|
|
37010
|
+
- createdAt
|
|
37011
|
+
- createdBy
|
|
37012
|
+
- lastUsedAt
|
|
37013
|
+
- keyCreatedAt
|
|
37014
|
+
- keyHint
|
|
37015
|
+
ServiceAccountList:
|
|
37016
|
+
type: object
|
|
37017
|
+
properties:
|
|
37018
|
+
serviceAccounts:
|
|
37019
|
+
type: array
|
|
37020
|
+
items:
|
|
37021
|
+
$ref: "#/components/schemas/ServiceAccount"
|
|
37022
|
+
access:
|
|
37023
|
+
type: array
|
|
37024
|
+
items:
|
|
37025
|
+
$ref: "#/components/schemas/ServiceAccountAccess"
|
|
37026
|
+
required:
|
|
37027
|
+
- serviceAccounts
|
|
37028
|
+
- access
|
|
37029
|
+
CreateServiceAccountInput:
|
|
37030
|
+
type: object
|
|
37031
|
+
properties:
|
|
37032
|
+
name:
|
|
37033
|
+
type: string
|
|
37034
|
+
access:
|
|
37035
|
+
$ref: "#/components/schemas/ServiceAccountAccess"
|
|
37036
|
+
required:
|
|
37037
|
+
- name
|
|
37038
|
+
- access
|
|
37039
|
+
UpdateServiceAccountInput:
|
|
37040
|
+
type: object
|
|
37041
|
+
properties:
|
|
37042
|
+
name:
|
|
37043
|
+
type: string
|
|
37044
|
+
access:
|
|
37045
|
+
$ref: "#/components/schemas/ServiceAccountAccess"
|
|
37046
|
+
CreateServiceAccountResult:
|
|
37047
|
+
type: object
|
|
37048
|
+
properties:
|
|
37049
|
+
serviceAccount:
|
|
37050
|
+
$ref: "#/components/schemas/ServiceAccount"
|
|
37051
|
+
key:
|
|
37052
|
+
type: string
|
|
37053
|
+
required:
|
|
37054
|
+
- serviceAccount
|
|
37055
|
+
- key
|
|
37056
|
+
ServiceAccountKeyResult:
|
|
37057
|
+
type: object
|
|
37058
|
+
properties:
|
|
37059
|
+
key:
|
|
37060
|
+
type: string
|
|
37061
|
+
required:
|
|
37062
|
+
- key
|
|
37063
|
+
ServiceAccountAccess:
|
|
37064
|
+
type: object
|
|
37065
|
+
additionalProperties: true
|
|
36917
37066
|
ShopPrice:
|
|
36918
37067
|
type: object
|
|
36919
37068
|
properties:
|
package/dist/types/authKit.d.ts
CHANGED
|
@@ -704,6 +704,28 @@ export interface AuthKitSettingsResponse {
|
|
|
704
704
|
}>;
|
|
705
705
|
checks: AuthKitCheck[];
|
|
706
706
|
}
|
|
707
|
+
/** A domain in {@link authKit.redirectDomains}. */
|
|
708
|
+
export interface AuthKitRedirectDomain {
|
|
709
|
+
domain: string;
|
|
710
|
+
/** The collection the domain is connected to. */
|
|
711
|
+
collectionId: string;
|
|
712
|
+
/** That collection's name. */
|
|
713
|
+
title: string;
|
|
714
|
+
}
|
|
715
|
+
/** {@link authKit.redirectDomains}: where this sign-in may send emailed links (password reset, magic link, verification). */
|
|
716
|
+
export interface AuthKitRedirectDomainsResponse {
|
|
717
|
+
/** Connected domains of the collections this sign-in serves: always allowed. */
|
|
718
|
+
automatic: AuthKitRedirectDomain[];
|
|
719
|
+
/** The extra domains in its settings (`allowedRedirectDomains`). */
|
|
720
|
+
allowed: string[];
|
|
721
|
+
/**
|
|
722
|
+
* Connected domains of the caller's OTHER collections, where the caller is an Owner of both: add one to
|
|
723
|
+
* `allowedRedirectDomains` to trust it. Never added automatically.
|
|
724
|
+
*/
|
|
725
|
+
suggested: AuthKitRedirectDomain[];
|
|
726
|
+
/** The caller is an Owner of this collection (only owners are offered other collections' domains). */
|
|
727
|
+
canSuggest: boolean;
|
|
728
|
+
}
|
|
707
729
|
/** Body of {@link authKit.setup}. */
|
|
708
730
|
export interface AuthKitSetupRequest {
|
|
709
731
|
/** For a new sign-in. */
|
package/dist/types/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from "./contact.js";
|
|
|
16
16
|
export * from "./broadcasts.js";
|
|
17
17
|
export * from "./segments.js";
|
|
18
18
|
export * from "./userGroups.js";
|
|
19
|
+
export * from "./serviceAccounts.js";
|
|
19
20
|
export * from "./operations.js";
|
|
20
21
|
export * from "./common.js";
|
|
21
22
|
export * from "./query.js";
|
package/dist/types/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export * from "./contact.js";
|
|
|
18
18
|
export * from "./broadcasts.js";
|
|
19
19
|
export * from "./segments.js";
|
|
20
20
|
export * from "./userGroups.js";
|
|
21
|
+
export * from "./serviceAccounts.js";
|
|
21
22
|
export * from "./operations.js";
|
|
22
23
|
export * from "./common.js";
|
|
23
24
|
export * from "./query.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** The access a service account can have on its collection (never Owner). */
|
|
2
|
+
export type ServiceAccountAccess = "User" | "Reporter" | "Assigner" | "Admin";
|
|
3
|
+
/** One of a collection's service accounts. The key itself is never listed (only shown when made or replaced). */
|
|
4
|
+
export interface ServiceAccount {
|
|
5
|
+
/** e.g. "sa-3f9c0a1b2d4e"; its user id on the collection is "svc:" + id. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** What uses it, e.g. "Warehouse system". */
|
|
8
|
+
name: string;
|
|
9
|
+
/** Its access on the collection (null if it was removed from the collection's members another way). */
|
|
10
|
+
access: ServiceAccountAccess | null;
|
|
11
|
+
/** false once its key has been switched off. */
|
|
12
|
+
active: boolean;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
/** The user id of the person who made it. */
|
|
15
|
+
createdBy: string | null;
|
|
16
|
+
/** When its key was last used (to within a few minutes), or null if never. */
|
|
17
|
+
lastUsedAt: string | null;
|
|
18
|
+
/** When its current key was made. */
|
|
19
|
+
keyCreatedAt: string;
|
|
20
|
+
/** How its key starts ("slsvc_sa-….…"), to recognise it — never the secret. */
|
|
21
|
+
keyHint: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ServiceAccountList {
|
|
24
|
+
serviceAccounts: ServiceAccount[];
|
|
25
|
+
/** The access levels that can be given. */
|
|
26
|
+
access: ServiceAccountAccess[];
|
|
27
|
+
}
|
|
28
|
+
export interface CreateServiceAccountInput {
|
|
29
|
+
name: string;
|
|
30
|
+
access: ServiceAccountAccess;
|
|
31
|
+
}
|
|
32
|
+
export interface UpdateServiceAccountInput {
|
|
33
|
+
name?: string;
|
|
34
|
+
access?: ServiceAccountAccess;
|
|
35
|
+
}
|
|
36
|
+
/** A new service account and its key. Show the key once: it can't be read again (make a new one instead). */
|
|
37
|
+
export interface CreateServiceAccountResult {
|
|
38
|
+
serviceAccount: ServiceAccount;
|
|
39
|
+
key: string;
|
|
40
|
+
}
|
|
41
|
+
/** A replacement key; the old one stops working (within a minute everywhere). */
|
|
42
|
+
export interface ServiceAccountKeyResult {
|
|
43
|
+
key: string;
|
|
44
|
+
}
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.45 | Generated: 2026-11-23T13:14:33.772Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -168,6 +168,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
168
168
|
- **realtime** - Functions for realtime operations
|
|
169
169
|
- **research** - Functions for research operations
|
|
170
170
|
- **secrets** - Functions for secrets operations
|
|
171
|
+
- **serviceAccounts** - Functions for serviceAccounts operations
|
|
171
172
|
- **shop** - Functions for shop operations
|
|
172
173
|
- **subscriptions** - Functions for subscriptions operations
|
|
173
174
|
- **tagCodes** - Functions for tagCodes operations
|
|
@@ -5349,6 +5350,25 @@ interface AuthKitSettingsResponse {
|
|
|
5349
5350
|
}
|
|
5350
5351
|
```
|
|
5351
5352
|
|
|
5353
|
+
**AuthKitRedirectDomain** (interface)
|
|
5354
|
+
```typescript
|
|
5355
|
+
interface AuthKitRedirectDomain {
|
|
5356
|
+
domain: string
|
|
5357
|
+
collectionId: string
|
|
5358
|
+
title: string
|
|
5359
|
+
}
|
|
5360
|
+
```
|
|
5361
|
+
|
|
5362
|
+
**AuthKitRedirectDomainsResponse** (interface)
|
|
5363
|
+
```typescript
|
|
5364
|
+
interface AuthKitRedirectDomainsResponse {
|
|
5365
|
+
automatic: AuthKitRedirectDomain[]
|
|
5366
|
+
allowed: string[]
|
|
5367
|
+
suggested: AuthKitRedirectDomain[]
|
|
5368
|
+
canSuggest: boolean
|
|
5369
|
+
}
|
|
5370
|
+
```
|
|
5371
|
+
|
|
5352
5372
|
**AuthKitSetupRequest** (interface)
|
|
5353
5373
|
```typescript
|
|
5354
5374
|
interface AuthKitSetupRequest {
|
|
@@ -11930,6 +11950,64 @@ interface SegmentRecipientsResponse {
|
|
|
11930
11950
|
|
|
11931
11951
|
**SegmentFilterRule** = ``
|
|
11932
11952
|
|
|
11953
|
+
### serviceAccounts
|
|
11954
|
+
|
|
11955
|
+
**ServiceAccount** (interface)
|
|
11956
|
+
```typescript
|
|
11957
|
+
interface ServiceAccount {
|
|
11958
|
+
id: string
|
|
11959
|
+
name: string
|
|
11960
|
+
access: ServiceAccountAccess | null
|
|
11961
|
+
active: boolean
|
|
11962
|
+
createdAt: string
|
|
11963
|
+
createdBy: string | null
|
|
11964
|
+
lastUsedAt: string | null
|
|
11965
|
+
keyCreatedAt: string
|
|
11966
|
+
keyHint: string
|
|
11967
|
+
}
|
|
11968
|
+
```
|
|
11969
|
+
|
|
11970
|
+
**ServiceAccountList** (interface)
|
|
11971
|
+
```typescript
|
|
11972
|
+
interface ServiceAccountList {
|
|
11973
|
+
serviceAccounts: ServiceAccount[]
|
|
11974
|
+
access: ServiceAccountAccess[]
|
|
11975
|
+
}
|
|
11976
|
+
```
|
|
11977
|
+
|
|
11978
|
+
**CreateServiceAccountInput** (interface)
|
|
11979
|
+
```typescript
|
|
11980
|
+
interface CreateServiceAccountInput {
|
|
11981
|
+
name: string
|
|
11982
|
+
access: ServiceAccountAccess
|
|
11983
|
+
}
|
|
11984
|
+
```
|
|
11985
|
+
|
|
11986
|
+
**UpdateServiceAccountInput** (interface)
|
|
11987
|
+
```typescript
|
|
11988
|
+
interface UpdateServiceAccountInput {
|
|
11989
|
+
name?: string
|
|
11990
|
+
access?: ServiceAccountAccess
|
|
11991
|
+
}
|
|
11992
|
+
```
|
|
11993
|
+
|
|
11994
|
+
**CreateServiceAccountResult** (interface)
|
|
11995
|
+
```typescript
|
|
11996
|
+
interface CreateServiceAccountResult {
|
|
11997
|
+
serviceAccount: ServiceAccount
|
|
11998
|
+
key: string
|
|
11999
|
+
}
|
|
12000
|
+
```
|
|
12001
|
+
|
|
12002
|
+
**ServiceAccountKeyResult** (interface)
|
|
12003
|
+
```typescript
|
|
12004
|
+
interface ServiceAccountKeyResult {
|
|
12005
|
+
key: string
|
|
12006
|
+
}
|
|
12007
|
+
```
|
|
12008
|
+
|
|
12009
|
+
**ServiceAccountAccess** = `"User" | "Reporter" | "Assigner" | "Admin"`
|
|
12010
|
+
|
|
11933
12011
|
### shop
|
|
11934
12012
|
|
|
11935
12013
|
**ShopPrice** (interface)
|
|
@@ -14390,6 +14468,9 @@ Set up the collection's sign-in in one call, safe to repeat: finds its sign-in (
|
|
|
14390
14468
|
**settings**(collectionId: string, authKitId: string) → `Promise<AuthKitSettingsResponse>`
|
|
14391
14469
|
What sign-in does now: the stored config, every default filled in, which secrets are set (masked), and checks.
|
|
14392
14470
|
|
|
14471
|
+
**redirectDomains**(collectionId: string, authKitId: string) → `Promise<AuthKitRedirectDomainsResponse>`
|
|
14472
|
+
Where this sign-in may send emailed links (password reset, magic link, verification): the domains that are automatic (connected to its own collections), the extra ones in its settings, and the connected domains of the caller's other collections it could also allow (offered only to an Owner of both). A page on a domain that isn't allowed still gets its link, via the same page on smartlinks.app.
|
|
14473
|
+
|
|
14393
14474
|
**secretEntryLink**(collectionId: string, authKitId: string, name: string, opts: { label?: string } = {}) → `Promise<AuthKitSecretLink>`
|
|
14394
14475
|
A one-time SmartLinks page where the PERSON types a secret (e.g. `linkedInClientSecret`) — so it never passes through a chat or your code. Give them the `url`; it works once, for 30 minutes. Asking again replaces the link. Check it landed with {@link settings} (`secrets.<name>.set`).
|
|
14395
14476
|
|
|
@@ -16189,6 +16270,23 @@ Soft-delete a secret. DELETE /secrets/:ref
|
|
|
16189
16270
|
id: string,
|
|
16190
16271
|
query: { limit?: number; offset?: number } = {}) → `Promise<SegmentRecipientsResponse>`
|
|
16191
16272
|
|
|
16273
|
+
### serviceAccounts
|
|
16274
|
+
|
|
16275
|
+
**list**(collectionId: string) → `Promise<ServiceAccountList>`
|
|
16276
|
+
The collection's service accounts (never their keys) and the access levels that can be given. GET /service-accounts
|
|
16277
|
+
|
|
16278
|
+
**create**(collectionId: string, input: CreateServiceAccountInput) → `Promise<CreateServiceAccountResult>`
|
|
16279
|
+
Make a service account → `{ serviceAccount, key }`. Show the key once — it can't be read again. You can't give it more access than you have. POST /service-accounts
|
|
16280
|
+
|
|
16281
|
+
**update**(collectionId: string, id: string, input: UpdateServiceAccountInput) → `Promise<ServiceAccount>`
|
|
16282
|
+
Rename it and/or change its access. PUT /service-accounts/:id
|
|
16283
|
+
|
|
16284
|
+
**newKey**(collectionId: string, id: string) → `Promise<ServiceAccountKeyResult>`
|
|
16285
|
+
Give it a new key → `{ key }` (shown once); the old key stops working within a minute. POST /service-accounts/:id/key
|
|
16286
|
+
|
|
16287
|
+
**remove**(collectionId: string, id: string) → `Promise<`
|
|
16288
|
+
Delete it: its key stops working and its access is removed. DELETE /service-accounts/:id
|
|
16289
|
+
|
|
16192
16290
|
### sessions
|
|
16193
16291
|
|
|
16194
16292
|
**stats**(collectionId: string) → `Promise<SessionStatistics>`
|
package/docs/auth-kit.md
CHANGED
|
@@ -87,8 +87,13 @@ being asked; `always` asks everyone who has one at every sign-in.
|
|
|
87
87
|
|
|
88
88
|
**Redirects** — `redirectUrl`: the site's sign-in page (where invitations open; the default for
|
|
89
89
|
emailed links). `afterSignInUrl`: where the site sends people after they sign in (the screens hand the session to the
|
|
90
|
-
page's `onAuthSuccess`; the page reads `afterSignInUrl` from `authKit.load()` and goes there). `allowedRedirectDomains`: extra domains emailed links may return to (the
|
|
91
|
-
and
|
|
90
|
+
page's `onAuthSuccess`; the page reads `afterSignInUrl` from `authKit.load()` and goes there). `allowedRedirectDomains`: extra domains emailed links may return to (smartlinks.app, the connected
|
|
91
|
+
domains of the sign-in's own collections and their site addresses on smartlinks.host are always allowed).
|
|
92
|
+
`authKit.redirectDomains(collectionId, authKitId)` lists the automatic ones, the extra ones, and the
|
|
93
|
+
connected domains of your other collections you could add (offered only to an Owner of both — say a sister
|
|
94
|
+
collection's links domain where this collection's tags open). An emailed link for a page of one of the
|
|
95
|
+
sign-in's own collections (`/p/<collectionId>/…`) on a domain that isn't allowed is not refused: it opens
|
|
96
|
+
the same page on smartlinks.app.
|
|
92
97
|
|
|
93
98
|
**The screens' look** — `branding`: `title`, `subtitle`, `registerTitle`, `registerSubtitle`,
|
|
94
99
|
`logoUrl` (absent = SmartLinks logo, `''` = none), `primaryColor`, `secondaryColor`,
|
package/docs/overview.md
CHANGED
|
@@ -78,6 +78,7 @@ The SmartLinks SDK (`@proveanything/smartlinks`) includes comprehensive document
|
|
|
78
78
|
| **AI Guide Template** | `docs/ai-guide-template.md` | Template for creating `public/ai-guide.md` — customise per app |
|
|
79
79
|
| **Forms** | `docs/forms.md` | Form definitions, schema-driven rendering, submission patterns |
|
|
80
80
|
| **Auth Kit** | `docs/auth-kit.md` | End-user sign-in: email/password, magic links, phone OTP, Google OAuth |
|
|
81
|
+
| **Service accounts** | `docs/service-accounts.md` | Identities for other systems (an ERP, a warehouse system) to work with one collection: own key, own access level, made and removed by the collection's admins |
|
|
81
82
|
| **Members** | `docs/members.md` | Signed-in members with a level (clubs, leagues, members' areas): the level field, members-only functions, joining rules |
|
|
82
83
|
| **Portal Request Login** | `docs/portal-request-login.md` | How sub-apps ask the portal to authenticate the user; hook and iframe postMessage contracts |
|
|
83
84
|
| **Portal Auth Broadcast** | `docs/portal-auth-broadcast.md` | Publishing custom auth flows to the portal; syncing sessions across containers and iframes |
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Service accounts
|
|
2
|
+
|
|
3
|
+
A **service account** is how another system works with a collection: an ERP sending stock levels, a
|
|
4
|
+
warehouse system recording shipments, an agency's integration. It's an identity of its own, with its own key
|
|
5
|
+
and access level. It is **not** a person's API key.
|
|
6
|
+
|
|
7
|
+
- It's a member of **one** collection with an access level (`User`, `Reporter`, `Assigner` or `Admin`), just
|
|
8
|
+
like a person on the team. Everything a person with that access can do on that collection, it can do.
|
|
9
|
+
It can reach nothing else.
|
|
10
|
+
- It belongs to the collection, not to whoever made it, so it keeps working when people leave the team.
|
|
11
|
+
- Its key (`slsvc_<id>.<secret>`) is shown **once**, when it's made or given a new key. Only a hash is kept.
|
|
12
|
+
- It **can't** invite people or change anyone's access. It can't make API keys or other service accounts,
|
|
13
|
+
make collections, or hand the collection over. A leaked key can't leave a way back in once it's deleted.
|
|
14
|
+
|
|
15
|
+
Collection admins manage them in **Studio → Team → Service accounts**, or with `serviceAccounts.*`:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { serviceAccounts } from "@proveanything/smartlinks"
|
|
19
|
+
|
|
20
|
+
// Make one: show the key once, then it's gone.
|
|
21
|
+
const { serviceAccount, key } = await serviceAccounts.create(collectionId, { name: "Warehouse system", access: "Assigner" })
|
|
22
|
+
|
|
23
|
+
await serviceAccounts.list(collectionId) // { serviceAccounts: [...], access: ["User", "Reporter", "Assigner", "Admin"] }
|
|
24
|
+
await serviceAccounts.update(collectionId, serviceAccount.id, { access: "Reporter" })
|
|
25
|
+
const { key: replacement } = await serviceAccounts.newKey(collectionId, serviceAccount.id) // the old key stops within a minute
|
|
26
|
+
await serviceAccounts.remove(collectionId, serviceAccount.id) // key stops, access removed
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
You can't give a service account more access than you have yourself, and never `Owner`.
|
|
30
|
+
|
|
31
|
+
## Using the key
|
|
32
|
+
|
|
33
|
+
The other system sends the key as its bearer token:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { initializeApi } from "@proveanything/smartlinks"
|
|
37
|
+
initializeApi({ baseURL: "https://smartlinks.app/api/v1", bearerToken: process.env.SMARTLINKS_KEY })
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
or, without the SDK, `Authorization: Bearer slsvc_…` on each request. Keep it in a secret store. To retire
|
|
41
|
+
a key, give the account a new one; delete the account when the system no longer needs it.
|
|
42
|
+
|
|
43
|
+
A list shows `lastUsedAt` (to within a few minutes) so you can see which accounts are still in use.
|
package/openapi.yaml
CHANGED
|
@@ -2249,6 +2249,38 @@ paths:
|
|
|
2249
2249
|
application/json:
|
|
2250
2250
|
schema:
|
|
2251
2251
|
$ref: "#/components/schemas/AuthKitInviteRequest"
|
|
2252
|
+
/admin/collection/{collectionId}/authKit/{authKitId}/redirect-domains:
|
|
2253
|
+
get:
|
|
2254
|
+
tags:
|
|
2255
|
+
- authKit
|
|
2256
|
+
summary: "Where this sign-in may send emailed links (password reset, magic link, verification): the domains that are automatic (connected to its own collections), the extra ones in its settings, and the connected domains of the caller's other collections it could also allow (offered only to an Owner of both)."
|
|
2257
|
+
operationId: authKit_redirectDomains
|
|
2258
|
+
security:
|
|
2259
|
+
- bearerAuth: []
|
|
2260
|
+
parameters:
|
|
2261
|
+
- name: collectionId
|
|
2262
|
+
in: path
|
|
2263
|
+
required: true
|
|
2264
|
+
schema:
|
|
2265
|
+
type: string
|
|
2266
|
+
- name: authKitId
|
|
2267
|
+
in: path
|
|
2268
|
+
required: true
|
|
2269
|
+
schema:
|
|
2270
|
+
type: string
|
|
2271
|
+
responses:
|
|
2272
|
+
200:
|
|
2273
|
+
description: Success
|
|
2274
|
+
content:
|
|
2275
|
+
application/json:
|
|
2276
|
+
schema:
|
|
2277
|
+
$ref: "#/components/schemas/AuthKitRedirectDomainsResponse"
|
|
2278
|
+
400:
|
|
2279
|
+
description: Bad request
|
|
2280
|
+
401:
|
|
2281
|
+
description: Unauthorized
|
|
2282
|
+
404:
|
|
2283
|
+
description: Not found
|
|
2252
2284
|
/admin/collection/{collectionId}/authKit/{authKitId}/secrets/{name}/link:
|
|
2253
2285
|
post:
|
|
2254
2286
|
tags:
|
|
@@ -10148,7 +10180,7 @@ paths:
|
|
|
10148
10180
|
post:
|
|
10149
10181
|
tags:
|
|
10150
10182
|
- authKit
|
|
10151
|
-
summary:
|
|
10183
|
+
summary: Sign in with LinkedIn (OpenID Connect) via a server-side authorization code (public).
|
|
10152
10184
|
operationId: authKit_linkedInLogin
|
|
10153
10185
|
security: []
|
|
10154
10186
|
parameters:
|
|
@@ -26031,6 +26063,41 @@ components:
|
|
|
26031
26063
|
- effective
|
|
26032
26064
|
- secrets
|
|
26033
26065
|
- checks
|
|
26066
|
+
AuthKitRedirectDomain:
|
|
26067
|
+
type: object
|
|
26068
|
+
properties:
|
|
26069
|
+
domain:
|
|
26070
|
+
type: string
|
|
26071
|
+
collectionId:
|
|
26072
|
+
type: string
|
|
26073
|
+
title:
|
|
26074
|
+
type: string
|
|
26075
|
+
required:
|
|
26076
|
+
- domain
|
|
26077
|
+
- collectionId
|
|
26078
|
+
- title
|
|
26079
|
+
AuthKitRedirectDomainsResponse:
|
|
26080
|
+
type: object
|
|
26081
|
+
properties:
|
|
26082
|
+
automatic:
|
|
26083
|
+
type: array
|
|
26084
|
+
items:
|
|
26085
|
+
$ref: "#/components/schemas/AuthKitRedirectDomain"
|
|
26086
|
+
allowed:
|
|
26087
|
+
type: array
|
|
26088
|
+
items:
|
|
26089
|
+
type: string
|
|
26090
|
+
suggested:
|
|
26091
|
+
type: array
|
|
26092
|
+
items:
|
|
26093
|
+
$ref: "#/components/schemas/AuthKitRedirectDomain"
|
|
26094
|
+
canSuggest:
|
|
26095
|
+
type: boolean
|
|
26096
|
+
required:
|
|
26097
|
+
- automatic
|
|
26098
|
+
- allowed
|
|
26099
|
+
- suggested
|
|
26100
|
+
- canSuggest
|
|
26034
26101
|
AuthKitSetupRequest:
|
|
26035
26102
|
type: object
|
|
26036
26103
|
properties:
|
|
@@ -36914,6 +36981,88 @@ components:
|
|
|
36914
36981
|
SegmentFilterRule:
|
|
36915
36982
|
type: object
|
|
36916
36983
|
additionalProperties: true
|
|
36984
|
+
ServiceAccount:
|
|
36985
|
+
type: object
|
|
36986
|
+
properties:
|
|
36987
|
+
id:
|
|
36988
|
+
type: string
|
|
36989
|
+
name:
|
|
36990
|
+
type: string
|
|
36991
|
+
access:
|
|
36992
|
+
$ref: "#/components/schemas/ServiceAccountAccess"
|
|
36993
|
+
active:
|
|
36994
|
+
type: boolean
|
|
36995
|
+
createdAt:
|
|
36996
|
+
type: string
|
|
36997
|
+
createdBy:
|
|
36998
|
+
type: string
|
|
36999
|
+
lastUsedAt:
|
|
37000
|
+
type: string
|
|
37001
|
+
keyCreatedAt:
|
|
37002
|
+
type: string
|
|
37003
|
+
keyHint:
|
|
37004
|
+
type: string
|
|
37005
|
+
required:
|
|
37006
|
+
- id
|
|
37007
|
+
- name
|
|
37008
|
+
- access
|
|
37009
|
+
- active
|
|
37010
|
+
- createdAt
|
|
37011
|
+
- createdBy
|
|
37012
|
+
- lastUsedAt
|
|
37013
|
+
- keyCreatedAt
|
|
37014
|
+
- keyHint
|
|
37015
|
+
ServiceAccountList:
|
|
37016
|
+
type: object
|
|
37017
|
+
properties:
|
|
37018
|
+
serviceAccounts:
|
|
37019
|
+
type: array
|
|
37020
|
+
items:
|
|
37021
|
+
$ref: "#/components/schemas/ServiceAccount"
|
|
37022
|
+
access:
|
|
37023
|
+
type: array
|
|
37024
|
+
items:
|
|
37025
|
+
$ref: "#/components/schemas/ServiceAccountAccess"
|
|
37026
|
+
required:
|
|
37027
|
+
- serviceAccounts
|
|
37028
|
+
- access
|
|
37029
|
+
CreateServiceAccountInput:
|
|
37030
|
+
type: object
|
|
37031
|
+
properties:
|
|
37032
|
+
name:
|
|
37033
|
+
type: string
|
|
37034
|
+
access:
|
|
37035
|
+
$ref: "#/components/schemas/ServiceAccountAccess"
|
|
37036
|
+
required:
|
|
37037
|
+
- name
|
|
37038
|
+
- access
|
|
37039
|
+
UpdateServiceAccountInput:
|
|
37040
|
+
type: object
|
|
37041
|
+
properties:
|
|
37042
|
+
name:
|
|
37043
|
+
type: string
|
|
37044
|
+
access:
|
|
37045
|
+
$ref: "#/components/schemas/ServiceAccountAccess"
|
|
37046
|
+
CreateServiceAccountResult:
|
|
37047
|
+
type: object
|
|
37048
|
+
properties:
|
|
37049
|
+
serviceAccount:
|
|
37050
|
+
$ref: "#/components/schemas/ServiceAccount"
|
|
37051
|
+
key:
|
|
37052
|
+
type: string
|
|
37053
|
+
required:
|
|
37054
|
+
- serviceAccount
|
|
37055
|
+
- key
|
|
37056
|
+
ServiceAccountKeyResult:
|
|
37057
|
+
type: object
|
|
37058
|
+
properties:
|
|
37059
|
+
key:
|
|
37060
|
+
type: string
|
|
37061
|
+
required:
|
|
37062
|
+
- key
|
|
37063
|
+
ServiceAccountAccess:
|
|
37064
|
+
type: object
|
|
37065
|
+
additionalProperties: true
|
|
36917
37066
|
ShopPrice:
|
|
36918
37067
|
type: object
|
|
36919
37068
|
properties:
|