{
	"info": {
		"name": "Nodemeta Backend - Users Module API",
		"description": "API documentation for the Users module endpoints. This collection includes authentication, user management, and 2FA operations.\n\n## Required Headers:\n\n### Standard Headers:\n- **Content-Type**: `application/json` (for requests with body)\n- **Authorization**: `Bearer <token>` (for authenticated endpoints)\n- **X-Request-Id**: Optional request tracking ID\n\n### Admin Endpoints (require signature verification):\n- **X-Signature**: RSA signature of the request\n- **X-Nonce**: Unique nonce to prevent replay attacks\n- **X-Timestamp**: Request timestamp\n\n### IP Detection:\n- **X-Forwarded-For**: Client IP (set by proxies)\n- **X-Real-IP**: Alternative IP header\n\n## Security Levels:\n- **Public**: No authentication required\n- **Authenticated**: Requires valid JWT token\n- **Admin**: Requires JWT token + admin role + request signature",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "12345678"
	},
	"item": [
		{
			"name": "Authentication",
			"item": [
				{
					"name": "Signup",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"action\": \"request\",\n  \"userData\": {\n    \"username\": \"testuser\",\n    \"email\": \"test@example.com\",\n    \"walletAddress\": \"0x123...\",\n    \"password\": \"password123\"\n  }\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/auth/signup",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "signup"]
						},
						"description": "Create a new user account. Use action: 'request' to send verification code, or 'verify' to complete signup."
					},
					"response": []
				},
				{
					"name": "Login",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"walletAddress\": \"0x123...\",\n  \"password\": \"password123\",\n  \"totpCode\": \"123456\" // optional if 2FA enabled\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/auth/login",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "login"]
						},
						"description": "Authenticate user with wallet address and password. Include TOTP code if 2FA is enabled."
					},
					"response": []
				},
				{
					"name": "Generate Token",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"walletAddress\": \"0x123...\"\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/auth/generate-token",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "generate-token"]
						},
						"description": "Generate JWT token for authenticated wallet address."
					},
					"response": []
				},
				{
					"name": "Verify Token",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"token\": \"your-jwt-token-here\"\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/auth/verify-token",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "verify-token"]
						},
						"description": "Validate JWT token and return decoded payload."
					},
					"response": []
				},
				{
					"name": "Check User",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{baseUrl}}/auth/check-user?address=0x123...",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "check-user"],
							"query": [
								{
									"key": "address",
									"value": "0x123...",
									"description": "Wallet address to check"
								}
							]
						},
						"description": "Check if user exists and has password/2FA settings."
					},
					"response": []
				},
				{
					"name": "Check Login",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{baseUrl}}/auth/check-login?address=0x123...",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "check-login"],
							"query": [
								{
									"key": "address",
									"value": "0x123...",
									"description": "Wallet address to check"
								}
							]
						},
						"description": "Check user existence and authentication status."
					},
					"response": []
				},
				{
					"name": "Logout",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{authToken}}"
							},
							{
								"key": "X-Request-Id",
								"value": "{{requestId}}",
								"description": "Optional: Request tracking ID"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"token\": \"{{authToken}}\"\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/auth/logout",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "logout"]
						},
						"description": "Invalidate user session token. Requires authentication."
					},
					"response": []
				},
				{
					"name": "Update Profile",
					"request": {
						"method": "PUT",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{authToken}}"
							},
							{
								"key": "X-Request-Id",
								"value": "{{requestId}}",
								"description": "Optional: Request tracking ID"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"walletAddress\": \"0x123...\",\n  \"fullName\": \"John Doe\",\n  \"bio\": \"User bio\",\n  \"notifications\": {\n    \"email\": true,\n    \"browser\": true\n  }\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/auth/update-profile",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "update-profile"]
						},
						"description": "Update user profile information. Requires authentication. Note: username and email cannot be changed after account creation."
					},
					"response": []
				},
				{
					"name": "Set Password",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"walletAddress\": \"0x123...\",\n  \"password\": \"newpassword123\"\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/auth/set-password",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "set-password"]
						},
						"description": "Set or update user password."
					},
					"response": []
				},
				{
					"name": "Get Token Stats",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{authToken}}"
							},
							{
								"key": "X-Request-Id",
								"value": "{{requestId}}",
								"description": "Optional: Request tracking ID"
							},
							{
								"key": "X-Signature",
								"value": "{{signature}}",
								"description": "RSA signature for request verification (required for admin endpoints)"
							},
							{
								"key": "X-Nonce",
								"value": "{{nonce}}",
								"description": "Unique nonce to prevent replay attacks"
							},
							{
								"key": "X-Timestamp",
								"value": "{{timestamp}}",
								"description": "Request timestamp"
							}
						],
						"url": {
							"raw": "{{baseUrl}}/auth/token-stats",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "token-stats"]
						},
						"description": "Get token statistics. Requires authentication and admin role. Includes signature verification."
					},
					"response": []
				}
			]
		},
		{
			"name": "Two-Factor Authentication",
			"item": [
				{
					"name": "Generate 2FA",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{authToken}}"
							},
							{
								"key": "X-Request-Id",
								"value": "{{requestId}}",
								"description": "Optional: Request tracking ID"
							}
						],
						"url": {
							"raw": "{{baseUrl}}/auth/2fa/generate",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "2fa", "generate"]
						},
						"description": "Generate 2FA secret and QR code. Requires authentication."
					},
					"response": []
				},
				{
					"name": "Verify 2FA",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{authToken}}"
							},
							{
								"key": "X-Request-Id",
								"value": "{{requestId}}",
								"description": "Optional: Request tracking ID"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"totpCode\": \"123456\"\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/auth/2fa/verify",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "2fa", "verify"]
						},
						"description": "Verify and enable 2FA with TOTP code. Requires authentication."
					},
					"response": []
				},
				{
					"name": "Disable 2FA",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{authToken}}"
							},
							{
								"key": "X-Request-Id",
								"value": "{{requestId}}",
								"description": "Optional: Request tracking ID"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"password\": \"userpassword\"\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/auth/2fa/disable",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "2fa", "disable"]
						},
						"description": "Disable 2FA. Requires authentication and current password."
					},
					"response": []
				},
				{
					"name": "Reset 2FA",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{authToken}}"
							},
							{
								"key": "X-Request-Id",
								"value": "{{requestId}}",
								"description": "Optional: Request tracking ID"
							}
						],
						"url": {
							"raw": "{{baseUrl}}/auth/2fa/reset",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "2fa", "reset"]
						},
						"description": "Reset 2FA secret. Requires authentication."
					},
					"response": []
				},
				{
					"name": "Test 2FA",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{authToken}}"
							},
							{
								"key": "X-Request-Id",
								"value": "{{requestId}}",
								"description": "Optional: Request tracking ID"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"totpCode\": \"123456\"\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/auth/2fa/test",
							"host": ["{{baseUrl}}"],
							"path": ["auth", "2fa", "test"]
						},
						"description": "Test 2FA code without affecting authentication. Requires authentication."
					},
					"response": []
				}
			]
		},
		{
			"name": "User Management",
			"item": [
				{
					"name": "List Users",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{authToken}}"
							},
							{
								"key": "X-Request-Id",
								"value": "{{requestId}}",
								"description": "Optional: Request tracking ID"
							},
							{
								"key": "X-Signature",
								"value": "{{signature}}",
								"description": "RSA signature for request verification (required for admin endpoints)"
							},
							{
								"key": "X-Nonce",
								"value": "{{nonce}}",
								"description": "Unique nonce to prevent replay attacks"
							},
							{
								"key": "X-Timestamp",
								"value": "{{timestamp}}",
								"description": "Request timestamp"
							}
						],
						"url": {
							"raw": "{{baseUrl}}/users/",
							"host": ["{{baseUrl}}"],
							"path": ["users", ""]
						},
						"description": "Get list of all users. Requires authentication and admin role. Includes signature verification."
					},
					"response": []
				},
				{
					"name": "Get User",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{authToken}}"
							},
							{
								"key": "X-Request-Id",
								"value": "{{requestId}}",
								"description": "Optional: Request tracking ID"
							},
							{
								"key": "X-Signature",
								"value": "{{signature}}",
								"description": "RSA signature for request verification (required for admin endpoints)"
							},
							{
								"key": "X-Nonce",
								"value": "{{nonce}}",
								"description": "Unique nonce to prevent replay attacks"
							},
							{
								"key": "X-Timestamp",
								"value": "{{timestamp}}",
								"description": "Request timestamp"
							}
						],
						"url": {
							"raw": "{{baseUrl}}/users/:id",
							"host": ["{{baseUrl}}"],
							"path": ["users", ":id"],
							"variable": [
								{
									"key": "id",
									"value": "user-id-here",
									"description": "User ID"
								}
							]
						},
						"description": "Get specific user details. Requires authentication and admin role. Includes signature verification."
					},
					"response": []
				},
				{
					"name": "Block User",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{authToken}}"
							},
							{
								"key": "X-Request-Id",
								"value": "{{requestId}}",
								"description": "Optional: Request tracking ID"
							},
							{
								"key": "X-Signature",
								"value": "{{signature}}",
								"description": "RSA signature for request verification (required for admin endpoints)"
							},
							{
								"key": "X-Nonce",
								"value": "{{nonce}}",
								"description": "Unique nonce to prevent replay attacks"
							},
							{
								"key": "X-Timestamp",
								"value": "{{timestamp}}",
								"description": "Request timestamp"
							}
						],
						"url": {
							"raw": "{{baseUrl}}/users/:id/block",
							"host": ["{{baseUrl}}"],
							"path": ["users", ":id", "block"],
							"variable": [
								{
									"key": "id",
									"value": "user-id-here",
									"description": "User ID to block"
								}
							]
						},
						"description": "Block a user account. Requires authentication and admin role. Includes signature verification."
					},
					"response": []
				},
				{
					"name": "Unblock User",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{authToken}}"
							},
							{
								"key": "X-Request-Id",
								"value": "{{requestId}}",
								"description": "Optional: Request tracking ID"
							},
							{
								"key": "X-Signature",
								"value": "{{signature}}",
								"description": "RSA signature for request verification (required for admin endpoints)"
							},
							{
								"key": "X-Nonce",
								"value": "{{nonce}}",
								"description": "Unique nonce to prevent replay attacks"
							},
							{
								"key": "X-Timestamp",
								"value": "{{timestamp}}",
								"description": "Request timestamp"
							}
						],
						"url": {
							"raw": "{{baseUrl}}/users/:id/unblock",
							"host": ["{{baseUrl}}"],
							"path": ["users", ":id", "unblock"],
							"variable": [
								{
									"key": "id",
									"value": "user-id-here",
									"description": "User ID to unblock"
								}
							]
						},
						"description": "Unblock a user account. Requires authentication and admin role. Includes signature verification."
					},
					"response": []
				},
				{
					"name": "Remove Device",
					"request": {
						"method": "DELETE",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{authToken}}"
							},
							{
								"key": "X-Request-Id",
								"value": "{{requestId}}",
								"description": "Optional: Request tracking ID"
							},
							{
								"key": "X-Signature",
								"value": "{{signature}}",
								"description": "RSA signature for request verification (required for admin endpoints)"
							},
							{
								"key": "X-Nonce",
								"value": "{{nonce}}",
								"description": "Unique nonce to prevent replay attacks"
							},
							{
								"key": "X-Timestamp",
								"value": "{{timestamp}}",
								"description": "Request timestamp"
							}
						],
						"url": {
							"raw": "{{baseUrl}}/users/:id/devices/:deviceId",
							"host": ["{{baseUrl}}"],
							"path": ["users", ":id", "devices", ":deviceId"],
							"variable": [
								{
									"key": "id",
									"value": "user-id-here",
									"description": "User ID"
								},
								{
									"key": "deviceId",
									"value": "device-id-here",
									"description": "Device ID to remove"
								}
							]
						},
						"description": "Remove a device from user's account. Requires authentication and admin role. Includes signature verification."
					},
					"response": []
				}
			]
		}
	],
	"variable": [
		{
			"key": "baseUrl",
			"value": "http://localhost:3000",
			"type": "string",
			"description": "Base URL for the API"
		},
		{
			"key": "authToken",
			"value": "",
			"type": "string",
			"description": "JWT authentication token"
		},
		{
			"key": "requestId",
			"value": "",
			"type": "string",
			"description": "Optional: Request tracking ID (auto-generated if empty)"
		},
		{
			"key": "signature",
			"value": "",
			"type": "string",
			"description": "RSA signature for admin endpoints (required)"
		},
		{
			"key": "nonce",
			"value": "",
			"type": "string",
			"description": "Unique nonce for admin endpoints (required)"
		},
		{
			"key": "timestamp",
			"value": "",
			"type": "string",
			"description": "Request timestamp for admin endpoints (required)"
		}
	]
}
