Developer Integrations & API Gateway
API key provisioning, constant-time SHA-256 verification, Redis distributed token-bucket rate limiting, and third-party webhook ingestion.
The Integrations module empowers partners, clients, and internal systems to securely interact with the SCRIPE platform. It provides high-performance API key authentication with constant-time secret verification, granular OAuth-style scope enforcement, Redis-backed distributed rate limiting, and real-time API telemetry tracking.
Integrations Architecture
Built for low latency (< 1ms authentication overhead) and strict multi-tenant isolation across high-volume external traffic.
Scoped API Keys
Generate prefixed API keys (sk_live_..., sk_test_...) with designated expiration dates and friendly labels.
Granular Scope Delegation
Restricted permission scopes (e.g. venue:read, billing:write) preventing external tokens from exceeding necessary privileges.
Distributed Rate Limiting
Redis token-bucket rate limiting enforcing per-minute request ceilings to safeguard platform stability.
Real-Time Telemetry
Audit logs capturing request origins, IP addresses, latency timings, and response HTTP codes.
Tamper-Proof Hashing
Cryptographic SHA-256 secret hashing with constant-time comparison to prevent timing vulnerabilities.
Third-Party Connectors
Extensible inbound and outbound webhook connectors for external CRM, payment, and analytics platforms.
Domain Aggregate Root: ApiKey
The ApiKey aggregate governs key lifecycle, cryptographic hash verification, scope assignments, and IP whitelisting.
public sealed class ApiKey : TenantAggregateRoot
{
public string Name { get; private set; } = string.Empty;
public string KeyPrefix { get; private set; } = string.Empty; // e.g. "sk_live_..."
public string SecretHash { get; private set; } = string.Empty; // SHA-256 hash
public List<string> Scopes { get; private set; } = new(); // "venue:read", "reservations:write"
public List<string> AllowedIpAddresses { get; private set; } = new();
public int RateLimitPerMinute { get; private set; } = 300;
public DateTimeOffset? ExpiresAtUtc { get; private set; }
public bool IsRevoked { get; private set; }
public bool VerifySecret(string rawSecret)
{
if (IsRevoked || (ExpiresAtUtc.HasValue && ExpiresAtUtc.Value < DateTimeOffset.UtcNow))
return false;
var computedHash = ApiKeySecurity.ComputeSha256(rawSecret);
return CryptographicOperations.FixedTimeEquals(
Encoding.UTF8.GetBytes(SecretHash),
Encoding.UTF8.GetBytes(computedHash)
);
}
}API Key Authentication & Rate Limiting Pipeline
The sub-millisecond execution pipeline for validating and auditing incoming external API calls:
Primary API Endpoints
Key endpoints exposed by IntegrationsControllers for key management, scope modification, and usage telemetry.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| GET | /api/v1/integrations/api-keys | List active and expired API keys for the current tenant | 🔒 Required |
| POST | /api/v1/integrations/api-keys | Generate a new API key with specific scopes and rate limits | 🔒 Required |
| DELETE | /api/v1/integrations/api-keys/{id} | Instantly revoke an API key, invalidating all active sessions | 🔒 Required |
| GET | /api/v1/integrations/api-keys/{id}/stats | Retrieve real-time request volume and error rate analytics for a key | 🔒 Required |
| PUT | /api/v1/integrations/api-keys/{id}/scopes | Update permitted scopes and IP whitelists for an existing key | 🔒 Required |