Idna bidi check
idna-bidi-check · version 1.0.0 · Numbers & math · free, no key needed
Apply the RFC 5893 Bidi Rule to one label and name the first failing condition.
Use when you need to: check the idna bidi rule · rfc 5893 label direction test · right to left label ending check.
Decide before calling
Read the versioned contract and the supported scope below. Reuse idna-bidi-check@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use idna-bidi-check@1.0.0 for check the idna bidi rule. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- check the idna bidi rule
- rfc 5893 label direction test
- right to left label ending check
- does this label mix arabic and european digits
- bidi condition for a domain label
- when does the bidi rule apply
- בדיקת כיוון אותיות בתווית
Not supported
- reject disallowed code points
- punycode encode the label
- apply one bidi rule to a whole multi-label domain
Behavior
- RFC 5893 only. Disallowed characters, hyphens, NFC, and punycode are not judged.
- enforce when_rtl: if the label has no Bidi_Class R, AL, or AN, applicable is false, valid is true, and direction is none.
- enforce always: the six conditions run even when no RTL class is present. A first class other than L, R, or AL fails bidi_condition_1.
- direction is rtl when the first class is R or AL, ltr when it is L, and none otherwise. RTL then checks conditions 2, 3, and 4. LTR checks 5 then 6. The first failure wins.
- reason_index and cp identify the failing code point. first_rtl_index is the first R, AL, or AN, or null.
- Results are not a homograph, phishing, DNS, or authenticity verdict. No DNS query is performed.
Input
label(string, required): min length 1; max length 252enforce(one of "when_rtl", "always", required)
Output
valid(boolean, required)applicable(boolean, required)direction(one of "ltr", "rtl", "none", required)reason(one of null, "bidi_condition_1", "bidi_condition_2", "bidi_condition_3", "bidi_condition_4", "bidi_condition_5", "bidi_condition_6", required)reason_index(integer or null, required): min 0; max 251cp(integer or null, required): min 0; max 1114111first_rtl_index(integer or null, required): min 0; max 251data_version(constant "idna2008-rfc5892-unicode-15.1.0", required)
Limits
- max label bytes: 252
- max output bytes: 8192
Example
Request input:
{
"label": "a",
"enforce": "when_rtl"
}
Response:
{
"result": {
"valid": true,
"applicable": false,
"direction": "none",
"reason": null,
"reason_index": null,
"cp": null,
"first_rtl_index": null,
"data_version": "idna2008-rfc5892-unicode-15.1.0"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "idna-bidi-check",
"version": "1.0.0",
"input": {
"label": "a",
"enforce": "when_rtl"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/idna-bidi-check/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"label":"a","enforce":"when_rtl"}'
The machine-readable contract is at /v1/tools/idna-bidi-check/versions/1.0.0.
CLI
node cli.mjs run idna-bidi-check 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Polynomial factorization check: Check a claimed factorization c * prod f_i^e_i of a rational polynomial: monic distinct factors, degrees, coefficients.
- Chi square decomposition check: Check a claimed Pearson chi-square, its per-cell (O-E)^2/E terms and df exactly; returns the first wrong term.
- Cnf assignment check: Check a claimed truth assignment against a DIMACS-style CNF; report the first bad literal or unsatisfied clause.
- Contingency expected check: Check claimed expected counts (row total x column total / N) of a count table exactly; returns the first wrong cell.
- Graph path weight check: Check that a path of edge IDs walks source to target in a weighted digraph and sums to the claimed exact weight.
- Lp primal feasibility check: Check that a claimed LP point satisfies x >= 0 and Ax <= b exactly; report the first violated bound or row.