mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 00:05:55 +03:00
[GH-ISSUE #495] Zeroconf based Authentication by command line #315
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#315
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jgabriel98 on GitHub (Jun 16, 2020).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/495
I want to mock (simulate) a connection to the lib by code, with the zeroconf authentication mode.
In other words, i want to run a librespot instance, and then connect to it as a "spotify connect" device, but using code or cli, not the spotify app.
is this possible?
@noelhibbard commented on GitHub (Jul 8, 2020):
I'm looking to do something similar. My goal is to programmatically swap which account the librespot instance is associated with. The document you referenced above explains how the auth blob is decoded but I need to know how to encode a blob which I would then use for zeroconf auth.
@idcmp commented on GitHub (Jan 11, 2021):
I have a similar need. I've got a Spotify Connect device at http://192.168.1.118/spotify that I would like to programatically run "addUser" on from one of two accounts. Calls to kick the current user off:
curl -d action=resetUsers http://192.168.1.118/spotifyand get details about the devicecurl -d action=getInfo http://192.168.1.118/spotifywork fine, but similar to @noelhibbard I'm not quite sure how to craft a "blob"@noelhibbard commented on GitHub (Jan 11, 2021):
I'm not super knowledgeable on encryption but I'm thinking you would need the private key to construct the blob and all we have is the public key for decrypting the blob. As far as I know, only the official Spotify clients are capable of initiating a zero config auth. If there is an open source project that can handle that side of the process then we could look at that for hints but I don't think one exists.
@idcmp commented on GitHub (Jan 13, 2021):
@plietar - I see you're the author of the zeroconf authentication page. Can you offer up any details on how to generate blobs? Whose private key do I need to do the DH exchange?
@ashthespy commented on GitHub (Jan 13, 2021):
In the odd case you haven't already seen the docs on zeroconf..
@noelhibbard commented on GitHub (Jan 13, 2021):
Those docs only explain how you decrypt a blob. We are trying to do the opposite.
@ashthespy commented on GitHub (Jan 13, 2021):
Ah fair enough, sorry for the noise :-)
@plietar commented on GitHub (Jan 13, 2021):
@idcmp with DH, both sides have a private and a public key. They exchange public keys to compute a shared secret.
getInfoTo actually compute the blob, you'd have to implement this function, backwards. There seem to be a couple of fields in the unencrypted blob that aren't described. I'm not sure what these are. Running librespot and printing their values could help.
@idcmp commented on GitHub (Jan 14, 2021):
Got it. Sorry if this is a stupid question, is
github.com/librespot-org/librespot@06f5aa9c90/core/src/authentication.rs (L92-L95)just doing the CTR (except the last 16 bytes?)?As listed in:
@plietar commented on GitHub (Jan 14, 2021):
That piece of code corresponds to the
login_data = AES192-DECRYPT(key, data)line in the docs.The code is a naive manual translation from the disassembled binary to Rust. I’m no crypto expert, so I have a hard time identifying the “high level” algorithms.
It is certainly not CTR, since it is XORing pieces of the plaintext together, rather than the plaintext with some AES stream. On the other hand, it doesn’t match any of the other common cipher modes.
@devgianlu commented on GitHub (Jan 14, 2021):
You can have a look at the Java implementation too:
github.com/librespot-org/librespot-java@1c9537a2a2/lib/src/main/java/xyz/gianlu/librespot/core/Session.java (L867)