feat: add authorize hook and tempo subscriptions#331
feat: add authorize hook and tempo subscriptions#331brendanjryan wants to merge 4 commits intomainfrom
Conversation
992c30a to
313f314
Compare
commit: |
a09cb0e to
d651f09
Compare
| ) | ||
| const active = matches.filter((record) => isActive(record)) | ||
|
|
||
| const subscription = (() => { |
There was a problem hiding this comment.
it feels odd we have to have the client pass a subscription id in order to disambiguate, shouldn't the server be able to filter subscriptions to check if one is valid for the given route / user?
| import type { SubscriptionRecord } from './Types.js' | ||
|
|
||
| const recordPrefix = 'tempo:subscription:record:' | ||
| const resourcePrefix = 'tempo:subscription:resource:' |
There was a problem hiding this comment.
allow these to be customized
| return records.filter((record: unknown): record is SubscriptionRecord => Boolean(record)) | ||
| }, | ||
| async put(record) { | ||
| await store.put(recordKey(record.subscriptionId), record) |
There was a problem hiding this comment.
add comments about what we are doing here
| return 'minute' | ||
| case 3_600: | ||
| return 'hour' | ||
| case 86_400: |
There was a problem hiding this comment.
make these constants
| } | ||
| } | ||
|
|
||
| function formatBillingInterval(periodSeconds: string) { |
There was a problem hiding this comment.
is there no way to manually bill users e.g. in a cron? we should add this
d651f09 to
5d333a6
Compare
5d333a6 to
e776f4e
Compare
|
Great addition, @brendanjryan. The main thing I’d pin down early is how a later charge proves linkage to the original authorization window. A minimal stable tuple for that would already help a lot: authorization ref, cumulative spent, remaining window, and a verifier-facing record ref. |
No description provided.