mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
1ad62e6f18
Key exchange and authentication is functional. Protocol definition has been moved to separate crate to speed up build time. Various cleanups. Take login info from command line, rather than hardcoded.
239 lines
6.6 KiB
Protocol Buffer
239 lines
6.6 KiB
Protocol Buffer
// size=80
|
|
message ClientHello {
|
|
required BuildInfo build_info = 0xa; // idx=0 offset=c
|
|
repeated Fingerprint fingerprints_supported = 0x14; // idx=ffff offset=10
|
|
repeated Cryptosuite cryptosuites_supported = 0x1e; // idx=ffff offset=2c
|
|
repeated Powscheme powschemes_supported = 0x28; // idx=ffff offset=48
|
|
required LoginCryptoHelloUnion login_crypto_hello = 0x32; // idx=1 offset=64
|
|
required bytes client_nonce = 0x3c; // idx=2 offset=68 size=f
|
|
optional bytes padding = 0x46; // idx=3 offset=78
|
|
optional FeatureSet feature_set = 0x50; // idx=4 offset=7c
|
|
}
|
|
|
|
// size=38
|
|
message BuildInfo {
|
|
required Product product = 0xa; // idx=0 offset=c
|
|
repeated ProductFlags product_flags = 0x14; // idx=ffff offset=10
|
|
required Platform platform = 0x1e; // idx=1 offset=2c
|
|
required uint64 version = 0x28; // idx=2 offset=30 extra=246558
|
|
}
|
|
|
|
enum Product {
|
|
PRODUCT_CLIENT = 0x0;
|
|
PRODUCT_LIBSPOTIFY= 0x1;
|
|
PRODUCT_MOBILE = 0x2;
|
|
PRODUCT_PARTNER = 0x3;
|
|
PRODUCT_LIBSPOTIFY_EMBEDDED = 0x5;
|
|
}
|
|
|
|
enum ProductFlags {
|
|
PRODUCT_FLAG_NONE = 0x0;
|
|
PRODUCT_FLAG_DEV_BUILD = 0x1;
|
|
}
|
|
|
|
enum Platform {
|
|
PLATFORM_WIN32_X86 = 0x0;
|
|
PLATFORM_OSX_X86 = 0x1;
|
|
PLATFORM_LINUX_X86 = 0x2;
|
|
PLATFORM_IPHONE_ARM = 0x3;
|
|
PLATFORM_S60_ARM = 0x4;
|
|
PLATFORM_OSX_PPC = 0x5;
|
|
PLATFORM_ANDROID_ARM = 0x6;
|
|
PLATFORM_WINDOWS_CE_ARM = 0x7;
|
|
PLATFORM_LINUX_X86_64 = 0x8;
|
|
PLATFORM_OSX_X86_64 = 0x9;
|
|
PLATFORM_PALM_ARM = 0xa;
|
|
PLATFORM_LINUX_SH = 0xb;
|
|
PLATFORM_FREEBSD_X86 = 0xc;
|
|
PLATFORM_FREEBSD_X86_64 = 0xd;
|
|
PLATFORM_BLACKBERRY_ARM = 0xe;
|
|
PLATFORM_SONOS = 0xf;
|
|
PLATFORM_LINUX_MIPS = 0x10;
|
|
PLATFORM_LINUX_ARM = 0x11;
|
|
PLATFORM_LOGITECH_ARM = 0x12;
|
|
PLATFORM_LINUX_BLACKFIN = 0x13;
|
|
PLATFORM_WP7_ARM = 0x14;
|
|
PLATFORM_ONKYO_ARM = 0x15;
|
|
PLATFORM_QNXNTO_ARM = 0x16;
|
|
PLATFORM_BCO_ARM = 0x17;
|
|
}
|
|
|
|
enum Fingerprint {
|
|
FINGERPRINT_GRAIN = 0x0;
|
|
FINGERPRINT_HMAC_RIPEMD = 0x1;
|
|
}
|
|
|
|
enum Cryptosuite {
|
|
CRYPTO_SUITE_SHANNON = 0x0;
|
|
CRYPTO_SUITE_RC4_SHA1_HMAC = 0x1;
|
|
}
|
|
|
|
enum Powscheme {
|
|
POW_HASH_CASH = 0x0;
|
|
}
|
|
|
|
// size=10
|
|
message LoginCryptoHelloUnion {
|
|
optional LoginCryptoDiffieHellmanHello diffie_hellman = 0xa; // idx=0 offset=c
|
|
}
|
|
|
|
// size=70
|
|
message LoginCryptoDiffieHellmanHello {
|
|
required bytes gc = 0xa; // idx=0 offset=c size=5f
|
|
required uint32 server_keys_known = 0x14; // idx=1 offset=6c
|
|
}
|
|
|
|
// size=10
|
|
message FeatureSet {
|
|
optional bool autoupdate2 = 0x1; // idx=0 offset=c
|
|
optional bool current_location = 0x2; // idx=1 offset=d
|
|
}
|
|
|
|
|
|
// size=18
|
|
message APResponseMessage {
|
|
optional APChallenge challenge = 0xa; // idx=0 offset=c
|
|
optional UpgradeRequiredMessage upgrade = 0x14; // idx=1 offset=10
|
|
optional APLoginFailed login_failed = 0x1e; // idx=2 offset=14
|
|
}
|
|
|
|
// size=30
|
|
message APChallenge {
|
|
required LoginCryptoChallengeUnion login_crypto_challenge = 0xa; // idx=0 offset=c
|
|
required FingerprintChallengeUnion fingerprint_challenge = 0x14; // idx=1 offset=10
|
|
required PoWChallengeUnion pow_challenge = 0x1e; // idx=2 offset=14
|
|
required CryptoChallengeUnion crypto_challenge = 0x28; // idx=3 offset=18
|
|
required bytes server_nonce = 0x32; // idx=4 offset=1c size=f
|
|
optional bytes padding = 0x3c; // idx=5 offset=2c
|
|
}
|
|
|
|
// size=10
|
|
message LoginCryptoChallengeUnion {
|
|
optional LoginCryptoDiffieHellmanChallenge diffie_hellman = 0xa; // idx=0 offset=c
|
|
}
|
|
|
|
// size=170
|
|
message LoginCryptoDiffieHellmanChallenge {
|
|
required bytes gs = 0xa; // idx=0 offset=c size=5f
|
|
required int32 server_signature_key = 0x14; // idx=1 offset=6c type=int8
|
|
required bytes gs_signature = 0x1e; // idx=2 offset=6d size=ff
|
|
}
|
|
|
|
// size=14
|
|
message FingerprintChallengeUnion {
|
|
optional FingerprintGrainChallenge grain = 0xa; // idx=0 offset=c
|
|
optional FingerprintHmacRipemdChallenge hmac_ripemd = 0x14; // idx=1 offset=10
|
|
}
|
|
|
|
// size=1c
|
|
message FingerprintGrainChallenge {
|
|
required bytes kek = 0xa; // idx=0 offset=c size=f
|
|
}
|
|
|
|
// size=20
|
|
message FingerprintHmacRipemdChallenge {
|
|
required bytes challenge = 0xa; // idx=0 offset=c size=13
|
|
}
|
|
|
|
// size=10
|
|
message PoWChallengeUnion {
|
|
optional PoWHashCashChallenge hash_cash = 0xa; // idx=0 offset=c
|
|
}
|
|
|
|
// size=24
|
|
message PoWHashCashChallenge {
|
|
optional bytes prefix = 0xa; // idx=0 offset=c size=f
|
|
optional int32 length = 0x14; // idx=1 offset=1c type=int8
|
|
optional int32 target = 0x1e; // idx=2 offset=20
|
|
}
|
|
|
|
// size=14
|
|
message CryptoChallengeUnion {
|
|
optional CryptoShannonChallenge shannon = 0xa; // idx=0 offset=c
|
|
optional CryptoRc4Sha1HmacChallenge rc4_sha1_hmac = 0x14; // idx=1 offset=10
|
|
}
|
|
|
|
// size=8
|
|
message CryptoShannonChallenge {
|
|
}
|
|
|
|
// size=8
|
|
message CryptoRc4Sha1HmacChallenge {
|
|
}
|
|
|
|
// size=18
|
|
message UpgradeRequiredMessage {
|
|
required bytes upgrade_signed_part = 0xa; // idx=0 offset=c
|
|
required bytes signature = 0x14; // idx=1 offset=10
|
|
optional string http_suffix = 0x1e; // idx=2 offset=14
|
|
}
|
|
|
|
// size=1c
|
|
message APLoginFailed {
|
|
required ErrorCode error_code = 0xa; // idx=0 offset=c
|
|
optional int32 retry_delay = 0x14; // idx=1 offset=10
|
|
optional int32 expiry = 0x1e; // idx=2 offset=14
|
|
optional string error_description = 0x28; // idx=3 offset=18
|
|
}
|
|
|
|
enum ErrorCode {
|
|
ProtocolError = 0x0;
|
|
TryAnotherAP = 0x2;
|
|
BadConnectionId = 0x5;
|
|
TravelRestriction = 0x9;
|
|
PremiumAccountRequired = 0xb;
|
|
BadCredentials = 0xc;
|
|
CouldNotValidateCredentials = 0xd;
|
|
AccountExists = 0xe;
|
|
ExtraVerificationRequired = 0xf;
|
|
InvalidAppKey = 0x10;
|
|
ApplicationBanned = 0x11;
|
|
}
|
|
|
|
|
|
|
|
// size=18
|
|
message ClientResponsePlaintext {
|
|
required LoginCryptoResponseUnion login_crypto_response = 0xa; // idx=0 offset=c
|
|
required PoWResponseUnion pow_response = 0x14; // idx=1 offset=10
|
|
required CryptoResponseUnion crypto_response = 0x1e; // idx=2 offset=14
|
|
}
|
|
|
|
// size=10
|
|
message LoginCryptoResponseUnion {
|
|
optional LoginCryptoDiffieHellmanResponse diffie_hellman = 0xa; // idx=0 offset=c
|
|
}
|
|
|
|
// size=20
|
|
message LoginCryptoDiffieHellmanResponse {
|
|
required bytes hmac = 0xa; // idx=0 offset=c size=13
|
|
}
|
|
|
|
// size=10
|
|
message PoWResponseUnion {
|
|
optional PoWHashCashResponse hash_cash = 0xa; // idx=0 offset=c
|
|
}
|
|
|
|
// size=1c
|
|
message PoWHashCashResponse {
|
|
required bytes hash_suffix = 0xa; // idx=0 offset=c size=f
|
|
}
|
|
|
|
// size=14
|
|
message CryptoResponseUnion {
|
|
optional CryptoShannonResponse shannon = 0xa; // idx=0 offset=c
|
|
optional CryptoRc4Sha1HmacResponse rc4_sha1_hmac = 0x14; // idx=1 offset=10
|
|
}
|
|
|
|
// size=10
|
|
message CryptoShannonResponse {
|
|
optional int32 dummy = 0x1; // idx=0 offset=c type=uint8
|
|
}
|
|
|
|
// size=10
|
|
message CryptoRc4Sha1HmacResponse {
|
|
optional int32 dummy = 0x1; // idx=0 offset=c type=uint8
|
|
}
|
|
|
|
|
|
|