librespot-protocol 0.4.2

The protobuf logic for communicating with Spotify servers
Documentation
syntax = "proto2";

message ClientHello {
    required BuildInfo build_info = 0xa; 
    repeated Fingerprint fingerprints_supported = 0x14; 
    repeated Cryptosuite cryptosuites_supported = 0x1e; 
    repeated Powscheme powschemes_supported = 0x28; 
    required LoginCryptoHelloUnion login_crypto_hello = 0x32; 
    required bytes client_nonce = 0x3c; 
    optional bytes padding = 0x46; 
    optional FeatureSet feature_set = 0x50; 
}


message BuildInfo {
    required Product product = 0xa; 
    repeated ProductFlags product_flags = 0x14; 
    required Platform platform = 0x1e; 
    required uint64 version = 0x28; 
}

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;
}


message LoginCryptoHelloUnion {
    optional LoginCryptoDiffieHellmanHello diffie_hellman = 0xa; 
}


message LoginCryptoDiffieHellmanHello {
    required bytes gc = 0xa; 
    required uint32 server_keys_known = 0x14; 
}


message FeatureSet {
    optional bool autoupdate2 = 0x1; 
    optional bool current_location = 0x2; 
}


message APResponseMessage {
    optional APChallenge challenge = 0xa; 
    optional UpgradeRequiredMessage upgrade = 0x14; 
    optional APLoginFailed login_failed = 0x1e; 
}

message APChallenge {
    required LoginCryptoChallengeUnion login_crypto_challenge = 0xa; 
    required FingerprintChallengeUnion fingerprint_challenge = 0x14; 
    required PoWChallengeUnion pow_challenge = 0x1e; 
    required CryptoChallengeUnion crypto_challenge = 0x28; 
    required bytes server_nonce = 0x32; 
    optional bytes padding = 0x3c; 
}

message LoginCryptoChallengeUnion {
    optional LoginCryptoDiffieHellmanChallenge diffie_hellman = 0xa; 
}

message LoginCryptoDiffieHellmanChallenge {
    required bytes gs = 0xa; 
    required int32 server_signature_key = 0x14; 
    required bytes gs_signature = 0x1e; 
}

message FingerprintChallengeUnion {
    optional FingerprintGrainChallenge grain = 0xa; 
    optional FingerprintHmacRipemdChallenge hmac_ripemd = 0x14; 
}


message FingerprintGrainChallenge {
    required bytes kek = 0xa; 
}


message FingerprintHmacRipemdChallenge {
    required bytes challenge = 0xa; 
}


message PoWChallengeUnion {
    optional PoWHashCashChallenge hash_cash = 0xa; 
}

message PoWHashCashChallenge {
    optional bytes prefix = 0xa; 
    optional int32 length = 0x14; 
    optional int32 target = 0x1e; 
}


message CryptoChallengeUnion {
    optional CryptoShannonChallenge shannon = 0xa; 
    optional CryptoRc4Sha1HmacChallenge rc4_sha1_hmac = 0x14; 
}


message CryptoShannonChallenge {
}


message CryptoRc4Sha1HmacChallenge {
}


message UpgradeRequiredMessage {
    required bytes upgrade_signed_part = 0xa; 
    required bytes signature = 0x14; 
    optional string http_suffix = 0x1e; 
}

message APLoginFailed {
    required ErrorCode error_code = 0xa; 
    optional int32 retry_delay = 0x14; 
    optional int32 expiry = 0x1e; 
    optional string error_description = 0x28; 
}

enum ErrorCode {
    ProtocolError = 0x0;
    TryAnotherAP = 0x2;
    BadConnectionId = 0x5;
    TravelRestriction = 0x9;
    PremiumAccountRequired = 0xb;
    BadCredentials = 0xc;
    CouldNotValidateCredentials = 0xd;
    AccountExists = 0xe;
    ExtraVerificationRequired = 0xf;
    InvalidAppKey = 0x10;
    ApplicationBanned = 0x11;
}

message ClientResponsePlaintext {
    required LoginCryptoResponseUnion login_crypto_response = 0xa; 
    required PoWResponseUnion pow_response = 0x14; 
    required CryptoResponseUnion crypto_response = 0x1e; 
}


message LoginCryptoResponseUnion {
    optional LoginCryptoDiffieHellmanResponse diffie_hellman = 0xa; 
}


message LoginCryptoDiffieHellmanResponse {
    required bytes hmac = 0xa; 
}


message PoWResponseUnion {
    optional PoWHashCashResponse hash_cash = 0xa; 
}


message PoWHashCashResponse {
    required bytes hash_suffix = 0xa; 
}


message CryptoResponseUnion {
    optional CryptoShannonResponse shannon = 0xa; 
    optional CryptoRc4Sha1HmacResponse rc4_sha1_hmac = 0x14; 
}


message CryptoShannonResponse {
    optional int32 dummy = 0x1; 
}


message CryptoRc4Sha1HmacResponse {
    optional int32 dummy = 0x1; 
}