> ## Documentation Index
> Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Delegate to a Server Signer

> Create a business account and delegate wallet signing to a registered server identity governed by approval requirements.

> [!WARNING]
>
> Request signing and server signer delegation are available only to approved beta and test customers. Dynamic must enable request signing for your environment and provide the beta Node SDK version before you start.

Use this flow when you want a registered server to sign with a wallet and want Business Account approval requirements to govern the wallet. You create a business account, configure Delegated Access, then delegate to the server signer.

## Prerequisites

Before you delegate to a server signer:

* Create a business account and create or link the wallet you want it to own. See [Create a Business Account](https://www.dynamic.xyz/docs/javascript/reference/business-accounts/create-a-business-account.md) and [Add Wallets](https://www.dynamic.xyz/docs/javascript/reference/business-accounts/add-wallets.md).
* Decide which [approval requirements](https://www.dynamic.xyz/docs/business-accounts/approvals.md) should apply when the server signer signs or the account changes.

## Configure Delegated Access

In the Dynamic Console, go to **Embedded Wallets** > **Configuration**. Open **Delegated Access**, then configure these four items:

1. **Dynamic API token** authenticates your server when it calls Dynamic APIs.
2. **Request signing key** signs wallet requests so Dynamic can verify that they came from your server.
3. **Webhook Encryption Key** encrypts delegated key shares before Dynamic sends them to your server. Register the public encryption key and keep its private key on your server.
4. **Webhook for Delegated Share** is the HTTPS endpoint that receives encrypted delegated key shares. Configure and verify the endpoint URL.

Your endpoint must verify webhook signatures before processing signer events. See [Set up webhooks](https://www.dynamic.xyz/docs/platform/console/webhooks/setup.md) for implementation guidance.

> [!WARNING]
>
> Store the encryption private key in a secrets manager, hardware security module (HSM), or key management service (KMS). Never commit it, expose it to a client, or log it.

## Delegate to the server signer

List the registered request signers for the business account, then pass the selected `serverIdentifier` to `addBusinessAccountSigner`. The method name reflects the underlying signer operation; the product flow delegates wallet signing authority to that server identity.

```typescript theme={"system"}
import {
  addBusinessAccountSigner,
  isBusinessAccountActionRequired,
  listBusinessAccountRegisteredRequestSigners,
} from '@dynamic-labs-sdk/client/waas';

const requestSigners = await listBusinessAccountRegisteredRequestSigners({
  businessAccountId,
});

const [serverSigner] = requestSigners;

if (!serverSigner) {
  throw new Error('No registered server signer is available');
}

const result = await addBusinessAccountSigner({
  businessAccountId,
  walletAccount,
  signerType: 'server',
  targetIdentity: { serverIdentifier: serverSigner.serverIdentifier },
});

if (isBusinessAccountActionRequired(result)) {
  throw new Error('Delegating to this server signer requires approval');
}

const { shareSetId } = result;
```

The caller must meet the requirements described in [Manage Signers](https://www.dynamic.xyz/docs/javascript/reference/business-accounts/manage-signers.md#delegate-to-a-server-signer). When the account requires approval for this change, the operation remains pending until the required approvers approve it.

## Add a transaction policy for the server signer

Use the `shareSetId` returned by `addBusinessAccountSigner` to add rules to this server signer's policy layer. The following policy limits each Ethereum transaction that the server signer initiates to 0.1 ETH and requires one approval from another owner or admin before signing.

```typescript theme={"system"}
import { createPolicy } from '@dynamic-labs-sdk/client/waas';
import { WaasChainEnum } from '@dynamic-labs/sdk-api-core';

const walletId = walletAccount.verifiedCredentialId;

await createPolicy({
  scope: { walletId, shareSetId },
  chain: WaasChainEnum.Evm,
  chainIds: [1],
  rules: {
    maxAmountPerTransaction: { amount: '100000000000000000' },
    approvalRequirements: [
      {
        v: 1,
        id: 'server-signer-approval',
        eligibleApproverRoles: ['owner', 'admin'],
        requiredApprovals: 1,
      },
    ],
  },
});
```

The initiator does not count toward `requiredApprovals`, so the business account needs another eligible owner or admin. Adjust the transaction limit, chain IDs, and approver roles for your application. See [Policies](https://www.dynamic.xyz/docs/javascript/reference/business-accounts/policies/overview.md#signer-layer) for other signer-layer rules and [Quorum policies](https://www.dynamic.xyz/docs/javascript/reference/business-accounts/policies/quorum-policies.md) for the approval flow.

## Receive the wallet credentials

After delegation completes, Dynamic sends `businessAccount.signer.added` to the configured webhook. Verify the webhook signature before you process its data, then decrypt the delegated share and wallet API key with the Share Delivery private key.

```typescript theme={"system"}
import { decryptDelegatedWebhookData } from '@dynamic-labs-wallet/node';

const SHARE_DELIVERY_PRIVATE_KEY = process.env.SHARE_DELIVERY_PRIVATE_KEY;

if (!SHARE_DELIVERY_PRIVATE_KEY) {
  throw new Error('Missing Share Delivery private key');
}

const {
  walletId,
  publicKey: accountAddress,
  shareSetId,
  encryptedDelegatedKeyShare,
  encryptedWalletApiKey,
} = webhookEvent.data;

const {
  decryptedDelegatedShare,
  decryptedWalletApiKey: walletApiKey,
} = decryptDelegatedWebhookData({
  privateKeyPem: SHARE_DELIVERY_PRIVATE_KEY,
  encryptedDelegatedKeyShare,
  encryptedWalletApiKey,
});
```

Store the wallet API key in a secrets manager. Treat the decrypted delegated share as raw key material: keep it only in protected server memory while signing, store only its encrypted form at rest, and never log it or return it to a client.

## Sign from the server

Create a request-signed Node client with the wallet API key included in `requestSigningOption`, then pass the wallet metadata and delegated share to the signing method. The wallet's policies and Business Account approval requirements apply to the server's signing requests.

```typescript theme={"system"}
import {
  requestSigningOption,
  ThresholdSignatureScheme,
  type WalletMetadata,
} from '@dynamic-labs-wallet/node';
import { DynamicEvmWalletClient } from '@dynamic-labs-wallet/node-evm';

const DYNAMIC_ENVIRONMENT_ID = process.env.DYNAMIC_ENVIRONMENT_ID;
const DYNAMIC_API_TOKEN = process.env.DYNAMIC_API_TOKEN;
const DYNAMIC_SIGNING_PRIVATE_KEY = process.env.DYNAMIC_SIGNING_PRIVATE_KEY;

if (!DYNAMIC_ENVIRONMENT_ID || !DYNAMIC_API_TOKEN || !DYNAMIC_SIGNING_PRIVATE_KEY) {
  throw new Error('Missing Dynamic server authentication configuration');
}

const client = new DynamicEvmWalletClient({
  environmentId: DYNAMIC_ENVIRONMENT_ID,
  requestSigning: requestSigningOption({
    signingPrivateKeyHex: DYNAMIC_SIGNING_PRIVATE_KEY,
    apiToken: DYNAMIC_API_TOKEN,
    walletApiKey,
  }),
});

const walletMetadata: WalletMetadata = {
  walletId,
  accountAddress,
  chainName: 'EVM',
  thresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_TWO,
  shareSetId,
};

const signature = await client.signMessage({
  message: 'hello from my server',
  walletMetadata,
  externalServerKeyShares: [decryptedDelegatedShare],
});
```

The call returns the message signature. For a policy that requires approvals, complete the proposal and retry the signing request with the approved intent as described in [Quorum policies](https://www.dynamic.xyz/docs/javascript/reference/business-accounts/policies/quorum-policies.md#complete-a-quorum-gated-signing-operation).

## Revoke delegated access

Remove the server signer from the wallet when it should no longer sign. Handle `businessAccount.signer.revoked` by deleting the corresponding wallet API key and any server-side wallet credentials you stored for that delegation.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.