Country constants
Importable from x511/countries. Country codes are ISO 3166-1 alpha-3 strings.
import {
ALL_COUNTRIES,
EU_COUNTRIES,
EEA_COUNTRIES,
SCHENGEN_COUNTRIES,
ASEAN_COUNTRIES,
MERCOSUR_COUNTRIES,
AMERICAS_COUNTRIES,
isSelfCountryAllowed,
} from 'x511/countries'
import type { X511Country } from 'x511/countries'ALL_COUNTRIES
const ALL_COUNTRIES: readonly string[]The full list of 249 ISO 3166-1 alpha-3 codes recognised by X511. Used as the source of truth for the X511Country type.
Pre-defined groups
| Constant | Members |
|---|---|
EU_COUNTRIES | The 27 EU member states. |
EEA_COUNTRIES | EU + Iceland (ISL), Liechtenstein (LIE), Norway (NOR). |
SCHENGEN_COUNTRIES | The 29 Schengen Area members. |
ASEAN_COUNTRIES | The 10 ASEAN members (BRN, KHM, IDN, LAO, MYS, MMR, PHL, SGP, THA, VNM). |
MERCOSUR_COUNTRIES | Mercosur full + associate members (ARG, BOL, BRA, CHL, COL, ECU, GUY, PRY, PER, SUR, URY, VEN). |
AMERICAS_COUNTRIES | 34 sovereign states across North, Central, and South America plus the Caribbean. |
Use them anywhere a CountryFilter is accepted:
import { x511, self } from 'x511/hono'
import { EU_COUNTRIES } from 'x511/countries'
const { verify, verified } = x511({
domain: 'https://your-app.example.com',
disclosures: {
minAge: 18,
nationality: { included: EU_COUNTRIES },
},
mode: { type: 'session', ttl: 1800 },
providers: [self({ scope: 'your-app' })],
})X511Country
type X511Country = (typeof ALL_COUNTRIES)[number]A literal-string union of every code in ALL_COUNTRIES. Use it when you build your own arrays:
import type { X511Country } from 'x511/countries'
const allowed: X511Country[] = ['HUN', 'POL', 'SVK', 'CZE']CountryFilter
type CountryFilter =
| { included: X511Country[]; excluded?: never }
| { excluded: X511Country[]; included?: never }Filters appear inside disclosures.nationality and disclosures.issuingState. The two halves are mutually exclusive — x511() throws if both (or neither) are present.
disclosures: {
minAge: 18,
issuingState: { excluded: ['PRK', 'IRN'] },
}isSelfCountryAllowed()
function isSelfCountryAllowed(disclosed: string, filter: CountryFilter): booleanUsed internally by the self provider when checking the nationality and issuingState it received from @selfxyz/core. Self emits country values using ICAO machine-readable codes (e.g. D<< for Germany), and this helper normalizes them back to ISO alpha-3 before matching against the configured filter.
You normally do not need to call it directly; expose it only if you write a custom provider that consumes Self attestation output.