Creates a new GraphQLEncryptionClient instance.
The GraphQL data provider to use for queries
Creates a new API key with secure server-side cryptographic hashing.
This method calls the server to:
CRITICAL: The raw key is returned only once and cannot be recovered. Instruct users to save it immediately in a secure location.
Configuration for the new API key
Result with raw key (show once!) and database ID
const result = await client.CreateAPIKey({
Label: 'Production Integration',
Description: 'API access for our CRM system',
ExpiresAt: new Date('2025-12-31'),
ScopeIDs: ['entities:read', 'entities:write']
});
if (result.Success) {
alert(`Save this key now! It won't be shown again:\n${result.RawKey}`);
} else {
console.error('Failed to create key:', result.Error);
}
Revokes an API key, permanently disabling it.
Once revoked, an API key cannot be reactivated. Users must create a new key.
The database ID of the API key to revoke
Result indicating success or failure
Client for encryption-related GraphQL operations.
This client provides methods for operations that require server-side cryptographic processing, such as API key generation. These operations cannot be performed client-side because they require secure random number generation and cryptographic hashing that must match the server's validation logic.
Example