firebase-admin-edge 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (445) hide show
  1. package/README.md +102 -405
  2. package/dist/app-check/app-check-endpoints.d.ts +31 -0
  3. package/dist/app-check/app-check-endpoints.d.ts.map +1 -0
  4. package/dist/app-check/app-check-endpoints.js +75 -0
  5. package/dist/app-check/app-check-endpoints.js.map +1 -0
  6. package/dist/app-check/app-check-jwt.d.ts +16 -0
  7. package/dist/app-check/app-check-jwt.d.ts.map +1 -0
  8. package/dist/app-check/app-check-jwt.js +59 -0
  9. package/dist/app-check/app-check-jwt.js.map +1 -0
  10. package/dist/app-check/app-check.d.ts +43 -0
  11. package/dist/app-check/app-check.d.ts.map +1 -0
  12. package/dist/app-check/app-check.js +141 -0
  13. package/dist/app-check/app-check.js.map +1 -0
  14. package/dist/auth/auth-blocking-types.d.ts +44 -0
  15. package/dist/auth/auth-blocking-types.d.ts.map +1 -0
  16. package/dist/auth/auth-blocking-types.js +2 -0
  17. package/dist/auth/auth-blocking-types.js.map +1 -0
  18. package/dist/auth/auth-config-types.d.ts +146 -0
  19. package/dist/auth/auth-config-types.d.ts.map +1 -0
  20. package/dist/auth/auth-config-types.js +2 -0
  21. package/dist/auth/auth-config-types.js.map +1 -0
  22. package/dist/auth/auth-config.d.ts +15 -0
  23. package/dist/auth/auth-config.d.ts.map +1 -0
  24. package/dist/auth/auth-config.js +413 -0
  25. package/dist/auth/auth-config.js.map +1 -0
  26. package/dist/auth/auth-emulator.d.ts +7 -0
  27. package/dist/auth/auth-emulator.d.ts.map +1 -0
  28. package/dist/auth/auth-emulator.js +24 -0
  29. package/dist/auth/auth-emulator.js.map +1 -0
  30. package/dist/auth/auth-endpoint-errors.d.ts +2 -0
  31. package/dist/auth/auth-endpoint-errors.d.ts.map +1 -1
  32. package/dist/auth/auth-endpoint-errors.js +20 -1
  33. package/dist/auth/auth-endpoint-errors.js.map +1 -1
  34. package/dist/auth/auth-error-codes.d.ts +12 -0
  35. package/dist/auth/auth-error-codes.d.ts.map +1 -1
  36. package/dist/auth/auth-error-codes.js +12 -0
  37. package/dist/auth/auth-error-codes.js.map +1 -1
  38. package/dist/auth/email-action-request.d.ts +40 -0
  39. package/dist/auth/email-action-request.d.ts.map +1 -0
  40. package/dist/auth/email-action-request.js +80 -0
  41. package/dist/auth/email-action-request.js.map +1 -0
  42. package/dist/auth/email-link.d.ts +24 -0
  43. package/dist/auth/email-link.d.ts.map +1 -0
  44. package/dist/auth/email-link.js +103 -0
  45. package/dist/auth/email-link.js.map +1 -0
  46. package/dist/auth/firebase-admin-auth.d.ts +60 -12
  47. package/dist/auth/firebase-admin-auth.d.ts.map +1 -1
  48. package/dist/auth/firebase-admin-auth.js +455 -64
  49. package/dist/auth/firebase-admin-auth.js.map +1 -1
  50. package/dist/auth/firebase-auth-endpoints.d.ts +94 -4
  51. package/dist/auth/firebase-auth-endpoints.d.ts.map +1 -1
  52. package/dist/auth/firebase-auth-endpoints.js +304 -64
  53. package/dist/auth/firebase-auth-endpoints.js.map +1 -1
  54. package/dist/auth/firebase-auth.d.ts +78 -4
  55. package/dist/auth/firebase-auth.d.ts.map +1 -1
  56. package/dist/auth/firebase-auth.js +101 -8
  57. package/dist/auth/firebase-auth.js.map +1 -1
  58. package/dist/auth/firebase-jwt.d.ts +19 -10
  59. package/dist/auth/firebase-jwt.d.ts.map +1 -1
  60. package/dist/auth/firebase-jwt.js +176 -39
  61. package/dist/auth/firebase-jwt.js.map +1 -1
  62. package/dist/auth/firebase-types.d.ts +3 -0
  63. package/dist/auth/firebase-types.d.ts.map +1 -1
  64. package/dist/auth/google-oauth.d.ts +0 -1
  65. package/dist/auth/google-oauth.d.ts.map +1 -1
  66. package/dist/auth/google-oauth.js +16 -86
  67. package/dist/auth/google-oauth.js.map +1 -1
  68. package/dist/auth/project-config-manager.d.ts +10 -0
  69. package/dist/auth/project-config-manager.d.ts.map +1 -0
  70. package/dist/auth/project-config-manager.js +22 -0
  71. package/dist/auth/project-config-manager.js.map +1 -0
  72. package/dist/auth/provider-credential.d.ts +43 -0
  73. package/dist/auth/provider-credential.d.ts.map +1 -0
  74. package/dist/auth/provider-credential.js +107 -0
  75. package/dist/auth/provider-credential.js.map +1 -0
  76. package/dist/auth/provider-session.d.ts +10 -0
  77. package/dist/auth/provider-session.d.ts.map +1 -0
  78. package/dist/auth/provider-session.js +28 -0
  79. package/dist/auth/provider-session.js.map +1 -0
  80. package/dist/auth/tenant-manager.d.ts +17 -0
  81. package/dist/auth/tenant-manager.d.ts.map +1 -0
  82. package/dist/auth/tenant-manager.js +59 -0
  83. package/dist/auth/tenant-manager.js.map +1 -0
  84. package/dist/auth/user-batch.d.ts +21 -0
  85. package/dist/auth/user-batch.d.ts.map +1 -0
  86. package/dist/auth/user-batch.js +49 -0
  87. package/dist/auth/user-batch.js.map +1 -0
  88. package/dist/auth/user-import.d.ts +55 -0
  89. package/dist/auth/user-import.d.ts.map +1 -0
  90. package/dist/auth/user-import.js +208 -0
  91. package/dist/auth/user-import.js.map +1 -0
  92. package/dist/auth/user-request.d.ts +10 -0
  93. package/dist/auth/user-request.d.ts.map +1 -1
  94. package/dist/auth/user-request.js +56 -0
  95. package/dist/auth/user-request.js.map +1 -1
  96. package/dist/db/aggregate.d.ts +49 -0
  97. package/dist/db/aggregate.d.ts.map +1 -0
  98. package/dist/db/aggregate.js +115 -0
  99. package/dist/db/aggregate.js.map +1 -0
  100. package/dist/db/bulk-writer.d.ts +55 -0
  101. package/dist/db/bulk-writer.d.ts.map +1 -0
  102. package/dist/db/bulk-writer.js +257 -0
  103. package/dist/db/bulk-writer.js.map +1 -0
  104. package/dist/db/bundle-builder.d.ts +17 -0
  105. package/dist/db/bundle-builder.d.ts.map +1 -0
  106. package/dist/db/bundle-builder.js +118 -0
  107. package/dist/db/bundle-builder.js.map +1 -0
  108. package/dist/db/bytes.d.ts +12 -0
  109. package/dist/db/bytes.d.ts.map +1 -0
  110. package/dist/db/bytes.js +49 -0
  111. package/dist/db/bytes.js.map +1 -0
  112. package/dist/db/collection-group.d.ts +14 -0
  113. package/dist/db/collection-group.d.ts.map +1 -0
  114. package/dist/db/collection-group.js +43 -0
  115. package/dist/db/collection-group.js.map +1 -0
  116. package/dist/db/collection-reference.d.ts +21 -0
  117. package/dist/db/collection-reference.d.ts.map +1 -0
  118. package/dist/db/collection-reference.js +46 -0
  119. package/dist/db/collection-reference.js.map +1 -0
  120. package/dist/db/document-reference.d.ts +41 -0
  121. package/dist/db/document-reference.d.ts.map +1 -0
  122. package/dist/db/document-reference.js +125 -0
  123. package/dist/db/document-reference.js.map +1 -0
  124. package/dist/db/document-snapshot.d.ts +31 -0
  125. package/dist/db/document-snapshot.d.ts.map +1 -0
  126. package/dist/db/document-snapshot.js +103 -0
  127. package/dist/db/document-snapshot.js.map +1 -0
  128. package/dist/db/explain.d.ts +28 -0
  129. package/dist/db/explain.d.ts.map +1 -0
  130. package/dist/db/explain.js +61 -0
  131. package/dist/db/explain.js.map +1 -0
  132. package/dist/db/field-path.d.ts +10 -0
  133. package/dist/db/field-path.d.ts.map +1 -0
  134. package/dist/db/field-path.js +65 -0
  135. package/dist/db/field-path.js.map +1 -0
  136. package/dist/db/field-value.d.ts +17 -0
  137. package/dist/db/field-value.d.ts.map +1 -0
  138. package/dist/db/field-value.js +57 -0
  139. package/dist/db/field-value.js.map +1 -0
  140. package/dist/db/filter.d.ts +20 -0
  141. package/dist/db/filter.d.ts.map +1 -0
  142. package/dist/db/filter.js +48 -0
  143. package/dist/db/filter.js.map +1 -0
  144. package/dist/db/firestore-converter.d.ts +11 -0
  145. package/dist/db/firestore-converter.d.ts.map +1 -0
  146. package/dist/db/firestore-converter.js +14 -0
  147. package/dist/db/firestore-converter.js.map +1 -0
  148. package/dist/db/firestore-document.d.ts +62 -0
  149. package/dist/db/firestore-document.d.ts.map +1 -0
  150. package/dist/db/firestore-document.js +238 -0
  151. package/dist/db/firestore-document.js.map +1 -0
  152. package/dist/db/firestore-endpoints.d.ts +41 -0
  153. package/dist/db/firestore-endpoints.d.ts.map +1 -0
  154. package/dist/db/firestore-endpoints.js +735 -0
  155. package/dist/db/firestore-endpoints.js.map +1 -0
  156. package/dist/db/firestore-error-codes.d.ts +24 -0
  157. package/dist/db/firestore-error-codes.d.ts.map +1 -0
  158. package/dist/db/firestore-error-codes.js +24 -0
  159. package/dist/db/firestore-error-codes.js.map +1 -0
  160. package/dist/db/firestore-logging.d.ts +23 -0
  161. package/dist/db/firestore-logging.d.ts.map +1 -0
  162. package/dist/db/firestore-logging.js +41 -0
  163. package/dist/db/firestore-logging.js.map +1 -0
  164. package/dist/db/firestore-path.d.ts +4 -0
  165. package/dist/db/firestore-path.d.ts.map +1 -0
  166. package/dist/db/firestore-path.js +37 -0
  167. package/dist/db/firestore-path.js.map +1 -0
  168. package/dist/db/firestore-results.d.ts +12 -0
  169. package/dist/db/firestore-results.d.ts.map +1 -0
  170. package/dist/db/firestore-results.js +19 -0
  171. package/dist/db/firestore-results.js.map +1 -0
  172. package/dist/db/firestore-settings.d.ts +22 -0
  173. package/dist/db/firestore-settings.d.ts.map +1 -0
  174. package/dist/db/firestore-settings.js +83 -0
  175. package/dist/db/firestore-settings.js.map +1 -0
  176. package/dist/db/firestore-telemetry.d.ts +21 -0
  177. package/dist/db/firestore-telemetry.d.ts.map +1 -0
  178. package/dist/db/firestore-telemetry.js +84 -0
  179. package/dist/db/firestore-telemetry.js.map +1 -0
  180. package/dist/db/firestore-types.d.ts +25 -0
  181. package/dist/db/firestore-types.d.ts.map +1 -0
  182. package/dist/db/firestore-types.js +2 -0
  183. package/dist/db/firestore-types.js.map +1 -0
  184. package/dist/db/firestore.d.ts +151 -0
  185. package/dist/db/firestore.d.ts.map +1 -0
  186. package/dist/db/firestore.js +505 -0
  187. package/dist/db/firestore.js.map +1 -0
  188. package/dist/db/geo-point.d.ts +11 -0
  189. package/dist/db/geo-point.d.ts.map +1 -0
  190. package/dist/db/geo-point.js +29 -0
  191. package/dist/db/geo-point.js.map +1 -0
  192. package/dist/db/json-stream.d.ts +3 -0
  193. package/dist/db/json-stream.d.ts.map +1 -0
  194. package/dist/db/json-stream.js +117 -0
  195. package/dist/db/json-stream.js.map +1 -0
  196. package/dist/db/pipeline-expression.d.ts +293 -0
  197. package/dist/db/pipeline-expression.d.ts.map +1 -0
  198. package/dist/db/pipeline-expression.js +1436 -0
  199. package/dist/db/pipeline-expression.js.map +1 -0
  200. package/dist/db/pipeline-query.d.ts +6 -0
  201. package/dist/db/pipeline-query.d.ts.map +1 -0
  202. package/dist/db/pipeline-query.js +91 -0
  203. package/dist/db/pipeline-query.js.map +1 -0
  204. package/dist/db/pipeline.d.ts +120 -0
  205. package/dist/db/pipeline.d.ts.map +1 -0
  206. package/dist/db/pipeline.js +396 -0
  207. package/dist/db/pipeline.js.map +1 -0
  208. package/dist/db/query-document-snapshot.d.ts +2 -0
  209. package/dist/db/query-document-snapshot.d.ts.map +1 -0
  210. package/dist/db/query-document-snapshot.js +2 -0
  211. package/dist/db/query-document-snapshot.js.map +1 -0
  212. package/dist/db/query-partition.d.ts +14 -0
  213. package/dist/db/query-partition.d.ts.map +1 -0
  214. package/dist/db/query-partition.js +32 -0
  215. package/dist/db/query-partition.js.map +1 -0
  216. package/dist/db/query-request.d.ts +96 -0
  217. package/dist/db/query-request.d.ts.map +1 -0
  218. package/dist/db/query-request.js +283 -0
  219. package/dist/db/query-request.js.map +1 -0
  220. package/dist/db/query.d.ts +129 -0
  221. package/dist/db/query.d.ts.map +1 -0
  222. package/dist/db/query.js +468 -0
  223. package/dist/db/query.js.map +1 -0
  224. package/dist/db/recursive-delete.d.ts +6 -0
  225. package/dist/db/recursive-delete.d.ts.map +1 -0
  226. package/dist/db/recursive-delete.js +38 -0
  227. package/dist/db/recursive-delete.js.map +1 -0
  228. package/dist/db/snapshot-listener.d.ts +10 -0
  229. package/dist/db/snapshot-listener.d.ts.map +1 -0
  230. package/dist/db/snapshot-listener.js +71 -0
  231. package/dist/db/snapshot-listener.js.map +1 -0
  232. package/dist/db/timestamp.d.ts +29 -0
  233. package/dist/db/timestamp.d.ts.map +1 -0
  234. package/dist/db/timestamp.js +98 -0
  235. package/dist/db/timestamp.js.map +1 -0
  236. package/dist/db/transaction.d.ts +44 -0
  237. package/dist/db/transaction.d.ts.map +1 -0
  238. package/dist/db/transaction.js +177 -0
  239. package/dist/db/transaction.js.map +1 -0
  240. package/dist/db/value-equality.d.ts +3 -0
  241. package/dist/db/value-equality.d.ts.map +1 -0
  242. package/dist/db/value-equality.js +29 -0
  243. package/dist/db/value-equality.js.map +1 -0
  244. package/dist/db/vector-query.d.ts +38 -0
  245. package/dist/db/vector-query.d.ts.map +1 -0
  246. package/dist/db/vector-query.js +110 -0
  247. package/dist/db/vector-query.js.map +1 -0
  248. package/dist/db/vector-value.d.ts +8 -0
  249. package/dist/db/vector-value.d.ts.map +1 -0
  250. package/dist/db/vector-value.js +25 -0
  251. package/dist/db/vector-value.js.map +1 -0
  252. package/dist/db/write-batch.d.ts +25 -0
  253. package/dist/db/write-batch.d.ts.map +1 -0
  254. package/dist/db/write-batch.js +72 -0
  255. package/dist/db/write-batch.js.map +1 -0
  256. package/dist/db/write-request.d.ts +36 -0
  257. package/dist/db/write-request.d.ts.map +1 -0
  258. package/dist/db/write-request.js +257 -0
  259. package/dist/db/write-request.js.map +1 -0
  260. package/dist/firebase-edge-server.d.ts +143 -36
  261. package/dist/firebase-edge-server.d.ts.map +1 -1
  262. package/dist/firebase-edge-server.js +466 -257
  263. package/dist/firebase-edge-server.js.map +1 -1
  264. package/dist/index.d.ts +6 -0
  265. package/dist/index.d.ts.map +1 -1
  266. package/dist/index.js +5 -0
  267. package/dist/index.js.map +1 -1
  268. package/dist/rest-fetch.d.ts +1 -1
  269. package/dist/rest-fetch.d.ts.map +1 -1
  270. package/dist/storage/storage-acl.d.ts +48 -0
  271. package/dist/storage/storage-acl.d.ts.map +1 -0
  272. package/dist/storage/storage-acl.js +101 -0
  273. package/dist/storage/storage-acl.js.map +1 -0
  274. package/dist/storage/storage-bucket-endpoints.d.ts +10 -0
  275. package/dist/storage/storage-bucket-endpoints.d.ts.map +1 -0
  276. package/dist/storage/storage-bucket-endpoints.js +514 -0
  277. package/dist/storage/storage-bucket-endpoints.js.map +1 -0
  278. package/dist/storage/storage-bucket-types.d.ts +183 -0
  279. package/dist/storage/storage-bucket-types.d.ts.map +1 -0
  280. package/dist/storage/storage-bucket-types.js +2 -0
  281. package/dist/storage/storage-bucket-types.js.map +1 -0
  282. package/dist/storage/storage-bucket.d.ts +122 -0
  283. package/dist/storage/storage-bucket.d.ts.map +1 -0
  284. package/dist/storage/storage-bucket.js +544 -0
  285. package/dist/storage/storage-bucket.js.map +1 -0
  286. package/dist/storage/storage-channel.d.ts +10 -0
  287. package/dist/storage/storage-channel.d.ts.map +1 -0
  288. package/dist/storage/storage-channel.js +15 -0
  289. package/dist/storage/storage-channel.js.map +1 -0
  290. package/dist/storage/storage-checksum.d.ts +35 -0
  291. package/dist/storage/storage-checksum.d.ts.map +1 -0
  292. package/dist/storage/storage-checksum.js +312 -0
  293. package/dist/storage/storage-checksum.js.map +1 -0
  294. package/dist/storage/storage-endpoints.d.ts +14 -0
  295. package/dist/storage/storage-endpoints.d.ts.map +1 -0
  296. package/dist/storage/storage-endpoints.js +721 -0
  297. package/dist/storage/storage-endpoints.js.map +1 -0
  298. package/dist/storage/storage-file.d.ts +126 -0
  299. package/dist/storage/storage-file.d.ts.map +1 -0
  300. package/dist/storage/storage-file.js +604 -0
  301. package/dist/storage/storage-file.js.map +1 -0
  302. package/dist/storage/storage-hmac-key.d.ts +26 -0
  303. package/dist/storage/storage-hmac-key.d.ts.map +1 -0
  304. package/dist/storage/storage-hmac-key.js +45 -0
  305. package/dist/storage/storage-hmac-key.js.map +1 -0
  306. package/dist/storage/storage-iam.d.ts +20 -0
  307. package/dist/storage/storage-iam.d.ts.map +1 -0
  308. package/dist/storage/storage-iam.js +43 -0
  309. package/dist/storage/storage-iam.js.map +1 -0
  310. package/dist/storage/storage-md5.d.ts +11 -0
  311. package/dist/storage/storage-md5.d.ts.map +1 -0
  312. package/dist/storage/storage-md5.js +96 -0
  313. package/dist/storage/storage-md5.js.map +1 -0
  314. package/dist/storage/storage-notification.d.ts +24 -0
  315. package/dist/storage/storage-notification.d.ts.map +1 -0
  316. package/dist/storage/storage-notification.js +40 -0
  317. package/dist/storage/storage-notification.js.map +1 -0
  318. package/dist/storage/storage-progress.d.ts +4 -0
  319. package/dist/storage/storage-progress.d.ts.map +1 -0
  320. package/dist/storage/storage-progress.js +17 -0
  321. package/dist/storage/storage-progress.js.map +1 -0
  322. package/dist/storage/storage-reference-endpoints.d.ts +63 -0
  323. package/dist/storage/storage-reference-endpoints.d.ts.map +1 -0
  324. package/dist/storage/storage-reference-endpoints.js +276 -0
  325. package/dist/storage/storage-reference-endpoints.js.map +1 -0
  326. package/dist/storage/storage-reference-helpers.d.ts +12 -0
  327. package/dist/storage/storage-reference-helpers.d.ts.map +1 -0
  328. package/dist/storage/storage-reference-helpers.js +72 -0
  329. package/dist/storage/storage-reference-helpers.js.map +1 -0
  330. package/dist/storage/storage-reference-signing.d.ts +40 -0
  331. package/dist/storage/storage-reference-signing.d.ts.map +1 -0
  332. package/dist/storage/storage-reference-signing.js +289 -0
  333. package/dist/storage/storage-reference-signing.js.map +1 -0
  334. package/dist/storage/storage-reference-types.d.ts +76 -0
  335. package/dist/storage/storage-reference-types.d.ts.map +1 -0
  336. package/dist/storage/storage-reference-types.js +2 -0
  337. package/dist/storage/storage-reference-types.js.map +1 -0
  338. package/dist/storage/storage-results.d.ts +8 -0
  339. package/dist/storage/storage-results.d.ts.map +1 -0
  340. package/dist/storage/storage-results.js +32 -0
  341. package/dist/storage/storage-results.js.map +1 -0
  342. package/dist/storage/storage-resumable.d.ts +18 -0
  343. package/dist/storage/storage-resumable.d.ts.map +1 -0
  344. package/dist/storage/storage-resumable.js +166 -0
  345. package/dist/storage/storage-resumable.js.map +1 -0
  346. package/dist/storage/storage-retry.d.ts +9 -0
  347. package/dist/storage/storage-retry.d.ts.map +1 -0
  348. package/dist/storage/storage-retry.js +104 -0
  349. package/dist/storage/storage-retry.js.map +1 -0
  350. package/dist/storage/storage-signed-url.d.ts +9 -0
  351. package/dist/storage/storage-signed-url.d.ts.map +1 -0
  352. package/dist/storage/storage-signed-url.js +96 -0
  353. package/dist/storage/storage-signed-url.js.map +1 -0
  354. package/dist/storage/storage-special-endpoints.d.ts +10 -0
  355. package/dist/storage/storage-special-endpoints.d.ts.map +1 -0
  356. package/dist/storage/storage-special-endpoints.js +394 -0
  357. package/dist/storage/storage-special-endpoints.js.map +1 -0
  358. package/dist/storage/storage-special-types.d.ts +154 -0
  359. package/dist/storage/storage-special-types.d.ts.map +1 -0
  360. package/dist/storage/storage-special-types.js +2 -0
  361. package/dist/storage/storage-special-types.js.map +1 -0
  362. package/dist/storage/storage-types.d.ts +251 -0
  363. package/dist/storage/storage-types.d.ts.map +1 -0
  364. package/dist/storage/storage-types.js +2 -0
  365. package/dist/storage/storage-types.js.map +1 -0
  366. package/dist/storage/storage-upload-stream.d.ts +41 -0
  367. package/dist/storage/storage-upload-stream.d.ts.map +1 -0
  368. package/dist/storage/storage-upload-stream.js +335 -0
  369. package/dist/storage/storage-upload-stream.js.map +1 -0
  370. package/dist/storage/storage-xml-signing.d.ts +17 -0
  371. package/dist/storage/storage-xml-signing.d.ts.map +1 -0
  372. package/dist/storage/storage-xml-signing.js +144 -0
  373. package/dist/storage/storage-xml-signing.js.map +1 -0
  374. package/dist/storage/storage.d.ts +152 -0
  375. package/dist/storage/storage.d.ts.map +1 -0
  376. package/dist/storage/storage.js +532 -0
  377. package/dist/storage/storage.js.map +1 -0
  378. package/dist/utils/token-cache.d.ts.map +1 -1
  379. package/dist/utils/token-cache.js +3 -2
  380. package/dist/utils/token-cache.js.map +1 -1
  381. package/package.json +22 -6
  382. package/dist/auth/auth-endpoint-errors.test.d.ts +0 -2
  383. package/dist/auth/auth-endpoint-errors.test.d.ts.map +0 -1
  384. package/dist/auth/auth-endpoint-errors.test.js +0 -411
  385. package/dist/auth/auth-endpoint-errors.test.js.map +0 -1
  386. package/dist/auth/errors.test.d.ts +0 -2
  387. package/dist/auth/errors.test.d.ts.map +0 -1
  388. package/dist/auth/errors.test.js +0 -123
  389. package/dist/auth/errors.test.js.map +0 -1
  390. package/dist/auth/firebase-admin-auth.test.d.ts +0 -2
  391. package/dist/auth/firebase-admin-auth.test.d.ts.map +0 -1
  392. package/dist/auth/firebase-admin-auth.test.js +0 -923
  393. package/dist/auth/firebase-admin-auth.test.js.map +0 -1
  394. package/dist/auth/firebase-auth-endpoints.test.d.ts +0 -2
  395. package/dist/auth/firebase-auth-endpoints.test.d.ts.map +0 -1
  396. package/dist/auth/firebase-auth-endpoints.test.js +0 -957
  397. package/dist/auth/firebase-auth-endpoints.test.js.map +0 -1
  398. package/dist/auth/firebase-auth.test.d.ts +0 -2
  399. package/dist/auth/firebase-auth.test.d.ts.map +0 -1
  400. package/dist/auth/firebase-auth.test.js +0 -167
  401. package/dist/auth/firebase-auth.test.js.map +0 -1
  402. package/dist/auth/firebase-jwt.test.d.ts +0 -2
  403. package/dist/auth/firebase-jwt.test.d.ts.map +0 -1
  404. package/dist/auth/firebase-jwt.test.js +0 -164
  405. package/dist/auth/firebase-jwt.test.js.map +0 -1
  406. package/dist/auth/github-oauth.d.ts +0 -19
  407. package/dist/auth/github-oauth.d.ts.map +0 -1
  408. package/dist/auth/github-oauth.js +0 -145
  409. package/dist/auth/github-oauth.js.map +0 -1
  410. package/dist/auth/github-oauth.test.d.ts +0 -2
  411. package/dist/auth/github-oauth.test.d.ts.map +0 -1
  412. package/dist/auth/github-oauth.test.js +0 -202
  413. package/dist/auth/github-oauth.test.js.map +0 -1
  414. package/dist/auth/google-oauth.test.d.ts +0 -2
  415. package/dist/auth/google-oauth.test.d.ts.map +0 -1
  416. package/dist/auth/google-oauth.test.js +0 -200
  417. package/dist/auth/google-oauth.test.js.map +0 -1
  418. package/dist/auth/oauth.d.ts +0 -3
  419. package/dist/auth/oauth.d.ts.map +0 -1
  420. package/dist/auth/oauth.js +0 -48
  421. package/dist/auth/oauth.js.map +0 -1
  422. package/dist/auth/oauth.test.d.ts +0 -2
  423. package/dist/auth/oauth.test.d.ts.map +0 -1
  424. package/dist/auth/oauth.test.js +0 -109
  425. package/dist/auth/oauth.test.js.map +0 -1
  426. package/dist/auth/user-record.test.d.ts +0 -2
  427. package/dist/auth/user-record.test.d.ts.map +0 -1
  428. package/dist/auth/user-record.test.js +0 -198
  429. package/dist/auth/user-record.test.js.map +0 -1
  430. package/dist/auth/user-request.test.d.ts +0 -2
  431. package/dist/auth/user-request.test.d.ts.map +0 -1
  432. package/dist/auth/user-request.test.js +0 -269
  433. package/dist/auth/user-request.test.js.map +0 -1
  434. package/dist/firebase-edge-errors.test.d.ts +0 -2
  435. package/dist/firebase-edge-errors.test.d.ts.map +0 -1
  436. package/dist/firebase-edge-errors.test.js +0 -72
  437. package/dist/firebase-edge-errors.test.js.map +0 -1
  438. package/dist/firebase-edge-server.test.d.ts +0 -2
  439. package/dist/firebase-edge-server.test.d.ts.map +0 -1
  440. package/dist/firebase-edge-server.test.js +0 -264
  441. package/dist/firebase-edge-server.test.js.map +0 -1
  442. package/dist/rest-fetch.test.d.ts +0 -2
  443. package/dist/rest-fetch.test.d.ts.map +0 -1
  444. package/dist/rest-fetch.test.js +0 -164
  445. package/dist/rest-fetch.test.js.map +0 -1
package/README.md CHANGED
@@ -1,45 +1,56 @@
1
1
  # Firebase Admin Edge
2
2
 
3
- Lightweight helpers to use Firebase Admin features in edge runtimes and serverless
4
- environments. Built on top of the Firebase REST APIs, with `jose` for token signing
5
- and verification.
3
+ Use Firebase Authentication, Firestore, Cloud Storage, and App Check from your
4
+ server or edge runtime. `firebase-admin-edge` is a TypeScript library built on
5
+ Firebase REST APIs, standard web APIs, and `jose` for token signing and verification.
6
6
 
7
- Supported runtimes:
8
-
9
- - Vercel Edge
10
- - Cloudflare Workers
11
- - Deno (Edge)
12
- - Bun
13
- - Node.js
7
+ Designed for Cloudflare Workers, Vercel Edge, Deno, Bun, and Node.js. Bring your
8
+ framework's cookie helpers to connect authentication to your app.
14
9
 
15
10
  ## Contents
16
11
 
17
- - [Setup](#setup)
18
- - [Sign in](#sign-in)
19
- - [Users and sessions](#users-and-sessions)
20
- - [Link and unlink accounts](#link-and-unlink-accounts)
21
- - [All server methods](#all-server-methods)
22
- - [Firebase Auth helpers](#firebase-auth-helpers)
23
12
  - [Features](#features)
24
- - [Planned work](#planned-work)
13
+ - [Installation](#installation)
14
+ - [Setup](#setup)
15
+ - [Demo](#demo)
16
+ - [Class Guides](#class-guides)
17
+ - [Auth Emulator](#auth-emulator)
18
+ - [Compatibility](#compatibility)
19
+ - [Contributing and Reporting Issues](#contributing-and-reporting-issues)
20
+ - [License](#license)
21
+
22
+ ## Features
23
+
24
+ - **Authentication:** Provider sign-in, magic links, session cookies, account
25
+ linking, and password reset flows.
26
+ - **User Administration:** Manage users, verify tokens, and configure projects
27
+ and authentication tenants.
28
+ - **Firestore:** Read and write documents, query collections, and use
29
+ transactions, batches, and document converters.
30
+ - **Cloud Storage:** Manage buckets and files, stream uploads and downloads,
31
+ and create signed URLs.
32
+ - **App Check:** Create and verify tokens, with replay protection support.
33
+ - **TypeScript:** Typed APIs with configurable cookies, token caching, and fetch.
25
34
 
26
35
  ## Installation
27
36
 
28
- ```bash
29
- npm i firebase-admin-edge
37
+ ```sh
38
+ npm install firebase-admin-edge
30
39
  ```
31
40
 
32
41
  ## Setup
33
42
 
34
- For user lookups, token checks, and sessions, see the
35
- [FirebaseAdminAuth guide](FIREBASE_ADMIN_AUTH.md).
43
+ You'll need a Firebase project, its web app configuration, and a service account.
44
+ Load the service account from your server's secret storage; keep it out of browser
45
+ code and source control.
46
+
47
+ Create the server API with cookie helpers for the current request. In this
48
+ example, `serviceAccount` is your loaded service-account object, and `getCookie`
49
+ and `setCookie` are supplied by your framework:
36
50
 
37
- ```typescript
51
+ ```ts
38
52
  import { createFirebaseEdgeServer } from 'firebase-admin-edge';
39
- import { getCookie, setCookie } from 'your-framework-library';
40
53
 
41
- // Load serviceAccount and client secrets from your server's secrets.
42
- // Cookie helpers must read and write cookies for the current request.
43
54
  const firebaseServer = createFirebaseEdgeServer({
44
55
  serviceAccount,
45
56
  firebaseConfig: {
@@ -47,416 +58,102 @@ const firebaseServer = createFirebaseEdgeServer({
47
58
  authDomain: 'your-project.firebaseapp.com',
48
59
  projectId: 'your-project-id'
49
60
  },
50
- providers: {
51
- google: {
52
- client_id: 'your-google-oauth-client-id',
53
- client_secret: 'your-google-oauth-client-secret'
54
- },
55
- github: {
56
- client_id: 'your-github-oauth-client-id',
57
- client_secret: 'your-github-oauth-client-secret'
58
- }
59
- },
60
61
  cookies: {
61
- // Provide your framework's cookie helpers
62
62
  getSession: (name) => getCookie(name),
63
63
  saveSession: (name, value, options) => setCookie(name, value, options)
64
64
  },
65
- // Optional: Custom session cookie name (defaults to '__session')
66
- cookieName: '__session',
67
- // Optional: Custom cookie options
68
- cookieOptions: {
69
- httpOnly: true,
70
- secure: true,
71
- sameSite: 'lax',
72
- path: '/',
73
- maxAge: 60 * 60 * 24 * 5 // 5 days
74
- },
75
- // OAuth callback URL (registered with your provider)
76
- redirectUri: 'https://example.com/auth/callback',
77
- // Optional: Tenant ID for multi-tenancy
78
- tenantId: 'your-tenant-id',
79
- // Optional: Automatically link accounts with same email
80
- autoLinkProviders: false
65
+ redirectUri: 'https://example.com/auth/callback'
81
66
  });
82
67
  ```
83
68
 
84
- Replace the cookie helpers and redirects in these examples with your framework's
85
- functions. Enable the providers you use in Firebase and register your callback URL
86
- with Google or GitHub.
87
-
88
- Optional settings:
89
-
90
- | Setting | Purpose |
91
- | -------------------- | ------------------------------------------------------------------------------------------- |
92
- | `cookieName` | Session cookie name. Defaults to `__session`. |
93
- | `cookieOptions` | Cookie settings. Defaults to secure, HTTP-only, `sameSite: 'lax'`, path `/`, and five days. |
94
- | `tenantId` | Select a Firebase Auth tenant. |
95
- | `autoLinkProviders` | Try to link accounts with the same email. Defaults to off. |
96
- | `fetch` | Supply your own HTTP request function. |
97
- | `cache`, `cacheName` | Supply token cache callbacks and a cache key. See [TokenCache](TOKEN_CACHE.md). |
98
-
99
- ## Sign in
100
-
101
- ### 1. Send the user to Google or GitHub
69
+ To start Google sign-in, enable Google in Firebase Console and authorize your
70
+ app's domain. Use HTTPS for the login and callback routes so the authentication
71
+ cookies can be sent.
102
72
 
103
73
  ```ts
104
- // Create an OAuth login URL for the `next` state.
105
- // `next` should be the URL or path to return to after successful login.
106
- const next = '/dashboard';
107
-
108
- // Generate provider-specific login URLs (server uses configured redirectUri)
109
- const loginUrlGoogle = await firebaseServer.getGoogleLoginURL(next);
110
- const loginUrlGithub = await firebaseServer.getGitHubLoginURL(next);
111
-
112
- // Redirect the user to the provider's login page
113
- redirect(302, loginUrlGoogle);
114
- ```
115
-
116
- These login methods clear the current session. Both accept an optional second
117
- argument with `customParameters` and `addScopes`. Google also accepts
118
- `languageCode`.
119
-
120
- ### 2. Handle the callback
121
-
122
- The callback completes sign-in, saves the session cookie, and returns the path to
123
- send the user back to.
124
-
125
- ```ts
126
- const { data: returnTo, error } = await firebaseServer.signInWithCallback(
127
- new URL(request.url)
74
+ const loginURL = await firebaseServer.getProviderLoginURL(
75
+ 'google',
76
+ '/dashboard'
128
77
  );
129
-
130
- if (error) {
131
- throw error;
132
- }
133
-
134
- redirect(302, returnTo || '/');
135
- ```
136
-
137
- ## Users and sessions
138
-
139
- ### Get the signed-in user
140
-
141
- ```ts
142
- const { data: user, error } = await firebaseServer.getUser();
143
-
144
- if (error) {
145
- throw error;
146
- }
147
-
148
- // user is null when there is no session. user.sub is the Firebase user ID.
78
+ // Redirect to loginURL using your framework.
149
79
  ```
150
80
 
151
- This returns the details inside the session token. To look up the full user
152
- record, use `firebaseServer.adminAuth.getUser(uid)`.
81
+ Your callback route completes sign-in and saves the session cookie. Follow the
82
+ [provider callback guide](docs/FIREBASE_EDGE_SERVER.md#provider-login-and-linking)
83
+ for the route implementation, or use the [demo](app-demo/README.md) as a working
84
+ example.
153
85
 
154
- ### Get Firebase tokens
86
+ The same server object exposes `auth`, `adminAuth`, `firestore`, `storage`, and
87
+ `appCheck`. See the [server guide](docs/FIREBASE_EDGE_SERVER.md) for configuration,
88
+ providers, session handling, and examples. For Storage, also set
89
+ `firebaseConfig.storageBucket` to your bucket name.
155
90
 
156
- Use this when you need a Firebase ID token and refresh token for the current user.
91
+ ## Demo
157
92
 
158
- ```ts
159
- const { data: tokens, error } = await firebaseServer.getToken();
93
+ The [SvelteKit demo](app-demo/README.md) shows Google and GitHub sign-in, magic
94
+ links, password resets, account linking, and Firestore reads. Its README covers
95
+ local setup and the required Firebase configuration.
160
96
 
161
- if (error) {
162
- throw error;
163
- }
97
+ ## Class Guides
164
98
 
165
- // tokens is null when there is no session.
166
- // Otherwise, it contains idToken, refreshToken, and expiresIn.
167
- ```
99
+ Start with the guide for the feature you're adding:
168
100
 
169
- ### Sign out
101
+ | Guide | What It Covers |
102
+ | ------------------------------------------------------------------------------ | ---------------------------------------------------------- |
103
+ | [Firebase Edge Server](docs/FIREBASE_EDGE_SERVER.md) | App setup, sign-in, callbacks, and sessions |
104
+ | [FirebaseAdminAuth](docs/FIREBASE_ADMIN_AUTH.md) | User management, token verification, and session cookies |
105
+ | [FirebaseAuth](docs/FIREBASE_AUTH.md) | Authentication operations and provider credentials |
106
+ | [Firestore](docs/FIRESTORE.md) | Documents, queries, transactions, and related class guides |
107
+ | [Storage](docs/STORAGE.md), [Bucket](docs/BUCKET.md), and [File](docs/FILE.md) | File transfers, signed URLs, and bucket administration |
108
+ | [AppCheck](docs/APP_CHECK.md) | Token creation, verification, and replay protection |
109
+ | [ProjectConfigManager](docs/PROJECT_CONFIG_MANAGER.md) | Project authentication settings |
110
+ | [TenantManager](docs/TENANT_MANAGER.md) | Tenant management and authentication |
111
+ | [TokenCache](docs/TOKEN_CACHE.md) | In-memory token caching |
112
+ | [FirebaseEdgeError](docs/FIREBASE_EDGE_ERROR.md) | Error codes, causes, and context |
170
113
 
171
- ```ts
172
- firebaseServer.signOut();
173
- redirect(302, '/');
174
- ```
114
+ See [Standalone Functions](docs/FUNCTIONS.md) for the function reference and
115
+ [Integration Testing](docs/INTEGRATION_TESTING.md) for local runtime checks and
116
+ live Firebase tests.
175
117
 
176
- This clears the session cookie. It does not revoke existing Firebase client tokens.
118
+ ## Auth Emulator
177
119
 
178
- ## Link and unlink accounts
120
+ For local authentication development, follow the
121
+ [Auth Emulator setup](docs/FIREBASE_EDGE_SERVER.md#auth-emulator). The guide covers
122
+ configuration and how emulator behavior differs from production.
179
123
 
180
- ### Link through Google or GitHub
124
+ ## Compatibility
181
125
 
182
- Start this flow while the user is signed in. Use the same callback handler shown
183
- in [Sign in](#2-handle-the-callback).
126
+ This package provides its own REST-based API and error conventions; it is not a
127
+ drop-in replacement for the Firebase Admin Node.js SDK. Check the guides when
128
+ porting existing code, especially for `{ error, data }` results and Web Streams.
184
129
 
185
- ```ts
186
- // 1) Start link: redirect to provider
187
- const next = '/dashboard';
188
- const linkURL = await firebaseServer.getGoogleLinkURL(next);
189
- // or: linkURL = await firebaseServer.getGitHubLinkURL(next);
190
- redirect(302, linkURL);
191
- ```
130
+ The [Firestore parity audit](docs/FIRESTORE_PARITY.md) and
131
+ [Storage compatibility checklist](docs/STORAGE_PARITY.md) describe the compared
132
+ API surfaces and runtime differences. The
133
+ [integration testing guide](docs/INTEGRATION_TESTING.md) documents the runtime
134
+ checks and their scope.
192
135
 
193
- ### Link with a provider token
136
+ ## Contributing and Reporting Issues
194
137
 
195
- If you already have a provider token, pass it directly. Use a Google ID token with
196
- `google.com`, or a GitHub access token with `github.com`.
138
+ Contributions are welcome! Open a pull request with bug fixes, improvements, or
139
+ documentation updates. For code changes, include relevant tests and usage examples.
197
140
 
198
- ```ts
199
- const { data, error } = await firebaseServer.linkProvider(
200
- githubAccessToken,
201
- 'github.com'
202
- );
141
+ To get started locally:
203
142
 
204
- if (error) {
205
- throw error;
206
- }
143
+ ```sh
144
+ npm install
145
+ npm run ci
207
146
  ```
208
147
 
209
- ### Unlink a provider
148
+ `npm run ci` builds the package, checks formatting, and runs the unit tests. See
149
+ [Integration Testing](docs/INTEGRATION_TESTING.md) for checks that need a Firebase
150
+ project or additional runtime tooling.
210
151
 
211
- ```ts
212
- const { error } = await firebaseServer.unlinkProvider('google.com');
152
+ If you run into a problem or have a feature request,
153
+ [open a GitHub issue](https://github.com/jdgamble555/firebase-admin-edge/issues).
154
+ For bugs, include your package version, runtime, steps to reproduce, and relevant
155
+ error messages. A small reproduction helps others investigate.
213
156
 
214
- if (error) {
215
- throw error;
216
- }
217
- ```
218
-
219
- ## All server methods
220
-
221
- These are all ten methods returned by `createFirebaseEdgeServer()`.
222
-
223
- | Method | What it does |
224
- | ------------------------------------------ | --------------------------------------------------- |
225
- | `getGoogleLoginURL(next, options?)` | Builds a Google login URL. |
226
- | `getGitHubLoginURL(next, options?)` | Builds a GitHub login URL. |
227
- | `signInWithCallback(url, expiresInMs?)` | Completes login or linking and saves the session. |
228
- | `getUser(checkRevoked?)` | Reads and checks the current session. |
229
- | `getToken()` | Creates Firebase login tokens for the current user. |
230
- | `signOut()` | Clears the session cookie. |
231
- | `getGoogleLinkURL(next, options?)` | Builds a Google account linking URL. |
232
- | `getGitHubLinkURL(next, options?)` | Builds a GitHub account linking URL. |
233
- | `linkProvider(providerToken, providerId)` | Links a provider using its token. |
234
- | `unlinkProvider(providerId, expiresInMs?)` | Removes a provider and replaces the session cookie. |
235
-
236
- URL methods return a string and can throw errors. `signOut()` returns nothing.
237
- The other methods return a result with `data` and/or `error`; check `error` first.
238
- Session durations are in milliseconds and default to five days.
239
-
240
- In the current implementation, `getUser(true)` also looks up the user, but does
241
- not check disabled status or revocation time. See the
242
- [session verification details](FIREBASE_ADMIN_AUTH.md#sessions).
243
-
244
- ## Firebase Auth helpers
245
-
246
- The server also exposes two helper objects:
247
-
248
- | Object | Use it for |
249
- | -------------------------- | ----------------------------------------------------------------------------------------------- |
250
- | `firebaseServer.auth` | Sign in with tokens and link or unlink providers using a Firebase ID token. |
251
- | `firebaseServer.adminAuth` | Look up users, verify tokens, create sessions, create custom tokens, and revoke refresh tokens. |
252
-
253
- ```ts
254
- const { data: user, error } = await firebaseServer.adminAuth.getUserByEmail(
255
- 'someone@example.com'
256
- );
257
-
258
- if (error) {
259
- throw error;
260
- }
261
- ```
262
-
263
- ### Create a user
264
-
265
- Create a user from your server. Firebase generates a UID unless you provide one:
266
-
267
- ```ts
268
- const { data: user, error } = await firebaseServer.adminAuth.createUser({
269
- email: 'jane@example.com',
270
- displayName: 'Jane Doe'
271
- });
272
-
273
- if (error) {
274
- throw error;
275
- }
276
-
277
- console.log(user.uid, user.email);
278
- ```
279
-
280
- You can also set `uid`, `password`, `phoneNumber`, `photoURL`, `emailVerified`,
281
- `disabled`, and phone-based `multiFactor` enrollments, using Firebase Admin's
282
- `CreateRequest` fields. An empty object creates a user with a generated UID.
283
-
284
- ### Update a user
285
-
286
- Pass the user's UID and only the fields you want to change:
287
-
288
- ```ts
289
- const { data: user, error } = await firebaseServer.adminAuth.updateUser(
290
- 'user-uid',
291
- {
292
- displayName: 'Jane Smith',
293
- photoURL: null
294
- }
295
- );
296
-
297
- if (error) {
298
- throw error;
299
- }
300
-
301
- console.log(user.uid, user.displayName);
302
- ```
303
-
304
- Use `null` to remove `displayName`, `photoURL`, or `phoneNumber`. Set `disabled`
305
- to `true` to disable the account, or `false` to enable it. Updates also support
306
- `providerToLink`, `providersToUnlink`, and replacing phone MFA enrollments with
307
- `multiFactor.enrolledFactors` (`null` or `[]` removes all enrolled factors).
308
-
309
- Create and update return the complete `UserRecord` after saving. Their
310
- `CreateRequest`, `UpdateRequest`, and `UserRecord` types can be imported from
311
- `firebase-admin-edge`.
312
-
313
- ### Delete a user
314
-
315
- Delete a single user by UID:
316
-
317
- ```ts
318
- const { error } = await firebaseServer.adminAuth.deleteUser('user-uid');
319
-
320
- if (error) {
321
- throw error;
322
- }
323
-
324
- console.log('User deleted');
325
- ```
326
-
327
- Deletion returns `{ data: undefined, error: null }` on success. All three
328
- methods return `{ data: null, error }` on failure and use the configured tenant
329
- when one is set. API errors are available through `error.cause`; a nonexistent
330
- UID is an error for update and delete.
331
-
332
- ### Get several users
333
-
334
- Look up specific users in one request, using a mix of identifiers:
335
-
336
- ```ts
337
- const { data, error } = await firebaseServer.adminAuth.getUsers([
338
- { uid: 'user-uid' },
339
- { email: 'jane@example.com' },
340
- { phoneNumber: '+15555550100' },
341
- { providerId: 'google.com', providerUid: 'google-user-id' }
342
- ]);
343
-
344
- if (error) {
345
- throw error;
346
- }
347
-
348
- console.table(data.users, ['uid', 'email', 'displayName']);
349
- console.log('Users not found:', data.notFound);
350
- ```
351
-
352
- Each call accepts up to 100 identifiers. `users` contains full user records;
353
- `notFound` contains the original identifiers that did not match a user. Missing
354
- users are not an error. Results are not guaranteed to follow the input order,
355
- and multiple identifiers can match the same user. An empty array returns empty
356
- results without a request. Lookups use the configured tenant, if any.
357
-
358
- The `UserIdentifier` and `GetUsersResult` types are exported from
359
- `firebase-admin-edge`.
360
-
361
- ### List users
362
-
363
- Load 25 users for the first page of a users table. Run this on your server:
364
-
365
- ```ts
366
- const { data, error } = await firebaseServer.adminAuth.listUsers(25);
367
-
368
- if (error) {
369
- throw error;
370
- }
371
-
372
- console.table(data.users, ['uid', 'email', 'displayName']);
373
- const nextPageToken = data.pageToken;
374
- ```
375
-
376
- Keep `nextPageToken` with your pagination state. When the user clicks **Next**,
377
- pass that token to your server and fetch the next 25 users:
378
-
379
- ```ts
380
- if (nextPageToken) {
381
- const { data, error } = await firebaseServer.adminAuth.listUsers(
382
- 25,
383
- nextPageToken
384
- );
385
-
386
- if (error) {
387
- throw error;
388
- }
389
-
390
- console.table(data.users, ['uid', 'email', 'displayName']);
391
- // Replace the displayed rows and save data.pageToken for the next click.
392
- }
393
- ```
394
-
395
- Disable **Next** when there is no `pageToken`. Passing `undefined` starts again
396
- from the first page.
397
-
398
- The page size defaults to 1000 and accepts integers from 1 to 1000. Each call
399
- returns `{ data, error }`, where `data` contains `users` and an optional
400
- `pageToken`. If you configured a tenant, only that tenant's users are returned.
401
- User records include Firebase Admin fields such as `uid`, `email`, `metadata`,
402
- and `customClaims`. Use `user.toJSON()` for a plain object.
403
-
404
- ## Class guides
405
-
406
- Each class has its own guide:
407
-
408
- - [FirebaseAdminAuth](FIREBASE_ADMIN_AUTH.md): user management, tokens, and sessions.
409
- - [FirebaseAuth](FIREBASE_AUTH.md): sign-in and provider linking.
410
- - [TokenCache](TOKEN_CACHE.md): in-memory caching.
411
- - [FirebaseEdgeError](FIREBASE_EDGE_ERROR.md): error codes, causes, and context.
412
-
413
- See [Standalone functions](FUNCTIONS.md) for the function reference.
414
-
415
- ## Features
157
+ ## License
416
158
 
417
- - ✅ **Edge Runtime Compatible** - Works in Vercel Edge, Cloudflare Workers, Deno, and Bun
418
- - ✅ **Lightweight** - Uses the fetch API and jose
419
- - ✅ **TypeScript Support** - Full type safety and IntelliSense
420
- - ✅ **Session Management** - Secure HTTP-only cookies
421
- - ✅ **OAuth Support** - Google and GitHub OAuth 2.0 flows
422
- - ✅ **Token Management** - Generate client tokens from server sessions
423
- - ✅ **Token Caching** - Optional caching for service account tokens (1-hour TTL)
424
- - ✅ **Multi-Tenancy** - Support for Firebase Auth tenant IDs
425
- - ✅ **Flexible Configuration** - Customizable cookie options and cache implementations
426
- - ✅ **Link and Unlink Providers** - Link and unlink oauth providers
427
-
428
- ## Planned work
429
-
430
- Some tasks below already have individual helpers. This list also tracks work to
431
- connect those helpers to the main server API.
432
-
433
- ### Firebase Auth
434
-
435
- - ☐ Magic Link Login (auto save email option)
436
- - ☐ Email / Password / Annonymous Login
437
- - ☐ Reset Password
438
- - ☐ Change Email
439
- - ☐ Get All Users with Order By and Pagination
440
- - ✅ Create User
441
- - ✅ Delete User
442
- - ✅ Update User
443
- - ☐ Add / Remove Custom Claims
444
- - ☐ Disable User (Ban User)
445
- - ☐ Add All Providers
446
- - ☐ Add App Check
447
- - ☐ Ban Users
448
- - ☐ RBAC
449
-
450
- ### Firestore
451
-
452
- - ☐ Get Document By ID
453
- - ☐ Create Document
454
- - ☐ Update Document (merge option)
455
- - ☐ Delete Document
456
- - ☐ Query Documents
457
-
458
- ### Firebase Storage
459
-
460
- - ☐ Create File
461
- - ☐ Delete File
462
- - ☐ Get File
159
+ [MIT](LICENSE)
@@ -0,0 +1,31 @@
1
+ /** @internal A reusable resolver with bounded caching and key rotation. */
2
+ export declare function createAppCheckKeyResolver(fetch: typeof globalThis.fetch): {
3
+ (protectedHeader?: import("jose").JWSHeaderParameters, token?: import("jose").FlattenedJWSInput): Promise<import("jose").CryptoKey>;
4
+ coolingDown: boolean;
5
+ fresh: boolean;
6
+ reloading: boolean;
7
+ reload: () => Promise<void>;
8
+ jwks: () => import("jose").JSONWebKeySet | undefined;
9
+ };
10
+ /** @internal Authenticated App Check operations. */
11
+ export declare function appCheckRequest(projectId: string, accessToken: string, operation: {
12
+ appId: string;
13
+ customToken: string;
14
+ limitedUse?: boolean;
15
+ jti?: string;
16
+ } | {
17
+ token: string;
18
+ }, fetch: typeof globalThis.fetch): Promise<{
19
+ token?: string;
20
+ ttl?: string;
21
+ alreadyConsumed?: boolean;
22
+ }>;
23
+ /** @internal Convert the exchange response's protobuf duration. */
24
+ export declare function parseAppCheckToken(data: {
25
+ token?: string;
26
+ ttl?: string;
27
+ }): {
28
+ token: string;
29
+ ttlMillis: number;
30
+ };
31
+ //# sourceMappingURL=app-check-endpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-check-endpoints.d.ts","sourceRoot":"","sources":["../../src/app-check/app-check-endpoints.ts"],"names":[],"mappings":"AAIA,2EAA2E;AAC3E,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK;;;;;;;EAOvE;AAED,oDAAoD;AACpD,wBAAsB,eAAe,CACjC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EACH;IACI,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB,GACD;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EACvB,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK;YAQhB,MAAM;UAAQ,MAAM;sBAAoB,OAAO;GAyChE;AAED,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE;;;EAoBxE"}
@@ -0,0 +1,75 @@
1
+ import { createRemoteJWKSet, customFetch } from 'jose';
2
+ import { restFetch } from '../rest-fetch.js';
3
+ import { FirebaseEdgeError } from '../auth/errors.js';
4
+ /** @internal A reusable resolver with bounded caching and key rotation. */
5
+ export function createAppCheckKeyResolver(fetch) {
6
+ return createRemoteJWKSet(new URL('https://firebaseappcheck.googleapis.com/v1/jwks'), {
7
+ [customFetch]: fetch
8
+ });
9
+ }
10
+ /** @internal Authenticated App Check operations. */
11
+ export async function appCheckRequest(projectId, accessToken, operation, fetch) {
12
+ const project = encodeURIComponent(projectId);
13
+ const exchange = 'appId' in operation;
14
+ const path = exchange
15
+ ? `v1/projects/${project}/apps/${encodeURIComponent(operation.appId)}:exchangeCustomToken`
16
+ : `v1beta/projects/${project}:verifyAppCheckToken`;
17
+ const { error, data } = await restFetch(`https://firebaseappcheck.googleapis.com/${path}`, {
18
+ method: 'POST',
19
+ bearerToken: accessToken,
20
+ body: exchange
21
+ ? {
22
+ customToken: operation.customToken,
23
+ ...(operation.limitedUse !== undefined && {
24
+ limitedUse: operation.limitedUse
25
+ }),
26
+ ...(operation.jti !== undefined && { jti: operation.jti })
27
+ }
28
+ : { app_check_token: operation.token },
29
+ global: { fetch }
30
+ });
31
+ if (error !== null) {
32
+ const status = typeof error === 'object' ? error?.error?.status : undefined;
33
+ const codes = {
34
+ INVALID_ARGUMENT: 'invalid-argument',
35
+ PERMISSION_DENIED: 'permission-denied',
36
+ UNAUTHENTICATED: 'unauthenticated',
37
+ NOT_FOUND: 'not-found',
38
+ RESOURCE_EXHAUSTED: 'resource-exhausted'
39
+ };
40
+ throw new FirebaseEdgeError({
41
+ code: `app-check/${codes[status ?? ''] ?? 'unknown-error'}`,
42
+ message: typeof error === 'string'
43
+ ? error
44
+ : (error?.error?.message ?? 'App Check request failed.')
45
+ });
46
+ }
47
+ if (!data || typeof data !== 'object') {
48
+ throw new FirebaseEdgeError({
49
+ code: 'app-check/internal-error',
50
+ message: 'Invalid App Check response.'
51
+ });
52
+ }
53
+ return data;
54
+ }
55
+ /** @internal Convert the exchange response's protobuf duration. */
56
+ export function parseAppCheckToken(data) {
57
+ if (typeof data.token !== 'string' ||
58
+ !data.token ||
59
+ typeof data.ttl !== 'string' ||
60
+ !/^\d+(?:\.\d{1,9})?s$/.test(data.ttl)) {
61
+ throw new FirebaseEdgeError({
62
+ code: 'app-check/internal-error',
63
+ message: 'Invalid App Check token response.'
64
+ });
65
+ }
66
+ const ttlMillis = Math.floor(Number(data.ttl.slice(0, -1)) * 1000);
67
+ if (!Number.isSafeInteger(ttlMillis) || ttlMillis <= 0) {
68
+ throw new FirebaseEdgeError({
69
+ code: 'app-check/internal-error',
70
+ message: 'Invalid App Check token lifetime.'
71
+ });
72
+ }
73
+ return { token: data.token, ttlMillis };
74
+ }
75
+ //# sourceMappingURL=app-check-endpoints.js.map