HMAC Signature Verification
How Verification Works
The Papermap API verifies requests by:- Extracting
workspace_idandvalid_untilfrom headers - Computing signature:
HMAC-SHA256(workspace_id + valid_until, secret_key) - Comparing computed signature with provided
X-Signature - Checking
valid_untilhasn’t expired
Signature Pattern
Token Expiration
Papermap API Requests
- Duration: 5 minutes vallidity advisable
- Configuration:
valid_until = now + 300 - Purpose: Short-lived to prevent replay attacks
Iframe Tokens
- Duration: 1 hour validity (configurable)
- Configuration:
valid_until = now + 3600 - Purpose: Long enough for user sessions, short enough for security
Expired Token Handling
Expired tokens are automatically rejected by Papermap API:Secret Key Management
Environment Variables
Store credentials securely in environment variables:.env
Obtaining Your Configuration: - API Credentials: Available in your
Papermap dashboard under Settings → API Keys - API Endpoint: Available
in Settings → API Configuration - Always use the values provided in your
dashboard for your specific workspace
Key Rotation
Regularly rotate your API keys:- Generate new API key in Papermap dashboard
- Update environment variables in your application
- Deploy updated configuration
- Revoke old API key after confirming new one works
Tenant Isolation
Always Verify Tenant Access
Never generate tokens or retrieve dashboards without verifying the user has access to the tenant:Database-Level Isolation
Ensure your database queries respect tenant boundaries:HTTPS and Transport Security
Force HTTPS
CORS Configuration
Configure CORS properly to prevent unauthorized domains from accessing your API:Monitoring Alerts
Set up alerts for suspicious activity:- Multiple failed authentication attempts
- Unusual number of token generation requests
- Access attempts from unexpected IP addresses
- Expired token usage attempts
Security Checklist
Use this checklist before going to production:API keys stored in environment variables (not in code)
HTTPS enforced on all endpoints
Tenant access verification on all endpoints
JWT tokens have proper expiration
Monitoring and alerts configured
Key rotation schedule established
Error messages don’t expose sensitive info
API endpoint URL treated as sensitive
Common Vulnerability to Avoid
1. Signature Replay Attacks
Thevalid_until timestamp prevents replay attacks. Never:
- Reuse old signatures
- Set very long expiration times for API requests
- Remove timestamp validation

