Member Junction
    Preparing search index...

    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.

    // Create the client
    const encryptionClient = new GraphQLEncryptionClient(graphQLProvider);

    // Create a new API key
    const result = await encryptionClient.CreateAPIKey({
    Label: 'My Integration Key',
    Description: 'Used for external service access',
    ExpiresAt: new Date('2025-12-31'),
    ScopeIDs: ['scope-id-1', 'scope-id-2']
    });

    if (result.Success) {
    // Show rawKey to user ONCE - cannot be recovered
    console.log('Save this key:', result.RawKey);
    }
    Index

    Constructors

    Methods

    • Creates a new API key with secure server-side cryptographic hashing.

      This method calls the server to:

      1. Generate a cryptographically secure random API key
      2. Hash the key using SHA-256 for secure storage
      3. Store only the hash in the database
      4. Return the raw key ONCE

      CRITICAL: The raw key is returned only once and cannot be recovered. Instruct users to save it immediately in a secure location.

      Parameters

      Returns Promise<CreateAPIKeyResult>

      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.

      Parameters

      • apiKeyId: string

        The database ID of the API key to revoke

      Returns Promise<RevokeAPIKeyResult>

      Result indicating success or failure

      const result = await client.RevokeAPIKey('key-uuid-here');

      if (result.Success) {
      console.log('API key has been revoked');
      } else {
      console.error('Failed to revoke:', result.Error);
      }