-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat/samples): Add AMD token generation sample #27
base: main
Are you sure you want to change the base?
Conversation
This commit adds a sample that showcases token generation for Adaptive Media Delivery. Signed-off-by: Radu Matei <[email protected]>
version = "0.1.0" | ||
|
||
[variables] | ||
encryption_key = { required = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be a secret?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that secret = true
doesn't actually do anything today. It was meant to allow partial debug logging of variable values but instead we just never log any. 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose optimistically some external tooling could take it into account 😅
const encoder = new TextEncoder(); | ||
const data = encoder.encode(message); | ||
|
||
// Use crypto.subtle.sign instead of crypto.hmac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be good to expand on the comment here a bit, and explain why this is a valid thing to do
Signed-off-by: Radu Matei <[email protected]>
Signed-off-by: Radu Matei <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
} | ||
|
||
// Handle token generation | ||
if path == "/rustapi/token" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would tend to invert this check and return early with the 404, so the rest of the code can be unindented a level—but certainly not blocking at all.
@radu-matei can this merge or are you still working on it? |
This commit adds a sample that showcases token generation for Adaptive Media Delivery.