-
-
Notifications
You must be signed in to change notification settings - Fork 6
docs: update getDeviceData documentation with detailed usage and examples #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| # Auto detect text files and perform LF normalization | ||
| * text=auto | ||
| * text=auto eol=lf | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1064,28 +1064,50 @@ This method only works for E2EE (end-to-end encrypted) messages. For regular mes | |||||||||||||
| <a name="getDeviceData"></a> | ||||||||||||||
| ## client.getDeviceData() | ||||||||||||||
|
|
||||||||||||||
| Get E2EE device data for storage. | ||||||||||||||
| Get the current E2EE device data as JSON string. | ||||||||||||||
|
|
||||||||||||||
| This returns the current in-memory E2EE device state, which includes: | ||||||||||||||
| - Noise key pair (for encrypted communication) | ||||||||||||||
| - Identity key pair (for identity verification) | ||||||||||||||
| - Signed pre-key (for session establishment) | ||||||||||||||
| - Registration ID | ||||||||||||||
| - All sessions and identities established with other users | ||||||||||||||
|
|
||||||||||||||
| __Returns__ | ||||||||||||||
|
|
||||||||||||||
| string - Device data as JSON string | ||||||||||||||
|
|
||||||||||||||
| __Note__ | ||||||||||||||
| __Works with all device store modes__ | ||||||||||||||
|
|
||||||||||||||
| | Mode | Description | | ||||||||||||||
| |------|-------------| | ||||||||||||||
| | `e2eeMemoryOnly: true` | Get the ephemeral device data before it's lost on disconnect | | ||||||||||||||
| | `deviceData: "..."` | Get the updated state after sessions/keys change | | ||||||||||||||
| | `devicePath: "..."` | Get current state (also auto-saved to file) | | ||||||||||||||
|
Comment on lines
+1084
to
+1086
|
||||||||||||||
| | `e2eeMemoryOnly: true` | Get the ephemeral device data before it's lost on disconnect | | |
| | `deviceData: "..."` | Get the updated state after sessions/keys change | | |
| | `devicePath: "..."` | Get current state (also auto-saved to file) | | |
| | _No device store options specified_ | Memory-only mode: get ephemeral device data before it's lost on disconnect | | |
| | `deviceData: "..."` | In-memory + caller-managed persistence: get the updated state after sessions/keys change | | |
| | `devicePath: "..."` | File-based persistence: get current state (also auto-saved to file) | |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1064,28 +1064,50 @@ Method này chỉ hoạt động với tin nhắn E2EE (mã hóa đầu cuối). | |||||
| <a name="getDeviceData"></a> | ||||||
| ## client.getDeviceData() | ||||||
|
|
||||||
| Lấy E2EE device data để lưu trữ. | ||||||
| Lấy dữ liệu E2EE device hiện tại dưới dạng JSON string. | ||||||
|
|
||||||
| Method này trả về trạng thái E2EE device hiện tại trong bộ nhớ, bao gồm: | ||||||
| - Noise key pair (cho giao tiếp mã hóa) | ||||||
| - Identity key pair (cho xác minh danh tính) | ||||||
| - Signed pre-key (cho thiết lập session) | ||||||
| - Registration ID | ||||||
| - Tất cả sessions và identities đã thiết lập với người dùng khác | ||||||
|
|
||||||
| __Trả về__ | ||||||
|
|
||||||
| string - Device data dưới dạng JSON string | ||||||
|
|
||||||
| __Lưu ý__ | ||||||
| __Hoạt động với tất cả các chế độ device store__ | ||||||
|
|
||||||
| | Chế độ | Mô tả | | ||||||
| |------|-------------| | ||||||
| | `e2eeMemoryOnly: true` | Lấy dữ liệu tạm thời trước khi mất khi ngắt kết nối | | ||||||
|
||||||
| | `e2eeMemoryOnly: true` | Lấy dữ liệu tạm thời trước khi mất khi ngắt kết nối | | |
| | Không cấu hình device store (không truyền `devicePath` hoặc `deviceData`) | Lấy dữ liệu tạm thời trong memory-only mode trước khi mất khi ngắt kết nối | |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -710,11 +710,39 @@ export class Client extends (EventEmitter as new () => TypedEventEmitter<ClientE | |||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Get E2EE device data as JSON string | ||||||
| * Get the current E2EE device data as JSON string | ||||||
| * | ||||||
| * Use this to persist device data externally (e.g., in a database) | ||||||
| * This returns the current in-memory E2EE device state, which includes: | ||||||
| * - Noise key pair | ||||||
| * - Identity key pair | ||||||
| * - Signed pre-key | ||||||
| * - Registration ID | ||||||
| * - All sessions and identities | ||||||
| * | ||||||
| * Works with all device store modes: | ||||||
| * - `e2eeMemoryOnly: true` - Get the ephemeral device data before it's lost | ||||||
|
||||||
| * - `e2eeMemoryOnly: true` - Get the ephemeral device data before it's lost | |
| * - In-memory mode (default when neither `devicePath` nor `deviceData` is set) - Get the ephemeral device data before it's lost |
Uh oh!
There was an error while loading. Please reload this page.