Repository navigation
Add $hmac JSONata function - #525
Merged
Merged
Conversation
$hmac(keyId, message, algorithm?, encoding?) signs a message with the secret of a Credentials function, without ever returning the secret. The Credentials roles decide who may sign (no roles = admin only), so apps can expose signing to users through an Invoke function with runas. Supports HmacSHA256/384/512 and base64, base64url or hex output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aeberhart
requested changes
Nov 6, 2026
| "diff" : "diff --git a/dashjoin-demo.db b/dashjoin-demo.db\nindex 6fdb4ce..d29b8f1 100644\n--- a/dashjoin-demo.db\n+++ b/dashjoin-demo.db\nBinary files differ\n" | ||
| } ] | ||
| ``` | ||
| ### hmac |
Contributor
There was a problem hiding this comment.
this must go in /dashjoin-base/dashjoin-docs/llms/jsonata.json
also, we need to add this to Action.ts to make the function available on the client (proxied to backend if client jsonata engine)
The appendix and llms.txt are generated by LLMs.java. Regenerating also picks up gitCheckout and use, which were in jsonata.json but not yet in the generated files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a generic
$hmac(keyId, message, algorithm?, encoding?)JSONata function. It signs a message with the secret of aCredentialsfunction and never returns the secret.rolesof the Credentials record decide who may sign. No roles means admin only. Apps can let normal users sign through anInvokefunction withrunas, so those users never get the key role themselves.dashjoin.function.<ID>.password(e.g. an environment variable) or from the stored encrypted value.is_timed_hmac_valid_v0, built entirely in app JSONata with no app-specific Java.Changes
Hmac.java, registered inMETA-INF/services/org.dashjoin.function.FunctionHmacTest.java: RFC example values, role checks, only-Credentials check, invalid argumentsappendix-jsonata.md,developer-reference.mdTesting
HmacTestpasses (4 tests).runasfunction produced a URL whose MAC verifies the way Cloudflare checks it.$hmacdirectly. The unit test covers that case.🤖 Generated with Claude Code