Back to Home
web2.auth

Register Account

Create a new Web2 account with email and password, verify via OTP, then register an Ed25519 key for session signing.

Step 1

Register with Email

Call web2.auth.register() with your email and password. An OTP will be sent to your email.

const result = await web2.auth.register({
email: 'user@example.com',
password: 'securePassword123',
blackboxUrl,
});
// result.principalId → UUID
Step 2

Verify Email (OTP)

Enter the OTP sent to your email. Call web2.auth.verifyEmail().

await web2.auth.verifyEmail({
email, otp: '123456', blackboxUrl,
});
Step 3

Generate Ed25519 Keypair

Generate an Ed25519 keypair using @noble/ed25519. The keys will be displayed so you can review them before registration.

// Generate keypair with @noble/ed25519
const signer = generateEd25519Signer();
const keys = serializeKeys(signer);
// keys.publicKeyHex → hex string
// keys.privateKeyHex → hex string
Step 4

Register Ed25519 Key

Register the generated Ed25519 keypair with the cluster nodes. This key will be used to create sessions.

await web2.auth.registerKey({
principalId, password,
ed25519Signer: signer,
blackboxUrl,
});

Console Output

Waiting for action...