@atproto/pds 0.4.104 → 0.4.106
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 +34 -0
- package/dist/account-manager/{index.d.ts → account-manager.d.ts} +26 -35
- package/dist/account-manager/account-manager.d.ts.map +1 -0
- package/dist/account-manager/{index.js → account-manager.js} +52 -207
- package/dist/account-manager/account-manager.js.map +1 -0
- package/dist/account-manager/helpers/account.d.ts +3 -3
- package/dist/account-manager/helpers/device-account.d.ts +15 -15
- package/dist/account-manager/helpers/device-account.d.ts.map +1 -1
- package/dist/account-manager/helpers/device-account.js +2 -1
- package/dist/account-manager/helpers/device-account.js.map +1 -1
- package/dist/account-manager/helpers/token.d.ts +98 -98
- package/dist/account-manager/oauth-store.d.ts +58 -0
- package/dist/account-manager/oauth-store.d.ts.map +1 -0
- package/dist/account-manager/oauth-store.js +417 -0
- package/dist/account-manager/oauth-store.js.map +1 -0
- package/dist/actor-store/record/reader.d.ts +3 -3
- package/dist/actor-store/repo/reader.d.ts +2 -0
- package/dist/actor-store/repo/reader.d.ts.map +1 -1
- package/dist/actor-store/repo/reader.js +9 -0
- package/dist/actor-store/repo/reader.js.map +1 -1
- package/dist/actor-store/repo/sql-repo-reader.d.ts +1 -1
- package/dist/actor-store/repo/transactor.d.ts.map +1 -1
- package/dist/actor-store/repo/transactor.js +13 -4
- package/dist/actor-store/repo/transactor.js.map +1 -1
- package/dist/api/com/atproto/admin/deleteAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/admin/deleteAccount.js +2 -3
- package/dist/api/com/atproto/admin/deleteAccount.js.map +1 -1
- package/dist/api/com/atproto/admin/updateAccountHandle.d.ts.map +1 -1
- package/dist/api/com/atproto/admin/updateAccountHandle.js +2 -6
- package/dist/api/com/atproto/admin/updateAccountHandle.js.map +1 -1
- package/dist/api/com/atproto/identity/resolveHandle.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/resolveHandle.js +2 -36
- package/dist/api/com/atproto/identity/resolveHandle.js.map +1 -1
- package/dist/api/com/atproto/identity/updateHandle.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/updateHandle.js +1 -7
- package/dist/api/com/atproto/identity/updateHandle.js.map +1 -1
- package/dist/api/com/atproto/server/activateAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/server/activateAccount.js +2 -18
- package/dist/api/com/atproto/server/activateAccount.js.map +1 -1
- package/dist/api/com/atproto/server/createAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/server/createAccount.js +7 -7
- package/dist/api/com/atproto/server/createAccount.js.map +1 -1
- package/dist/api/com/atproto/server/createSession.js +1 -1
- package/dist/api/com/atproto/server/createSession.js.map +1 -1
- package/dist/api/com/atproto/server/deleteAccount.d.ts.map +1 -1
- package/dist/api/com/atproto/server/deleteAccount.js +2 -3
- package/dist/api/com/atproto/server/deleteAccount.js.map +1 -1
- package/dist/api/com/atproto/server/getSession.js +1 -1
- package/dist/api/com/atproto/server/getSession.js.map +1 -1
- package/dist/api/com/atproto/server/refreshSession.js +1 -1
- package/dist/api/com/atproto/server/refreshSession.js.map +1 -1
- package/dist/api/com/atproto/sync/getRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getRecord.js.map +1 -1
- package/dist/api/com/atproto/sync/getRepoStatus.js +1 -1
- package/dist/api/com/atproto/sync/getRepoStatus.js.map +1 -1
- package/dist/api/com/atproto/sync/listRepos.js +1 -1
- package/dist/api/com/atproto/sync/listRepos.js.map +1 -1
- package/dist/api/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/subscribeRepos.js +2 -10
- package/dist/api/com/atproto/sync/subscribeRepos.js.map +1 -1
- package/dist/app-view.d.ts +14 -0
- package/dist/app-view.d.ts.map +1 -0
- package/dist/app-view.js +36 -0
- package/dist/app-view.js.map +1 -0
- package/dist/auth-routes.d.ts +1 -1
- package/dist/auth-routes.d.ts.map +1 -1
- package/dist/auth-routes.js +9 -3
- package/dist/auth-routes.js.map +1 -1
- package/dist/auth-verifier.d.ts +1 -1
- package/dist/auth-verifier.d.ts.map +1 -1
- package/dist/config/config.d.ts +3 -2
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +17 -7
- package/dist/config/config.js.map +1 -1
- package/dist/config/env.d.ts +4 -0
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +5 -0
- package/dist/config/env.js.map +1 -1
- package/dist/context.d.ts +4 -4
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +24 -18
- package/dist/context.js.map +1 -1
- package/dist/handle/index.d.ts +0 -7
- package/dist/handle/index.d.ts.map +1 -1
- package/dist/handle/index.js +4 -58
- package/dist/handle/index.js.map +1 -1
- package/dist/image/image-url.d.ts +8 -0
- package/dist/image/image-url.d.ts.map +1 -0
- package/dist/image/image-url.js +26 -0
- package/dist/image/image-url.js.map +1 -0
- package/dist/lexicon/index.d.ts +6 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +12 -0
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +310 -130
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +171 -67
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/video.d.ts +1 -0
- package/dist/lexicon/types/app/bsky/embed/video.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/video.js.map +1 -1
- package/dist/lexicon/types/com/atproto/identity/defs.d.ts +17 -0
- package/dist/lexicon/types/com/atproto/identity/defs.d.ts.map +1 -0
- package/dist/lexicon/types/com/atproto/identity/defs.js +16 -0
- package/dist/lexicon/types/com/atproto/identity/defs.js.map +1 -0
- package/dist/lexicon/types/com/atproto/identity/refreshIdentity.d.ts +39 -0
- package/dist/lexicon/types/com/atproto/identity/refreshIdentity.d.ts.map +1 -0
- package/dist/lexicon/types/com/atproto/identity/refreshIdentity.js +7 -0
- package/dist/lexicon/types/com/atproto/identity/refreshIdentity.js.map +1 -0
- package/dist/lexicon/types/com/atproto/identity/resolveDid.d.ts +40 -0
- package/dist/lexicon/types/com/atproto/identity/resolveDid.d.ts.map +1 -0
- package/dist/lexicon/types/com/atproto/identity/resolveDid.js +7 -0
- package/dist/lexicon/types/com/atproto/identity/resolveDid.js.map +1 -0
- package/dist/lexicon/types/com/atproto/identity/resolveHandle.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/identity/resolveHandle.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/identity/resolveIdentity.d.ts +36 -0
- package/dist/lexicon/types/com/atproto/identity/resolveIdentity.d.ts.map +1 -0
- package/dist/lexicon/types/com/atproto/identity/resolveIdentity.js +7 -0
- package/dist/lexicon/types/com/atproto/identity/resolveIdentity.js.map +1 -0
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts +1 -30
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js +0 -27
- package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/team/listMembers.d.ts +1 -0
- package/dist/lexicon/types/tools/ozone/team/listMembers.d.ts.map +1 -1
- package/dist/mailer/index.d.ts +5 -5
- package/dist/mailer/index.d.ts.map +1 -1
- package/dist/mailer/index.js +6 -5
- package/dist/mailer/index.js.map +1 -1
- package/dist/read-after-write/viewer.d.ts +1 -1
- package/dist/read-after-write/viewer.d.ts.map +1 -1
- package/dist/repo/types.d.ts +6 -2
- package/dist/repo/types.d.ts.map +1 -1
- package/dist/repo/types.js.map +1 -1
- package/dist/scripts/rebuild-repo.d.ts.map +1 -1
- package/dist/scripts/rebuild-repo.js +2 -1
- package/dist/scripts/rebuild-repo.js.map +1 -1
- package/dist/sequencer/db/schema.d.ts +1 -1
- package/dist/sequencer/db/schema.d.ts.map +1 -1
- package/dist/sequencer/events.d.ts +27 -38
- package/dist/sequencer/events.d.ts.map +1 -1
- package/dist/sequencer/events.js +40 -58
- package/dist/sequencer/events.js.map +1 -1
- package/dist/sequencer/sequencer.d.ts +2 -3
- package/dist/sequencer/sequencer.d.ts.map +1 -1
- package/dist/sequencer/sequencer.js +5 -17
- package/dist/sequencer/sequencer.js.map +1 -1
- package/package.json +15 -15
- package/src/account-manager/{index.ts → account-manager.ts} +107 -307
- package/src/account-manager/helpers/device-account.ts +1 -0
- package/src/account-manager/oauth-store.ts +494 -0
- package/src/actor-store/repo/reader.ts +11 -0
- package/src/actor-store/repo/transactor.ts +15 -4
- package/src/api/com/atproto/admin/deleteAccount.ts +2 -3
- package/src/api/com/atproto/admin/updateAccountHandle.ts +7 -8
- package/src/api/com/atproto/identity/resolveHandle.ts +2 -11
- package/src/api/com/atproto/identity/updateHandle.ts +4 -7
- package/src/api/com/atproto/server/activateAccount.ts +4 -18
- package/src/api/com/atproto/server/createAccount.ts +15 -11
- package/src/api/com/atproto/server/createSession.ts +1 -1
- package/src/api/com/atproto/server/deleteAccount.ts +2 -3
- package/src/api/com/atproto/server/getSession.ts +1 -1
- package/src/api/com/atproto/server/refreshSession.ts +1 -1
- package/src/api/com/atproto/sync/getRecord.ts +0 -1
- package/src/api/com/atproto/sync/getRepoStatus.ts +1 -1
- package/src/api/com/atproto/sync/listRepos.ts +1 -1
- package/src/api/com/atproto/sync/subscribeRepos.ts +2 -9
- package/src/app-view.ts +24 -0
- package/src/auth-routes.ts +9 -3
- package/src/auth-verifier.ts +1 -1
- package/src/config/config.ts +25 -13
- package/src/config/env.ts +12 -0
- package/src/context.ts +44 -24
- package/src/handle/index.ts +6 -52
- package/src/image/image-url.ts +16 -0
- package/src/lexicon/index.ts +36 -0
- package/src/lexicon/lexicons.ts +186 -67
- package/src/lexicon/types/app/bsky/embed/video.ts +1 -0
- package/src/lexicon/types/com/atproto/identity/defs.ts +30 -0
- package/src/lexicon/types/com/atproto/identity/refreshIdentity.ts +52 -0
- package/src/lexicon/types/com/atproto/identity/resolveDid.ts +52 -0
- package/src/lexicon/types/com/atproto/identity/resolveHandle.ts +1 -0
- package/src/lexicon/types/com/atproto/identity/resolveIdentity.ts +48 -0
- package/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +0 -59
- package/src/lexicon/types/tools/ozone/team/listMembers.ts +1 -0
- package/src/mailer/index.ts +7 -5
- package/src/read-after-write/viewer.ts +1 -1
- package/src/repo/types.ts +7 -2
- package/src/scripts/rebuild-repo.ts +4 -1
- package/src/sequencer/db/schema.ts +1 -8
- package/src/sequencer/events.ts +47 -75
- package/src/sequencer/sequencer.ts +9 -23
- package/tests/account-deletion.test.ts +3 -5
- package/tests/oauth.test.ts +286 -71
- package/tests/sequencer.test.ts +20 -29
- package/tests/sync/subscribe-repos.test.ts +89 -45
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/account-manager/index.d.ts.map +0 -1
- package/dist/account-manager/index.js.map +0 -1
- package/dist/actor-store/repo/util.d.ts +0 -5
- package/dist/actor-store/repo/util.d.ts.map +0 -1
- package/dist/actor-store/repo/util.js +0 -25
- package/dist/actor-store/repo/util.js.map +0 -1
- package/dist/oauth/provider.d.ts +0 -10
- package/dist/oauth/provider.d.ts.map +0 -1
- package/dist/oauth/provider.js +0 -38
- package/dist/oauth/provider.js.map +0 -1
- package/src/actor-store/repo/util.ts +0 -22
- package/src/oauth/provider.ts +0 -59
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,39 @@
|
|
1
1
|
# @atproto/pds
|
2
2
|
|
3
|
+
## 0.4.106
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#3587](https://github.com/bluesky-social/atproto/pull/3587) [`18fbfa000`](https://github.com/bluesky-social/atproto/commit/18fbfa00057dda9ef4eba77d8b4e87994893c952) Thanks [@foysalit](https://github.com/foysalit)! - Add searchable handle and displayName to ozone team members
|
8
|
+
|
9
|
+
- [#3612](https://github.com/bluesky-social/atproto/pull/3612) [`eab9c003f`](https://github.com/bluesky-social/atproto/commit/eab9c003f838d43f0135ded9d3ede3f449997597) Thanks [@devinivy](https://github.com/devinivy)! - Emit sync event on account creation
|
10
|
+
|
11
|
+
- Updated dependencies [[`c01d7f5d1`](https://github.com/bluesky-social/atproto/commit/c01d7f5d155445d7741c09f91c84af64b31bdbed), [`8827ff433`](https://github.com/bluesky-social/atproto/commit/8827ff433a211d2db80840cfc4ee146a7fb44849), [`18fbfa000`](https://github.com/bluesky-social/atproto/commit/18fbfa00057dda9ef4eba77d8b4e87994893c952)]:
|
12
|
+
- @atproto/oauth-provider@0.5.1
|
13
|
+
- @atproto/api@0.14.9
|
14
|
+
|
15
|
+
## 0.4.105
|
16
|
+
|
17
|
+
### Patch Changes
|
18
|
+
|
19
|
+
- [#3585](https://github.com/bluesky-social/atproto/pull/3585) [`38320191e`](https://github.com/bluesky-social/atproto/commit/38320191e559f8b928c6e951a9b4a6207240bfc1) Thanks [@dholms](https://github.com/dholms)! - Wrap sync v1.1 semantics. Add #sync event to subscribeRepos and deprecate #handle and #tombstone events
|
20
|
+
|
21
|
+
- [#3602](https://github.com/bluesky-social/atproto/pull/3602) [`6bcbb6d8c`](https://github.com/bluesky-social/atproto/commit/6bcbb6d8cd3696280935ff7892d8e191fd21fa49) Thanks [@devinivy](https://github.com/devinivy)! - Permit 100mb video embeds.
|
22
|
+
|
23
|
+
- [#2945](https://github.com/bluesky-social/atproto/pull/2945) [`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add support for account sign-ups during OAuth flows
|
24
|
+
|
25
|
+
- Updated dependencies [[`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29), [`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29), [`38320191e`](https://github.com/bluesky-social/atproto/commit/38320191e559f8b928c6e951a9b4a6207240bfc1), [`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29), [`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29), [`6bcbb6d8c`](https://github.com/bluesky-social/atproto/commit/6bcbb6d8cd3696280935ff7892d8e191fd21fa49), [`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29), [`dc6e4ecb0`](https://github.com/bluesky-social/atproto/commit/dc6e4ecb0e09bbf4bc7a79c6ac43fb6da4166200)]:
|
26
|
+
- @atproto/oauth-provider@0.5.0
|
27
|
+
- @atproto/api@0.14.8
|
28
|
+
- @atproto/syntax@0.3.4
|
29
|
+
- @atproto-labs/fetch-node@0.1.8
|
30
|
+
- @atproto/lexicon@0.4.8
|
31
|
+
- @atproto/repo@0.7.1
|
32
|
+
- @atproto/xrpc@0.6.10
|
33
|
+
- @atproto/xrpc-server@0.7.12
|
34
|
+
- @atproto/aws@0.2.17
|
35
|
+
- @atproto-labs/xrpc-utils@0.0.8
|
36
|
+
|
3
37
|
## 0.4.104
|
4
38
|
|
5
39
|
### Patch Changes
|
@@ -1,9 +1,7 @@
|
|
1
1
|
import { KeyObject } from 'node:crypto';
|
2
2
|
import { CID } from 'multiformats/cid';
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import { BackgroundQueue } from '../background';
|
6
|
-
import { ImageUrlBuilder } from '../image/image-url-builder';
|
3
|
+
import { IdResolver } from '@atproto/identity';
|
4
|
+
import { DatabaseConfig } from '../config';
|
7
5
|
import { StatusAttr } from '../lexicon/types/com/atproto/admin/defs';
|
8
6
|
import { AccountDb, EmailTokenPurpose } from './db';
|
9
7
|
import * as account from './helpers/account';
|
@@ -11,14 +9,13 @@ import { AccountStatus, ActorAccount } from './helpers/account';
|
|
11
9
|
import * as invite from './helpers/invite';
|
12
10
|
import * as password from './helpers/password';
|
13
11
|
export { AccountStatus, formatAccountStatus } from './helpers/account';
|
14
|
-
export declare class AccountManager
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
db:
|
21
|
-
constructor(actorStore: ActorStore, imageUrlBuilder: ImageUrlBuilder, backgroundQueue: BackgroundQueue, dbLocation: string, jwtKey: KeyObject, serviceDid: string, disableWalAutoCheckpoint?: boolean);
|
12
|
+
export declare class AccountManager {
|
13
|
+
readonly idResolver: IdResolver;
|
14
|
+
readonly jwtKey: KeyObject;
|
15
|
+
readonly serviceDid: string;
|
16
|
+
readonly serviceHandleDomains: string[];
|
17
|
+
readonly db: AccountDb;
|
18
|
+
constructor(idResolver: IdResolver, jwtKey: KeyObject, serviceDid: string, serviceHandleDomains: string[], db: DatabaseConfig);
|
22
19
|
migrateOrThrow(): Promise<void>;
|
23
20
|
close(): void;
|
24
21
|
getAccount(handleOrDid: string, flags?: account.AvailabilityFlags): Promise<ActorAccount | null>;
|
@@ -27,7 +24,22 @@ export declare class AccountManager implements AccountStore, RequestStore, Devic
|
|
27
24
|
isAccountActivated(did: string): Promise<boolean>;
|
28
25
|
getDidForActor(handleOrDid: string, flags?: account.AvailabilityFlags): Promise<string | null>;
|
29
26
|
getAccountStatus(handleOrDid: string): Promise<AccountStatus>;
|
30
|
-
|
27
|
+
normalizeAndValidateHandle(handle: string, { did, allowAnyValid, }?: {
|
28
|
+
did?: string;
|
29
|
+
allowAnyValid?: boolean;
|
30
|
+
}): Promise<string>;
|
31
|
+
createAccount({ did, handle, email, password, repoCid, repoRev, inviteCode, deactivated, refreshJwt, }: {
|
32
|
+
did: string;
|
33
|
+
handle: string;
|
34
|
+
email?: string;
|
35
|
+
password?: string;
|
36
|
+
repoCid: CID;
|
37
|
+
repoRev: string;
|
38
|
+
inviteCode?: string;
|
39
|
+
deactivated?: boolean;
|
40
|
+
refreshJwt?: string;
|
41
|
+
}): Promise<void>;
|
42
|
+
createAccountAndSession(opts: {
|
31
43
|
did: string;
|
32
44
|
handle: string;
|
33
45
|
email?: string;
|
@@ -110,26 +122,5 @@ export declare class AccountManager implements AccountStore, RequestStore, Devic
|
|
110
122
|
did: string;
|
111
123
|
password: string;
|
112
124
|
}): Promise<void>;
|
113
|
-
private buildAccount;
|
114
|
-
authenticateAccount({ username: identifier, password, remember }: SignInCredentials, deviceId: DeviceId): Promise<AccountInfo | null>;
|
115
|
-
addAuthorizedClient(deviceId: DeviceId, sub: string, clientId: string): Promise<void>;
|
116
|
-
getDeviceAccount(deviceId: DeviceId, sub: string): Promise<AccountInfo | null>;
|
117
|
-
listDeviceAccounts(deviceId: DeviceId): Promise<AccountInfo[]>;
|
118
|
-
removeDeviceAccount(deviceId: DeviceId, sub: string): Promise<void>;
|
119
|
-
createRequest(id: RequestId, data: RequestData): Promise<void>;
|
120
|
-
readRequest(id: RequestId): Promise<RequestData | null>;
|
121
|
-
updateRequest(id: RequestId, data: UpdateRequestData): Promise<void>;
|
122
|
-
deleteRequest(id: RequestId): Promise<void>;
|
123
|
-
findRequestByCode(code: Code): Promise<FoundRequestResult | null>;
|
124
|
-
createDevice(deviceId: DeviceId, data: DeviceData): Promise<void>;
|
125
|
-
readDevice(deviceId: DeviceId): Promise<null | DeviceData>;
|
126
|
-
updateDevice(deviceId: DeviceId, data: Partial<DeviceData>): Promise<void>;
|
127
|
-
deleteDevice(deviceId: DeviceId): Promise<void>;
|
128
|
-
createToken(id: TokenId, data: TokenData, refreshToken?: RefreshToken): Promise<void>;
|
129
|
-
readToken(tokenId: TokenId): Promise<TokenInfo | null>;
|
130
|
-
deleteToken(tokenId: TokenId): Promise<void>;
|
131
|
-
rotateToken(tokenId: TokenId, newTokenId: TokenId, newRefreshToken: RefreshToken, newData: NewTokenData): Promise<void>;
|
132
|
-
findTokenByRefreshToken(refreshToken: RefreshToken): Promise<TokenInfo | null>;
|
133
|
-
findTokenByCode(code: Code): Promise<TokenInfo | null>;
|
134
125
|
}
|
135
|
-
//# sourceMappingURL=
|
126
|
+
//# sourceMappingURL=account-manager.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"account-manager.d.ts","sourceR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K,EAAE,MAAM,CAAA;KAAE;IAUhD,aAAa,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IASvD,qBAAqB,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;CAWpE"}
|
@@ -25,45 +25,32 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
26
|
exports.AccountManager = exports.formatAccountStatus = exports.AccountStatus = void 0;
|
27
27
|
const common_1 = require("@atproto/common");
|
28
|
+
const syntax_1 = require("@atproto/syntax");
|
28
29
|
const xrpc_server_1 = require("@atproto/xrpc-server");
|
29
30
|
const auth_verifier_1 = require("../auth-verifier");
|
30
31
|
const db_1 = require("../db");
|
32
|
+
const explicit_slurs_1 = require("../handle/explicit-slurs");
|
33
|
+
const index_1 = require("../handle/index");
|
31
34
|
const db_2 = require("./db");
|
32
35
|
const account = __importStar(require("./helpers/account"));
|
33
36
|
const account_1 = require("./helpers/account");
|
34
37
|
const auth = __importStar(require("./helpers/auth"));
|
35
|
-
const authRequest = __importStar(require("./helpers/authorization-request"));
|
36
|
-
const device = __importStar(require("./helpers/device"));
|
37
|
-
const deviceAccount = __importStar(require("./helpers/device-account"));
|
38
38
|
const emailToken = __importStar(require("./helpers/email-token"));
|
39
39
|
const invite = __importStar(require("./helpers/invite"));
|
40
40
|
const password = __importStar(require("./helpers/password"));
|
41
41
|
const repo = __importStar(require("./helpers/repo"));
|
42
42
|
const scrypt = __importStar(require("./helpers/scrypt"));
|
43
43
|
const token = __importStar(require("./helpers/token"));
|
44
|
-
const usedRefreshToken = __importStar(require("./helpers/used-refresh-token"));
|
45
44
|
var account_2 = require("./helpers/account");
|
46
45
|
Object.defineProperty(exports, "AccountStatus", { enumerable: true, get: function () { return account_2.AccountStatus; } });
|
47
46
|
Object.defineProperty(exports, "formatAccountStatus", { enumerable: true, get: function () { return account_2.formatAccountStatus; } });
|
48
47
|
class AccountManager {
|
49
|
-
constructor(
|
50
|
-
Object.defineProperty(this, "
|
48
|
+
constructor(idResolver, jwtKey, serviceDid, serviceHandleDomains, db) {
|
49
|
+
Object.defineProperty(this, "idResolver", {
|
51
50
|
enumerable: true,
|
52
51
|
configurable: true,
|
53
52
|
writable: true,
|
54
|
-
value:
|
55
|
-
});
|
56
|
-
Object.defineProperty(this, "imageUrlBuilder", {
|
57
|
-
enumerable: true,
|
58
|
-
configurable: true,
|
59
|
-
writable: true,
|
60
|
-
value: imageUrlBuilder
|
61
|
-
});
|
62
|
-
Object.defineProperty(this, "backgroundQueue", {
|
63
|
-
enumerable: true,
|
64
|
-
configurable: true,
|
65
|
-
writable: true,
|
66
|
-
value: backgroundQueue
|
53
|
+
value: idResolver
|
67
54
|
});
|
68
55
|
Object.defineProperty(this, "jwtKey", {
|
69
56
|
enumerable: true,
|
@@ -77,13 +64,19 @@ class AccountManager {
|
|
77
64
|
writable: true,
|
78
65
|
value: serviceDid
|
79
66
|
});
|
67
|
+
Object.defineProperty(this, "serviceHandleDomains", {
|
68
|
+
enumerable: true,
|
69
|
+
configurable: true,
|
70
|
+
writable: true,
|
71
|
+
value: serviceHandleDomains
|
72
|
+
});
|
80
73
|
Object.defineProperty(this, "db", {
|
81
74
|
enumerable: true,
|
82
75
|
configurable: true,
|
83
76
|
writable: true,
|
84
77
|
value: void 0
|
85
78
|
});
|
86
|
-
this.db = (0, db_2.getDb)(
|
79
|
+
this.db = (0, db_2.getDb)(db.accountDbLoc, db.disableWalAutoCheckpoint);
|
87
80
|
}
|
88
81
|
async migrateOrThrow() {
|
89
82
|
await this.db.ensureWal();
|
@@ -121,18 +114,36 @@ class AccountManager {
|
|
121
114
|
const res = account.formatAccountStatus(got);
|
122
115
|
return res.active ? account_1.AccountStatus.Active : res.status;
|
123
116
|
}
|
124
|
-
async
|
125
|
-
const
|
117
|
+
async normalizeAndValidateHandle(handle, { did, allowAnyValid, } = {}) {
|
118
|
+
const normalized = (0, index_1.baseNormalizeAndValidate)(handle);
|
119
|
+
// tld validation
|
120
|
+
if (!(0, syntax_1.isValidTld)(normalized)) {
|
121
|
+
throw new xrpc_server_1.InvalidRequestError('Handle TLD is invalid or disallowed', 'InvalidHandle');
|
122
|
+
}
|
123
|
+
// slur check
|
124
|
+
if (!allowAnyValid && (0, explicit_slurs_1.hasExplicitSlur)(normalized)) {
|
125
|
+
throw new xrpc_server_1.InvalidRequestError('Inappropriate language in handle', 'InvalidHandle');
|
126
|
+
}
|
127
|
+
if ((0, index_1.isServiceDomain)(normalized, this.serviceHandleDomains)) {
|
128
|
+
// verify constraints on a service domain
|
129
|
+
(0, index_1.ensureHandleServiceConstraints)(normalized, this.serviceHandleDomains, allowAnyValid);
|
130
|
+
}
|
131
|
+
else {
|
132
|
+
if (did == null) {
|
133
|
+
throw new xrpc_server_1.InvalidRequestError('Not a supported handle domain', 'UnsupportedDomain');
|
134
|
+
}
|
135
|
+
// verify resolution of a non-service domain
|
136
|
+
const resolvedDid = await this.idResolver.handle.resolve(normalized);
|
137
|
+
if (resolvedDid !== did) {
|
138
|
+
throw new xrpc_server_1.InvalidRequestError('External handle did not resolve to DID');
|
139
|
+
}
|
140
|
+
}
|
141
|
+
return normalized;
|
142
|
+
}
|
143
|
+
async createAccount({ did, handle, email, password, repoCid, repoRev, inviteCode, deactivated, refreshJwt, }) {
|
126
144
|
const passwordScrypt = password
|
127
145
|
? await scrypt.genSaltAndHash(password)
|
128
146
|
: undefined;
|
129
|
-
const { accessJwt, refreshJwt } = await auth.createTokens({
|
130
|
-
did,
|
131
|
-
jwtKey: this.jwtKey,
|
132
|
-
serviceDid: this.serviceDid,
|
133
|
-
scope: auth_verifier_1.AuthScope.Access,
|
134
|
-
});
|
135
|
-
const refreshPayload = auth.decodeRefreshToken(refreshJwt);
|
136
147
|
const now = new Date().toISOString();
|
137
148
|
await this.db.transaction(async (dbTxn) => {
|
138
149
|
if (inviteCode) {
|
@@ -148,10 +159,20 @@ class AccountManager {
|
|
148
159
|
inviteCode,
|
149
160
|
now,
|
150
161
|
}),
|
151
|
-
|
162
|
+
refreshJwt &&
|
163
|
+
auth.storeRefreshToken(dbTxn, auth.decodeRefreshToken(refreshJwt), null),
|
152
164
|
repo.updateRoot(dbTxn, did, repoCid, repoRev),
|
153
165
|
]);
|
154
166
|
});
|
167
|
+
}
|
168
|
+
async createAccountAndSession(opts) {
|
169
|
+
const { accessJwt, refreshJwt } = await auth.createTokens({
|
170
|
+
did: opts.did,
|
171
|
+
jwtKey: this.jwtKey,
|
172
|
+
serviceDid: this.serviceDid,
|
173
|
+
scope: auth_verifier_1.AuthScope.Access,
|
174
|
+
});
|
175
|
+
await this.createAccount({ ...opts, refreshJwt });
|
155
176
|
return { accessJwt, refreshJwt };
|
156
177
|
}
|
157
178
|
// @NOTE should always be paired with a sequenceHandle().
|
@@ -375,182 +396,6 @@ class AccountManager {
|
|
375
396
|
auth.revokeRefreshTokensByDid(dbTxn, did),
|
376
397
|
]));
|
377
398
|
}
|
378
|
-
// AccountStore
|
379
|
-
async buildAccount(row) {
|
380
|
-
const account = deviceAccount.toAccount(row, this.serviceDid);
|
381
|
-
if (!account.name || !account.picture) {
|
382
|
-
const did = account.sub;
|
383
|
-
const profile = await this.actorStore.read(did, async (store) => {
|
384
|
-
return store.record.getProfileRecord();
|
385
|
-
});
|
386
|
-
if (profile) {
|
387
|
-
const { avatar, displayName } = profile;
|
388
|
-
account.name || (account.name = displayName);
|
389
|
-
account.picture || (account.picture = avatar
|
390
|
-
? this.imageUrlBuilder.build('avatar', did, avatar.ref.toString())
|
391
|
-
: undefined);
|
392
|
-
}
|
393
|
-
}
|
394
|
-
return account;
|
395
|
-
}
|
396
|
-
async authenticateAccount({ username: identifier, password, remember = false }, deviceId) {
|
397
|
-
try {
|
398
|
-
const { user, appPassword } = await this.login({ identifier, password });
|
399
|
-
if (appPassword) {
|
400
|
-
throw new xrpc_server_1.AuthRequiredError('App passwords are not allowed');
|
401
|
-
}
|
402
|
-
await this.db.executeWithRetry(deviceAccount.createOrUpdateQB(this.db, deviceId, user.did, remember));
|
403
|
-
return await this.getDeviceAccount(deviceId, user.did);
|
404
|
-
}
|
405
|
-
catch (err) {
|
406
|
-
if (err instanceof xrpc_server_1.AuthRequiredError)
|
407
|
-
return null;
|
408
|
-
throw err;
|
409
|
-
}
|
410
|
-
}
|
411
|
-
async addAuthorizedClient(deviceId, sub, clientId) {
|
412
|
-
await this.db.transaction(async (dbTxn) => {
|
413
|
-
const row = await deviceAccount
|
414
|
-
.readQB(dbTxn, deviceId, sub)
|
415
|
-
.executeTakeFirstOrThrow();
|
416
|
-
const { authorizedClients } = deviceAccount.toDeviceAccountInfo(row);
|
417
|
-
if (!authorizedClients.includes(clientId)) {
|
418
|
-
await deviceAccount
|
419
|
-
.updateQB(dbTxn, deviceId, sub, {
|
420
|
-
authorizedClients: [...authorizedClients, clientId],
|
421
|
-
})
|
422
|
-
.execute();
|
423
|
-
}
|
424
|
-
});
|
425
|
-
}
|
426
|
-
async getDeviceAccount(deviceId, sub) {
|
427
|
-
const row = await deviceAccount
|
428
|
-
.getAccountInfoQB(this.db, deviceId, sub)
|
429
|
-
.executeTakeFirst();
|
430
|
-
if (!row)
|
431
|
-
return null;
|
432
|
-
return {
|
433
|
-
account: await this.buildAccount(row),
|
434
|
-
info: deviceAccount.toDeviceAccountInfo(row),
|
435
|
-
};
|
436
|
-
}
|
437
|
-
async listDeviceAccounts(deviceId) {
|
438
|
-
const rows = await deviceAccount
|
439
|
-
.listRememberedQB(this.db, deviceId)
|
440
|
-
.execute();
|
441
|
-
return Promise.all(rows.map(async (row) => ({
|
442
|
-
account: await this.buildAccount(row),
|
443
|
-
info: deviceAccount.toDeviceAccountInfo(row),
|
444
|
-
})));
|
445
|
-
}
|
446
|
-
async removeDeviceAccount(deviceId, sub) {
|
447
|
-
await this.db.executeWithRetry(deviceAccount.removeQB(this.db, deviceId, sub));
|
448
|
-
}
|
449
|
-
// RequestStore
|
450
|
-
async createRequest(id, data) {
|
451
|
-
await this.db.executeWithRetry(authRequest.createQB(this.db, id, data));
|
452
|
-
}
|
453
|
-
async readRequest(id) {
|
454
|
-
try {
|
455
|
-
const row = await authRequest.readQB(this.db, id).executeTakeFirst();
|
456
|
-
if (!row)
|
457
|
-
return null;
|
458
|
-
return authRequest.rowToRequestData(row);
|
459
|
-
}
|
460
|
-
finally {
|
461
|
-
// Take the opportunity to clean up expired requests. Do this after we got
|
462
|
-
// the current (potentially expired) request data to allow the provider to
|
463
|
-
// handle expired requests.
|
464
|
-
this.backgroundQueue.add(async () => {
|
465
|
-
await this.db.executeWithRetry(authRequest.removeOldExpiredQB(this.db));
|
466
|
-
});
|
467
|
-
}
|
468
|
-
}
|
469
|
-
async updateRequest(id, data) {
|
470
|
-
await this.db.executeWithRetry(authRequest.updateQB(this.db, id, data));
|
471
|
-
}
|
472
|
-
async deleteRequest(id) {
|
473
|
-
await this.db.executeWithRetry(authRequest.removeByIdQB(this.db, id));
|
474
|
-
}
|
475
|
-
async findRequestByCode(code) {
|
476
|
-
const row = await authRequest.findByCodeQB(this.db, code).executeTakeFirst();
|
477
|
-
return row ? authRequest.rowToFoundRequestResult(row) : null;
|
478
|
-
}
|
479
|
-
// DeviceStore
|
480
|
-
async createDevice(deviceId, data) {
|
481
|
-
await this.db.executeWithRetry(device.createQB(this.db, deviceId, data));
|
482
|
-
}
|
483
|
-
async readDevice(deviceId) {
|
484
|
-
const row = await device.readQB(this.db, deviceId).executeTakeFirst();
|
485
|
-
return row ? device.rowToDeviceData(row) : null;
|
486
|
-
}
|
487
|
-
async updateDevice(deviceId, data) {
|
488
|
-
await this.db.executeWithRetry(device.updateQB(this.db, deviceId, data));
|
489
|
-
}
|
490
|
-
async deleteDevice(deviceId) {
|
491
|
-
// Will cascade to device_account (device_account_device_id_fk)
|
492
|
-
await this.db.executeWithRetry(device.removeQB(this.db, deviceId));
|
493
|
-
}
|
494
|
-
// TokenStore
|
495
|
-
async createToken(id, data, refreshToken) {
|
496
|
-
await this.db.transaction(async (dbTxn) => {
|
497
|
-
if (refreshToken) {
|
498
|
-
const { count } = await usedRefreshToken
|
499
|
-
.countQB(dbTxn, refreshToken)
|
500
|
-
.executeTakeFirstOrThrow();
|
501
|
-
if (count > 0) {
|
502
|
-
throw new Error('Refresh token already in use');
|
503
|
-
}
|
504
|
-
}
|
505
|
-
return token.createQB(dbTxn, id, data, refreshToken).execute();
|
506
|
-
});
|
507
|
-
}
|
508
|
-
async readToken(tokenId) {
|
509
|
-
const row = await token.findByQB(this.db, { tokenId }).executeTakeFirst();
|
510
|
-
return row ? token.toTokenInfo(row, this.serviceDid) : null;
|
511
|
-
}
|
512
|
-
async deleteToken(tokenId) {
|
513
|
-
// Will cascade to used_refresh_token (used_refresh_token_fk)
|
514
|
-
await this.db.executeWithRetry(token.removeQB(this.db, tokenId));
|
515
|
-
}
|
516
|
-
async rotateToken(tokenId, newTokenId, newRefreshToken, newData) {
|
517
|
-
const err = await this.db.transaction(async (dbTxn) => {
|
518
|
-
const { id, currentRefreshToken } = await token
|
519
|
-
.forRotateQB(dbTxn, tokenId)
|
520
|
-
.executeTakeFirstOrThrow();
|
521
|
-
if (currentRefreshToken) {
|
522
|
-
await usedRefreshToken
|
523
|
-
.insertQB(dbTxn, id, currentRefreshToken)
|
524
|
-
.execute();
|
525
|
-
}
|
526
|
-
const { count } = await usedRefreshToken
|
527
|
-
.countQB(dbTxn, newRefreshToken)
|
528
|
-
.executeTakeFirstOrThrow();
|
529
|
-
if (count > 0) {
|
530
|
-
// Do NOT throw (we don't want the transaction to be rolled back)
|
531
|
-
return new Error('New refresh token already in use');
|
532
|
-
}
|
533
|
-
await token
|
534
|
-
.rotateQB(dbTxn, id, newTokenId, newRefreshToken, newData)
|
535
|
-
.execute();
|
536
|
-
});
|
537
|
-
if (err)
|
538
|
-
throw err;
|
539
|
-
}
|
540
|
-
async findTokenByRefreshToken(refreshToken) {
|
541
|
-
const used = await usedRefreshToken
|
542
|
-
.findByTokenQB(this.db, refreshToken)
|
543
|
-
.executeTakeFirst();
|
544
|
-
const search = used
|
545
|
-
? { id: used.tokenId }
|
546
|
-
: { currentRefreshToken: refreshToken };
|
547
|
-
const row = await token.findByQB(this.db, search).executeTakeFirst();
|
548
|
-
return row ? token.toTokenInfo(row, this.serviceDid) : null;
|
549
|
-
}
|
550
|
-
async findTokenByCode(code) {
|
551
|
-
const row = await token.findByQB(this.db, { code }).executeTakeFirst();
|
552
|
-
return row ? token.toTokenInfo(row, this.serviceDid) : null;
|
553
|
-
}
|
554
399
|
}
|
555
400
|
exports.AccountManager = AccountManager;
|
556
|
-
//# sourceMappingURL=
|
401
|
+
//# sourceMappingURL=account-manager.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"account-manager.js","sourceRoot":"","sources":["../../src/account-manager/account-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,4CAA4C;AAE5C,4CAA4C;AAC5C,sDAA6E;AAC7E,oDAA4C;AAE5C,8BAAmC;AACnC,6DAA0D;AAC1D,2CAIwB;AAExB,6BAAuE;AACvE,2DAA4C;AAC5C,+CAA+D;AAC/D,qDAAsC;AACtC,kEAAmD;AACnD,yDAA0C;AAC1C,6DAA8C;AAC9C,qDAAsC;AACtC,yDAA0C;AAC1C,uDAAwC;AAExC,6CAAsE;AAA7D,wGAAA,aAAa,OAAA;AAAE,8GAAA,mBAAmB,OAAA;AAE3C,MAAa,cAAc;IAGzB,YACW,UAAsB,EACtB,MAAiB,EACjB,UAAkB,EAClB,oBAA8B,EACvC,EAAkB;QAJlB;;;;mBAAS,UAAU;WAAY;QAC/B;;;;mBAAS,MAAM;WAAW;QAC1B;;;;mBAAS,UAAU;WAAQ;QAC3B;;;;mBAAS,oBAAoB;WAAU;QANhC;;;;;WAAa;QASpB,IAAI,CAAC,EAAE,GAAG,IAAA,UAAK,EAAC,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC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AG,GAAG,MAAM,UAAU,CAAC,0BAA0B,CACrD,IAAI,CAAC,EAAE,EACP,gBAAgB,EAChB,IAAI,CAAC,KAAK,CACX,CAAA;QACD,MAAM,IAAI,CAAC,qBAAqB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;IACpE,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,IAAuC;QACjE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;QACpB,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACjE,MAAM,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CACxC,OAAO,CAAC,GAAG,CAAC;YACV,QAAQ,CAAC,kBAAkB,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,cAAc,EAAE,CAAC;YAC3D,UAAU,CAAC,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,gBAAgB,CAAC;YACzD,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,GAAG,CAAC;SAC1C,CAAC,CACH,CAAA;IACH,CAAC;CACF;AAzgBD,wCAygBC"}
|
@@ -19,20 +19,20 @@ export declare enum AccountStatus {
|
|
19
19
|
Deactivated = "deactivated"
|
20
20
|
}
|
21
21
|
export declare const selectAccountQB: (db: AccountDb, flags?: AvailabilityFlags) => import("kysely/dist/cjs/parser/select-parser").QueryBuilderWithSelection<{
|
22
|
-
repo_root: import("../db").RepoRoot;
|
23
|
-
token: import("../db").Token;
|
24
22
|
account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
|
23
|
+
token: import("../db").Token;
|
25
24
|
actor: import("../db").Actor;
|
26
25
|
app_password: import("../db").AppPassword;
|
27
26
|
invite_code: import("../db").InviteCode;
|
28
27
|
invite_code_use: import("../db").InviteCodeUse;
|
29
28
|
refresh_token: import("../db").RefreshToken;
|
29
|
+
repo_root: import("../db").RepoRoot;
|
30
30
|
email_token: import("../db").EmailToken;
|
31
31
|
authorization_request: import("../db").AuthorizationRequest;
|
32
32
|
device: import("../db").Device;
|
33
33
|
device_account: import("../db").DeviceAccount;
|
34
34
|
used_refresh_token: import("../db").UsedRefreshToken;
|
35
|
-
}, "account" | "actor", import("kysely/dist/cjs/util/type-utils").MergePartial<Partial<Omit<{}, never>>, Partial<Omit<{}, never>>>, "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.
|
35
|
+
}, "account" | "actor", import("kysely/dist/cjs/util/type-utils").MergePartial<Partial<Omit<{}, never>>, Partial<Omit<{}, never>>>, "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter">;
|
36
36
|
export declare const getAccount: (db: AccountDb, handleOrDid: string, flags?: AvailabilityFlags) => Promise<ActorAccount | null>;
|
37
37
|
export declare const getAccounts: (db: AccountDb, dids: string[], flags?: AvailabilityFlags) => Promise<Map<string, ActorAccount>>;
|
38
38
|
export declare const getAccountByEmail: (db: AccountDb, email: string, flags?: AvailabilityFlags) => Promise<ActorAccount | null>;
|
@@ -17,44 +17,44 @@ export declare const updateQB: (db: AccountDb, deviceId: DeviceId, did: string,
|
|
17
17
|
authorizedClients?: OAuthClientId[];
|
18
18
|
remember?: boolean;
|
19
19
|
}) => import("kysely").UpdateQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../db").DatabaseSchema, "device_account">, "device_account", "device_account", import("kysely").UpdateResult>;
|
20
|
-
export declare const createOrUpdateQB: (db: AccountDb, deviceId: DeviceId, did: string, remember: boolean) => import("kysely").InsertQueryBuilder<import("../db").DatabaseSchema, "device_account", import("kysely").
|
20
|
+
export declare const createOrUpdateQB: (db: AccountDb, deviceId: DeviceId, did: string, remember: boolean) => import("kysely").InsertQueryBuilder<import("../db").DatabaseSchema, "device_account", import("kysely").Selection<import("../db").DatabaseSchema, "device_account", "authenticatedAt" | "remember" | "authorizedClients">>;
|
21
21
|
export declare const getAccountInfoQB: (db: AccountDb, deviceId: DeviceId, did: string) => import("kysely").SelectQueryBuilder<{
|
22
|
-
repo_root: import("../db").RepoRoot;
|
23
|
-
token: import("../db").Token;
|
24
22
|
account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
|
23
|
+
token: import("../db").Token;
|
25
24
|
actor: import("../db").Actor;
|
26
25
|
app_password: import("../db").AppPassword;
|
27
26
|
invite_code: import("../db").InviteCode;
|
28
27
|
invite_code_use: import("../db").InviteCodeUse;
|
29
28
|
refresh_token: import("../db").RefreshToken;
|
29
|
+
repo_root: import("../db").RepoRoot;
|
30
30
|
email_token: import("../db").EmailToken;
|
31
31
|
authorization_request: import("../db").AuthorizationRequest;
|
32
32
|
device: import("../db").Device;
|
33
33
|
device_account: DeviceAccount;
|
34
34
|
used_refresh_token: import("../db").UsedRefreshToken;
|
35
35
|
}, "account" | "actor" | "device" | "device_account", Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
|
36
|
-
repo_root: import("../db").RepoRoot;
|
37
|
-
token: import("../db").Token;
|
38
36
|
account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
|
37
|
+
token: import("../db").Token;
|
39
38
|
actor: import("../db").Actor;
|
40
39
|
app_password: import("../db").AppPassword;
|
41
40
|
invite_code: import("../db").InviteCode;
|
42
41
|
invite_code_use: import("../db").InviteCodeUse;
|
43
42
|
refresh_token: import("../db").RefreshToken;
|
43
|
+
repo_root: import("../db").RepoRoot;
|
44
44
|
email_token: import("../db").EmailToken;
|
45
45
|
authorization_request: import("../db").AuthorizationRequest;
|
46
46
|
device: import("../db").Device;
|
47
47
|
device_account: DeviceAccount;
|
48
48
|
used_refresh_token: import("../db").UsedRefreshToken;
|
49
|
-
}, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.
|
50
|
-
repo_root: import("../db").RepoRoot;
|
51
|
-
token: import("../db").Token;
|
49
|
+
}, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
|
52
50
|
account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
|
51
|
+
token: import("../db").Token;
|
53
52
|
actor: import("../db").Actor;
|
54
53
|
app_password: import("../db").AppPassword;
|
55
54
|
invite_code: import("../db").InviteCode;
|
56
55
|
invite_code_use: import("../db").InviteCodeUse;
|
57
56
|
refresh_token: import("../db").RefreshToken;
|
57
|
+
repo_root: import("../db").RepoRoot;
|
58
58
|
email_token: import("../db").EmailToken;
|
59
59
|
authorization_request: import("../db").AuthorizationRequest;
|
60
60
|
device: import("../db").Device;
|
@@ -62,42 +62,42 @@ export declare const getAccountInfoQB: (db: AccountDb, deviceId: DeviceId, did:
|
|
62
62
|
used_refresh_token: import("../db").UsedRefreshToken;
|
63
63
|
}, "account" | "actor" | "device" | "device_account", "device_account.authenticatedAt" | "device_account.remember" | "device_account.authorizedClients">>;
|
64
64
|
export declare const listRememberedQB: (db: AccountDb, deviceId: DeviceId) => import("kysely").SelectQueryBuilder<{
|
65
|
-
repo_root: import("../db").RepoRoot;
|
66
|
-
token: import("../db").Token;
|
67
65
|
account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
|
66
|
+
token: import("../db").Token;
|
68
67
|
actor: import("../db").Actor;
|
69
68
|
app_password: import("../db").AppPassword;
|
70
69
|
invite_code: import("../db").InviteCode;
|
71
70
|
invite_code_use: import("../db").InviteCodeUse;
|
72
71
|
refresh_token: import("../db").RefreshToken;
|
72
|
+
repo_root: import("../db").RepoRoot;
|
73
73
|
email_token: import("../db").EmailToken;
|
74
74
|
authorization_request: import("../db").AuthorizationRequest;
|
75
75
|
device: import("../db").Device;
|
76
76
|
device_account: DeviceAccount;
|
77
77
|
used_refresh_token: import("../db").UsedRefreshToken;
|
78
78
|
}, "account" | "actor" | "device" | "device_account", Partial<Omit<{}, never>> & Partial<Omit<Partial<Omit<{}, never>>, never>> & import("kysely").Selection<{
|
79
|
-
repo_root: import("../db").RepoRoot;
|
80
|
-
token: import("../db").Token;
|
81
79
|
account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
|
80
|
+
token: import("../db").Token;
|
82
81
|
actor: import("../db").Actor;
|
83
82
|
app_password: import("../db").AppPassword;
|
84
83
|
invite_code: import("../db").InviteCode;
|
85
84
|
invite_code_use: import("../db").InviteCodeUse;
|
86
85
|
refresh_token: import("../db").RefreshToken;
|
86
|
+
repo_root: import("../db").RepoRoot;
|
87
87
|
email_token: import("../db").EmailToken;
|
88
88
|
authorization_request: import("../db").AuthorizationRequest;
|
89
89
|
device: import("../db").Device;
|
90
90
|
device_account: DeviceAccount;
|
91
91
|
used_refresh_token: import("../db").UsedRefreshToken;
|
92
|
-
}, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.
|
93
|
-
repo_root: import("../db").RepoRoot;
|
94
|
-
token: import("../db").Token;
|
92
|
+
}, "account" | "actor", "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter"> & import("kysely").Selection<{
|
95
93
|
account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
|
94
|
+
token: import("../db").Token;
|
96
95
|
actor: import("../db").Actor;
|
97
96
|
app_password: import("../db").AppPassword;
|
98
97
|
invite_code: import("../db").InviteCode;
|
99
98
|
invite_code_use: import("../db").InviteCodeUse;
|
100
99
|
refresh_token: import("../db").RefreshToken;
|
100
|
+
repo_root: import("../db").RepoRoot;
|
101
101
|
email_token: import("../db").EmailToken;
|
102
102
|
authorization_request: import("../db").AuthorizationRequest;
|
103
103
|
device: import("../db").Device;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"device-account.d.ts","sourceRoot":"","sources":["../../../src/account-manager/helpers/device-account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,QAAQ,CAAA;AAC/C,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACd,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAmB,MAAM,WAAW,CAAA;AAEzD,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,UAAU,CAAC,aAAa,CAAC,EACzB,iBAAiB,GAAG,mBAAmB,GAAG,UAAU,CACrD,CAAA;AAcD,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,EAAE,IAAI,CAAA;IACrB,iBAAiB,EAAE,aAAa,EAAE,CAAA;IAClC,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AAqBD,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,uBAAuB,GAC3B,iBAAiB,CAMnB;AAED,wBAAgB,SAAS,CACvB,GAAG,EAAE,UAAU,CAAC,YAAY,CAAC,EAC7B,QAAQ,EAAE,MAAM,GACf,OAAO,CAQT;AAED,eAAO,MAAM,MAAM,OAAQ,SAAS,YAAY,QAAQ,OAAO,MAAM,+PAKJ,CAAA;AAEjE,eAAO,MAAM,QAAQ,OACf,SAAS,YACH,QAAQ,OACb,MAAM,SACJ;IACL,eAAe,CAAC,EAAE,IAAI,CAAA;IACtB,iBAAiB,CAAC,EAAE,aAAa,EAAE,CAAA;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,iNAMkC,CAAA;AAErC,eAAO,MAAM,gBAAgB,OACvB,SAAS,YACH,QAAQ,OACb,MAAM,YACD,OAAO,
|
1
|
+
{"version":3,"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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yJAGZ,CAAA;AAED,eAAO,MAAM,gBAAgB,OAAQ,SAAS,YAAY,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yJACU,CAAA;AAE5E,eAAO,MAAM,QAAQ,OAAQ,SAAS,YAAY,QAAQ,OAAO,MAAM,+LAI5C,CAAA"}
|
@@ -65,7 +65,8 @@ const createOrUpdateQB = (db, deviceId, did, remember) => {
|
|
65
65
|
return db.db
|
66
66
|
.insertInto('device_account')
|
67
67
|
.values({ did, deviceId, authorizedClients, ...values })
|
68
|
-
.onConflict((oc) => oc.columns(['deviceId', 'did']).doUpdateSet(values))
|
68
|
+
.onConflict((oc) => oc.columns(['deviceId', 'did']).doUpdateSet(values))
|
69
|
+
.returning(['remember', 'authorizedClients', 'authenticatedAt']);
|
69
70
|
};
|
70
71
|
exports.createOrUpdateQB = createOrUpdateQB;
|
71
72
|
const getAccountInfoQB = (db, deviceId, did) => {
|