> ## Documentation Index
> Fetch the complete documentation index at: https://sdk.umbraprivacy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Registration

> API reference: getUserRegistrationFunction (3-step: account init, X25519 key, user commitment ZK proof), key rotators, entropy seed updaters, staged fund recovery.

## getUserRegistrationFunction

**Import:** `@umbra-privacy/sdk/registration`

```typescript theme={null}
function getUserRegistrationFunction(
  args: GetUserRegistrationFunctionArgs,
  deps?: GetUserRegistrationFunctionDeps,
): UserRegistrationFunction
```

Registers the caller on-chain. Registration is a multi-step idempotent flow that enables confidential token accounts (encrypted balances) and anonymous usage (mixer eligibility). Steps already completed in a previous session are skipped.

***

### GetUserRegistrationFunctionArgs

* `client: IUmbraClient` - The configured client.

***

### GetUserRegistrationFunctionDeps

All fields are optional overrides for SDK defaults.

RPC overrides:

* `accountInfoProvider?: AccountInfoProviderFunction`
* `getLatestBlockhash?: GetLatestBlockhash`
* `transactionForwarder?: TransactionForwarder`

Key derivation overrides:

* `userAccountX25519KeypairGenerator?: Curve25519KeypairGeneratorFunction`
* `masterViewingKeyEncryptingX25519KeypairGenerator?: Curve25519KeypairGeneratorFunction`
* `mintX25519KeypairGenerator?: MintX25519KeypairGeneratorFunction`
* `masterViewingKeyGenerator?: MasterViewingKeyGeneratorFunction`
* `masterViewingKeyBlindingFactorGenerator?: MasterViewingKeyBlindingFactorGeneratorFunction`
* `poseidonPrivateKeyGenerator?: PoseidonPrivateKeyGeneratorFunction`
* `poseidonBlindingFactorGenerator?: PoseidonBlindingFactorGeneratorFunction`
* `rescueCommitmentBlindingFactorGenerator?: RescueEncryptionCommitmentBlindingFactorGeneratorFunction`
* `randomFactorGenerator?: RandomFactorForPolynomialCommitmentGeneratorFunction`

Rescue cipher overrides:

* `getRcKeyGenerator?: (privateKey: X25519PrivateKey) => RcKeyGeneratorFunction`
* `getRcEncryptor?: (privateKey: X25519PrivateKey) => RcEncryptorWithNonceFunction`
* `rescueCommitmentGenerator?: RescueEncryptionCommitmentGeneratorFunction`

Commitment overrides:

* `userCommitmentGenerator?: UserCommitmentGeneratorFunction`

Challenge / polynomial overrides:

* `fiatShamirChallengeGenerator?: FiatShamirChallengeGeneratorFunction`
* `challengePowersFunction?: ChallengePowersFunction`
* `polynomialEvaluator?: PolynomialEvaluatorFunction`

Poseidon / BN254 overrides:

* `poseidonAggregator?: PoseidonAggregatorHashFunction`
* `bn254ModInverter?: ModuleInvFunction`
* `computeLimbwiseSumInverse?: (limbs: Base85LimbTuple) => Bn254FieldElement`

ZK prover:

* `zkProver?: IZkProverForUserRegistration` — ZK proof generator for the anonymous registration sub-step. Required only when `options.anonymous` is `true`. Use `getUserRegistrationProver()` from `@umbra-privacy/sdk/zk-prover` — see [ZK Provers](/sdk/advanced/zk-provers).

***

### Returns

`UserRegistrationFunction`

```typescript theme={null}
type UserRegistrationFunction = (
  options?: UserRegistrationOptions,
) => Promise<TransactionSignature[]>
```

Returns the signatures of all transactions submitted during the registration flow. Already-completed steps produce no transactions.

### UserRegistrationOptions

* `confidential?: boolean` - Register for confidential (encrypted) token account usage. Default: `true`.
* `anonymous?: boolean` - Register for anonymous (mixer) usage. Requires a ZK proof. Default: `true`.
* `hooks?: RegistrationHooks` - Per-step lifecycle hooks. Slots: `initUserAccount`, `registerX25519PublicKey`, `registerAnonymousUsage` (each `SkippableDirectTransactionStepHooks` or `SkippableMpcTransactionStepHooks`), plus top-level `onValidationStart/Complete`, `onAccountFetchStart/Complete`, `onKeyDerivationStart/Complete`, `onComplete`, `onError`.
* `optionalData?: OptionalData32` - 32-byte caller metadata attached to on-chain instructions.

***

### Errors

Throws `RegistrationError`. See [Errors](./errors#registrationerror) for all stages.

### Example

```typescript theme={null}
import { getUserRegistrationFunction } from "@umbra-privacy/sdk";
import { getUserRegistrationProver } from "@umbra-privacy/sdk/zk-prover";

const zkProver = getUserRegistrationProver();

const register = getUserRegistrationFunction({ client }, { zkProver });
const signatures = await register({ confidential: true, anonymous: true });
```

***

## getUserEncryptionKeyRotatorFunction

**Import:** `@umbra-privacy/sdk/account`

```typescript theme={null}
function getUserEncryptionKeyRotatorFunction(
  args: { client: IUmbraClient },
  deps?: GetUserRegistrationFunctionDeps,
): () => Promise<TransactionSignature[]>;
```

Rotates the X25519 public key stored in the on-chain user account. Synchronous, no MPC. Use this when the existing key may have been compromised. Accepts the same shape `args` / `deps` as `getUserRegistrationFunction`.

Returns a zero-argument function. Call it with no arguments to execute the rotation.

***

## getMasterViewingKeyRotatorFunction

**Import:** `@umbra-privacy/sdk/account`

```typescript theme={null}
function getMasterViewingKeyRotatorFunction(
  args: { client: IUmbraClient },
  deps?: GetUserRegistrationFunctionDeps,
): () => Promise<TransactionSignature[]>;
```

Rotates the Master Viewing Key (MVK) X25519 encryption key. **MPC + ZK** — also rotates the on-chain user commitment. Accepts the same `args` / `deps` shape as `getUserRegistrationFunction`.

Returns a zero-argument function. Call it with no arguments to execute the rotation.

***

## getUserEntropySeedRotatorFunction

**Import:** `@umbra-privacy/sdk/account`

```typescript theme={null}
function getUserEntropySeedRotatorFunction(
  args: { client: IUmbraClient },
  deps?: GetUserEntropySeedRotatorFunctionDeps,
): UserEntropySeedRotatorFunction;
```

Rotates the random generation seed stored in the on-chain user account. This seed contributes to commitment randomness in Stealth Pool Note operations. Synchronous, no MPC.

### Deps

* `accountInfoProvider?: AccountInfoProviderFunction`.
* `getLatestBlockhash?: GetLatestBlockhash`.
* `transactionForwarder?: TransactionForwarder`.

### Returns

```typescript theme={null}
type UserEntropySeedRotatorFunction = (args: {
  newSeed: Uint8Array;
  optionalData?: OptionalData32;
}) => Promise<SimpleOperationResult>;
```

* `newSeed: Uint8Array` — the 32-byte replacement seed.

***

## getTokenEntropySeedRotatorFunction

**Import:** `@umbra-privacy/sdk/account`

```typescript theme={null}
function getTokenEntropySeedRotatorFunction(
  args: { client: IUmbraClient },
  deps?: GetTokenEntropySeedRotatorFunctionDeps,
): TokenEntropySeedRotatorFunction;
```

Rotates the random generation seed on a per-mint EncryptedTokenAccount. Synchronous, no MPC.

### Deps

* `accountInfoProvider?: AccountInfoProviderFunction`.
* `getLatestBlockhash?: GetLatestBlockhash`.
* `transactionForwarder?: TransactionForwarder`.

### Returns

```typescript theme={null}
type TokenEntropySeedRotatorFunction = (args: {
  mint: Address;
  newSeed: Uint8Array;
  optionalData?: OptionalData32;
  hooks?: DirectTransactionStepHooks;
}) => Promise<SimpleOperationResult>;
```

* `mint: Address` — the token mint whose account seed to rotate.
* `newSeed: Uint8Array` — the 32-byte replacement seed.

***

## getStagedSolRecovererFunction

**Import:** `@umbra-privacy/sdk/account`

```typescript theme={null}
function getStagedSolRecovererFunction(
  args: { client: IUmbraClient },
  deps?: GetStagedSolRecovererFunctionDeps,
): StagedSolRecovererFunction;
```

Recovers wSOL that was staged in the protocol's pool custody during a failed MPC callback. Call this if a deposit / withdraw / convert callback never landed and you need to reclaim the staged SOL. Synchronous — no MPC, no ZK proof.

### Deps

* `accountInfoProvider?: AccountInfoProviderFunction`.
* `getLatestBlockhash?: GetLatestBlockhash`.
* `transactionForwarder?: TransactionForwarder`.

### Returns

```typescript theme={null}
type StagedSolRecovererFunction = (args: {
  mint: Address;
  optionalData?: OptionalData32;
  hooks?: DirectTransactionStepHooks;
}) => Promise<SimpleOperationResult>;
```

* `mint: Address` — the mint of the failed operation (typically the wSOL mint).

***

## getStagedSplRecovererFunction

**Import:** `@umbra-privacy/sdk/account`

```typescript theme={null}
function getStagedSplRecovererFunction(
  args: { client: IUmbraClient },
  deps?: GetStagedSplRecovererFunctionDeps,
): StagedSplRecovererFunction;
```

Recovers SPL tokens that were staged in the protocol's pool custody during a failed MPC callback. Synchronous — no MPC, no ZK proof.

### Deps

* `accountInfoProvider?: AccountInfoProviderFunction`.
* `getLatestBlockhash?: GetLatestBlockhash`.
* `transactionForwarder?: TransactionForwarder`.

### Returns

```typescript theme={null}
type StagedSplRecovererFunction = (args: {
  mint: Address;
  optionalData?: OptionalData32;
  hooks?: DirectTransactionStepHooks;
}) => Promise<SimpleOperationResult>;
```

* `mint: Address` — the token mint of the staged SPL tokens.

***

## RegistrationError

Thrown by `getUserRegistrationFunction`. See [Errors](./errors#registrationerror).

Stage values: `"initialization"` | `"master-seed-derivation"` | `"account-fetch"` | `"key-derivation"` | `"zk-proof-generation"` | `"pda-derivation"` | `"instruction-build"` | `"transaction-build"` | `"transaction-compile"` | `"transaction-sign"` | `"transaction-validate"` | `"transaction-send"`
