Jami
  • Setup Jami
    • Download and install Jami
      • Jami for Android
      • Jami for GNU/Linux
      • Jami for iOS
      • Jami for macOS
      • Jami for Windows
      • Jami for servers
      • Jami for Web
    • Accounts
    • Add yourself
    • Link devices
    • Back up JAMI protocol accounts
    • Jami extensions
      • Jami extensions for Android
      • Jami extensions for Desktop
      • Jami extensions for iOS
      • Jami extensions for Web
  • Media
    • Safe software
    • Press releases
      • February 22, 2019
  • Videos
    • This is Jami
      • Let's talk freely with Jami
      • How to talk privately with Jami
    • Jami for professionals
      • How can professionals communicate privately with their clients?
    • Jami for education
      • How can teachers communicate securely online with their students?
    • Jami for Windows
      • How to install Jami on Windows
    • Jami for macOS
      • How to create a Jami account on macOS
    • Jami for Android
      • How to create a Jami account on Android
    • Jami for Android TV
      • Use Jami on Android TV
    • JAMS (Jami Account Management Server)
      • Install JAMS on a server using Ubuntu 20.04 on a Digital Ocean Droplet
    • Tips
      • Why back up your Jami account?
      • How to share your ID on Android and iOS with other users (short version)
      • How to share your ID on Android and iOS with other users (long version)
      • How to configure biometric authentication for new accounts on Android
  • Recommendations
    • ar-AE العربية (الإمارات العربية المتحدة)
    • de-AT Deutsch (Österreich)
    • de-CH Deutsch (Schweiz)
    • de-DE Deutsch (Deutschland)
    • en-AU English (Australia)
    • en-CA English (Canada)
    • en-CH English (Switzerland)
    • en-DE English (Germany)
    • en-EC English (Ecuador)
    • en-GB English (United Kingdom)
    • en-ID English (Indonesia)
    • en-IN English (India)
    • en-IS English (Iceland)
    • en-KN English (Saint Kitts and Nevis)
    • en-SE English (Sweden)
    • en-US English (United States)
    • es-ES español (españa)
    • es-US español (estados unidos)
    • fr-BE Français (Belgique)
    • fr-CA Français (Canada)
    • fr-FR Français (France)
    • hi-IN हिंदी (भारत)
    • hu-HU magyar (Magyarország)
    • ko-KR 한국어(한국)
    • nl-NL Nederlands (Nederland)
    • pl-PL polski (Polska)
    • pt-BR Português (Brasil)
    • ru-RU Русский (Россия)
    • sv-SE svenska (Sverige)
    • tr-TR Türkçe (Türkiye)
    • vi-VN Tiếng Việt (Việt Nam)
    • zh-CN 中文(簡體,中國)
    • zh-TW 中文(繁體,台灣)
    • zh-US 中文(簡體,美國)
  • Quyển hướng dẫn người dùng
    • Khởi đầu
      • Jami làm việc như thế nào?
      • Ai làm Jami?
    • Tạo tài khoản Jami
      • Android
      • iOS
      • macOS
      • Chiếc cửa sổ
    • Đường mạng phân phối Jami
      • Kết nối
      • Mạng lưới OpenDHT
      • Các JamiNS blockchain
    • Tất cả các tính năng theo khách hàng
      • Legend
      • Thông điệp văn bản
      • Đổi điện thoại
      • Cài đặt tài khoản
      • Các tính năng khác
      • Thiết lập nâng cao
    • FAQ
      • Các nguyên tắc cơ bản
      • Quản lý tài khoản
      • Tiến bộ
    • Sử dụng Jami trên LAN
      • Bootstrapping
      • Server TURN
      • Trên điện thoại di động (DHT Proxy)
      • Name server
    • Jami for servers
      • Create a user account on the server
      • Install the Jami daemon on the server
      • Copy the Jami configuration files
      • Create a script file to launch Jami on the server
    • Hướng dẫn báo cáo lỗi
      • Định hướng môi trường của bạn
      • Làm thế nào để báo cáo một lỗi
      • Viết một bản tóm tắt rõ ràng
      • Viết các bước chính xác để tái tạo
      • Kết quả đạt được
      • Kết quả mong đợi
      • Cung cấp thông tin bổ sung
  • JAMS manual
    • Download JAMS manual
    • Additional guides
      • Admin guide
      • Client guide
    • Introduction
      • Obtaining JAMS
      • System requirements
      • JAMS concepts
      • Getting started
      • Step 1: Create an administrator account
      • Step 2: Set up the Certification Authority
      • Step 3: Set up the user database
      • Step 4: Set up the server parameters
    • Private DHT node
  • Tạo hướng dẫn
    • Sections
      • Khởi đầu
      • Tùy thuộc
  • Quyển hướng dẫn phát triển
    • Các yêu cầu tính năng
      • SFL
      • Kế hoạch/Tạm dịch
      • Được tìm nhưng không có kế hoạch
      • Có thể được thực hiện, đóng góp được chấp nhận (hoặc sẽ mất nhiều tháng/năm tới)
      • Tùy thuộc vào sự thay đổi khối lượng
      • Bao bì
      • Những người khác
    • New developers
      • Các API của Jami
      • Phong cách mã hóa
      • Debugging tools
      • Cải thiện chất lượng của Jami
      • Thiết kế mã hóa Qt và QML
      • Các công cụ kiểm tra Qt và QML
      • Đưa ra bản vá đầu tiên của bạn
      • Làm việc với Gerrit
    • Jami Concepts
      • Quản lý tài khoản
      • Âm thanh
      • Liên lạc bị cấm
      • Calls
      • Các cuộc gọi của Swarm
      • Nghị định thư hội nghị
      • Người quản lý kết nối
      • Quản lý liên lạc
      • Dynamic Routing Table (DRT)
      • Chuyển tập tin
      • Các nhận dạng Jami
      • Kết nối thiết bị mới
      • Tên Protocol Server
      • Thủy
      • Phụ liệu đồng bộ hóa
      • Tích hợp hồ sơ
    • Going further
      • Chọn giá trị CRF cho bộ mã hóa
      • Synchronization of delivery status
      • How it works (backend)
      • Client API
      • Notes for client
      • RFC quan trọng
      • Địa điểm chia sẻ trên khách hàng QT
      • Tình trạng hiển thị thông điệp
      • Thiết lập máy chủ TURN của riêng bạn
    • Processes
      • Design Process
      • Quá trình giải phóng
  • Extension manual
    • How it works?
      • How to use it?
      • Setup
      • Android
      • Linux/Windows
      • Use!
    • How to build?
      • Dependencies
      • ONNX Runtime 1.6.0
      • Plugin
      • Related articles:
    • Publishing on the Extension Store
      • Publication on the Extension Store
      • How the Extension Store works in Jami Desktop
      • Important: Test locally before publication
      • Add an extension
      • Congratulations, the Jami Extension has been added and is available for Jami users!
    • Requesting publication
      • Extension Store Requests
      • Authorize a new organization
      • Upload a new extension
    • Creating Jami extensions
      • Jami extensions
    • Jami extension certificates
      • Certificates
      • Signature mechanism
      • Certificate chain
      • Certificate constraint
      • Certificate revocation
      • Sign Organization Certificate
      • Examples
    • Extension Store in the Jami client
      • The Extension Store in the Daemon
      • The Extension Store in the Client
      • Extension State
    • TensorFlow extension
      • TensorFlow 2.1.0
  • Tham gia
    • Báo cáo lỗi và các vấn đề
    • Mã đóng góp
    • Commit message guidelines
    • Bao bì Jami
    • Tham gia vào tài liệu này
    • Tùy thuộc
    • Khẩu dung
    • Chỉnh sửa một trang
    • Xem xét công việc của bạn
    • Bảo tồn công việc của bạn
    • Đưa ra thay đổi
    • Thay đổi công việc của bạn
    • Thêm một trang
  • GNU Free Documentation License
    • 0. PREAMBLE
    • 1. APPLICABILITY AND DEFINITIONS
    • 2. VERBATIM COPYING
    • 3. COPYING IN QUANTITY
    • 4. MODIFICATIONS
    • 5. COMBINING DOCUMENTS
    • 6. COLLECTIONS OF DOCUMENTS
    • 7. AGGREGATION WITH INDEPENDENT WORKS
    • 8. TRANSLATION
    • 9. TERMINATION
    • 10. FUTURE REVISIONS OF THIS LICENSE
    • 11. RELICENSING
    • ADDENDUM: How to use this License for your documents
Jami
  • Quyển hướng dẫn phát triển
  • Jami Concepts
  • Kết nối thiết bị mới
  • View page source

Kết nối thiết bị mới

This document describes the architecture of the feature allowing users to link their account to a new device, referred to as the Link new device process.

  • Terminology

  • State machine

    • State overview

    • Chi tiết

      • Details for import side

      • Details for export side

  • API between daemon and client

    • API for import side

    • API for export side

  • Daemon state machine

  • Client state machine

  • Full sequence diagram (import and export)

Terminology

To understand this document, here are some key terms:

  • import side: The device importing the account.

  • export side: The device exporting the account.

  • token: A URI that identifies a device on the Distributed Hash Table (DHT).

State machine

The daemon manages this functionality using a state machine.

The state evolution is communicated to clients, enabling the appropriate interface display.

Currently, the state machine is symmetrical for both import side and export side, though certain states are inaccessible depending on the side.

State overview

State

Tên

Usage (Side)

Mô tả

0

Init

Không có

Initial state.

1

Token available

Import only

The token is available. This is the URI identifying the new device on the DHT, displayed as text or a QR code.

2

Kết nối

Export/Import

A peer-to-peer connection is being established.

3

Authenticating

Export/Import

The identity of the account and device address are being confirmed.

4

In progress

Export/Import

State transition, the account archive is being transferred.

5

Được làm

Export/Import

Final state. Represents success or failure.

Chi tiết

The state machine can include supplementary information for display purposes, passed as a map<String, String> called details.

Details for import side

State

Tên

Chi tiết

0

Init

Not applicable.

1

Token available

token: A 59-character URI with the prefix jami-auth://.

2

Kết nối

No details.

3

Authenticating

peer_id: Jami ID of the imported account.
auth_scheme: {"", "none", "password"} (empty if unprotected).
auth_error: {"bad_password"}.

4

In progress

No details.

5

Được làm

error: {"", "none", "network", "authentication"} (empty if no error).

Details for export side

State

Tên

Chi tiết

0

Init

Not applicable.

1

Token available

Not applicable.

2

Kết nối

No details.

3

Authenticating

peer_address: IP address of the exporting device.

4

In progress

No details.

5

Được làm

error: {"", "none", "network", "authentication"} (empty if no error).

API between daemon and client

API for import side

Signal Name

Direction

Purpose

addAccount

Outbound

Announces the intent to import an account. Must include the key Account.archiveURL="jami-auth".

provideAccountAuthentication

Outbound

Provides a password if needed and confirms the identity of the imported account.

removeAccount

Outbound

Cancels the operation.

deviceAuthStateChanged

Inbound

Indicates the new state and provides details.

API for export side

Signal Name

Direction

Purpose

addDevice

Outbound

Announces the intent to export an account.

confirmAddDevice

Outbound

Confirms the address of the exporting device.

cancelAddDevice

Outbound

Cancels the operation.

addDeviceStateChanged

Inbound

Indicates the new state and provides details.

Daemon state machine

        stateDiagram-v2
    state "Import Side" as Import {
        [*] --> Import_Init
        Import_Init --> Import_TokenAvailable: Generate token
        Import_TokenAvailable --> Import_Connecting: Peer detected
        Import_Connecting --> Import_Authenticating: Connection established
        Import_Authenticating --> Import_InProgress: Auth success
        Import_InProgress --> Import_Done: Transfer complete
        note right of Import_TokenAvailable
            Provides:
            - Authentication code
            - QR data
        end note
        note right of Import_Authenticating
            May require password
            auth_scheme: "", "none", "password"
        end note
        note right of Import_Done
            error: "", "none", "network", "authentication"
        end note
    }
    state "Export Side" as Export {
        [*] --> Export_Init
        Export_Init --> Export_Connecting: Token validated
        Export_Connecting --> Export_Authenticating: Connection established
        Export_Authenticating --> Export_InProgress: Auth success
        Export_InProgress --> Export_Done: Transfer complete
        note right of Export_Init
            Accepts:
            - Authentication code
            - QR data
        end note
        note right of Export_Authenticating
            Confirms peer address
        end note
    }
    

Client state machine

        stateDiagram-v2
    [*] --> Initial
    Initial --> ImportDevice: ImportFromDevice selected
    Initial --> ExportDevice: ExportToDevice selected
    state "Import Device" as ImportDevice {
        [*] --> Import_Init
        Import_Init --> Import_TokenAvailable: Token received
        Import_TokenAvailable --> Import_Connecting: Peer detected
        Import_Connecting --> Import_Authenticating: Connection established
        Import_Authenticating --> Import_InProgress: Auth success
        Import_InProgress --> Import_Done: Transfer complete
        Import_Authenticating --> Import_Error: Bad password
        Import_Connecting --> Import_Error: Connection failed
        Import_InProgress --> Import_Error: Transfer failed
        Import_Error --> [*]: Reset
        Import_Done --> [*]: Account ready
        note right of Import_TokenAvailable
            Display:
            - QR code
            - Authentication code
            - Copy button
        end note
        note right of Import_Authenticating
            Show password input if needed
        end note
    }
    state "Export Device" as ExportDevice {
        [*] --> Export_Init
        state Export_Init {
            [*] --> ShowInputOptions
            ShowInputOptions --> ScanQR: Camera selected
            ShowInputOptions --> ManualEntry: Manual selected
            ScanQR --> QRScanning: Start camera
            QRScanning --> TokenObtained: QR detected
            QRScanning --> ShowInputOptions: Cancel scan
            ManualEntry --> TokenObtained: Valid code entered
            ManualEntry --> ShowInputOptions: Cancel entry
        }
        Export_Init --> Export_Connecting: Token validated
        Export_Connecting --> Export_Authenticating: Connection established
        Export_Authenticating --> Export_InProgress: Auth provided
        Export_InProgress --> Export_Done: Transfer complete
        Export_Connecting --> Export_Error: Invalid token
        Export_Authenticating --> Export_Error: Auth failed
        Export_InProgress --> Export_Error: Transfer failed
        Export_Error --> [*]: Reset
        Export_Done --> [*]: Device added
        note right of Export_Init
            Input options:
            - QR scanner
            - Manual code entry
        end note
        note right of Export_Authenticating
            Confirm peer device
        end note
    }
    ImportDevice --> Initial: Back/Cancel
    ExportDevice --> Initial: Back/Cancel
    

Full sequence diagram (import and export)

        sequenceDiagram
    box white Import Side
    participant IC as New Client
    participant ID as New Daemon
    end
    box white Export Side
    participant ED as Old Daemon
    participant EC as Old Client
    end
    %% Initial Setup
    IC->>ID: addAccount(archiveURL="jami-auth")
    activate ID
    ID-->>IC: deviceAuthStateChanged(state=TOKEN_AVAILABLE)
    Note over IC: Display QR code<br/>and auth token
    %% Export Side Initiation
    EC->>EC: User chooses to export
    EC->>EC: Scan QR/Enter token
    EC->>ED: addDevice(token)
    activate ED
    %% Connection Establishment
    ED->>ID: DHT connection request
    ID-->>IC: deviceAuthStateChanged(state=CONNECTING)
    ED-->>EC: addDeviceStateChanged(state=CONNECTING)
    %% Authentication Phase
    ID-->>IC: deviceAuthStateChanged(state=AUTHENTICATING,<br/>peer_id, auth_scheme)
    ED-->>EC: addDeviceStateChanged(state=AUTHENTICATING,<br/>peer_address)
    alt Account is password protected
        IC->>IC: Show password prompt
        IC->>ID: provideAccountAuthentication(password)
    end
    EC->>ED: confirmAddDevice()
    %% Transfer Phase
    ID-->>IC: deviceAuthStateChanged(state=IN_PROGRESS)
    ED-->>EC: addDeviceStateChanged(state=IN_PROGRESS)
    ED->>ID: Transfer account archive
    %% Completion
    ID-->>IC: deviceAuthStateChanged(state=DONE, error="")
    ED-->>EC: addDeviceStateChanged(state=DONE, error="")
    deactivate ID
    deactivate ED
    Note over IC,EC: Account successfully linked
    alt Error Scenarios
        ID-->>IC: deviceAuthStateChanged(state=DONE, error="network")
        ED-->>EC: addDeviceStateChanged(state=DONE, error="network")
        Note over IC,EC: Network error during transfer
        ID-->>IC: deviceAuthStateChanged(state=DONE, error="authentication")
        ED-->>EC: addDeviceStateChanged(state=DONE, error="authentication")
        Note over IC,EC: Authentication failed
    end
    %% Cancellation Scenarios
    rect rgb(240, 240, 240)
        Note over IC,EC: Optional Cancellation Flows
        IC->>ID: removeAccount()
        EC->>ED: cancelAddDevice()
    end
    
Previous Next

Copyright © 2018-2025 Savoir-faire Linux Inc. and contributors.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.

Built with Sphinx using a theme provided by Read the Docs.