@atproto/pds 0.4.33 → 0.4.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/account-manager/db/migrations/004-oauth.d.ts +4 -0
  3. package/dist/account-manager/db/migrations/004-oauth.d.ts.map +1 -0
  4. package/dist/account-manager/db/migrations/004-oauth.js +106 -0
  5. package/dist/account-manager/db/migrations/004-oauth.js.map +1 -0
  6. package/dist/account-manager/db/migrations/index.d.ts +2 -0
  7. package/dist/account-manager/db/migrations/index.d.ts.map +1 -1
  8. package/dist/account-manager/db/migrations/index.js +2 -0
  9. package/dist/account-manager/db/migrations/index.js.map +1 -1
  10. package/dist/account-manager/db/schema/authorization-request.d.ts +19 -0
  11. package/dist/account-manager/db/schema/authorization-request.d.ts.map +1 -0
  12. package/dist/account-manager/db/schema/authorization-request.js +5 -0
  13. package/dist/account-manager/db/schema/authorization-request.js.map +1 -0
  14. package/dist/account-manager/db/schema/device-account.d.ts +14 -0
  15. package/dist/account-manager/db/schema/device-account.d.ts.map +1 -0
  16. package/dist/account-manager/db/schema/device-account.js +5 -0
  17. package/dist/account-manager/db/schema/device-account.js.map +1 -0
  18. package/dist/account-manager/db/schema/device.d.ts +16 -0
  19. package/dist/account-manager/db/schema/device.d.ts.map +1 -0
  20. package/dist/account-manager/db/schema/device.js +5 -0
  21. package/dist/account-manager/db/schema/device.js.map +1 -0
  22. package/dist/account-manager/db/schema/index.d.ts +11 -1
  23. package/dist/account-manager/db/schema/index.d.ts.map +1 -1
  24. package/dist/account-manager/db/schema/token.d.ts +24 -0
  25. package/dist/account-manager/db/schema/token.d.ts.map +1 -0
  26. package/dist/account-manager/db/schema/token.js +5 -0
  27. package/dist/account-manager/db/schema/token.js.map +1 -0
  28. package/dist/account-manager/db/schema/used-refresh-token.d.ts +12 -0
  29. package/dist/account-manager/db/schema/used-refresh-token.d.ts.map +1 -0
  30. package/dist/account-manager/db/schema/used-refresh-token.js +5 -0
  31. package/dist/account-manager/db/schema/used-refresh-token.js.map +1 -0
  32. package/dist/account-manager/helpers/account.d.ts +27 -5
  33. package/dist/account-manager/helpers/account.d.ts.map +1 -1
  34. package/dist/account-manager/helpers/account.js +15 -14
  35. package/dist/account-manager/helpers/account.js.map +1 -1
  36. package/dist/account-manager/helpers/authorization-request.d.ts +12 -0
  37. package/dist/account-manager/helpers/authorization-request.d.ts.map +1 -0
  38. package/dist/account-manager/helpers/authorization-request.js +59 -0
  39. package/dist/account-manager/helpers/authorization-request.js.map +1 -0
  40. package/dist/account-manager/helpers/device-account.d.ts +108 -0
  41. package/dist/account-manager/helpers/device-account.d.ts.map +1 -0
  42. package/dist/account-manager/helpers/device-account.js +82 -0
  43. package/dist/account-manager/helpers/device-account.js.map +1 -0
  44. package/dist/account-manager/helpers/device.d.ts +9 -0
  45. package/dist/account-manager/helpers/device.d.ts.map +1 -0
  46. package/dist/account-manager/helpers/device.js +32 -0
  47. package/dist/account-manager/helpers/device.js.map +1 -0
  48. package/dist/account-manager/helpers/token.d.ts +485 -0
  49. package/dist/account-manager/helpers/token.d.ts.map +1 -0
  50. package/dist/account-manager/helpers/token.js +123 -0
  51. package/dist/account-manager/helpers/token.js.map +1 -0
  52. package/dist/account-manager/helpers/used-refresh-token.d.ts +10 -0
  53. package/dist/account-manager/helpers/used-refresh-token.d.ts.map +1 -0
  54. package/dist/account-manager/helpers/used-refresh-token.js +25 -0
  55. package/dist/account-manager/helpers/used-refresh-token.js.map +1 -0
  56. package/dist/account-manager/index.d.ts +36 -6
  57. package/dist/account-manager/index.d.ts.map +1 -1
  58. package/dist/account-manager/index.js +223 -22
  59. package/dist/account-manager/index.js.map +1 -1
  60. package/dist/actor-store/preference/reader.d.ts +2 -1
  61. package/dist/actor-store/preference/reader.d.ts.map +1 -1
  62. package/dist/actor-store/preference/reader.js +3 -1
  63. package/dist/actor-store/preference/reader.js.map +1 -1
  64. package/dist/actor-store/preference/transactor.d.ts +2 -1
  65. package/dist/actor-store/preference/transactor.d.ts.map +1 -1
  66. package/dist/actor-store/preference/transactor.js +7 -1
  67. package/dist/actor-store/preference/transactor.js.map +1 -1
  68. package/dist/actor-store/preference/util.d.ts +3 -0
  69. package/dist/actor-store/preference/util.d.ts.map +1 -0
  70. package/dist/actor-store/preference/util.js +12 -0
  71. package/dist/actor-store/preference/util.js.map +1 -0
  72. package/dist/actor-store/record/reader.d.ts +1 -1
  73. package/dist/api/app/bsky/actor/getPreferences.d.ts.map +1 -1
  74. package/dist/api/app/bsky/actor/getPreferences.js +1 -6
  75. package/dist/api/app/bsky/actor/getPreferences.js.map +1 -1
  76. package/dist/api/app/bsky/actor/putPreferences.d.ts.map +1 -1
  77. package/dist/api/app/bsky/actor/putPreferences.js +1 -1
  78. package/dist/api/app/bsky/actor/putPreferences.js.map +1 -1
  79. package/dist/api/app/bsky/util/resolver.d.ts +1 -1
  80. package/dist/api/com/atproto/server/createSession.d.ts.map +1 -1
  81. package/dist/api/com/atproto/server/createSession.js +7 -31
  82. package/dist/api/com/atproto/server/createSession.js.map +1 -1
  83. package/dist/api/com/atproto/server/deleteSession.d.ts.map +1 -1
  84. package/dist/api/com/atproto/server/deleteSession.js +14 -13
  85. package/dist/api/com/atproto/server/deleteSession.js.map +1 -1
  86. package/dist/api/com/atproto/server/getSession.d.ts.map +1 -1
  87. package/dist/api/com/atproto/server/getSession.js +4 -2
  88. package/dist/api/com/atproto/server/getSession.js.map +1 -1
  89. package/dist/api/com/atproto/server/refreshSession.d.ts.map +1 -1
  90. package/dist/api/com/atproto/server/refreshSession.js +4 -2
  91. package/dist/api/com/atproto/server/refreshSession.js.map +1 -1
  92. package/dist/api/com/atproto/sync/getRepoStatus.d.ts.map +1 -1
  93. package/dist/api/com/atproto/sync/getRepoStatus.js +2 -1
  94. package/dist/api/com/atproto/sync/getRepoStatus.js.map +1 -1
  95. package/dist/api/com/atproto/sync/listRepos.js +2 -2
  96. package/dist/api/com/atproto/sync/listRepos.js.map +1 -1
  97. package/dist/api/proxy.d.ts.map +1 -1
  98. package/dist/api/proxy.js +15 -2
  99. package/dist/api/proxy.js.map +1 -1
  100. package/dist/auth-routes.d.ts +4 -0
  101. package/dist/auth-routes.d.ts.map +1 -0
  102. package/dist/auth-routes.js +24 -0
  103. package/dist/auth-routes.js.map +1 -0
  104. package/dist/auth-verifier.d.ts +32 -11
  105. package/dist/auth-verifier.d.ts.map +1 -1
  106. package/dist/auth-verifier.js +238 -79
  107. package/dist/auth-verifier.js.map +1 -1
  108. package/dist/config/config.d.ts +12 -0
  109. package/dist/config/config.d.ts.map +1 -1
  110. package/dist/config/config.js +45 -0
  111. package/dist/config/config.js.map +1 -1
  112. package/dist/config/env.d.ts +8 -0
  113. package/dist/config/env.d.ts.map +1 -1
  114. package/dist/config/env.js +10 -0
  115. package/dist/config/env.js.map +1 -1
  116. package/dist/config/secrets.d.ts +1 -0
  117. package/dist/config/secrets.d.ts.map +1 -1
  118. package/dist/config/secrets.js +1 -0
  119. package/dist/config/secrets.js.map +1 -1
  120. package/dist/context.d.ts +6 -0
  121. package/dist/context.d.ts.map +1 -1
  122. package/dist/context.js +71 -13
  123. package/dist/context.js.map +1 -1
  124. package/dist/db/cast.d.ts +15 -0
  125. package/dist/db/cast.d.ts.map +1 -0
  126. package/dist/db/cast.js +66 -0
  127. package/dist/db/cast.js.map +1 -0
  128. package/dist/db/db.d.ts +2 -2
  129. package/dist/db/db.d.ts.map +1 -1
  130. package/dist/db/db.js +9 -7
  131. package/dist/db/db.js.map +1 -1
  132. package/dist/db/index.d.ts +1 -0
  133. package/dist/db/index.d.ts.map +1 -1
  134. package/dist/db/index.js +1 -0
  135. package/dist/db/index.js.map +1 -1
  136. package/dist/error.d.ts.map +1 -1
  137. package/dist/error.js +5 -0
  138. package/dist/error.js.map +1 -1
  139. package/dist/index.d.ts.map +1 -1
  140. package/dist/index.js +2 -0
  141. package/dist/index.js.map +1 -1
  142. package/dist/lexicon/index.d.ts +4 -0
  143. package/dist/lexicon/index.d.ts.map +1 -1
  144. package/dist/lexicon/index.js +8 -0
  145. package/dist/lexicon/index.js.map +1 -1
  146. package/dist/lexicon/lexicons.d.ts +51 -0
  147. package/dist/lexicon/lexicons.d.ts.map +1 -1
  148. package/dist/lexicon/lexicons.js +51 -0
  149. package/dist/lexicon/lexicons.js.map +1 -1
  150. package/dist/lexicon/types/app/bsky/feed/defs.d.ts +1 -0
  151. package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
  152. package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
  153. package/dist/lexicon/types/app/bsky/graph/muteThread.d.ts +29 -0
  154. package/dist/lexicon/types/app/bsky/graph/muteThread.d.ts.map +1 -0
  155. package/dist/lexicon/types/app/bsky/graph/muteThread.js +3 -0
  156. package/dist/lexicon/types/app/bsky/graph/muteThread.js.map +1 -0
  157. package/dist/lexicon/types/app/bsky/graph/unmuteThread.d.ts +29 -0
  158. package/dist/lexicon/types/app/bsky/graph/unmuteThread.d.ts.map +1 -0
  159. package/dist/lexicon/types/app/bsky/graph/unmuteThread.js +3 -0
  160. package/dist/lexicon/types/app/bsky/graph/unmuteThread.js.map +1 -0
  161. package/dist/logger.d.ts +13 -11
  162. package/dist/logger.d.ts.map +1 -1
  163. package/dist/logger.js +80 -64
  164. package/dist/logger.js.map +1 -1
  165. package/dist/oauth/detailed-account-store.d.ts +27 -0
  166. package/dist/oauth/detailed-account-store.d.ts.map +1 -0
  167. package/dist/oauth/detailed-account-store.js +76 -0
  168. package/dist/oauth/detailed-account-store.js.map +1 -0
  169. package/dist/oauth/provider.d.ts +16 -0
  170. package/dist/oauth/provider.d.ts.map +1 -0
  171. package/dist/oauth/provider.js +45 -0
  172. package/dist/oauth/provider.js.map +1 -0
  173. package/dist/pipethrough.d.ts.map +1 -1
  174. package/dist/pipethrough.js.map +1 -1
  175. package/dist/sequencer/events.d.ts +2 -2
  176. package/example.env +21 -3
  177. package/package.json +9 -7
  178. package/src/account-manager/db/migrations/004-oauth.ts +122 -0
  179. package/src/account-manager/db/migrations/index.ts +2 -0
  180. package/src/account-manager/db/schema/authorization-request.ts +26 -0
  181. package/src/account-manager/db/schema/device-account.ts +15 -0
  182. package/src/account-manager/db/schema/device.ts +18 -0
  183. package/src/account-manager/db/schema/index.ts +15 -0
  184. package/src/account-manager/db/schema/token.ts +34 -0
  185. package/src/account-manager/db/schema/used-refresh-token.ts +13 -0
  186. package/src/account-manager/helpers/account.ts +16 -21
  187. package/src/account-manager/helpers/authorization-request.ts +82 -0
  188. package/src/account-manager/helpers/device-account.ts +135 -0
  189. package/src/account-manager/helpers/device.ts +45 -0
  190. package/src/account-manager/helpers/token.ts +185 -0
  191. package/src/account-manager/helpers/used-refresh-token.ts +30 -0
  192. package/src/account-manager/index.ts +325 -20
  193. package/src/actor-store/preference/reader.ts +8 -2
  194. package/src/actor-store/preference/transactor.ts +10 -0
  195. package/src/actor-store/preference/util.ts +8 -0
  196. package/src/api/app/bsky/actor/getPreferences.ts +2 -9
  197. package/src/api/app/bsky/actor/putPreferences.ts +5 -1
  198. package/src/api/com/atproto/server/createSession.ts +8 -44
  199. package/src/api/com/atproto/server/deleteSession.ts +14 -20
  200. package/src/api/com/atproto/server/getSession.ts +7 -2
  201. package/src/api/com/atproto/server/refreshSession.ts +6 -2
  202. package/src/api/com/atproto/sync/getRepoStatus.ts +3 -1
  203. package/src/api/com/atproto/sync/listRepos.ts +1 -1
  204. package/src/api/proxy.ts +18 -2
  205. package/src/auth-routes.ts +27 -0
  206. package/src/auth-verifier.ts +312 -92
  207. package/src/config/config.ts +66 -0
  208. package/src/config/env.ts +24 -0
  209. package/src/config/secrets.ts +2 -0
  210. package/src/context.ts +80 -14
  211. package/src/db/cast.ts +59 -0
  212. package/src/db/db.ts +15 -12
  213. package/src/db/index.ts +1 -0
  214. package/src/error.ts +7 -0
  215. package/src/index.ts +2 -0
  216. package/src/lexicon/index.ts +24 -0
  217. package/src/lexicon/lexicons.ts +52 -0
  218. package/src/lexicon/types/app/bsky/feed/defs.ts +1 -0
  219. package/src/lexicon/types/app/bsky/graph/muteThread.ts +38 -0
  220. package/src/lexicon/types/app/bsky/graph/unmuteThread.ts +38 -0
  221. package/src/logger.ts +83 -38
  222. package/src/oauth/detailed-account-store.ts +96 -0
  223. package/src/oauth/provider.ts +77 -0
  224. package/src/pipethrough.ts +3 -2
  225. package/tests/preferences.test.ts +67 -1
  226. package/tests/proxied/__snapshots__/feedgen.test.ts.snap +4 -1
  227. package/tests/proxied/__snapshots__/views.test.ts.snap +116 -38
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prefInScope = void 0;
4
+ const auth_verifier_1 = require("../../auth-verifier");
5
+ const FULL_ACCESS_ONLY_PREFS = ['app.bsky.actor.defs#personalDetailsPref'];
6
+ const prefInScope = (scope, prefType) => {
7
+ if (scope === auth_verifier_1.AuthScope.Access)
8
+ return true;
9
+ return !FULL_ACCESS_ONLY_PREFS.includes(prefType);
10
+ };
11
+ exports.prefInScope = prefInScope;
12
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/actor-store/preference/util.ts"],"names":[],"mappings":";;;AAAA,uDAA+C;AAE/C,MAAM,sBAAsB,GAAG,CAAC,yCAAyC,CAAC,CAAA;AAEnE,MAAM,WAAW,GAAG,CAAC,KAAgB,EAAE,QAAgB,EAAE,EAAE;IAChE,IAAI,KAAK,KAAK,yBAAS,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IAC3C,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AACnD,CAAC,CAAA;AAHY,QAAA,WAAW,eAGvB"}
@@ -37,8 +37,8 @@ export declare class RecordReader {
37
37
  linkTo: string;
38
38
  }): Promise<{
39
39
  takedownRef: string | null;
40
- cid: string;
41
40
  indexedAt: string;
41
+ cid: string;
42
42
  uri: string;
43
43
  collection: string;
44
44
  rkey: string;
@@ -1 +1 @@
1
- {"version":3,"file":"getPreferences.d.ts","sourceRoot":"","sources":["../../../../../src/api/app/bsky/actor/getPreferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAG5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAqBvD"}
1
+ {"version":3,"file":"getPreferences.d.ts","sourceRoot":"","sources":["../../../../../src/api/app/bsky/actor/getPreferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAE5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAevD"}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const auth_verifier_1 = require("../../../../auth-verifier");
4
3
  function default_1(server, ctx) {
5
4
  if (!ctx.cfg.bskyAppView)
6
5
  return;
@@ -8,11 +7,7 @@ function default_1(server, ctx) {
8
7
  auth: ctx.authVerifier.accessStandard(),
9
8
  handler: async ({ auth }) => {
10
9
  const requester = auth.credentials.did;
11
- let preferences = await ctx.actorStore.read(requester, (store) => store.pref.getPreferences('app.bsky'));
12
- if (auth.credentials.scope !== auth_verifier_1.AuthScope.Access) {
13
- // filter out personal details for app passwords
14
- preferences = preferences.filter((pref) => pref.$type !== 'app.bsky.actor.defs#personalDetailsPref');
15
- }
10
+ const preferences = await ctx.actorStore.read(requester, (store) => store.pref.getPreferences('app.bsky', auth.credentials.scope));
16
11
  return {
17
12
  encoding: 'application/json',
18
13
  body: { preferences },
@@ -1 +1 @@
1
- {"version":3,"file":"getPreferences.js","sourceRoot":"","sources":["../../../../../src/api/app/bsky/actor/getPreferences.ts"],"names":[],"mappings":";;AAEA,6DAAqD;AAErD,mBAAyB,MAAc,EAAE,GAAe;IACtD,IAA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WAAW,CAAC,GAAG,CAAA;YACtC,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CACjE,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAC9D,CAAA;YACD,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE,EAAE,WAAW,EAAE;aACtB,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAfD,4BAeC"}
@@ -1 +1 @@
1
- {"version":3,"file":"putPreferences.d.ts","sourceRoot":"","sources":["../../../../../src/api/app/bsky/actor/putPreferences.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAG5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAoBvD"}
1
+ {"version":3,"file":"putPreferences.d.ts","sourceRoot":"","sources":["../../../../../src/api/app/bsky/actor/putPreferences.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAG5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAwBvD"}
@@ -19,7 +19,7 @@ function default_1(server, ctx) {
19
19
  }
20
20
  }
21
21
  await ctx.actorStore.transact(requester, async (actorTxn) => {
22
- await actorTxn.pref.putPreferences(checkedPreferences, 'app.bsky');
22
+ await actorTxn.pref.putPreferences(checkedPreferences, 'app.bsky', auth.credentials.scope);
23
23
  });
24
24
  },
25
25
  });
@@ -1 +1 @@
1
- {"version":3,"file":"putPreferences.js","sourceRoot":"","sources":["../../../../../src/api/app/bsky/actor/putPreferences.ts"],"names":[],"m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C,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;QACnC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;QAC9D,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;YACjC,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC,IAAI,CAAA;YAClC,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAA;YACtC,MAAM,kBAAkB,GAAwB,EAAE,CAAA;YAClD,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;gBAC/B,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;oBACnC,kBAAkB,CAAC,IAAI,CAAC,IAAyB,CAAC,CAAA;gBACpD,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,iCAAmB,CAAC,+BAA+B,CAAC,CAAA;gBAChE,CAAC;YACH,CAAC;YACD,MAAM,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;gBAC1D,MAAM,QAAQ,CAAC,IAAI,CAAC,cAAc,CAChC,kBAAkB,EAClB,UAAU,EACV,IAAI,CAAC,WAAW,CAAC,KAAK,CACvB,CAAA;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAxBD,4BAwBC"}
@@ -11,7 +11,7 @@ export declare const getDidDoc: (ctx: AppContext, did: string) => Promise<{
11
11
  service?: {
12
12
  id: string;
13
13
  type: string;
14
- serviceEndpoint: (string | Record<string, unknown>) & (string | Record<string, unknown> | undefined);
14
+ serviceEndpoint: string | Record<string, unknown>;
15
15
  }[] | undefined;
16
16
  }>;
17
17
  //# sourceMappingURL=resolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createSession.d.ts","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/createSession.ts"],"names":[],"mappings":"AAGA,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAK5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAoFvD"}
1
+ {"version":3,"file":"createSession.d.ts","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/createSession.ts"],"names":[],"mappings":"AAIA,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAI5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAiDvD"}
@@ -2,10 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const common_1 = require("@atproto/common");
4
4
  const syntax_1 = require("@atproto/syntax");
5
- const xrpc_server_1 = require("@atproto/xrpc-server");
6
- const util_1 = require("../../../../db/util");
7
- const util_2 = require("./util");
5
+ const account_manager_1 = require("../../../../account-manager");
8
6
  const proxy_1 = require("../../../proxy");
7
+ const util_1 = require("./util");
9
8
  function default_1(server, ctx) {
10
9
  server.com.atproto.server.createSession({
11
10
  rateLimit: [
@@ -24,35 +23,12 @@ function default_1(server, ctx) {
24
23
  if (ctx.entrywayAgent) {
25
24
  return (0, proxy_1.resultPassthru)(await ctx.entrywayAgent.com.atproto.server.createSession(input.body, (0, proxy_1.authPassthru)(req, true)));
26
25
  }
27
- const { password } = input.body;
28
- const identifier = input.body.identifier.toLowerCase();
29
- const user = identifier.includes('@')
30
- ? await ctx.accountManager.getAccountByEmail(identifier, {
31
- includeDeactivated: true,
32
- includeTakenDown: true,
33
- })
34
- : await ctx.accountManager.getAccount(identifier, {
35
- includeDeactivated: true,
36
- includeTakenDown: true,
37
- });
38
- if (!user) {
39
- throw new xrpc_server_1.AuthRequiredError('Invalid identifier or password');
40
- }
41
- let appPassword = null;
42
- const validAccountPass = await ctx.accountManager.verifyAccountPassword(user.did, password);
43
- if (!validAccountPass) {
44
- appPassword = await ctx.accountManager.verifyAppPassword(user.did, password);
45
- if (appPassword === null) {
46
- throw new xrpc_server_1.AuthRequiredError('Invalid identifier or password');
47
- }
48
- }
49
- if ((0, util_1.softDeleted)(user)) {
50
- throw new xrpc_server_1.AuthRequiredError('Account has been taken down', 'AccountTakedown');
51
- }
26
+ const { user, appPassword } = await ctx.accountManager.login(input.body);
52
27
  const [{ accessJwt, refreshJwt }, didDoc] = await Promise.all([
53
28
  ctx.accountManager.createSession(user.did, appPassword),
54
- (0, util_2.didDocForSession)(ctx, user.did),
29
+ (0, util_1.didDocForSession)(ctx, user.did),
55
30
  ]);
31
+ const { status, active } = (0, account_manager_1.formatAccountStatus)(user);
56
32
  return {
57
33
  encoding: 'application/json',
58
34
  body: {
@@ -63,8 +39,8 @@ function default_1(server, ctx) {
63
39
  emailConfirmed: !!user.emailConfirmedAt,
64
40
  accessJwt,
65
41
  refreshJwt,
66
- active: user.active,
67
- status: user.status,
42
+ active,
43
+ status,
68
44
  },
69
45
  };
70
46
  },
@@ -1 +1 @@
1
- {"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/createSession.ts"],"names":[],"mappings":";;AAAA,4CAA6C;AAC7C,4CAAgD;AAChD,sDAAwD;AAExD,8CAAiD;AAEjD,iCAAyC;AACzC,0CAA6D;AAG7D,mBAAyB,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC;QACtC,SAAS,EAAE;YACT;gBACE,UAAU,EAAE,YAAG;gBACf,MAAM,EAAE,GAAG;gBACX,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,GAAG,CAAC,EAAE,EAAE;aAClE;YACD;gB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IAAI,CAAC,GAAG,EACR,QAAQ,CACT,CAAA;YACD,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACtB,WAAW,GAAG,MAAM,GAAG,CAAC,cAAc,CAAC,iBAAiB,CACtD,IAAI,CAAC,GAAG,EACR,QAAQ,CACT,CAAA;gBACD,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;oBACzB,MAAM,IAAI,+BAAiB,CAAC,gCAAgC,CAAC,CAAA;gBAC/D,CAAC;YACH,CAAC;YAED,IAAI,IAAA,kBAAW,EAAC,IAAI,CAAC,EAAE,CAAC;gBACtB,MAAM,IAAI,+BAAiB,CACzB,6BAA6B,EAC7B,iBAAiB,CAClB,CAAA;YACH,CAAC;YAED,MAAM,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBAC5D,GAAG,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC;gBACvD,IAAA,uBAAgB,EAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;aAChC,CAAC,CAAA;YAEF,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,GAAG,EAAE,IAAI,CAAC,GAAG;oBACb,MAAM;oBACN,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,uBAAc;oBACrC,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS;oBAC9B,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB;oBACvC,SAAS;oBACT,UAAU;oBACV,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;iBACpB;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AApFD,4BAoFC"}
1
+ {"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/createSession.ts"],"names":[],"mappings":";;AAAA,4CAA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AAgB,EAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;aAChC,CAAC,CAAA;YAEF,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qCAAmB,EAAC,IAAI,CAAC,CAAA;YAEpD,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,GAAG,EAAE,IAAI,CAAC,GAAG;oBACb,MAAM;oBACN,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,uBAAc;oBACrC,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS;oBAC9B,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB;oBACvC,SAAS;oBACT,UAAU;oBACV,MAAM;oBACN,MAAM;iBACP;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAjDD,4BAiDC"}
@@ -1 +1 @@
1
- {"version":3,"file":"deleteSession.d.ts","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/deleteSession.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAG5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAsBvD"}
1
+ {"version":3,"file":"deleteSession.d.ts","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/deleteSession.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAG5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAiBvD"}
@@ -1,20 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const auth_verifier_1 = require("../../../../auth-verifier");
4
3
  const proxy_1 = require("../../../proxy");
5
4
  function default_1(server, ctx) {
6
- server.com.atproto.server.deleteSession(async ({ req }) => {
7
- if (ctx.entrywayAgent) {
8
- await ctx.entrywayAgent.com.atproto.server.deleteSession(undefined, (0, proxy_1.authPassthru)(req, true));
9
- return;
10
- }
11
- const result = await ctx.authVerifier.validateBearerToken(req, [auth_verifier_1.AuthScope.Refresh], { clockTolerance: Infinity });
12
- const id = result.payload.jti;
13
- if (!id) {
14
- throw new Error('Unexpected missing refresh token id');
15
- }
16
- await ctx.accountManager.revokeRefreshToken(id);
17
- });
5
+ const { entrywayAgent } = ctx;
6
+ if (entrywayAgent) {
7
+ server.com.atproto.server.deleteSession(async (reqCtx) => {
8
+ await entrywayAgent.com.atproto.server.deleteSession(undefined, (0, proxy_1.authPassthru)(reqCtx.req, true));
9
+ });
10
+ }
11
+ else {
12
+ server.com.atproto.server.deleteSession({
13
+ auth: ctx.authVerifier.refreshExpired,
14
+ handler: async ({ auth }) => {
15
+ await ctx.accountManager.revokeRefreshToken(auth.credentials.tokenId);
16
+ },
17
+ });
18
+ }
18
19
  }
19
20
  exports.default = default_1;
20
21
  //# sourceMappingURL=deleteSession.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deleteSession.js","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/deleteSession.ts"],"names":[],"mappings":";;AAAA,6DAAqD;AAGrD,0CAA6C;AAE7C,mBAAyB,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;QACxD,IAAI,GAAG,CAAC,aAAa,EAAE,CAAC;YACtB,MAAM,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CACtD,SAAS,EACT,IAAA,oBAAY,EAAC,GAAG,EAAE,IAAI,CAAC,CACxB,CAAA;YACD,OAAM;QACR,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,mB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
@@ -1 +1 @@
1
- {"version":3,"file":"getSession.d.ts","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/getSession.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAK5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAuCvD"}
1
+ {"version":3,"file":"getSession.d.ts","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/getSession.ts"],"names":[],"mappings":"AAIA,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAK5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QA0CvD"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const xrpc_server_1 = require("@atproto/xrpc-server");
4
4
  const syntax_1 = require("@atproto/syntax");
5
+ const account_manager_1 = require("../../../../account-manager");
5
6
  const proxy_1 = require("../../../proxy");
6
7
  const util_1 = require("./util");
7
8
  const auth_verifier_1 = require("../../../../auth-verifier");
@@ -22,6 +23,7 @@ function default_1(server, ctx) {
22
23
  if (!user) {
23
24
  throw new xrpc_server_1.InvalidRequestError(`Could not find user info for account: ${did}`);
24
25
  }
26
+ const { status, active } = (0, account_manager_1.formatAccountStatus)(user);
25
27
  return {
26
28
  encoding: 'application/json',
27
29
  body: {
@@ -30,8 +32,8 @@ function default_1(server, ctx) {
30
32
  email: user.email ?? undefined,
31
33
  didDoc,
32
34
  emailConfirmed: !!user.emailConfirmedAt,
33
- active: user.active,
34
- status: user.status,
35
+ active,
36
+ status,
35
37
  },
36
38
  };
37
39
  },
@@ -1 +1 @@
1
- {"version":3,"file":"getSession.js","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/getSession.ts"],"names":[],"mappings":";;AA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AAC,IAAI,CAAC,gBAAgB;oBACvC,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;iBACpB;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAvCD,4BAuCC"}
1
+ {"version":3,"file":"getSession.js","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/getSession.ts"],"names":[],"mappings":";;AAAA,sDAA0D;AAC1D,4CAAgD;AAEhD,iEAAiE;AAGjE,0CAA6D;AAC7D,iCAAyC;AACzC,6DAAqD;AAErD,mBAAyB,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;QACnC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,cAAc,CAAC;YACpC,UAAU,EAAE,CAAC,yBAAS,CAAC,YAAY,CAAC;SACrC,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE;YAC/B,IAAI,GAAG,CAAC,aAAa,EAAE,CAAC;gBACtB,OAAO,IAAA,sBAAc,EACnB,MAAM,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CACnD,SAAS,EACT,IAAA,oBAAY,EAAC,GAAG,CAAC,CAClB,CACF,CAAA;YACH,CAAC;YAED,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAA;YAChC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBACvC,GAAG,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;gBAChE,IAAA,uBAAgB,EAAC,GAAG,EAAE,GAAG,CAAC;aAC3B,CAAC,CAAA;YACF,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,IAAI,iCAAmB,CAC3B,yCAAyC,GAAG,EAAE,CAC/C,CAAA;YACH,CAAC;YAED,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qCAAmB,EAAC,IAAI,CAAC,CAAA;YAEpD,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,uBAAc;oBACrC,GAAG,EAAE,IAAI,CAAC,GAAG;oBACb,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS;oBAC9B,MAAM;oBACN,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB;oBACvC,MAAM;oBACN,MAAM;iBACP;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AA1CD,4BA0CC"}
@@ -1 +1 @@
1
- {"version":3,"file":"refreshSession.d.ts","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/refreshSession.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAI5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAoDvD"}
1
+ {"version":3,"file":"refreshSession.d.ts","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/refreshSession.ts"],"names":[],"mappings":"AAIA,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAI5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QAsDvD"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const syntax_1 = require("@atproto/syntax");
4
4
  const xrpc_server_1 = require("@atproto/xrpc-server");
5
+ const account_manager_1 = require("../../../../account-manager");
5
6
  const util_1 = require("../../../../db/util");
6
7
  const util_2 = require("./util");
7
8
  const proxy_1 = require("../../../proxy");
@@ -30,6 +31,7 @@ function default_1(server, ctx) {
30
31
  if (rotated === null) {
31
32
  throw new xrpc_server_1.InvalidRequestError('Token has been revoked', 'ExpiredToken');
32
33
  }
34
+ const { status, active } = (0, account_manager_1.formatAccountStatus)(user);
33
35
  return {
34
36
  encoding: 'application/json',
35
37
  body: {
@@ -38,8 +40,8 @@ function default_1(server, ctx) {
38
40
  handle: user.handle ?? syntax_1.INVALID_HANDLE,
39
41
  accessJwt: rotated.accessJwt,
40
42
  refreshJwt: rotated.refreshJwt,
41
- active: user.active,
42
- status: user.status,
43
+ active,
44
+ status,
43
45
  },
44
46
  };
45
47
  },
@@ -1 +1 @@
1
- {"version":3,"file":"refreshSession.js","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/refreshSession.ts"],"names":[],"mappings":";;AAAA,4CAAgD;AAChD,sDAA6E;AAE7E,8CAAiD;AAEjD,iCAAyC;AACzC,0CAA6D;AAE7D,mBAAyB,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC;QACvC,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,OAAO;QAC9B,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE;YAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAA;YAChC,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,EAAE;gBACpD,kBAAkB,EAAE,IAAI;gBACxB,gBAAgB,EAAE,IAAI;aACvB,CAAC,CAAA;YACF,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,IAAI,iCAAmB,CAC3B,yCAAyC,GAAG,EAAE,CAC/C,CAAA;YACH,CAAC;YACD,IAAI,IAAA,kBAAW,EAAC,IAAI,CAAC,EAAE,CAAC;gBACtB,MAAM,IAAI,+BAAiB,CACzB,6BAA6B,EAC7B,iBAAiB,CAClB,CAAA;YACH,CAAC;YAED,IAAI,GAAG,CAAC,aAAa,EAAE,CAAC;gBACtB,OAAO,IAAA,sBAAc,EACnB,MAAM,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CACvD,SAAS,EACT,IAAA,oBAAY,EAAC,GAAG,CAAC,CAClB,CACF,CAAA;YACH,CAAC;YAED,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBAC1C,IAAA,uBAAgB,EAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;gBAC/B,GAAG,CAAC,cAAc,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;aAChE,CAAC,CAAA;YACF,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACrB,MAAM,IAAI,iCAAmB,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAA;YACzE,CAAC;YAED,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,GAAG,EAAE,IAAI,CAAC,GAAG;oBACb,MAAM;oBACN,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,uBAAc;oBACrC,SAAS,EAAE,OAAO,CAAC,SAAS;oBAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;oBAC9B,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;iBACpB;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AApDD,4BAoDC"}
1
+ {"version":3,"file":"refreshSession.js","sourceRoot":"","sources":["../../../../../src/api/com/atproto/server/refreshSession.ts"],"names":[],"mappings":";;AAAA,4CAAgD;AAChD,sDAA6E;AAE7E,iEAAiE;AAEjE,8CAAiD;AAEjD,iCAAyC;AACzC,0CAA6D;AAE7D,mBAAyB,MAAc,EAAE,GAAe;IAC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ED,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qCAAmB,EAAC,IAAI,CAAC,CAAA;YAEpD,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,GAAG,EAAE,IAAI,CAAC,GAAG;oBACb,MAAM;oBACN,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,uBAAc;oBACrC,SAAS,EAAE,OAAO,CAAC,SAAS;oBAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;oBAC9B,MAAM;oBACN,MAAM;iBACP;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAtDD,4BAsDC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getRepoStatus.d.ts","sourceRoot":"","sources":["../../../../../src/api/com/atproto/sync/getRepoStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAG5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QA0BvD"}
1
+ {"version":3,"file":"getRepoStatus.d.ts","sourceRoot":"","sources":["../../../../../src/api/com/atproto/sync/getRepoStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAI5C,MAAM,CAAC,OAAO,WAAW,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,QA2BvD"}
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const util_1 = require("./util");
4
+ const account_manager_1 = require("../../../../account-manager");
4
5
  function default_1(server, ctx) {
5
6
  server.com.atproto.sync.getRepoStatus({
6
7
  handler: async ({ params }) => {
7
8
  const { did } = params;
8
9
  const account = await (0, util_1.assertRepoAvailability)(ctx, did, true);
9
- const { active, status } = account;
10
+ const { active, status } = (0, account_manager_1.formatAccountStatus)(account);
10
11
  let rev = undefined;
11
12
  if (active) {
12
13
  const root = await ctx.actorStore.read(did, (store) => store.repo.storage.getRootDetailed());
@@ -1 +1 @@
1
- {"version":3,"file":"getRepoStatus.js","sourceRoot":"","sources":["../../../../../src/api/com/atproto/sync/getRepoStatus.ts"],"names":[],"mappings":";;AAEA,iCAA+C;AAE/C,mBAAyB,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC;QACpC,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YAC5B,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAA;YACtB,MAAM,OAAO,GAAG,MAAM,IAAA,6BAAsB,EAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;YAC5D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;YAElC,IAAI,GAAG,GAAuB,SAAS,CAAA;YACvC,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CACpD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CACrC,CAAA;gBACD,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;YAChB,CAAC;YAED,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,GAAG;oBACH,MAAM;oBACN,MAAM;oBACN,GAAG;iBACJ;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AA1BD,4BA0BC"}
1
+ {"version":3,"file":"getRepoStatus.js","sourceRoot":"","sources":["../../../../../src/api/com/atproto/sync/getRepoStatus.ts"],"names":[],"mappings":";;AAEA,iCAA+C;AAC/C,iEAAiE;AAEjE,mBAAyB,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC;QACpC,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YAC5B,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAA;YACtB,MAAM,OAAO,GAAG,MAAM,IAAA,6BAAsB,EAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;YAE5D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,qCAAmB,EAAC,OAAO,CAAC,CAAA;YAEvD,IAAI,GAAG,GAAuB,SAAS,CAAA;YACvC,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CACpD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CACrC,CAAA;gBACD,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;YAChB,CAAC;YAED,OAAO;gBACL,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE;oBACJ,GAAG;oBACH,MAAM;oBACN,MAAM;oBACN,GAAG;iBACJ;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AA3BD,4BA2BC"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimeDidKeyset = void 0;
4
4
  const xrpc_server_1 = require("@atproto/xrpc-server");
5
5
  const pagination_1 = require("../../../../db/pagination");
6
- const account_1 = require("../../../../account-manager/helpers/account");
6
+ const account_manager_1 = require("../../../../account-manager");
7
7
  function default_1(server, ctx) {
8
8
  server.com.atproto.sync.listRepos(async ({ params }) => {
9
9
  const { limit, cursor } = params;
@@ -30,7 +30,7 @@ function default_1(server, ctx) {
30
30
  });
31
31
  const res = await builder.execute();
32
32
  const repos = res.map((row) => {
33
- const { active, status } = (0, account_1.formatAccountStatus)(row);
33
+ const { active, status } = (0, account_manager_1.formatAccountStatus)(row);
34
34
  return {
35
35
  did: row.did,
36
36
  head: row.head,
@@ -1 +1 @@
1
- {"version":3,"file":"listRepos.js","sourceRoot":"","sources":["../../../../../src/api/com/atproto/sync/listRepos.ts"],"names":[],"mappings":";;;AAAA,sDAA0D;AAG1D,0DAA2E;AAC3E,yEAAiF;AAEjF,mBAAyB,MAAc,EAAE,GAAe;IACtD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QACrD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;QAChC,MAAM,EAAE,GAAG,GAAG,CAAC,cAAc,CAAC,EAAE,CAAA;QAChC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,OAAO,CAAA;QAC7B,IAAI,OAAO,GAAG,EAAE,CAAC,EAAE;aAChB,UAAU,CAAC,OAAO,CAAC;aACnB,SAAS,CAAC,WAAW,EAAE,eAAe,EAAE,WAAW,CAAC;aACpD,MAAM,CAAC;YACN,kBAAkB;YAClB,uBAAuB;YACvB,sBAAsB;YACtB,8BAA8B;YAC9B,sCAAsC;YACtC,kCAAkC;SACnC,CAAC,CAAA;QACJ,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAA;QAC1E,OAAO,GAAG,IAAA,qBAAQ,EAAC,OAAO,EAAE;YAC1B,KAAK;YACL,MAAM;YACN,MAAM;YACN,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,IAAI;SACf,CAAC,CAAA;QACF,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAA;QACnC,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE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AS,CAAA"}
package/dist/api/proxy.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.authPassthru = exports.resultPassthru = void 0;
4
+ const xrpc_server_1 = require("@atproto/xrpc-server");
4
5
  const resultPassthru = (result) => {
5
6
  // @TODO pass through any headers that we always want to forward along
6
7
  return {
@@ -10,9 +11,21 @@ const resultPassthru = (result) => {
10
11
  };
11
12
  exports.resultPassthru = resultPassthru;
12
13
  function authPassthru(req, withEncoding) {
13
- if (req.headers.authorization) {
14
+ const { authorization } = req.headers;
15
+ if (authorization) {
16
+ // DPoP requests are bound to the endpoint being called. Allowing them to be
17
+ // proxied would require that the receiving end allows DPoP proof not
18
+ // created for him. Since proxying is mainly there to support legacy
19
+ // clients, and DPoP is a new feature, we don't support DPoP requests
20
+ // through the proxy.
21
+ // This is fine since app views are usually called using the requester's
22
+ // credentials when "auth.credentials.type === 'access'", which is the only
23
+ // case were DPoP is used.
24
+ if (authorization.startsWith('DPoP ') || req.headers['dpop']) {
25
+ throw new xrpc_server_1.InvalidRequestError('DPoP requests cannot be proxied');
26
+ }
14
27
  return {
15
- headers: { authorization: req.headers.authorization },
28
+ headers: { authorization },
16
29
  encoding: withEncoding ? 'application/json' : undefined,
17
30
  };
18
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/api/proxy.ts"],"names":[],"mappings":";;;AAGO,MAAM,cAAc,GAAG,CAAI,MAAqC,EAAE,EAAE;IACzE,sEAAsE;IACtE,OAAO;QACL,QAAQ,EAAE,kBAA2B;QACrC,IAAI,EAAE,MAAM,CAAC,IAAI;KAClB,CAAA;AACH,CAAC,CAAA;AANY,QAAA,cAAc,kBAM1B;AAgBD,SAAgB,YAAY,CAAC,GAAoB,EAAE,YAAsB;IACvE,IAAI,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QAC9B,OAAO;YACL,OAAO,EAAE,EAAE,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE;YACrD,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;SACxD,CAAA;IACH,CAAC;AACH,CAAC;AAPD,oCAOC"}
1
+ {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/api/proxy.ts"],"names":[],"mappings":";;;AACA,sDAA0D;AAGnD,MAAM,cAAc,GAAG,CAAI,MAAqC,EAAE,EAAE;IACzE,sEAAsE;IACtE,OAAO;QACL,QAAQ,EAAE,kBAA2B;QACrC,IAAI,EAAE,MAAM,CAAC,IAAI;KAClB,CAAA;AACH,CAAC,CAAA;AANY,QAAA,cAAc,kBAM1B;AAgBD,SAAgB,YAAY,CAAC,GAAoB,EAAE,YAAsB;IACvE,MAAM,EAAE,aAAa,EAAE,GAAG,GAAG,CAAC,OAAO,CAAA;IAErC,IAAI,aAAa,EAAE,CAAC;QAClB,4EAA4E;QAC5E,qEAAqE;QACrE,oEAAoE;QACpE,qEAAqE;QACrE,qBAAqB;QAErB,wEAAwE;QACxE,2EAA2E;QAC3E,0BAA0B;QAC1B,IAAI,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7D,MAAM,IAAI,iCAAmB,CAAC,iCAAiC,CAAC,CAAA;QAClE,CAAC;QAED,OAAO;YACL,OAAO,EAAE,EAAE,aAAa,EAAE;YAC1B,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;SACxD,CAAA;IACH,CAAC;AACH,CAAC;AAtBD,oCAsBC"}
@@ -0,0 +1,4 @@
1
+ import { Router } from 'express';
2
+ import AppContext from './context';
3
+ export declare const createRouter: ({ authProvider, cfg }: AppContext) => Router;
4
+ //# sourceMappingURL=auth-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-routes.d.ts","sourceRoot":"","sources":["../src/auth-routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEhC,OAAO,UAAU,MAAM,WAAW,CAAA;AAElC,eAAO,MAAM,YAAY,0BAA2B,UAAU,KAAG,MAqBhE,CAAA"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRouter = void 0;
4
+ const oauth_provider_1 = require("@atproto/oauth-provider");
5
+ const express_1 = require("express");
6
+ const createRouter = ({ authProvider, cfg }) => {
7
+ const router = (0, express_1.Router)();
8
+ const oauthProtectedResourceMetadata = oauth_provider_1.oauthProtectedResourceMetadataSchema.parse({
9
+ resource: cfg.service.publicUrl,
10
+ authorization_servers: [cfg.entryway?.url ?? cfg.service.publicUrl],
11
+ bearer_methods_supported: ['header'],
12
+ scopes_supported: ['profile', 'email', 'phone'],
13
+ resource_documentation: 'https://atproto.com',
14
+ });
15
+ router.get('/.well-known/oauth-protected-resource', (req, res) => {
16
+ res.status(200).json(oauthProtectedResourceMetadata);
17
+ });
18
+ if (authProvider) {
19
+ router.use(authProvider.createRouter());
20
+ }
21
+ return router;
22
+ };
23
+ exports.createRouter = createRouter;
24
+ //# sourceMappingURL=auth-routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-routes.js","sourceRoot":"","sources":["../src/auth-routes.ts"],"names":[],"mappings":";;;AAAA,4DAA8E;AAC9E,qCAAgC;AAIzB,MAAM,YAAY,GAAG,CAAC,EAAE,YAAY,EAAE,GAAG,EAAc,EAAU,EAAE;IACxE,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAA;IAEvB,MAAM,8BAA8B,GAClC,qDAAoC,CAAC,KAAK,CAAC;QACzC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,SAAS;QAC/B,qBAAqB,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC;QACnE,wBAAwB,EAAE,CAAC,QAAQ,CAAC;QACpC,gBAAgB,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC;QAC/C,sBAAsB,EAAE,qBAAqB;KAC9C,CAAC,CAAA;IAEJ,MAAM,CAAC,GAAG,CAAC,uCAAuC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC/D,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAA;IACtD,CAAC,CAAC,CAAA;IAEF,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,CAAA;IACzC,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AArBY,QAAA,YAAY,gBAqBxB"}
@@ -1,11 +1,13 @@
1
1
  /// <reference types="node" />
2
2
  import { KeyObject } from 'node:crypto';
3
+ import { OAuthVerifier } from '@atproto/oauth-provider';
3
4
  import { IdResolver } from '@atproto/identity';
4
5
  import express from 'express';
5
6
  import * as jose from 'jose';
6
7
  import { AccountManager } from './account-manager';
7
8
  type ReqCtx = {
8
9
  req: express.Request;
10
+ res?: express.Response;
9
11
  };
10
12
  export declare enum AuthScope {
11
13
  Access = "com.atproto.access",
@@ -72,7 +74,11 @@ type ValidatedBearer = {
72
74
  payload: jose.JWTPayload;
73
75
  audience: string | undefined;
74
76
  };
77
+ type ValidatedRefreshBearer = ValidatedBearer & {
78
+ tokenId: string;
79
+ };
75
80
  export type AuthVerifierOpts = {
81
+ publicUrl: string;
76
82
  jwtKey: KeyObject;
77
83
  adminPass: string;
78
84
  dids: {
@@ -84,36 +90,51 @@ export type AuthVerifierOpts = {
84
90
  export declare class AuthVerifier {
85
91
  accountManager: AccountManager;
86
92
  idResolver: IdResolver;
93
+ oauthVerifier: OAuthVerifier;
94
+ private _publicUrl;
87
95
  private _jwtKey;
88
96
  private _adminPass;
89
97
  dids: AuthVerifierOpts['dids'];
90
- constructor(accountManager: AccountManager, idResolver: IdResolver, opts: AuthVerifierOpts);
98
+ constructor(accountManager: AccountManager, idResolver: IdResolver, oauthVerifier: OAuthVerifier, opts: AuthVerifierOpts);
91
99
  accessStandard: (opts?: Partial<AccessOpts>) => (ctx: ReqCtx) => Promise<AccessOutput>;
92
100
  accessFull: (opts?: Partial<AccessOpts>) => (ctx: ReqCtx) => Promise<AccessOutput>;
93
101
  accessPrivileged: (opts?: Partial<AccessOpts>) => (ctx: ReqCtx) => Promise<AccessOutput>;
94
102
  refresh: (ctx: ReqCtx) => Promise<RefreshOutput>;
95
- adminToken: (ctx: ReqCtx) => AdminTokenOutput;
103
+ refreshExpired: (ctx: ReqCtx) => Promise<RefreshOutput>;
104
+ adminToken: (ctx: ReqCtx) => Promise<AdminTokenOutput>;
96
105
  optionalAccessOrAdminToken: (ctx: ReqCtx) => Promise<AccessOutput | AdminTokenOutput | NullOutput>;
97
- userDidAuth: (reqCtx: ReqCtx) => Promise<UserDidOutput>;
98
- userDidAuthOptional: (reqCtx: ReqCtx) => Promise<UserDidOutput | NullOutput>;
99
- modService: (reqCtx: ReqCtx) => Promise<ModServiceOutput>;
100
- moderator: (reqCtx: ReqCtx) => Promise<AdminTokenOutput | ModServiceOutput>;
101
- validateBearerToken(req: express.Request, scopes: AuthScope[], verifyOptions?: jose.JWTVerifyOptions): Promise<ValidatedBearer>;
102
- validateAccessToken(req: express.Request, scopes: AuthScope[], opts?: {
106
+ userDidAuth: (ctx: ReqCtx) => Promise<UserDidOutput>;
107
+ userDidAuthOptional: (ctx: ReqCtx) => Promise<UserDidOutput | NullOutput>;
108
+ modService: (ctx: ReqCtx) => Promise<ModServiceOutput>;
109
+ moderator: (ctx: ReqCtx) => Promise<AdminTokenOutput | ModServiceOutput>;
110
+ protected validateAdminToken({ req, }: ReqCtx): Promise<AdminTokenOutput>;
111
+ protected validateRefreshToken(ctx: ReqCtx, verifyOptions?: Omit<jose.JWTVerifyOptions, 'audience'>): Promise<ValidatedRefreshBearer>;
112
+ protected validateBearerToken(ctx: ReqCtx, scopes: AuthScope[], verifyOptions?: jose.JWTVerifyOptions): Promise<ValidatedBearer>;
113
+ protected validateAccessToken(ctx: ReqCtx, scopes: AuthScope[], { checkTakedown, checkDeactivated, }?: {
103
114
  checkTakedown?: boolean;
104
115
  checkDeactivated?: boolean;
105
116
  }): Promise<AccessOutput>;
106
- verifyServiceJwt(reqCtx: ReqCtx, opts: {
117
+ protected validateDpopAccessToken(ctx: ReqCtx, scopes: AuthScope[]): Promise<AccessOutput>;
118
+ protected validateBearerAccessToken(ctx: ReqCtx, scopes: AuthScope[]): Promise<AccessOutput>;
119
+ protected verifyServiceJwt(ctx: ReqCtx, opts: {
107
120
  aud: string | null;
108
121
  iss: string[] | null;
109
122
  }): Promise<{
110
123
  iss: string;
111
124
  aud: string;
112
125
  }>;
113
- null(): NullOutput;
126
+ protected null(ctx: ReqCtx): NullOutput;
114
127
  isUserOrAdmin(auth: AccessOutput | AdminTokenOutput | NullOutput, did: string): boolean;
128
+ protected jwtVerify(token: string, verifyOptions?: jose.JWTVerifyOptions): Promise<jose.JWTVerifyResult<jose.JWTPayload>>;
129
+ protected setAuthHeaders({ res }: ReqCtx): void;
130
+ }
131
+ declare enum AuthType {
132
+ BASIC = "Basic",
133
+ BEARER = "Bearer",
134
+ DPOP = "DPoP"
115
135
  }
116
- export declare const parseBasicAuth: (token: string) => {
136
+ export declare const parseAuthorizationHeader: (authorization?: string) => [type: null] | [type: AuthType, token: string];
137
+ export declare const parseBasicAuth: (authorizationHeader?: string) => {
117
138
  username: string;
118
139
  password: string;
119
140
  } | null;
@@ -1 +1 @@
1
- {"version":3,"file":"auth-verifier.d.ts","sourceRoot":"","sources":["../src/auth-verifier.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAoC,MAAM,aAAa,CAAA;AAOzE,OAAO,EAAE,UAAU,EAA0B,MAAM,mBAAmB,CAAA;AAEtE,OAAO,OAAO,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