Skip to content

πŸ’Ύ Protocol Buffer definitions and build script for TurtlPass β€” enabling multi-language integration across C++, Python, JavaScript and Kotlin.

License

Notifications You must be signed in to change notification settings

TurtlPass/turtlpass-protobuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Logo

πŸ”— TurtlPass Ecosystem

🐒 Firmware β€’ πŸ’Ύ Protobuf β€’ πŸ’» Host β€’ 🌐 Chrome β€’ πŸ“± Android


πŸ’Ύ TurtlPass Protocol Buffers

This repository contains the official Protocol Buffer (.proto) schema for the TurtlPass project and a reproducible build script to generate language bindings for C++, Python, JavaScript and Kotlin. It enables host applications to communicate with TurtlPass hardware over USB using a consistent, cross-platform data format.


πŸ“¦ Repository Layout


turtlpass-protobuf/
β”œβ”€β”€ proto/
β”‚   β”œβ”€β”€ turtlpass.proto       # Core protobuf definition
β”‚   └── turtlpass.options     # Nanopb / protobuf options
β”œβ”€β”€ build_turtlpass_proto.sh  # Script to generate all bindings
β”œβ”€β”€ PROTOCOL.md
β”œβ”€β”€ README.md
└── LICENSE


βš™οΈ Requirements

You must have all of the following tools installed and available in your system PATH:

Tool Purpose Install Command
protoc Protocol Buffers compiler brew install protobuf
python3 For running the Nanopb generator brew install python
nanopb_generator.py Generates C/Nanopb source files pip install nanopb
protobufjs / pbjs JS protobuf generation npm install --save-dev protobufjs protobufjs-cli
esbuild JS bundling for browser npm install --save-dev esbuild
gradle Kotlin protobuf generation brew install gradle

πŸš€ Usage

From the repository root:

./build_turtlpass_proto.sh

The script will:

  1. Validate dependencies

  2. Generate protobuf bindings for:

    • C++ / Nanopb
    • Python
    • JavaScript
    • Kotlin
  3. Create output directories automatically:

    /out/cpp
    /out/python
    /out/js
    /out/kotlin
    

πŸ“„ Outputs Example

After running the build script, you’ll see a structure like this:

cpp/
β”œβ”€β”€ turtlpass.pb.c
└── turtlpass.pb.h

python/
β”œβ”€β”€ __init__.py
└── turtlpass_pb2.py

js/
└── turtlpass_pb.js

kotlin/
└── turtlpass/
    β”œβ”€β”€ CommandKt.kt
    β”œβ”€β”€ DeviceInfoKt.kt
    β”œβ”€β”€ GeneratePasswordParamsKt.kt
    β”œβ”€β”€ InitializeSeedParamsKt.kt
    β”œβ”€β”€ ResponseKt.kt
    └── TurtlpassKt.proto.kt

πŸ“˜ Protocol Overview

  • Transport: USB serial (CDC)
  • Serialization: Protocol Buffers (proto3)
  • Pattern: Command / Response

Key Commands:

  • GET_DEVICE_INFO: Fetch device version and seed state
  • INITIALIZE_SEED: Store a seed for password derivation
  • GENERATE_PASSWORD: Generate password using stored seed
  • FACTORY_RESET: Reset device to default state

Message Highlights:

  • Command / Response pair for communication
  • Fixed-size buffers for reliable MCU parsing
  • DeviceInfo includes firmware and MCU identifiers

For full details, see the complete protocol specification.


🧩 Purpose

This repository is intentionally minimal. It exists solely to:

  1. Define the canonical .proto schema for TurtlPass.
  2. Provide a single reproducible script to generate bindings for all supported languages.

🧰 Troubleshooting

Check your PATH and ensure that all required executables can be run directly from the terminal. You can also verify your Protobuf installation:

protoc --version

If it runs successfully, protoc itself is correctly installed.


πŸ“œ License

This repository is licensed under the MIT License.

About

πŸ’Ύ Protocol Buffer definitions and build script for TurtlPass β€” enabling multi-language integration across C++, Python, JavaScript and Kotlin.

Topics

Resources

License

Stars

Watchers

Forks

Languages