Skip to content

Temporary storage for session verification#182

Merged
ayomideadeniran merged 4 commits intoStellarDevHub:mainfrom
anonfedora:feature/temporary_storage_for_session_verfication
Mar 30, 2026
Merged

Temporary storage for session verification#182
ayomideadeniran merged 4 commits intoStellarDevHub:mainfrom
anonfedora:feature/temporary_storage_for_session_verfication

Conversation

@anonfedora
Copy link
Copy Markdown
Contributor

Description

This PR implements a temporary session verification system for students completing quizzes, as specified in issue #135. The system leverages Soroban's Temporary Storage to manage short-lived verification codes securely and efficiently.

Key Changes

  • New Session Module: Created session.rs which contains the SessionVerificationContract.
  • Session Generation: Implemented start_session to generate a unique 128-bit verification code (via SHA-256 hash truncation) and store it with a configurable TTL (100–200 ledgers).
  • Verification Logic: Added verify_session to validate student codes against temporary storage.
  • Session Extension: Added extend_session to allow active students to prolong their session's validity.
  • Module Registration: Registered the session module in the main contract lib.rs.
  • Linter Cleanup: Resolved compiler diagnostics and linter warnings in token.rs (unused imports and redundant assertions).

Reference Issues

Fixes #135

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue - Cleanup of compiler diagnostics)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Test Results

Unit tests for the new session system were added to tests.rs and passed successfully:

running 3 tests
test tests::test_session_expiration ... ok
test tests::test_session_start_and_verify ... ok
test tests::test_session_extension ... ok

Existing token tests also pass after the linter fixes:

running 21 tests
...
test result: ok. 21 passed; 0 failed; 0 ignored; 0 measured; 66 filtered out; finished in 0.18s

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@anonfedora Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@ayomideadeniran
Copy link
Copy Markdown
Contributor

Pr under review.

@ayomideadeniran ayomideadeniran merged commit 1964abf into StellarDevHub:main Mar 30, 2026
1 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Contract] Temporary Storage for Session Verification

2 participants