> ## Documentation Index
> Fetch the complete documentation index at: https://armory.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Sign-In-With-X

> Add SIWX authentication to x402 payment flows

## Client Hook

```typescript theme={null}
import { createSIWxHook } from '@armory-sh/extensions';

const hook = createSIWxHook({
  domain: 'api.example.com',
  statement: 'Sign in to access protected routes',
  expirationSeconds: 3600
});
```

## Server Declaration

```typescript theme={null}
import { declareSIWxExtension } from '@armory-sh/extensions';

const extension = declareSIWxExtension({
  domain: 'api.example.com',
  statement: 'Sign in to access this API',
  network: 'eip155:8453',
  expirationSeconds: 3600
});
```

## Validation

```typescript theme={null}
import { parseSIWxHeader, validateSIWxMessage, verifySIWxSignature } from '@armory-sh/extensions';

const payload = parseSIWxHeader(header);
const messageResult = validateSIWxMessage(payload, 'https://api.example.com/data');

if (messageResult.valid) {
  const signatureResult = await verifySIWxSignature(payload, {
    evmVerifier: async () => true
  });
}
```
