Skip to main content

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.

Overview

DynamicSvmWalletClient::sign_message signs a UTF-8 message with Ed25519 and returns a base58-encoded 64-byte signature. The signature is over the raw message bytes — no Solana-specific message envelope is applied.

Prerequisites

Basic Message Signing

use dynamic_waas_sdk::{ServerKeyShare, WalletProperties};
use dynamic_waas_sdk_svm::DynamicSvmWalletClient;

let svm = DynamicSvmWalletClient::new(&client);

// Load the metadata + shares you persisted at creation time.
let wallet_properties: WalletProperties = serde_json::from_str(
    &redis.get(format!("wallet:{}", account_address)).await?,
)?;
let external_server_key_shares: Vec<ServerKeyShare> = serde_json::from_slice(
    &vault.read(format!("wallet:{}/shares", account_address)).await?,
)?;

let signature_b58 = svm
    .sign_message(
        &wallet_properties,
        &external_server_key_shares,
        "Hello, World!",
    )
    .await?;

println!("Signature: {signature_b58}");

Verifying the signer locally

use ed25519_dalek::{Signature, VerifyingKey};

let pubkey_bytes: [u8; 32] = bs58::decode(&wallet_properties.account_address)
    .into_vec()?
    .try_into()
    .unwrap();
let verifying = VerifyingKey::from_bytes(&pubkey_bytes)?;

let sig_bytes = bs58::decode(&signature_b58).into_vec()?;
let signature = Signature::from_slice(&sig_bytes)?;

verifying.verify_strict("Hello, World!".as_bytes(), &signature)?;

Use case: off-chain auth

Common pattern for nonce-based wallet auth:
let nonce = uuid::Uuid::new_v4().to_string();
let message = format!("Sign this nonce to authenticate: {nonce}");

let signature_b58 = svm
    .sign_message(&wallet_properties, &external_server_key_shares, &message)
    .await?;

Next Steps