Atrás
+20 XP
4/12
Challenge: Build a SIWS Message
Construct a properly formatted Sign-In With Solana (SIWS) message that can be used for authentication.
Requirements
- Create a function that accepts
domain(string),publicKey(PublicKey),nonce(string), andstatement(string) - Generate an ISO timestamp for "Issued At" (use
new Date().toISOString()) - Return a formatted SIWS message string following this structure:
{domain} wants you to sign in with your Solana account: {publicKey} {statement} URI: https://{domain} Version: 1 Nonce: {nonce} Issued At: {issuedAt}
Casos de Prueba
Should return a SIWS message string containing the domain
Entrada:
'academy.courses', sender, 'nonce123', 'Sign in'Esperado: typeof result === 'string' && result.includes('academy.courses')Should include SIWS version header
Entrada:
'academy.courses', sender, 'nonce123', 'Sign in'Esperado: result.includes('Version: 1')