@app_/consts

Centralized constants for the entire Atlas Protocol stack — cryptographic parameters, HTTP headers, service discovery, currency rules, trust anchors, Schema.org types, and client-side storage keys.

Cryptographic parameters

Constants for Falcon-1024 post-quantum cryptography, including PoW difficulty tiers and key format specifications.

crypto.ts
import {
  DIFFICULTY,
  FALCON_PUB_KEY_LENGTH,
  FALCON_PRIV_KEY_LENGTH,
  PUBLIC_KEY_HRP,
  PRIVATE_KEY_HRP,
  PUBLIC_KEY_HASH_REGEX,
  BASE64_REGEX,
} from '@app_/consts';

DIFFICULTY.hero;   // 2
DIFFICULTY.titan;  // 6
DIFFICULTY.atlas;  // 9

FALCON_PUB_KEY_LENGTH;   // 1793 bytes
FALCON_PRIV_KEY_LENGTH;  // 2305 bytes

PUBLIC_KEY_HRP;   // 'apub' — Bech32m human-readable part
PRIVATE_KEY_HRP;  // 'asec'

PUBLIC_KEY_HASH_REGEX;  // /^[a-f0-9]{64}$/i
BASE64_REGEX;           // /^[A-Za-z0-9+/]*={0,2}$/

HTTP headers

Header names used for Atlas authentication. Every authenticated request includes the identity (public key), proofs, and a timestamped HMAC signature.

headers.ts
import {
  ATLAS_IDENTITY,
  ATLAS_SIGNATURE,
  ATLAS_PROOFS,
  MAX_TIMESTAMP_DRIFT_MS,
} from '@app_/consts';

ATLAS_IDENTITY;   // 'atlas-identity'  — public key header
ATLAS_SIGNATURE;  // 'atlas-signature' — format: t=<payload>; s=<signature>
ATLAS_PROOFS;     // 'atlas-proofs'    — JSON array of PoW/Permit proofs

MAX_TIMESTAMP_DRIFT_MS;  // 300000 (5 minutes)

Service discovery

Default ports and URLs for Custodian and Registry services.

discovery.ts
import {
  DEFAULT_CUSTODIAN_PORT,
  DEFAULT_CUSTODIAN_API_URL,
  DEFAULT_REGISTRY_PORT,
  DEFAULT_GUIDE_REGISTRY_URL,
  DEFAULT_OPERATOR_REGISTRY_URL,
  DEFAULT_ANNOUNCEMENT_URL,
  DEFAULT_DISCOVERY_ENDPOINTS,
} from '@app_/consts';

DEFAULT_CUSTODIAN_PORT;         // 6473
DEFAULT_CUSTODIAN_API_URL;      // 'https://127.0.0.1:6473'
DEFAULT_REGISTRY_PORT;          // 6475
DEFAULT_GUIDE_REGISTRY_URL;     // 'https://127.0.0.1:6475'
DEFAULT_OPERATOR_REGISTRY_URL;  // 'https://127.0.0.1:6475'
DEFAULT_ANNOUNCEMENT_URL;       // 'https://boostrap.atlas-protocol.com'
DEFAULT_DISCOVERY_ENDPOINTS;    // array of default registry URLs

FairShares currency

FairShares (FS) is the internal currency used for query access, shelter leases, and trust allocation. Every identity receives a weekly income and an initial grant.

currency.ts
import {
  ATLAS_CURRENCY,
  FAIR_SHARES_WEEKLY_INCOME,
  FAIR_SHARES_INITIAL_GRANT,
  FAIR_SHARES_EQUILIBRIUM_WEEKS,
} from '@app_/consts';

ATLAS_CURRENCY;
// { unit: 'Fairs', short: 'FS', displayName: 'FairShares', code: 'FAIRS' }

FAIR_SHARES_WEEKLY_INCOME;      // 100 — weekly FS income per identity
FAIR_SHARES_INITIAL_GRANT;      // 100 — FS granted on identity creation
FAIR_SHARES_EQUILIBRIUM_WEEKS;  // 100 — weeks to reach equilibrium

Trust system

The trust graph is anchored by genesis keys. Trust flows from these anchors through the network via trust allocation envelopes.

trust.ts
import {
  TRUST_LABEL,
  BASE_TRUST_POOL,
  ORDER_VALUES,
  DEFAULT_ORDER,
  ORDER_TRUST_ANCHOR_KEYS,
  getOrderTrustAnchorKeys,
  topicLabel,
  buildTrustAllocationEnvelopeWhere,
} from '@app_/consts';

TRUST_LABEL;       // 'Trust'
BASE_TRUST_POOL;   // 100
ORDER_VALUES;      // ['Atlas', 'None']
DEFAULT_ORDER;     // 'Atlas'

// 5 genesis public key hashes that anchor the trust graph
ORDER_TRUST_ANCHOR_KEYS;  // { Atlas: [hash1, hash2, ...] }

// Look up trust anchors for an order
const anchors = getOrderTrustAnchorKeys('Atlas');

// Capitalize a topic name for display
topicLabel('content');  // 'Content'

// Build query filter for trust allocation envelopes
const where = buildTrustAllocationEnvelopeWhere();

Additional types

Schema.org additionalType values that distinguish Atlas-specific envelope kinds.

additional-type.ts
import {
  delegatedKeyAdditionalType,
  fairSharesAdditionalType,
  fairSharesSetupAdditionalType,
  identityVerificationAdditionalType,
  proofOfWorkAdditionalType,
  registryAdditionalType,
  shelterLeaseAdditionalType,
  trustReviewAdditionalType,
} from '@app_/consts';

// Schema.org additionalType values used across the protocol:
// 'atlas:delegatedKey'          — Permit/delegated key proofs
// 'atlas:fairShares'            — FairShares balance records
// 'atlas:fairSharesSetup'       — FairShares initialization
// 'atlas:identityVerification'  — Identity verification credentials
// 'atlas:proofOfWork'           — Proof of Work proofs
// 'atlas:registry'              — Registry DataCatalog
// 'atlas:shelterLease'          — Shelter hosting lease
// 'atlas:trust'                 — Trust review/allocation

Envelope handling modes

Defines how envelopes of each type are stored — whether only the latest version is kept, history is preserved, entries are append-only, or follow a workflow state machine.

envelope-kind.ts
import {
  ENVELOPE_DATA_HANDLING_MODE,
  ENVELOPE_DATA_HANDLING_BY_KEY,
  toEnvelopeHandlingKey,
} from '@app_/consts';

// How envelopes of a given type are stored and updated
ENVELOPE_DATA_HANDLING_MODE.LATEST_ONLY;         // Keep only latest version
ENVELOPE_DATA_HANDLING_MODE.LATEST_WITH_HISTORY;  // Keep latest + history
ENVELOPE_DATA_HANDLING_MODE.APPEND_ONLY;          // Never overwrite
ENVELOPE_DATA_HANDLING_MODE.WORKFLOW;              // State machine transitions

// Look up handling mode for a type
const key = toEnvelopeHandlingKey('CreativeWork', 'atlas:proofOfWork');
const mode = ENVELOPE_DATA_HANDLING_BY_KEY[key];

Storage keys

LocalStorage key names for client-side state persistence.

storage.ts
import {
  PUBLIC_KEY_HASH_TO_NAME_STORAGE_KEY,
  IDENTITY_SESSION_STORAGE_KEY,
  CUSTODIAN_API_URL_STORAGE_KEY,
  WORLD_APPS_STORAGE_KEY,
  SEARCH_HISTORY_STORAGE_KEY,
  // ... and more
} from '@app_/consts';

// LocalStorage keys for client-side state:
// 'atlas.publicKeyHashToName'  — Public key → display name mapping
// 'atlas.identitySession'      — Cached identity session
// 'atlas.custodianApiUrl'      — Custom Custodian URL
// 'atlas.worldApps'            — Installed world apps
// 'atlas.searchHistoryV2'      — Search history