DocsFRL reference
On this page

Secrets and operators reference

Declare secure configuration and look up rule operators.

Before you begin: Context and operators reference.

Site Settings and Secret Keys

Store business settings in a protected post schema and build the editing form in your theme's admin pages. Use a fixed, unique key for one site-wide settings record, restrict reads and writes with FRL permissions, and provide defaults when no record has been saved yet. See Theme admin pages.

Keep credentials and configurable integration hosts in $secret. Declare every secret immediately after version 2;, before other rules. Each declaration needs an as "Display name" and a description "What to provide and what it enables". Undeclared references prevent a theme version from being processed. Site owners provide values through Manage Secrets; saved values work across all versions of the same site.

Use pin.request({ purpose: "..." }) where the PIN is needed. Every request needs a purpose. You can also pass bind with context values such as { challengeId: $request.body.challengeId }, and an optional boolean shuffle to rearrange the keypad after each digit. A sign-in hook can return the request to finish sign-in only after PIN entry:

backend/index.frl
Rule input (JSON)

Use a complete version 2 rule file. Select a post with “postType” and “action”, or an “endpoint” by name. Saved data, jobs, payments and email need the local server. Dedupe replay protection also needs a site.

Check complete rules or run schemas, permissions, hooks and calculations against the input above. Add excerpts to a complete rule before running.

An endpoint can require the PIN before its action runs. Put the request before dedupe so Frontbacked checks it before endpoint execution:

backend/index.frl
Rule input (JSON)

Use a complete version 2 rule file. Select a post with “postType” and “action”, or an “endpoint” by name. Saved data, jobs, payments and email need the local server. Dedupe replay protection also needs a site.

Check complete rules or run schemas, permissions, hooks and calculations against the input above. Add excerpts to a complete rule before running.

When a page calls the endpoint with Frontbacked.endpoints.call(...), Frontbacked asks the user to create or enter their PIN and then resumes the request. The current PIN length is four digits; the keypad reads the length and shuffle choice from the PIN challenge response. Incorrect attempts are limited, and the dialog keeps the page behind it still while open.

If someone forgets their PIN, they can choose Forgot PIN? in the same dialog. Frontbacked emails a six-digit recovery code, then asks them to create and confirm a new PIN. A valid code completes a pending sign-in or resumes the protected action. Recovery codes expire after 10 minutes and allow five attempts.

Operators

OperatorExample
||$admin.canEdit("articles") || $actor.id == $post.current.authorId
&&$post.pending.data.email && $post.pending.data.acceptedTerms
==, !=$post.current.data.status == "published"
>, <, >=, <=$post.pending.data.price > 0
includes$post.pending.data.role includes ["admin", "editor"]
+, -, *, /, %$post.pending.data.quantity * $post.pending.data.price
!, not!$post.current.data.archived

Continue with Built-in functions reference.