tutus-chain/pkg/core/native/native_test
Tutus Development c250c16e89 Add VPP (Vita Presence Protocol) to native Vita contract
Implement real-time proof-of-humanity presence tracking as OAuth 2.0 extension:

Native Contract Methods:
- recordPresence(sessionId, deviceHash): Record heartbeat for caller's Vita
- getPresence(tokenId): Get presence record with computed status
- getPresenceStatus(tokenId): Get computed status (offline/online/away/invisible)
- setPresenceVisibility(invisible): Toggle invisible mode
- getPresenceConfig(): Get VPP configuration values

State Types (pkg/core/state/vita.go):
- PresenceStatus enum: Offline, Online, Away, Invisible
- PresenceRecord: TokenID, LastHeartbeat, SessionID, DeviceHash, Status, Invisible
- PresenceConfig: PresenceWindow (60), AwayWindow (300), MinHeartbeatInterval (15),
  MaxHeartbeatInterval (60) - all in blocks (~seconds)

Security Features:
- Session and device hash must be exactly 32 bytes
- Rate limiting: Min 15 blocks between heartbeats
- Invisible mode: Heartbeats recorded but status hidden
- Caller must have active Vita token

Internal Methods for Cross-Contract Use:
- GetPresenceRecord, GetPresenceStatusInternal, IsOnline, IsPresent

Events:
- PresenceRecorded(tokenId, blockHeight, sessionId)
- PresenceVisibilityChanged(tokenId, invisible)

Tests (7 new):
- GetPresenceConfig, GetPresence_NonExistent, GetPresenceStatus_NonExistent
- RecordPresence_NoVita, RecordPresence_InvalidSession, RecordPresence_InvalidDevice
- SetPresenceVisibility_NoVita

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 17:01:59 +00:00
..
helpers Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
ancora_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
annos_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
collocatio_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
common_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
cryptolib_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
cryptolib_verification_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
designate_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
eligere_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
federation_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
generate_expected_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
ledger_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
lex_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
lub_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
management_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
notary_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
opus_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
oracle_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
palam_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
policy_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
pons_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
role_registry_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
salus_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
scire_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
sese_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
std_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
treasury_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
tribute_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
tutus_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00
vita_test.go Add VPP (Vita Presence Protocol) to native Vita contract 2025-12-27 17:01:59 +00:00
vts_test.go Native contracts complete - all tests passing 2025-12-27 15:45:47 +00:00