Skip to content

Support for Static Tags? (OpenHaystack) #45

Closed

Description

@ReLoia

Hi, I want to start this issue saying that I love the overall App, especially its UI!

I'd like to propose adding support to static keys. I've taken a look at FindMy.py project and it already supports it. (and example of a project that uses it and also supports static keys is malmeloo/hass-FindMy)

We would just need to generate a tag (KeyPair in FindMy.py codebase) based on the Base64 representation of the private key (the one generated by OpenHaystack when creating a custom Tag) and then we can pass it to the already existing account.fetch_location_history to get all the raw reports.

  key = KeyPair.from_b64(privateKeyBase64)
  reports = account.fetch_location_history(key)

Implementing this would (kinda) close all Macless Haystack related issues since it would not be necessary to use it to get the raw reports (since FindMy.py can do it and it can also decrypt them) like #28.

I won't be able to implement and PR this in the near future due to upcoming University exams but I wanted to share the idea here in case somebody wants to implement it.

Activity

  1. wanderdev0 commented on Jun 18, 2026

    @wanderdev0
    Owner

    I think this would be a nice and reasonable idea for the app. I'm curious how many users with pure OpenHaystack use cases are coming across this app and wanting to use it in this way?

  2. wanderdev0 commented on Aug 14, 2026

    @wanderdev0
    Owner

    I went through the app to work out what this would actually cost. The short version is that
    most of it already works — more than I expected — and the bulk of the remaining effort is in
    one Java class rather than anywhere near the crypto.

    One refinement to the approach above

    KeyPair.from_b64(...) passed to fetch_location_history does work — the overloads accept a bare
    HasHashedPublicKey. But it bypasses the accessory_json column, which is how the app
    persists accessory state between fetches. KeyPair isn't a RollingKeyPairSource and doesn't
    round-trip through that column.

    FixedRollingKeyPairAccessory is accepted by the same overloads and does round-trip. Same fetch,
    but it fits the storage that already exists instead of needing a parallel path for static tags.
    Since accessory_json exists because of the key-drift bug in #30, adding a second kind of beacon
    that sidesteps it seems like the wrong direction — even though a static key has no drift to track.

    What already works

    • FindMy.py has the class. FixedRollingKeyPairAccessory serialises as
      custom_rolling_key_accessory with a plain private_keys list, and implements the same
      RollingKeyPairSource interface as FindMyAccessory.
    • The curve and format match exactly. KeyPair uses SECP224R1 with a 28-byte private key, and
      KeyPair.from_b64 takes precisely the base64 OpenHaystack's generate_keys.py writes. No
      conversion needed.
    • The fetch path in main.py works unmodified, which is the part I expected to break.
      keys_between dedupes through a yielded set, so a fixed accessory yields each key exactly once
      — all at index 0 — rather than N² pairs. update_alignment is a no-op and
      get_min_index/get_max_index are 0 and N-1, so the width stays far below
      _ALIGNMENT_PROBE_THRESHOLD_INDICES (2000) and the normal branch is taken. The whole
      key-alignment problem simply doesn't arise for static tags.
    • accessory_json already exists on the OwnedBeacon entity and already round-trips.

    What actually breaks — three places

    1. app/src/main/python/main.py, roughly ten lines. FindMyAccessory.from_json(...) is
    hardcoded in getLastReports and getReports; it needs to dispatch on the JSON's type field.
    The surrounding helpers are annotated FindMyAccessory but only call base-interface methods, so
    those are type hints to widen rather than logic to change.

    2. BeaconDataParser — this is the bulk of the work. It unconditionally parses two plists
    per beacon and XPaths out batteryLevel, model, pairingDate, productId, stableIdentifier,
    systemVersion and vendorId, plus name and emoji from the naming record. A static tag has none
    of that and no plist at all, so BeaconInformation needs a construction path that doesn't start
    from XML.

    3. Import UI. Today it's a zip of plists via AppleZipImporterUtil. Static keys arrive as
    OpenHaystack .keys files, macless-haystack JSON, or a pasted base64 key — a different entry
    point. Which format(s) to accept is the main open design question, and it decides most of the UI
    work.

    Schema: probably no migration needed

    Worth confirming, since a Room migration is the expensive kind of change here. OwnedBeacons.content
    is already nullable, and the discriminator already exists inside accessory_json as its type
    field, so no new column is strictly required. A BeaconNamingRecord row is needed only because the
    parser reads one — either synthesise one locally at import, or make that join optional.

    What a user sees is genuinely thinner

    No battery level, no model, no pairing date, no Apple-side emoji, no alignment record, and the name
    is local-only. The UI has to tolerate a beacon that is mostly nulls.

    Worth spiking before building anything

    Confirm a self-generated key still returns reports on a current account. It invalidates
    everything else if it doesn't, and it's a short experiment — generate a key, flash nothing, and see
    whether the fetch path returns anything. macless-haystack being actively used suggests it's fine,
    but that's inference rather than a test.

    The other open question is your original one on this issue, which no amount of code reading
    answers: how many people actually want this. The above is only an estimate of cost, not an argument
    that it's worth paying.


    This comment was written by Claude Code.

  3. wanderdev0 commented on Aug 14, 2026

    @wanderdev0
    Owner

    An aside that came out of the iCloud export work, worth recording before it is forgotten.

    Registering an OpenHaystack tag into an Apple account looks mechanically possible, and is
    probably not worth doing.

    The new export route reads accessories out of iCloud's BeaconStore zone and can write to it —
    renaming a tag from Android works and shows up in Apple's own Find My. An OwnedBeacons record
    turns out to be nothing but privateKey, sharedSecret, secondarySharedSecret, productId,
    vendorId, model, pairingDate and an identifier. There is no Apple signature or factory
    attestation in it, and the record is encrypted client-side under Protected Cloud Storage, so
    Apple's servers cannot inspect what a client puts there.

    So "register a tag without an Apple device" reduces to: generate the key material the way
    OpenHaystack already does, then write a record. Which is a real answer to a question people ask.

    Two reasons it is a curiosity rather than a feature.

    It buys nothing for locating. The Find My network relays on the BLE advertisement and reports
    are fetched by hashed advertisement key — neither step consults the owner's account. An
    OpenHaystack tag is already locatable without any registration, which is the whole premise of
    OpenHaystack. What registration adds is that the tag appears in Apple's own Find My app,
    alongside real AirTags.

    And the unknown is Apple's clients, not Apple's servers. The write would go through; whether iOS
    renders a record whose productId/vendorId name no real accessory, ignores it, or does
    something less pleasant is not knowable from the protocol work — none of it ever observed an
    Apple client consuming a record written by something else. Finding out means a permanent write
    to a real account, which is a different risk class from a rename.

    What this means for this issue, which is the part that matters: importing OpenHaystack tags
    into OpenTagViewer is a local feature and touches Apple not at all. That is the thing worth
    building. Registering them into an Apple account is separate, optional, and only for someone who
    wants their static tags to show up on their iPhone too.


    Written by Claude Code.

  4. wanderdev0 commented on Aug 15, 2026

    @wanderdev0
    Owner

    Same update here as the #28 issue: #28 (comment)

    TL;DR half of the work is done (export works), the other half is pending (making the Android app read it) and should be out soon.

  5. added
    enhancement
    @app
    @exporter-tool
    on Aug 15, 2026
  6. added
    fixed in app 1.1.0
    on Aug 23, 2026
  7. self-assigned this
    on Aug 25, 2026
  8. wanderdev0 commented on Sep 16, 2026

    @wanderdev0
    Owner

    Hi, OpenHaystack tags are supported by the app as of the new 1.1.0 release. Have a look and feel free to open a new issue if you find any problems with the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

@app@exporter-toolenhancementfixed in app 1.1.0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions