How hmk8386/locket.js works
locket.js is a Node.js SDK for programmatic access to Locket Camera. Developers initialize a client, authenticate through Firebase, then use its user, moments, friends, and chat modules to retrieve or change account data. The moments workflow includes media preparation and upload before posting; chat supports message operations and optional live streaming. Device emulation and shared HTTP/API handling are internal layers. The excerpts show core calls, but some feature internals are omitted; README-documented capabilities are retained where implementation details were not sampled.
Main entry points: client.js Locket client · user.js User profiles · session.js Session manager · chat.js Chat operations
Components 18
SDK client
- Public exports
index.js - Locket client
lib/client.js
Identity and device
- Device emulation
lib/device.js - Session manager
lib/session.js
Locket features
- User profiles
lib/modules/user.js - Moments and feed
lib/modules/moments.js - Caption presets
caption_presets.json - Friends and groups
lib/modules/friends.js - Chat operations
lib/modules/chat.js
Network and storage
- HTTP helper
lib/http.js - Session file
- Chat history file
- Typed errors
lib/exceptions.js
Other components
- SDK developer
- Firebase Auth
- Locket API
- Firebase Storage
- Chat WebSocket
Connections 39
- SDK developer → Public exports: imports SDK
README.md - Public exports → Locket client: exports client
index.js - Locket client → Device emulation: creates profile
lib/client.js - Locket client → Session manager: creates manager
lib/client.js - Locket client → User profiles: creates module
lib/client.js - Locket client → Moments and feed: creates module
lib/client.js - Locket client → Friends and groups: creates module
lib/client.js - Locket client → Chat operations: creates module
lib/client.js - Locket client → Session manager: delegates login
lib/client.js - Session manager → Firebase Auth: authenticates and refreshes
lib/session.js - Session manager → HTTP helper: sends requests
lib/session.js - Session manager → Session file: loads and saves
lib/session.js - Session manager → Device emulation: uses profile
lib/session.js - Locket client → Session manager: gets valid token
lib/client.js - Locket client → Device emulation: sets request headers
lib/client.js - Locket client → Locket API: posts API requests
lib/client.js - Locket client → HTTP helper: sends requests
lib/client.js - Locket client → Typed errors: raises API errors
lib/client.js - User profiles → Locket client: calls API
lib/modules/user.js - User profiles → Friends and groups: resolves usernames
lib/modules/user.js - User profiles → Firebase Auth: looks up and updates account
lib/modules/user.js - User profiles → Firebase Storage: uploads avatar
lib/modules/user.js - Moments and feed → Locket client: calls API
lib/modules/moments.js - Moments and feed → Firebase Storage: uploads media
lib/modules/moments.js - Moments and feed → Caption presets: uses presets
README.md - Moments and feed → Chat history file: persists moment history
lib/modules/moments.js - Friends and groups → Locket client: calls API
lib/modules/friends.js - Friends and groups → User profiles: fetches friend profiles
lib/modules/friends.js - Friends and groups → Locket API: reads Firestore
lib/modules/friends.js - Friends and groups → HTTP helper: sends requests
lib/modules/friends.js - Chat operations → Locket client: calls API
lib/modules/chat.js - Chat operations → Session manager: gets valid token
lib/modules/chat.js - Chat operations → Chat history file: loads and records
lib/modules/chat.js - Chat operations → HTTP helper: fetches messages
lib/modules/chat.js - Chat operations → Chat WebSocket: streams messages
README.md - Chat operations → User profiles: resolves username
lib/modules/chat.js - User profiles → Typed errors: may raise upload errors
- Moments and feed → Typed errors: raises upload errors
lib/modules/moments.js - Friends and groups → Typed errors: uses SDK errors
lib/modules/friends.js