Skip to content

Core: Token & Thread/Turn Management #5

Description

@ggondim

Summary

Implement ephemeral token management (for replyTo URLs), channel API key management, and thread/turn lifecycle logic.

Tasks

Token Management

  • Ephemeral token generation for replyTo URLs (default TTL 24h, globally configurable)
  • Token validation (check existence, expiry, scope)
  • Token revocation
  • Channel API key generation (ot_ch_sk_* prefix)
  • Channel API key validation
  • Storage of tokens/keys via StorageAdapter

Thread Management

  • Thread creation: generate threadId (ot_thr_*), associate with native thread if available
  • Virtual thread detection: group messages by reply chain when platform lacks native threads
  • Main thread concept: messages outside any thread → channel's main thread ID
  • Thread lookup: by threadId, by native thread ID, by channel + target

Turn Management

  • Turn creation: generate turnId (ot_turn_*), associate with thread
  • Log each inbound/outbound interaction as a turn
  • Turn listing by thread (chronological)

Acceptance Criteria

  • Ephemeral tokens are valid within TTL and rejected after expiry
  • Channel API keys grant access scoped to the channel
  • Threads are correctly created/resolved for native, virtual, and main thread scenarios
  • Turns are logged for every interaction
  • Unit tests for token lifecycle, thread resolution, and turn tracking

Dependencies

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions