@atproto/pds 0.4.40 → 0.4.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/account-manager/index.d.ts +3 -4
  3. package/dist/account-manager/index.d.ts.map +1 -1
  4. package/dist/account-manager/index.js +2 -3
  5. package/dist/account-manager/index.js.map +1 -1
  6. package/dist/auth-verifier.d.ts.map +1 -1
  7. package/dist/auth-verifier.js +11 -9
  8. package/dist/auth-verifier.js.map +1 -1
  9. package/dist/config/config.d.ts.map +1 -1
  10. package/dist/config/config.js +2 -1
  11. package/dist/config/config.js.map +1 -1
  12. package/dist/config/env.d.ts +2 -1
  13. package/dist/config/env.d.ts.map +1 -1
  14. package/dist/config/env.js +2 -1
  15. package/dist/config/env.js.map +1 -1
  16. package/dist/lexicon/index.d.ts +2 -0
  17. package/dist/lexicon/index.d.ts.map +1 -1
  18. package/dist/lexicon/index.js +4 -0
  19. package/dist/lexicon/index.js.map +1 -1
  20. package/dist/lexicon/lexicons.d.ts +32 -0
  21. package/dist/lexicon/lexicons.d.ts.map +1 -1
  22. package/dist/lexicon/lexicons.js +32 -0
  23. package/dist/lexicon/lexicons.js.map +1 -1
  24. package/dist/lexicon/types/app/bsky/notification/getUnreadCount.d.ts +1 -0
  25. package/dist/lexicon/types/app/bsky/notification/getUnreadCount.d.ts.map +1 -1
  26. package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts +2 -0
  27. package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts.map +1 -1
  28. package/dist/lexicon/types/app/bsky/notification/listNotifications.js.map +1 -1
  29. package/dist/lexicon/types/app/bsky/notification/putPreferences.d.ts +29 -0
  30. package/dist/lexicon/types/app/bsky/notification/putPreferences.d.ts.map +1 -0
  31. package/dist/lexicon/types/app/bsky/notification/putPreferences.js +3 -0
  32. package/dist/lexicon/types/app/bsky/notification/putPreferences.js.map +1 -0
  33. package/dist/logger.d.ts +3 -1
  34. package/dist/logger.d.ts.map +1 -1
  35. package/dist/logger.js +9 -76
  36. package/dist/logger.js.map +1 -1
  37. package/dist/oauth/detailed-account-store.d.ts +2 -2
  38. package/dist/oauth/detailed-account-store.d.ts.map +1 -1
  39. package/dist/oauth/detailed-account-store.js.map +1 -1
  40. package/package.json +9 -9
  41. package/src/account-manager/index.ts +4 -5
  42. package/src/auth-verifier.ts +18 -9
  43. package/src/config/config.ts +2 -1
  44. package/src/config/env.ts +4 -2
  45. package/src/lexicon/index.ts +12 -0
  46. package/src/lexicon/lexicons.ts +33 -0
  47. package/src/lexicon/types/app/bsky/notification/getUnreadCount.ts +1 -0
  48. package/src/lexicon/types/app/bsky/notification/listNotifications.ts +2 -0
  49. package/src/lexicon/types/app/bsky/notification/putPreferences.ts +38 -0
  50. package/src/logger.ts +11 -81
  51. package/src/oauth/detailed-account-store.ts +2 -2
@@ -4,6 +4,7 @@
4
4
  import express from 'express';
5
5
  import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server';
6
6
  export interface QueryParams {
7
+ priority?: boolean;
7
8
  seenAt?: string;
8
9
  }
9
10
  export type InputSchema = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"getUnreadCount.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/getUnreadCount.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAK7B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEtE,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,CAAA;AAEpC,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,kBAAkB,CAAA;AAC9E,MAAM,MAAM,aAAa,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI;IAC1D,IAAI,EAAE,EAAE,CAAA;IACR,MAAM,EAAE,WAAW,CAAA;IACnB,KAAK,EAAE,YAAY,CAAA;IACnB,GAAG,EAAE,OAAO,CAAC,OAAO,CAAA;IACpB,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAA;CACtB,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI,CACpD,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC,KACnB,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAA"}
1
+ {"version":3,"file":"getUnreadCount.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/getUnreadCount.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAK7B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEtE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,CAAA;AAEnC,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,CAAA;AAEpC,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,kBAAkB,CAAA;AAC9E,MAAM,MAAM,aAAa,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI;IAC1D,IAAI,EAAE,EAAE,CAAA;IACR,MAAM,EAAE,WAAW,CAAA;IACnB,KAAK,EAAE,YAAY,CAAA;IACnB,GAAG,EAAE,OAAO,CAAC,OAAO,CAAA;IACpB,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAA;CACtB,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI,CACpD,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC,KACnB,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAA"}
@@ -8,6 +8,7 @@ import * as AppBskyActorDefs from '../actor/defs';
8
8
  import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs';
9
9
  export interface QueryParams {
10
10
  limit: number;
11
+ priority?: boolean;
11
12
  cursor?: string;
12
13
  seenAt?: string;
13
14
  }
@@ -15,6 +16,7 @@ export type InputSchema = undefined;
15
16
  export interface OutputSchema {
16
17
  cursor?: string;
17
18
  notifications: Notification[];
19
+ priority?: boolean;
18
20
  seenAt?: string;
19
21
  [k: string]: unknown;
20
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"listNotifications.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/listNotifications.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,E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,SAAS,WAAW,GAAG,KAAK,IAAI,CACpD,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC,KACnB,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAA;AAE3C,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,gBAAgB,CAAC,WAAW,CAAA;IACpC,6GAA6G;IAC7G,MAAM,EACF,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,OAAO,GACP,OAAO,GACP,oBAAoB,GACpB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,EAAE,CAAA;IACV,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,mBAAmB,CAAC,KAAK,EAAE,CAAA;IACpC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,YAAY,CAM5D;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAKjE"}
1
+ {"version":3,"file":"listNotifications.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/listNotifications.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,gBAAgB,EAAW,MAAM,kBAAkB,CAAA;AAI5D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,gBAAgB,MAAM,eAAe,CAAA;AACjD,OAAO,KAAK,mBAAmB,MAAM,iCAAiC,CAAA;AAEtE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;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M,EAAE,gBAAgB,CAAC,WAAW,CAAA;IACpC,6GAA6G;IAC7G,MAAM,EACF,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,OAAO,GACP,OAAO,GACP,oBAAoB,GACpB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,EAAE,CAAA;IACV,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,mBAAmB,CAAC,KAAK,EAAE,CAAA;IACpC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,YAAY,CAM5D;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAKjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"listNotifications.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/listNotifications.ts"],"names":[],"mappings":";;;AAKA,mDAA+C;AAC/C,2CAAiD;AAoEjD,SAAgB,cAAc,CAAC,CAAU;IACvC,OAAO,CACL,IAAA,YAAK,EAAC,CAAC,CAAC;QACR,IAAA,cAAO,EAAC,CAAC,EAAE,OAAO,CAAC;QACnB,CAAC,CAAC,KAAK,KAAK,sDAAsD,CACnE,CAAA;AACH,CAAC;AAND,wCAMC;AAED,SAAgB,oBAAoB,CAAC,CAAU;IAC7C,OAAO,mBAAQ,CAAC,QAAQ,CACtB,sDAAsD,EACtD,CAAC,CACF,CAAA;AACH,CAAC;AALD,oDAKC"}
1
+ {"version":3,"file":"listNotifications.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/listNotifications.ts"],"names":[],"mappings":";;;AAKA,mDAA+C;AAC/C,2CAAiD;AAsEjD,SAAgB,cAAc,CAAC,CAAU;IACvC,OAAO,CACL,IAAA,YAAK,EAAC,CAAC,CAAC;QACR,IAAA,cAAO,EAAC,CAAC,EAAE,OAAO,CAAC;QACnB,CAAC,CAAC,KAAK,KAAK,sDAAsD,CACnE,CAAA;AACH,CAAC;AAND,wCAMC;AAED,SAAgB,oBAAoB,CAAC,CAAU;IAC7C,OAAO,mBAAQ,CAAC,QAAQ,CACtB,sDAAsD,EACtD,CAAC,CACF,CAAA;AACH,CAAC;AALD,oDAKC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import express from 'express';
5
+ import { HandlerAuth } from '@atproto/xrpc-server';
6
+ export interface QueryParams {
7
+ }
8
+ export interface InputSchema {
9
+ priority: boolean;
10
+ [k: string]: unknown;
11
+ }
12
+ export interface HandlerInput {
13
+ encoding: 'application/json';
14
+ body: InputSchema;
15
+ }
16
+ export interface HandlerError {
17
+ status: number;
18
+ message?: string;
19
+ }
20
+ export type HandlerOutput = HandlerError | void;
21
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
22
+ auth: HA;
23
+ params: QueryParams;
24
+ input: HandlerInput;
25
+ req: express.Request;
26
+ res: express.Response;
27
+ };
28
+ export type Handler<HA extends HandlerAuth = never> = (ctx: HandlerReqCtx<HA>) => Promise<HandlerOutput> | HandlerOutput;
29
+ //# sourceMappingURL=putPreferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"putPreferences.d.ts","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/putPreferences.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,SAAS,CAAA;AAK7B,OAAO,EAAE,WAAW,EAAsB,MAAM,sBAAsB,CAAA;AAEtE,MAAM,WAAW,WAAW;CAAG;AAE/B,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,OAAO,CAAA;IACjB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,WAAW,CAAA;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,IAAI,CAAA;AAC/C,MAAM,MAAM,aAAa,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI;IAC1D,IAAI,EAAE,EAAE,CAAA;IACR,MAAM,EAAE,WAAW,CAAA;IACnB,KAAK,EAAE,YAAY,CAAA;IACnB,GAAG,EAAE,OAAO,CAAC,OAAO,CAAA;IACpB,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAA;CACtB,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,EAAE,SAAS,WAAW,GAAG,KAAK,IAAI,CACpD,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC,KACnB,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=putPreferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"putPreferences.js","sourceRoot":"","sources":["../../../../../../src/lexicon/types/app/bsky/notification/putPreferences.ts"],"names":[],"mappings":""}
package/dist/logger.d.ts CHANGED
@@ -1,4 +1,6 @@
1
+ /// <reference types="node" />
1
2
  /// <reference types="node/http" />
3
+ import { type IncomingMessage } from 'node:http';
2
4
  export declare const dbLogger: import("pino").default.Logger<never>;
3
5
  export declare const didCacheLogger: import("pino").default.Logger<never>;
4
6
  export declare const readStickyLogger: import("pino").default.Logger<never>;
@@ -10,5 +12,5 @@ export declare const crawlerLogger: import("pino").default.Logger<never>;
10
12
  export declare const httpLogger: import("pino").default.Logger<never>;
11
13
  export declare const fetchLogger: import("pino").default.Logger<never>;
12
14
  export declare const oauthLogger: import("pino").default.Logger<never>;
13
- export declare const loggerMiddleware: import("pino-http").HttpLogger<import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, never>;
15
+ export declare const loggerMiddleware: import("pino-http").HttpLogger<IncomingMessage, import("http").ServerResponse<IncomingMessage>, never>;
14
16
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAIA,eAAO,MAAM,QAAQ,sCAA4B,CAAA;AACjD,eAAO,MAAM,cAAc,sCAAmC,CAAA;AAC9D,eAAO,MAAM,gBAAgB,sCAAqC,CAAA;AAClE,eAAO,MAAM,WAAW,sCAA+B,CAAA;AACvD,eAAO,MAAM,SAAS,sCAAmC,CAAA;AACzD,eAAO,MAAM,YAAY,sCAAgC,CAAA;AACzD,eAAO,MAAM,aAAa,sCAAiC,CAAA;AAC3D,eAAO,MAAM,aAAa,sCAAiC,CAAA;AAC3D,eAAO,MAAM,UAAU,sCAAyB,CAAA;AAChD,eAAO,MAAM,WAAW,sCAA+B,CAAA;AACvD,eAAO,MAAM,WAAW,sCAA+B,CAAA;AAEvD,eAAO,MAAM,gBAAgB,sIAM3B,CAAA"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAA;AAKhD,eAAO,MAAM,QAAQ,sCAA4B,CAAA;AACjD,eAAO,MAAM,cAAc,sCAAmC,CAAA;AAC9D,eAAO,MAAM,gBAAgB,sCAAqC,CAAA;AAClE,eAAO,MAAM,WAAW,sCAA+B,CAAA;AACvD,eAAO,MAAM,SAAS,sCAAmC,CAAA;AACzD,eAAO,MAAM,YAAY,sCAAgC,CAAA;AACzD,eAAO,MAAM,aAAa,sCAAiC,CAAA;AAC3D,eAAO,MAAM,aAAa,sCAAiC,CAAA;AAC3D,eAAO,MAAM,UAAU,sCAAyB,CAAA;AAChD,eAAO,MAAM,WAAW,sCAA+B,CAAA;AACvD,eAAO,MAAM,WAAW,sCAA+B,CAAA;AAEvD,eAAO,MAAM,gBAAgB,wGAa3B,CAAA"}
package/dist/logger.js CHANGED
@@ -21,82 +21,15 @@ exports.oauthLogger = (0, common_1.subsystemLogger)('pds:oauth');
21
21
  exports.loggerMiddleware = (0, pino_http_1.default)({
22
22
  logger: exports.httpLogger,
23
23
  serializers: {
24
- err: errSerializer,
25
- req: reqSerializer,
24
+ err: (err) => ({
25
+ code: err?.['code'],
26
+ message: err?.['message'],
27
+ }),
28
+ req: (req) => {
29
+ const serialized = pino_1.stdSerializers.req(req);
30
+ const headers = (0, common_1.obfuscateHeaders)(serialized.headers);
31
+ return { ...serialized, headers };
32
+ },
26
33
  },
27
34
  });
28
- function errSerializer(err) {
29
- return {
30
- code: err?.code,
31
- message: err?.message,
32
- };
33
- }
34
- function reqSerializer(req) {
35
- const serialized = pino_1.stdSerializers.req(req);
36
- serialized.headers = obfuscateHeaders(serialized.headers);
37
- return serialized;
38
- }
39
- function obfuscateHeaders(headers) {
40
- const obfuscatedHeaders = {};
41
- for (const key in headers) {
42
- if (key.toLowerCase() === 'authorization') {
43
- obfuscatedHeaders[key] = obfuscateAuthHeader(headers[key]);
44
- }
45
- else if (key.toLowerCase() === 'dpop') {
46
- obfuscatedHeaders[key] = obfuscateJws(headers[key]) || 'Invalid';
47
- }
48
- else {
49
- obfuscatedHeaders[key] = headers[key];
50
- }
51
- }
52
- return obfuscatedHeaders;
53
- }
54
- function obfuscateAuthHeader(authHeader) {
55
- // This is a hot path (runs on every request). Avoid using split() or regex.
56
- const spaceIdx = authHeader.indexOf(' ');
57
- if (spaceIdx === -1)
58
- return 'Invalid';
59
- const type = authHeader.slice(0, spaceIdx);
60
- switch (type.toLowerCase()) {
61
- case 'bearer':
62
- return `${type} ${obfuscateBearer(authHeader.slice(spaceIdx + 1))}`;
63
- case 'dpop':
64
- return `${type} ${obfuscateJws(authHeader.slice(spaceIdx + 1)) || 'Invalid'}`;
65
- case 'basic':
66
- return `${type} ${obfuscateBasic(authHeader.slice(spaceIdx + 1)) || 'Invalid'}`;
67
- default:
68
- return `Invalid`;
69
- }
70
- }
71
- function obfuscateBasic(token) {
72
- if (!token)
73
- return null;
74
- const buffer = Buffer.from(token, 'base64');
75
- if (!buffer.length)
76
- return null; // Buffer.from will silently ignore invalid base64 chars
77
- const authHeader = buffer.toString('utf8');
78
- const colIdx = authHeader.indexOf(':');
79
- if (colIdx === -1)
80
- return null;
81
- const username = authHeader.slice(0, colIdx);
82
- return `${username}:***`;
83
- }
84
- function obfuscateBearer(token) {
85
- return obfuscateJws(token) || obfuscateToken(token);
86
- }
87
- function obfuscateToken(token) {
88
- return token ? '***' : '';
89
- }
90
- function obfuscateJws(token) {
91
- const firstDot = token.indexOf('.');
92
- if (firstDot === -1)
93
- return null;
94
- const secondDot = token.indexOf('.', firstDot + 1);
95
- if (secondDot === -1)
96
- return null;
97
- if (token.indexOf('.', secondDot + 1) !== -1)
98
- return null;
99
- // Strip the signature
100
- return token.slice(0, secondDot) + '.obfuscated';
101
- }
102
35
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAqC;AACrC,0DAAgC;AAChC,4CAAiD;AAEpC,QAAA,QAAQ,GAAG,IAAA,wBAAe,EAAC,QAAQ,CAAC,CAAA;AACpC,QAAA,cAAc,GAAG,IAAA,wBAAe,EAAC,eAAe,CAAC,CAAA;AACjD,QAAA,gBAAgB,GAAG,IAAA,wBAAe,EAAC,iBAAiB,CAAC,CAAA;AACrD,QAAA,WAAW,GAAG,IAAA,wBAAe,EAAC,WAAW,CAAC,CAAA;AAC1C,QAAA,SAAS,GAAG,IAAA,wBAAe,EAAC,eAAe,CAAC,CAAA;AAC5C,QAAA,YAAY,GAAG,IAAA,wBAAe,EAAC,YAAY,CAAC,CAAA;AAC5C,QAAA,aAAa,GAAG,IAAA,wBAAe,EAA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AAA;AACjD,QAAA,gBAAgB,GAAG,IAAA,wBAAe,EAAC,iBAAiB,CAAC,CAAA;AACrD,QAAA,WAAW,GAAG,IAAA,wBAAe,EAAC,WAAW,CAAC,CAAA;AAC1C,QAAA,SAAS,GAAG,IAAA,wBAAe,EAAC,eAAe,CAAC,CAAA;AAC5C,QAAA,YAAY,GAAG,IAAA,wBAAe,EAAC,YAAY,CAAC,CAAA;AAC5C,QAAA,aAAa,GAAG,IAAA,wBAAe,EAAC,aAAa,CAAC,CAAA;AAC9C,QAAA,aAAa,GAAG,IAAA,wBAAe,EAAC,aAAa,CAAC,CAAA;AAC9C,QAAA,UAAU,GAAG,IAAA,wBAAe,EAAC,KAAK,CAAC,CAAA;AACnC,QAAA,WAAW,GAAG,IAAA,wBAAe,EAAC,WAAW,CAAC,CAAA;AAC1C,QAAA,WAAW,GAAG,IAAA,wBAAe,EAAC,WAAW,CAAC,CAAA;AAE1C,QAAA,gBAAgB,GAAG,IAAA,mBAAQ,EAAC;IACvC,MAAM,EAAE,kBAAU;IAClB,WAAW,EAAE;QACX,GAAG,EAAE,CAAC,GAAY,EAAE,EAAE,CAAC,CAAC;YACtB,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC;YACnB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC;SAC1B,CAAC;QACF,GAAG,EAAE,CAAC,GAAoB,EAAE,EAAE;YAC5B,MAAM,UAAU,GAAG,qBAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YAC1C,MAAM,OAAO,GAAG,IAAA,yBAAgB,EAAC,UAAU,CAAC,OAAO,CAAC,CAAA;YACpD,OAAO,EAAE,GAAG,UAAU,EAAE,OAAO,EAAE,CAAA;QACnC,CAAC;KACF;CACF,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import { AccountInfo, AccountStore, DeviceId, LoginCredentials } from '@atproto/oauth-provider';
1
+ import { AccountInfo, AccountStore, DeviceId, SignInCredentials } from '@atproto/oauth-provider';
2
2
  import { AccountManager } from '../account-manager/index';
3
3
  import { ActorStore } from '../actor-store/index';
4
4
  import { LocalViewerCreator } from '../read-after-write/index';
@@ -18,7 +18,7 @@ export declare class DetailedAccountStore implements AccountStore {
18
18
  constructor(accountManager: AccountManager, actorStore: ActorStore, localViewer: LocalViewerCreator);
19
19
  private getProfile;
20
20
  private enrichAccountInfo;
21
- authenticateAccount(credentials: LoginCredentials, deviceId: DeviceId): Promise<AccountInfo | null>;
21
+ authenticateAccount(credentials: SignInCredentials, deviceId: DeviceId): Promise<AccountInfo | null>;
22
22
  addAuthorizedClient(deviceId: DeviceId, sub: string, clientId: string): Promise<void>;
23
23
  getDeviceAccount(deviceId: DeviceId, sub: string): Promise<AccountInfo | null>;
24
24
  listDeviceAccounts(deviceId: DeviceId): Promise<AccountInfo[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"detailed-account-store.d.ts","sourceRoot":"","sources":["../../src/oauth/detailed-account-store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,gBAAgB,EACjB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D;;;;;;;;GAQG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IAErD,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,WAAW;gBAFX,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,kBAAkB;YAG3B,UAAU;YAQV,iBAAiB;IAezB,mBAAmB,CACvB,WAAW,EAAE,gBAAgB,EAC7B,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IASxB,mBAAmB,CACvB,QAAQ,EAAE,QAAQ,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AAC,WAAW;YAAE,OAAO,IAAI,CAAA;QAC7B,OAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAA;IAC5C,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,QAAkB,EAClB,GAAW,EACX,QAAgB;QAEhB,OAAO,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;IACzE,CAAC;IAED,KAAK,CAAC,gBAAgB,CACpB,QAAkB,EAClB,GAAW;QAEX,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAC5D,QAAQ,EACR,GAAG,CACJ,CAAA;QACD,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAA;QAC7B,OAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAA;IAC5C,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,QAAkB;QACzC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAA;QAC3E,OAAO,OAAO,CAAC,GAAG,CAChB,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,CACrC,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,CACpC,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,QAAkB,EAAE,GAAW;QACvD,OAAO,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;IAC/D,CAAC;CACF;AA1ED,oDA0EC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/pds",
3
- "version": "0.4.40",
3
+ "version": "0.4.42",
4
4
  "license": "MIT",
5
5
  "description": "Reference implementation of atproto Personal Data Server (PDS)",
6
6
  "keywords": [
@@ -44,17 +44,17 @@
44
44
  "uint8arrays": "3.0.0",
45
45
  "zod": "^3.23.8",
46
46
  "@atproto-labs/fetch-node": "0.1.0",
47
- "@atproto/api": "^0.12.24",
48
- "@atproto/aws": "^0.2.0",
49
- "@atproto/common": "^0.4.0",
47
+ "@atproto/api": "^0.12.25",
48
+ "@atproto/aws": "^0.2.1",
49
+ "@atproto/common": "^0.4.1",
50
50
  "@atproto/crypto": "^0.4.0",
51
51
  "@atproto/identity": "^0.4.0",
52
52
  "@atproto/lexicon": "^0.4.0",
53
- "@atproto/oauth-provider": "^0.1.0",
54
- "@atproto/repo": "^0.4.0",
53
+ "@atproto/oauth-provider": "^0.1.1",
54
+ "@atproto/repo": "^0.4.1",
55
55
  "@atproto/syntax": "^0.3.0",
56
56
  "@atproto/xrpc": "^0.5.0",
57
- "@atproto/xrpc-server": "^0.5.2"
57
+ "@atproto/xrpc-server": "^0.5.3"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@atproto/pds-entryway": "npm:@atproto/pds@0.3.0-entryway.3",
@@ -72,8 +72,8 @@
72
72
  "jest": "^28.1.2",
73
73
  "ts-node": "^10.8.2",
74
74
  "ws": "^8.12.0",
75
- "@atproto/api": "^0.12.24",
76
- "@atproto/bsky": "^0.0.67",
75
+ "@atproto/api": "^0.12.25",
76
+ "@atproto/bsky": "^0.0.69",
77
77
  "@atproto/lex-cli": "^0.4.0"
78
78
  },
79
79
  "scripts": {
@@ -7,12 +7,12 @@ import {
7
7
  DeviceId,
8
8
  DeviceStore,
9
9
  FoundRequestResult,
10
- LoginCredentials,
11
10
  NewTokenData,
12
11
  RefreshToken,
13
12
  RequestData,
14
13
  RequestId,
15
14
  RequestStore,
15
+ SignInCredentials,
16
16
  TokenData,
17
17
  TokenId,
18
18
  TokenInfo,
@@ -32,8 +32,8 @@ import * as account from './helpers/account'
32
32
  import { AccountStatus, ActorAccount } from './helpers/account'
33
33
  import * as auth from './helpers/auth'
34
34
  import * as authRequest from './helpers/authorization-request'
35
- import * as deviceAccount from './helpers/device-account'
36
35
  import * as device from './helpers/device'
36
+ import * as deviceAccount from './helpers/device-account'
37
37
  import * as emailToken from './helpers/email-token'
38
38
  import * as invite from './helpers/invite'
39
39
  import * as password from './helpers/password'
@@ -42,8 +42,7 @@ import * as scrypt from './helpers/scrypt'
42
42
  import * as token from './helpers/token'
43
43
  import * as usedRefreshToken from './helpers/used-refresh-token'
44
44
 
45
- export { AccountStatus } from './helpers/account'
46
- export { formatAccountStatus } from './helpers/account'
45
+ export { AccountStatus, formatAccountStatus } from './helpers/account'
47
46
 
48
47
  export class AccountManager
49
48
  implements AccountStore, RequestStore, DeviceStore, TokenStore
@@ -487,7 +486,7 @@ export class AccountManager
487
486
  // AccountStore
488
487
 
489
488
  async authenticateAccount(
490
- { username: identifier, password, remember = false }: LoginCredentials,
489
+ { username: identifier, password, remember = false }: SignInCredentials,
491
490
  deviceId: DeviceId,
492
491
  ): Promise<AccountInfo | null> {
493
492
  try {
@@ -605,17 +605,26 @@ enum AuthType {
605
605
  export const parseAuthorizationHeader = (
606
606
  authorization?: string,
607
607
  ): [type: null] | [type: AuthType, token: string] => {
608
- const result = authorization?.split(' ', 3)
609
- if (result?.length === 2) {
610
- for (const [name, type] of Object.entries(AuthType)) {
611
- // authorization type is case-insensitive
612
- if (name === result[0].toUpperCase()) {
613
- return [type, result[1]] as [type: AuthType, token: string]
614
- }
615
- }
608
+ if (!authorization) return [null]
609
+
610
+ const result = authorization.split(' ')
611
+ if (result.length !== 2) {
612
+ throw new InvalidRequestError(
613
+ 'Malformed authorization header',
614
+ 'InvalidToken',
615
+ )
616
616
  }
617
617
 
618
- return [null] as [type: null]
618
+ // authorization type is case-insensitive
619
+ const authType = result[0].toUpperCase()
620
+
621
+ const type = Object.hasOwn(AuthType, authType) ? AuthType[authType] : null
622
+ if (type) return [type, result[1]]
623
+
624
+ throw new InvalidRequestError(
625
+ `Unsupported authorization type: ${result[0]}`,
626
+ 'InvalidToken',
627
+ )
619
628
  }
620
629
 
621
630
  const isAccessToken = (req: express.Request): boolean => {
@@ -251,8 +251,9 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
251
251
  name: env.serviceName ?? 'Personal PDS',
252
252
  logo: env.logoUrl,
253
253
  colors: {
254
- primary: env.primaryColor,
254
+ brand: env.brandColor,
255
255
  error: env.errorColor,
256
+ warning: env.warningColor,
256
257
  },
257
258
  links: [
258
259
  {
package/src/config/env.ts CHANGED
@@ -19,8 +19,9 @@ export const readEnv = (): ServerEnvironment => {
19
19
  devMode: envBool('PDS_DEV_MODE'),
20
20
 
21
21
  // branding
22
- primaryColor: envStr('PDS_PRIMARY_COLOR'),
22
+ brandColor: envStr('PDS_PRIMARY_COLOR'),
23
23
  errorColor: envStr('PDS_ERROR_COLOR'),
24
+ warningColor: envStr('PDS_WARNING_COLOR'),
24
25
 
25
26
  // database
26
27
  dataDirectory: envStr('PDS_DATA_DIRECTORY'),
@@ -139,8 +140,9 @@ export type ServerEnvironment = {
139
140
  devMode?: boolean
140
141
 
141
142
  // branding
142
- primaryColor?: string
143
+ brandColor?: string
143
144
  errorColor?: string
145
+ warningColor?: string
144
146
 
145
147
  // database
146
148
  dataDirectory?: string
@@ -130,6 +130,7 @@ import * as AppBskyGraphUnmuteThread from './types/app/bsky/graph/unmuteThread'
130
130
  import * as AppBskyLabelerGetServices from './types/app/bsky/labeler/getServices'
131
131
  import * as AppBskyNotificationGetUnreadCount from './types/app/bsky/notification/getUnreadCount'
132
132
  import * as AppBskyNotificationListNotifications from './types/app/bsky/notification/listNotifications'
133
+ import * as AppBskyNotificationPutPreferences from './types/app/bsky/notification/putPreferences'
133
134
  import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush'
134
135
  import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen'
135
136
  import * as AppBskyUnspeccedGetPopularFeedGenerators from './types/app/bsky/unspecced/getPopularFeedGenerators'
@@ -1745,6 +1746,17 @@ export class AppBskyNotificationNS {
1745
1746
  return this._server.xrpc.method(nsid, cfg)
1746
1747
  }
1747
1748
 
1749
+ putPreferences<AV extends AuthVerifier>(
1750
+ cfg: ConfigOf<
1751
+ AV,
1752
+ AppBskyNotificationPutPreferences.Handler<ExtractAuth<AV>>,
1753
+ AppBskyNotificationPutPreferences.HandlerReqCtx<ExtractAuth<AV>>
1754
+ >,
1755
+ ) {
1756
+ const nsid = 'app.bsky.notification.putPreferences' // @ts-ignore
1757
+ return this._server.xrpc.method(nsid, cfg)
1758
+ }
1759
+
1748
1760
  registerPush<AV extends AuthVerifier>(
1749
1761
  cfg: ConfigOf<
1750
1762
  AV,
@@ -8341,6 +8341,9 @@ export const schemaDict = {
8341
8341
  parameters: {
8342
8342
  type: 'params',
8343
8343
  properties: {
8344
+ priority: {
8345
+ type: 'boolean',
8346
+ },
8344
8347
  seenAt: {
8345
8348
  type: 'string',
8346
8349
  format: 'datetime',
@@ -8379,6 +8382,9 @@ export const schemaDict = {
8379
8382
  maximum: 100,
8380
8383
  default: 50,
8381
8384
  },
8385
+ priority: {
8386
+ type: 'boolean',
8387
+ },
8382
8388
  cursor: {
8383
8389
  type: 'string',
8384
8390
  },
@@ -8404,6 +8410,9 @@ export const schemaDict = {
8404
8410
  ref: 'lex:app.bsky.notification.listNotifications#notification',
8405
8411
  },
8406
8412
  },
8413
+ priority: {
8414
+ type: 'boolean',
8415
+ },
8407
8416
  seenAt: {
8408
8417
  type: 'string',
8409
8418
  format: 'datetime',
@@ -8475,6 +8484,29 @@ export const schemaDict = {
8475
8484
  },
8476
8485
  },
8477
8486
  },
8487
+ AppBskyNotificationPutPreferences: {
8488
+ lexicon: 1,
8489
+ id: 'app.bsky.notification.putPreferences',
8490
+ defs: {
8491
+ main: {
8492
+ type: 'procedure',
8493
+ description:
8494
+ 'Set notification-related preferences for an account. Requires auth.',
8495
+ input: {
8496
+ encoding: 'application/json',
8497
+ schema: {
8498
+ type: 'object',
8499
+ required: ['priority'],
8500
+ properties: {
8501
+ priority: {
8502
+ type: 'boolean',
8503
+ },
8504
+ },
8505
+ },
8506
+ },
8507
+ },
8508
+ },
8509
+ },
8478
8510
  AppBskyNotificationRegisterPush: {
8479
8511
  lexicon: 1,
8480
8512
  id: 'app.bsky.notification.registerPush',
@@ -11769,6 +11801,7 @@ export const ids = {
11769
11801
  AppBskyNotificationGetUnreadCount: 'app.bsky.notification.getUnreadCount',
11770
11802
  AppBskyNotificationListNotifications:
11771
11803
  'app.bsky.notification.listNotifications',
11804
+ AppBskyNotificationPutPreferences: 'app.bsky.notification.putPreferences',
11772
11805
  AppBskyNotificationRegisterPush: 'app.bsky.notification.registerPush',
11773
11806
  AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen',
11774
11807
  AppBskyRichtextFacet: 'app.bsky.richtext.facet',
@@ -9,6 +9,7 @@ import { CID } from 'multiformats/cid'
9
9
  import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
10
10
 
11
11
  export interface QueryParams {
12
+ priority?: boolean
12
13
  seenAt?: string
13
14
  }
14
15
 
@@ -12,6 +12,7 @@ import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
12
12
 
13
13
  export interface QueryParams {
14
14
  limit: number
15
+ priority?: boolean
15
16
  cursor?: string
16
17
  seenAt?: string
17
18
  }
@@ -21,6 +22,7 @@ export type InputSchema = undefined
21
22
  export interface OutputSchema {
22
23
  cursor?: string
23
24
  notifications: Notification[]
25
+ priority?: boolean
24
26
  seenAt?: string
25
27
  [k: string]: unknown
26
28
  }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import express from 'express'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
+ import { lexicons } from '../../../../lexicons'
7
+ import { isObj, hasProp } from '../../../../util'
8
+ import { CID } from 'multiformats/cid'
9
+ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
10
+
11
+ export interface QueryParams {}
12
+
13
+ export interface InputSchema {
14
+ priority: boolean
15
+ [k: string]: unknown
16
+ }
17
+
18
+ export interface HandlerInput {
19
+ encoding: 'application/json'
20
+ body: InputSchema
21
+ }
22
+
23
+ export interface HandlerError {
24
+ status: number
25
+ message?: string
26
+ }
27
+
28
+ export type HandlerOutput = HandlerError | void
29
+ export type HandlerReqCtx<HA extends HandlerAuth = never> = {
30
+ auth: HA
31
+ params: QueryParams
32
+ input: HandlerInput
33
+ req: express.Request
34
+ res: express.Response
35
+ }
36
+ export type Handler<HA extends HandlerAuth = never> = (
37
+ ctx: HandlerReqCtx<HA>,
38
+ ) => Promise<HandlerOutput> | HandlerOutput