firebase / firebase/firebase-functions-dart

Expose "checkTokens" or similar

Open
#235 4 comments 0 reactions 1 assignee Claimed by @demolaf View on GitHub
blocked enhancement reproduced
Dominant language
Dart
Stars
44
Forks
9
Avg merge
5d 5h
Merged PRs (30d)
2

Description

### Description
Currently, a client can implement onRequest or onCall.
- onCall provides the user with AuthData and performs app check verification
- onRequest requires the user to perform all checks from the ground up without many helpers

It would be great to offer helpers that extract AuthData / App check verifications etc. that the user could use in onRequest. Looking at onCall, it seems exposing the internal `checkTokens` or another top-level helper that performs the validation logic in the current onCall handler would provide the necessary utility.

### Use Case
A developer might choose a binary transport protocol, for instance, protobuf, to make requests and to avoid base64 encoding required to transport the request with onCall, the developer would use onRequest with validation helpers to follow a shape similar to onCall, but with skipped serialization steps.

### Proposed Solution
Expose internal validators or add a new user-facing validator that enables the user to extract AuthData or app check data with a single method.

### Alternatives Considered
- Implement extraction from scratch
- Depend on internal implementations
- Encode binary requests to base64 string

### Additional Context
This feature would provide a nice middle ground where a developer could define their API how they like but simultaneously get the same verification out of the box, that is provided in onCall.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.