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.
- package/README.md +102 -405
- package/dist/app-check/app-check-endpoints.d.ts +31 -0
- package/dist/app-check/app-check-endpoints.d.ts.map +1 -0
- package/dist/app-check/app-check-endpoints.js +75 -0
- package/dist/app-check/app-check-endpoints.js.map +1 -0
- package/dist/app-check/app-check-jwt.d.ts +16 -0
- package/dist/app-check/app-check-jwt.d.ts.map +1 -0
- package/dist/app-check/app-check-jwt.js +59 -0
- package/dist/app-check/app-check-jwt.js.map +1 -0
- package/dist/app-check/app-check.d.ts +43 -0
- package/dist/app-check/app-check.d.ts.map +1 -0
- package/dist/app-check/app-check.js +141 -0
- package/dist/app-check/app-check.js.map +1 -0
- package/dist/auth/auth-blocking-types.d.ts +44 -0
- package/dist/auth/auth-blocking-types.d.ts.map +1 -0
- package/dist/auth/auth-blocking-types.js +2 -0
- package/dist/auth/auth-blocking-types.js.map +1 -0
- package/dist/auth/auth-config-types.d.ts +146 -0
- package/dist/auth/auth-config-types.d.ts.map +1 -0
- package/dist/auth/auth-config-types.js +2 -0
- package/dist/auth/auth-config-types.js.map +1 -0
- package/dist/auth/auth-config.d.ts +15 -0
- package/dist/auth/auth-config.d.ts.map +1 -0
- package/dist/auth/auth-config.js +413 -0
- package/dist/auth/auth-config.js.map +1 -0
- package/dist/auth/auth-emulator.d.ts +7 -0
- package/dist/auth/auth-emulator.d.ts.map +1 -0
- package/dist/auth/auth-emulator.js +24 -0
- package/dist/auth/auth-emulator.js.map +1 -0
- package/dist/auth/auth-endpoint-errors.d.ts +2 -0
- package/dist/auth/auth-endpoint-errors.d.ts.map +1 -1
- package/dist/auth/auth-endpoint-errors.js +20 -1
- package/dist/auth/auth-endpoint-errors.js.map +1 -1
- package/dist/auth/auth-error-codes.d.ts +12 -0
- package/dist/auth/auth-error-codes.d.ts.map +1 -1
- package/dist/auth/auth-error-codes.js +12 -0
- package/dist/auth/auth-error-codes.js.map +1 -1
- package/dist/auth/email-action-request.d.ts +40 -0
- package/dist/auth/email-action-request.d.ts.map +1 -0
- package/dist/auth/email-action-request.js +80 -0
- package/dist/auth/email-action-request.js.map +1 -0
- package/dist/auth/email-link.d.ts +24 -0
- package/dist/auth/email-link.d.ts.map +1 -0
- package/dist/auth/email-link.js +103 -0
- package/dist/auth/email-link.js.map +1 -0
- package/dist/auth/firebase-admin-auth.d.ts +60 -12
- package/dist/auth/firebase-admin-auth.d.ts.map +1 -1
- package/dist/auth/firebase-admin-auth.js +455 -64
- package/dist/auth/firebase-admin-auth.js.map +1 -1
- package/dist/auth/firebase-auth-endpoints.d.ts +94 -4
- package/dist/auth/firebase-auth-endpoints.d.ts.map +1 -1
- package/dist/auth/firebase-auth-endpoints.js +304 -64
- package/dist/auth/firebase-auth-endpoints.js.map +1 -1
- package/dist/auth/firebase-auth.d.ts +78 -4
- package/dist/auth/firebase-auth.d.ts.map +1 -1
- package/dist/auth/firebase-auth.js +101 -8
- package/dist/auth/firebase-auth.js.map +1 -1
- package/dist/auth/firebase-jwt.d.ts +19 -10
- package/dist/auth/firebase-jwt.d.ts.map +1 -1
- package/dist/auth/firebase-jwt.js +176 -39
- package/dist/auth/firebase-jwt.js.map +1 -1
- package/dist/auth/firebase-types.d.ts +3 -0
- package/dist/auth/firebase-types.d.ts.map +1 -1
- package/dist/auth/google-oauth.d.ts +0 -1
- package/dist/auth/google-oauth.d.ts.map +1 -1
- package/dist/auth/google-oauth.js +16 -86
- package/dist/auth/google-oauth.js.map +1 -1
- package/dist/auth/project-config-manager.d.ts +10 -0
- package/dist/auth/project-config-manager.d.ts.map +1 -0
- package/dist/auth/project-config-manager.js +22 -0
- package/dist/auth/project-config-manager.js.map +1 -0
- package/dist/auth/provider-credential.d.ts +43 -0
- package/dist/auth/provider-credential.d.ts.map +1 -0
- package/dist/auth/provider-credential.js +107 -0
- package/dist/auth/provider-credential.js.map +1 -0
- package/dist/auth/provider-session.d.ts +10 -0
- package/dist/auth/provider-session.d.ts.map +1 -0
- package/dist/auth/provider-session.js +28 -0
- package/dist/auth/provider-session.js.map +1 -0
- package/dist/auth/tenant-manager.d.ts +17 -0
- package/dist/auth/tenant-manager.d.ts.map +1 -0
- package/dist/auth/tenant-manager.js +59 -0
- package/dist/auth/tenant-manager.js.map +1 -0
- package/dist/auth/user-batch.d.ts +21 -0
- package/dist/auth/user-batch.d.ts.map +1 -0
- package/dist/auth/user-batch.js +49 -0
- package/dist/auth/user-batch.js.map +1 -0
- package/dist/auth/user-import.d.ts +55 -0
- package/dist/auth/user-import.d.ts.map +1 -0
- package/dist/auth/user-import.js +208 -0
- package/dist/auth/user-import.js.map +1 -0
- package/dist/auth/user-request.d.ts +10 -0
- package/dist/auth/user-request.d.ts.map +1 -1
- package/dist/auth/user-request.js +56 -0
- package/dist/auth/user-request.js.map +1 -1
- package/dist/db/aggregate.d.ts +49 -0
- package/dist/db/aggregate.d.ts.map +1 -0
- package/dist/db/aggregate.js +115 -0
- package/dist/db/aggregate.js.map +1 -0
- package/dist/db/bulk-writer.d.ts +55 -0
- package/dist/db/bulk-writer.d.ts.map +1 -0
- package/dist/db/bulk-writer.js +257 -0
- package/dist/db/bulk-writer.js.map +1 -0
- package/dist/db/bundle-builder.d.ts +17 -0
- package/dist/db/bundle-builder.d.ts.map +1 -0
- package/dist/db/bundle-builder.js +118 -0
- package/dist/db/bundle-builder.js.map +1 -0
- package/dist/db/bytes.d.ts +12 -0
- package/dist/db/bytes.d.ts.map +1 -0
- package/dist/db/bytes.js +49 -0
- package/dist/db/bytes.js.map +1 -0
- package/dist/db/collection-group.d.ts +14 -0
- package/dist/db/collection-group.d.ts.map +1 -0
- package/dist/db/collection-group.js +43 -0
- package/dist/db/collection-group.js.map +1 -0
- package/dist/db/collection-reference.d.ts +21 -0
- package/dist/db/collection-reference.d.ts.map +1 -0
- package/dist/db/collection-reference.js +46 -0
- package/dist/db/collection-reference.js.map +1 -0
- package/dist/db/document-reference.d.ts +41 -0
- package/dist/db/document-reference.d.ts.map +1 -0
- package/dist/db/document-reference.js +125 -0
- package/dist/db/document-reference.js.map +1 -0
- package/dist/db/document-snapshot.d.ts +31 -0
- package/dist/db/document-snapshot.d.ts.map +1 -0
- package/dist/db/document-snapshot.js +103 -0
- package/dist/db/document-snapshot.js.map +1 -0
- package/dist/db/explain.d.ts +28 -0
- package/dist/db/explain.d.ts.map +1 -0
- package/dist/db/explain.js +61 -0
- package/dist/db/explain.js.map +1 -0
- package/dist/db/field-path.d.ts +10 -0
- package/dist/db/field-path.d.ts.map +1 -0
- package/dist/db/field-path.js +65 -0
- package/dist/db/field-path.js.map +1 -0
- package/dist/db/field-value.d.ts +17 -0
- package/dist/db/field-value.d.ts.map +1 -0
- package/dist/db/field-value.js +57 -0
- package/dist/db/field-value.js.map +1 -0
- package/dist/db/filter.d.ts +20 -0
- package/dist/db/filter.d.ts.map +1 -0
- package/dist/db/filter.js +48 -0
- package/dist/db/filter.js.map +1 -0
- package/dist/db/firestore-converter.d.ts +11 -0
- package/dist/db/firestore-converter.d.ts.map +1 -0
- package/dist/db/firestore-converter.js +14 -0
- package/dist/db/firestore-converter.js.map +1 -0
- package/dist/db/firestore-document.d.ts +62 -0
- package/dist/db/firestore-document.d.ts.map +1 -0
- package/dist/db/firestore-document.js +238 -0
- package/dist/db/firestore-document.js.map +1 -0
- package/dist/db/firestore-endpoints.d.ts +41 -0
- package/dist/db/firestore-endpoints.d.ts.map +1 -0
- package/dist/db/firestore-endpoints.js +735 -0
- package/dist/db/firestore-endpoints.js.map +1 -0
- package/dist/db/firestore-error-codes.d.ts +24 -0
- package/dist/db/firestore-error-codes.d.ts.map +1 -0
- package/dist/db/firestore-error-codes.js +24 -0
- package/dist/db/firestore-error-codes.js.map +1 -0
- package/dist/db/firestore-logging.d.ts +23 -0
- package/dist/db/firestore-logging.d.ts.map +1 -0
- package/dist/db/firestore-logging.js +41 -0
- package/dist/db/firestore-logging.js.map +1 -0
- package/dist/db/firestore-path.d.ts +4 -0
- package/dist/db/firestore-path.d.ts.map +1 -0
- package/dist/db/firestore-path.js +37 -0
- package/dist/db/firestore-path.js.map +1 -0
- package/dist/db/firestore-results.d.ts +12 -0
- package/dist/db/firestore-results.d.ts.map +1 -0
- package/dist/db/firestore-results.js +19 -0
- package/dist/db/firestore-results.js.map +1 -0
- package/dist/db/firestore-settings.d.ts +22 -0
- package/dist/db/firestore-settings.d.ts.map +1 -0
- package/dist/db/firestore-settings.js +83 -0
- package/dist/db/firestore-settings.js.map +1 -0
- package/dist/db/firestore-telemetry.d.ts +21 -0
- package/dist/db/firestore-telemetry.d.ts.map +1 -0
- package/dist/db/firestore-telemetry.js +84 -0
- package/dist/db/firestore-telemetry.js.map +1 -0
- package/dist/db/firestore-types.d.ts +25 -0
- package/dist/db/firestore-types.d.ts.map +1 -0
- package/dist/db/firestore-types.js +2 -0
- package/dist/db/firestore-types.js.map +1 -0
- package/dist/db/firestore.d.ts +151 -0
- package/dist/db/firestore.d.ts.map +1 -0
- package/dist/db/firestore.js +505 -0
- package/dist/db/firestore.js.map +1 -0
- package/dist/db/geo-point.d.ts +11 -0
- package/dist/db/geo-point.d.ts.map +1 -0
- package/dist/db/geo-point.js +29 -0
- package/dist/db/geo-point.js.map +1 -0
- package/dist/db/json-stream.d.ts +3 -0
- package/dist/db/json-stream.d.ts.map +1 -0
- package/dist/db/json-stream.js +117 -0
- package/dist/db/json-stream.js.map +1 -0
- package/dist/db/pipeline-expression.d.ts +293 -0
- package/dist/db/pipeline-expression.d.ts.map +1 -0
- package/dist/db/pipeline-expression.js +1436 -0
- package/dist/db/pipeline-expression.js.map +1 -0
- package/dist/db/pipeline-query.d.ts +6 -0
- package/dist/db/pipeline-query.d.ts.map +1 -0
- package/dist/db/pipeline-query.js +91 -0
- package/dist/db/pipeline-query.js.map +1 -0
- package/dist/db/pipeline.d.ts +120 -0
- package/dist/db/pipeline.d.ts.map +1 -0
- package/dist/db/pipeline.js +396 -0
- package/dist/db/pipeline.js.map +1 -0
- package/dist/db/query-document-snapshot.d.ts +2 -0
- package/dist/db/query-document-snapshot.d.ts.map +1 -0
- package/dist/db/query-document-snapshot.js +2 -0
- package/dist/db/query-document-snapshot.js.map +1 -0
- package/dist/db/query-partition.d.ts +14 -0
- package/dist/db/query-partition.d.ts.map +1 -0
- package/dist/db/query-partition.js +32 -0
- package/dist/db/query-partition.js.map +1 -0
- package/dist/db/query-request.d.ts +96 -0
- package/dist/db/query-request.d.ts.map +1 -0
- package/dist/db/query-request.js +283 -0
- package/dist/db/query-request.js.map +1 -0
- package/dist/db/query.d.ts +129 -0
- package/dist/db/query.d.ts.map +1 -0
- package/dist/db/query.js +468 -0
- package/dist/db/query.js.map +1 -0
- package/dist/db/recursive-delete.d.ts +6 -0
- package/dist/db/recursive-delete.d.ts.map +1 -0
- package/dist/db/recursive-delete.js +38 -0
- package/dist/db/recursive-delete.js.map +1 -0
- package/dist/db/snapshot-listener.d.ts +10 -0
- package/dist/db/snapshot-listener.d.ts.map +1 -0
- package/dist/db/snapshot-listener.js +71 -0
- package/dist/db/snapshot-listener.js.map +1 -0
- package/dist/db/timestamp.d.ts +29 -0
- package/dist/db/timestamp.d.ts.map +1 -0
- package/dist/db/timestamp.js +98 -0
- package/dist/db/timestamp.js.map +1 -0
- package/dist/db/transaction.d.ts +44 -0
- package/dist/db/transaction.d.ts.map +1 -0
- package/dist/db/transaction.js +177 -0
- package/dist/db/transaction.js.map +1 -0
- package/dist/db/value-equality.d.ts +3 -0
- package/dist/db/value-equality.d.ts.map +1 -0
- package/dist/db/value-equality.js +29 -0
- package/dist/db/value-equality.js.map +1 -0
- package/dist/db/vector-query.d.ts +38 -0
- package/dist/db/vector-query.d.ts.map +1 -0
- package/dist/db/vector-query.js +110 -0
- package/dist/db/vector-query.js.map +1 -0
- package/dist/db/vector-value.d.ts +8 -0
- package/dist/db/vector-value.d.ts.map +1 -0
- package/dist/db/vector-value.js +25 -0
- package/dist/db/vector-value.js.map +1 -0
- package/dist/db/write-batch.d.ts +25 -0
- package/dist/db/write-batch.d.ts.map +1 -0
- package/dist/db/write-batch.js +72 -0
- package/dist/db/write-batch.js.map +1 -0
- package/dist/db/write-request.d.ts +36 -0
- package/dist/db/write-request.d.ts.map +1 -0
- package/dist/db/write-request.js +257 -0
- package/dist/db/write-request.js.map +1 -0
- package/dist/firebase-edge-server.d.ts +143 -36
- package/dist/firebase-edge-server.d.ts.map +1 -1
- package/dist/firebase-edge-server.js +466 -257
- package/dist/firebase-edge-server.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/rest-fetch.d.ts +1 -1
- package/dist/rest-fetch.d.ts.map +1 -1
- package/dist/storage/storage-acl.d.ts +48 -0
- package/dist/storage/storage-acl.d.ts.map +1 -0
- package/dist/storage/storage-acl.js +101 -0
- package/dist/storage/storage-acl.js.map +1 -0
- package/dist/storage/storage-bucket-endpoints.d.ts +10 -0
- package/dist/storage/storage-bucket-endpoints.d.ts.map +1 -0
- package/dist/storage/storage-bucket-endpoints.js +514 -0
- package/dist/storage/storage-bucket-endpoints.js.map +1 -0
- package/dist/storage/storage-bucket-types.d.ts +183 -0
- package/dist/storage/storage-bucket-types.d.ts.map +1 -0
- package/dist/storage/storage-bucket-types.js +2 -0
- package/dist/storage/storage-bucket-types.js.map +1 -0
- package/dist/storage/storage-bucket.d.ts +122 -0
- package/dist/storage/storage-bucket.d.ts.map +1 -0
- package/dist/storage/storage-bucket.js +544 -0
- package/dist/storage/storage-bucket.js.map +1 -0
- package/dist/storage/storage-channel.d.ts +10 -0
- package/dist/storage/storage-channel.d.ts.map +1 -0
- package/dist/storage/storage-channel.js +15 -0
- package/dist/storage/storage-channel.js.map +1 -0
- package/dist/storage/storage-checksum.d.ts +35 -0
- package/dist/storage/storage-checksum.d.ts.map +1 -0
- package/dist/storage/storage-checksum.js +312 -0
- package/dist/storage/storage-checksum.js.map +1 -0
- package/dist/storage/storage-endpoints.d.ts +14 -0
- package/dist/storage/storage-endpoints.d.ts.map +1 -0
- package/dist/storage/storage-endpoints.js +721 -0
- package/dist/storage/storage-endpoints.js.map +1 -0
- package/dist/storage/storage-file.d.ts +126 -0
- package/dist/storage/storage-file.d.ts.map +1 -0
- package/dist/storage/storage-file.js +604 -0
- package/dist/storage/storage-file.js.map +1 -0
- package/dist/storage/storage-hmac-key.d.ts +26 -0
- package/dist/storage/storage-hmac-key.d.ts.map +1 -0
- package/dist/storage/storage-hmac-key.js +45 -0
- package/dist/storage/storage-hmac-key.js.map +1 -0
- package/dist/storage/storage-iam.d.ts +20 -0
- package/dist/storage/storage-iam.d.ts.map +1 -0
- package/dist/storage/storage-iam.js +43 -0
- package/dist/storage/storage-iam.js.map +1 -0
- package/dist/storage/storage-md5.d.ts +11 -0
- package/dist/storage/storage-md5.d.ts.map +1 -0
- package/dist/storage/storage-md5.js +96 -0
- package/dist/storage/storage-md5.js.map +1 -0
- package/dist/storage/storage-notification.d.ts +24 -0
- package/dist/storage/storage-notification.d.ts.map +1 -0
- package/dist/storage/storage-notification.js +40 -0
- package/dist/storage/storage-notification.js.map +1 -0
- package/dist/storage/storage-progress.d.ts +4 -0
- package/dist/storage/storage-progress.d.ts.map +1 -0
- package/dist/storage/storage-progress.js +17 -0
- package/dist/storage/storage-progress.js.map +1 -0
- package/dist/storage/storage-reference-endpoints.d.ts +63 -0
- package/dist/storage/storage-reference-endpoints.d.ts.map +1 -0
- package/dist/storage/storage-reference-endpoints.js +276 -0
- package/dist/storage/storage-reference-endpoints.js.map +1 -0
- package/dist/storage/storage-reference-helpers.d.ts +12 -0
- package/dist/storage/storage-reference-helpers.d.ts.map +1 -0
- package/dist/storage/storage-reference-helpers.js +72 -0
- package/dist/storage/storage-reference-helpers.js.map +1 -0
- package/dist/storage/storage-reference-signing.d.ts +40 -0
- package/dist/storage/storage-reference-signing.d.ts.map +1 -0
- package/dist/storage/storage-reference-signing.js +289 -0
- package/dist/storage/storage-reference-signing.js.map +1 -0
- package/dist/storage/storage-reference-types.d.ts +76 -0
- package/dist/storage/storage-reference-types.d.ts.map +1 -0
- package/dist/storage/storage-reference-types.js +2 -0
- package/dist/storage/storage-reference-types.js.map +1 -0
- package/dist/storage/storage-results.d.ts +8 -0
- package/dist/storage/storage-results.d.ts.map +1 -0
- package/dist/storage/storage-results.js +32 -0
- package/dist/storage/storage-results.js.map +1 -0
- package/dist/storage/storage-resumable.d.ts +18 -0
- package/dist/storage/storage-resumable.d.ts.map +1 -0
- package/dist/storage/storage-resumable.js +166 -0
- package/dist/storage/storage-resumable.js.map +1 -0
- package/dist/storage/storage-retry.d.ts +9 -0
- package/dist/storage/storage-retry.d.ts.map +1 -0
- package/dist/storage/storage-retry.js +104 -0
- package/dist/storage/storage-retry.js.map +1 -0
- package/dist/storage/storage-signed-url.d.ts +9 -0
- package/dist/storage/storage-signed-url.d.ts.map +1 -0
- package/dist/storage/storage-signed-url.js +96 -0
- package/dist/storage/storage-signed-url.js.map +1 -0
- package/dist/storage/storage-special-endpoints.d.ts +10 -0
- package/dist/storage/storage-special-endpoints.d.ts.map +1 -0
- package/dist/storage/storage-special-endpoints.js +394 -0
- package/dist/storage/storage-special-endpoints.js.map +1 -0
- package/dist/storage/storage-special-types.d.ts +154 -0
- package/dist/storage/storage-special-types.d.ts.map +1 -0
- package/dist/storage/storage-special-types.js +2 -0
- package/dist/storage/storage-special-types.js.map +1 -0
- package/dist/storage/storage-types.d.ts +251 -0
- package/dist/storage/storage-types.d.ts.map +1 -0
- package/dist/storage/storage-types.js +2 -0
- package/dist/storage/storage-types.js.map +1 -0
- package/dist/storage/storage-upload-stream.d.ts +41 -0
- package/dist/storage/storage-upload-stream.d.ts.map +1 -0
- package/dist/storage/storage-upload-stream.js +335 -0
- package/dist/storage/storage-upload-stream.js.map +1 -0
- package/dist/storage/storage-xml-signing.d.ts +17 -0
- package/dist/storage/storage-xml-signing.d.ts.map +1 -0
- package/dist/storage/storage-xml-signing.js +144 -0
- package/dist/storage/storage-xml-signing.js.map +1 -0
- package/dist/storage/storage.d.ts +152 -0
- package/dist/storage/storage.d.ts.map +1 -0
- package/dist/storage/storage.js +532 -0
- package/dist/storage/storage.js.map +1 -0
- package/dist/utils/token-cache.d.ts.map +1 -1
- package/dist/utils/token-cache.js +3 -2
- package/dist/utils/token-cache.js.map +1 -1
- package/package.json +22 -6
- package/dist/auth/auth-endpoint-errors.test.d.ts +0 -2
- package/dist/auth/auth-endpoint-errors.test.d.ts.map +0 -1
- package/dist/auth/auth-endpoint-errors.test.js +0 -411
- package/dist/auth/auth-endpoint-errors.test.js.map +0 -1
- package/dist/auth/errors.test.d.ts +0 -2
- package/dist/auth/errors.test.d.ts.map +0 -1
- package/dist/auth/errors.test.js +0 -123
- package/dist/auth/errors.test.js.map +0 -1
- package/dist/auth/firebase-admin-auth.test.d.ts +0 -2
- package/dist/auth/firebase-admin-auth.test.d.ts.map +0 -1
- package/dist/auth/firebase-admin-auth.test.js +0 -923
- package/dist/auth/firebase-admin-auth.test.js.map +0 -1
- package/dist/auth/firebase-auth-endpoints.test.d.ts +0 -2
- package/dist/auth/firebase-auth-endpoints.test.d.ts.map +0 -1
- package/dist/auth/firebase-auth-endpoints.test.js +0 -957
- package/dist/auth/firebase-auth-endpoints.test.js.map +0 -1
- package/dist/auth/firebase-auth.test.d.ts +0 -2
- package/dist/auth/firebase-auth.test.d.ts.map +0 -1
- package/dist/auth/firebase-auth.test.js +0 -167
- package/dist/auth/firebase-auth.test.js.map +0 -1
- package/dist/auth/firebase-jwt.test.d.ts +0 -2
- package/dist/auth/firebase-jwt.test.d.ts.map +0 -1
- package/dist/auth/firebase-jwt.test.js +0 -164
- package/dist/auth/firebase-jwt.test.js.map +0 -1
- package/dist/auth/github-oauth.d.ts +0 -19
- package/dist/auth/github-oauth.d.ts.map +0 -1
- package/dist/auth/github-oauth.js +0 -145
- package/dist/auth/github-oauth.js.map +0 -1
- package/dist/auth/github-oauth.test.d.ts +0 -2
- package/dist/auth/github-oauth.test.d.ts.map +0 -1
- package/dist/auth/github-oauth.test.js +0 -202
- package/dist/auth/github-oauth.test.js.map +0 -1
- package/dist/auth/google-oauth.test.d.ts +0 -2
- package/dist/auth/google-oauth.test.d.ts.map +0 -1
- package/dist/auth/google-oauth.test.js +0 -200
- package/dist/auth/google-oauth.test.js.map +0 -1
- package/dist/auth/oauth.d.ts +0 -3
- package/dist/auth/oauth.d.ts.map +0 -1
- package/dist/auth/oauth.js +0 -48
- package/dist/auth/oauth.js.map +0 -1
- package/dist/auth/oauth.test.d.ts +0 -2
- package/dist/auth/oauth.test.d.ts.map +0 -1
- package/dist/auth/oauth.test.js +0 -109
- package/dist/auth/oauth.test.js.map +0 -1
- package/dist/auth/user-record.test.d.ts +0 -2
- package/dist/auth/user-record.test.d.ts.map +0 -1
- package/dist/auth/user-record.test.js +0 -198
- package/dist/auth/user-record.test.js.map +0 -1
- package/dist/auth/user-request.test.d.ts +0 -2
- package/dist/auth/user-request.test.d.ts.map +0 -1
- package/dist/auth/user-request.test.js +0 -269
- package/dist/auth/user-request.test.js.map +0 -1
- package/dist/firebase-edge-errors.test.d.ts +0 -2
- package/dist/firebase-edge-errors.test.d.ts.map +0 -1
- package/dist/firebase-edge-errors.test.js +0 -72
- package/dist/firebase-edge-errors.test.js.map +0 -1
- package/dist/firebase-edge-server.test.d.ts +0 -2
- package/dist/firebase-edge-server.test.d.ts.map +0 -1
- package/dist/firebase-edge-server.test.js +0 -264
- package/dist/firebase-edge-server.test.js.map +0 -1
- package/dist/rest-fetch.test.d.ts +0 -2
- package/dist/rest-fetch.test.d.ts.map +0 -1
- package/dist/rest-fetch.test.js +0 -164
- 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
|
-
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
- [
|
|
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
|
-
```
|
|
29
|
-
npm
|
|
37
|
+
```sh
|
|
38
|
+
npm install firebase-admin-edge
|
|
30
39
|
```
|
|
31
40
|
|
|
32
41
|
## Setup
|
|
33
42
|
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
```
|
|
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
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
152
|
-
|
|
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
|
-
|
|
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
|
-
|
|
91
|
+
## Demo
|
|
157
92
|
|
|
158
|
-
|
|
159
|
-
|
|
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
|
-
|
|
162
|
-
throw error;
|
|
163
|
-
}
|
|
97
|
+
## Class Guides
|
|
164
98
|
|
|
165
|
-
|
|
166
|
-
// Otherwise, it contains idToken, refreshToken, and expiresIn.
|
|
167
|
-
```
|
|
99
|
+
Start with the guide for the feature you're adding:
|
|
168
100
|
|
|
169
|
-
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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
|
-
|
|
118
|
+
## Auth Emulator
|
|
177
119
|
|
|
178
|
-
|
|
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
|
-
|
|
124
|
+
## Compatibility
|
|
181
125
|
|
|
182
|
-
|
|
183
|
-
in
|
|
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
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
-
|
|
136
|
+
## Contributing and Reporting Issues
|
|
194
137
|
|
|
195
|
-
|
|
196
|
-
|
|
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
|
-
|
|
199
|
-
const { data, error } = await firebaseServer.linkProvider(
|
|
200
|
-
githubAccessToken,
|
|
201
|
-
'github.com'
|
|
202
|
-
);
|
|
141
|
+
To get started locally:
|
|
203
142
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
143
|
+
```sh
|
|
144
|
+
npm install
|
|
145
|
+
npm run ci
|
|
207
146
|
```
|
|
208
147
|
|
|
209
|
-
|
|
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
|
-
|
|
212
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|