Prepare Auth Requests
Use the canonical prepare-auth-request flow to generate signer-neutral Namefi auth payloads
If you do not want to wire signing directly into your client, use the signer-neutral preparation flow.
The canonical entrypoint in the public namefi-api-skills repo is:
bun .rulesync/skills/namefi-api/scripts/prepare-auth-request.tsIt inspects the target operation and prepares one of three outputs:
- a plain request template for
none - a SIWE preparation flow for
siwe-requiredorsiwe-optional --prefer-auth - an EIP-712 typed-data payload for
eip712
Common flags
bun .rulesync/skills/namefi-api/scripts/prepare-auth-request.ts \
--env dev \
--operationId toggleDomainParking \
--payload '{"normalizedDomainName":"march1104.gl","enableParking":true,"overrideExistingRecords":false}'Useful flags:
| Flag | Purpose |
|---|---|
--env | Environment from openapi.docs.json |
--operationId | Target API operation |
--payload / --payload-file | Request payload |
--path-params / --path-params-file | Path parameters for templated routes |
--signer-address | Required for SIWE prep; optional placeholder for EIP-712 prep |
--chain | EIP-712 domain query chain or SIWE chain selection |
--primary-type | Override the selected EIP-712 primary type when a method accepts more than one |
--prefer-auth | Prepare the SIWE-authenticated path for siwe-optional operations |
No-auth example
bun .rulesync/skills/namefi-api/scripts/prepare-auth-request.ts \
--env dev \
--operationId checkAvailability \
--payload '{"domain":"hello.0x.city"}'Output shape:
{
"authMode": "siwe-optional",
"preparationMode": "none",
"request": {
"method": "GET",
"url": "https://api.namefi.dev/v-next/search/availability?domain=hello.0x.city"
},
"guidance": "This operation can run anonymously..."
}SIWE example
bun .rulesync/skills/namefi-api/scripts/prepare-auth-request.ts \
--env dev \
--operationId getUserDomains \
--signer-address 0xYourAddressThe output includes:
allowedChainsselectedChainIdnoncemessagemessageStringsigningRequest.method = personal_signverifyRequest- final request template with
x-namefi-siwe-token
You then:
- sign
messageStringexternally withpersonal_sign - fill
verifyRequest.body.signature - send
verifyRequest - copy the returned token into the final request header
EIP-712 example
bun .rulesync/skills/namefi-api/scripts/prepare-auth-request.ts \
--env dev \
--operationId toggleDomainParking \
--payload '{"normalizedDomainName":"march1104.gl","enableParking":true,"overrideExistingRecords":false}'The output includes:
- live
domainfrom/eip712/domain - live
acceptedPrimaryTypesandtypesfrom/eip712/types-for-method - selected
primaryType envelope- full
typedData signatureRequest.method = eth_signTypedData_v4signatureHeadersTemplate- final request template with placeholder signature headers
You then:
- sign
typedDataexternally - fill
x-namefi-signerandx-namefi-signature - send the final request body exactly as returned in
request.body
Multiple primary types
Some methods accept more than one primary type, such as registerDomain.
Default behavior:
- the helper chooses the first compatible primary type based on the payload shape
- for example,
registerDomainwithoutnftReceivingWalletpicks the default-wallet envelope
Override explicitly when needed:
bun .rulesync/skills/namefi-api/scripts/prepare-auth-request.ts \
--env dev \
--operationId registerDomain \
--payload-file ./register-domain.json \
--primary-type InstantRegisterDomainEnvelopeRelated helper scripts
get-eip712-domain.tsget-eip712-types-for-method.tsget-all-eip712-types.tsprepare-siwe-message.tsget-primary-type.ts
Use those when you want one focused piece of the flow. Use prepare-auth-request.ts when you want the full request-preparation result in one call.