chromesync 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chromesync/__init__.py +36 -0
- chromesync/_client.py +113 -0
- chromesync/_nigori.py +66 -0
- chromesync/_oscrypt.py +49 -0
- chromesync/_profile.py +101 -0
- chromesync/_proto/__init__.py +3 -0
- chromesync/_proto/components/__init__.py +0 -0
- chromesync/_proto/components/sync/__init__.py +0 -0
- chromesync/_proto/components/sync/protocol/__init__.py +0 -0
- chromesync/_proto/components/sync/protocol/account_setting_specifics_pb2.py +26 -0
- chromesync/_proto/components/sync/protocol/agile_encryption_keys_pb2.py +35 -0
- chromesync/_proto/components/sync/protocol/ai_thread_specifics_pb2.py +28 -0
- chromesync/_proto/components/sync/protocol/app_list_specifics_pb2.py +34 -0
- chromesync/_proto/components/sync/protocol/app_setting_specifics_pb2.py +27 -0
- chromesync/_proto/components/sync/protocol/app_specifics_pb2.py +45 -0
- chromesync/_proto/components/sync/protocol/arc_package_specifics_pb2.py +26 -0
- chromesync/_proto/components/sync/protocol/attachment_pb2.py +26 -0
- chromesync/_proto/components/sync/protocol/autofill_entity_suppression_specifics_pb2.py +38 -0
- chromesync/_proto/components/sync/protocol/autofill_offer_specifics_pb2.py +36 -0
- chromesync/_proto/components/sync/protocol/autofill_specifics_pb2.py +118 -0
- chromesync/_proto/components/sync/protocol/autofill_valuable_metadata_specifics_pb2.py +28 -0
- chromesync/_proto/components/sync/protocol/autofill_valuable_specifics_pb2.py +58 -0
- chromesync/_proto/components/sync/protocol/autofill_wallet_credential_specifics_pb2.py +26 -0
- chromesync/_proto/components/sync/protocol/autofill_wallet_usage_specifics_pb2.py +28 -0
- chromesync/_proto/components/sync/protocol/bookmark_specifics_pb2.py +31 -0
- chromesync/_proto/components/sync/protocol/client_commands_pb2.py +32 -0
- chromesync/_proto/components/sync/protocol/client_debug_info_pb2.py +34 -0
- chromesync/_proto/components/sync/protocol/collaboration_group_specifics_pb2.py +26 -0
- chromesync/_proto/components/sync/protocol/contact_info_specifics_pb2.py +38 -0
- chromesync/_proto/components/sync/protocol/contextual_task_specifics_pb2.py +31 -0
- chromesync/_proto/components/sync/protocol/cookie_specifics_pb2.py +36 -0
- chromesync/_proto/components/sync/protocol/data_type_progress_marker_pb2.py +42 -0
- chromesync/_proto/components/sync/protocol/deletion_origin_pb2.py +27 -0
- chromesync/_proto/components/sync/protocol/device_info_specifics_pb2.py +59 -0
- chromesync/_proto/components/sync/protocol/dictionary_specifics_pb2.py +26 -0
- chromesync/_proto/components/sync/protocol/encrypted_tab_context_container_specifics_pb2.py +27 -0
- chromesync/_proto/components/sync/protocol/encrypted_tab_context_item_specifics_pb2.py +29 -0
- chromesync/_proto/components/sync/protocol/encryption_pb2.py +26 -0
- chromesync/_proto/components/sync/protocol/entity_specifics_pb2.py +110 -0
- chromesync/_proto/components/sync/protocol/extension_setting_specifics_pb2.py +26 -0
- chromesync/_proto/components/sync/protocol/extension_specifics_pb2.py +32 -0
- chromesync/_proto/components/sync/protocol/gaia_password_reuse_pb2.py +42 -0
- chromesync/_proto/components/sync/protocol/gemini_thread_specifics_pb2.py +26 -0
- chromesync/_proto/components/sync/protocol/get_updates_caller_info_pb2.py +26 -0
- chromesync/_proto/components/sync/protocol/history_delete_directive_specifics_pb2.py +32 -0
- chromesync/_proto/components/sync/protocol/history_specifics_pb2.py +33 -0
- chromesync/_proto/components/sync/protocol/journey_specifics_pb2.py +34 -0
- chromesync/_proto/components/sync/protocol/managed_user_setting_specifics_pb2.py +26 -0
- chromesync/_proto/components/sync/protocol/nigori_specifics_pb2.py +49 -0
- chromesync/_proto/components/sync/protocol/notebook_specifics_pb2.py +28 -0
- chromesync/_proto/components/sync/protocol/os_preference_specifics_pb2.py +27 -0
- chromesync/_proto/components/sync/protocol/os_priority_preference_specifics_pb2.py +27 -0
- chromesync/_proto/components/sync/protocol/password_sharing_invitation_specifics_pb2.py +43 -0
- chromesync/_proto/components/sync/protocol/password_specifics_pb2.py +45 -0
- chromesync/_proto/components/sync/protocol/preference_specifics_pb2.py +26 -0
- chromesync/_proto/components/sync/protocol/printer_specifics_pb2.py +38 -0
- chromesync/_proto/components/sync/protocol/printers_authorization_server_specifics_pb2.py +26 -0
- chromesync/_proto/components/sync/protocol/priority_preference_specifics_pb2.py +27 -0
- chromesync/_proto/components/sync/protocol/product_comparison_specifics_pb2.py +33 -0
- chromesync/_proto/components/sync/protocol/reading_list_specifics_pb2.py +28 -0
- chromesync/_proto/components/sync/protocol/saved_tab_group_specifics_pb2.py +33 -0
- chromesync/_proto/components/sync/protocol/search_engine_specifics_pb2.py +38 -0
- chromesync/_proto/components/sync/protocol/security_event_specifics_pb2.py +27 -0
- chromesync/_proto/components/sync/protocol/send_tab_to_self_specifics_pb2.py +40 -0
- chromesync/_proto/components/sync/protocol/session_specifics_pb2.py +50 -0
- chromesync/_proto/components/sync/protocol/shared_comment_specifics_pb2.py +44 -0
- chromesync/_proto/components/sync/protocol/shared_tab_group_account_data_specifics_pb2.py +30 -0
- chromesync/_proto/components/sync/protocol/shared_tab_group_data_specifics_pb2.py +33 -0
- chromesync/_proto/components/sync/protocol/sharing_message_specifics_pb2.py +39 -0
- chromesync/_proto/components/sync/protocol/skill_specifics_pb2.py +30 -0
- chromesync/_proto/components/sync/protocol/sync_entity_pb2.py +40 -0
- chromesync/_proto/components/sync/protocol/sync_enums_pb2.py +70 -0
- chromesync/_proto/components/sync/protocol/sync_pb2.py +76 -0
- chromesync/_proto/components/sync/protocol/tab_group_attribution_metadata_pb2.py +30 -0
- chromesync/_proto/components/sync/protocol/tab_navigation_pb2.py +57 -0
- chromesync/_proto/components/sync/protocol/theme_android_specifics_pb2.py +29 -0
- chromesync/_proto/components/sync/protocol/theme_ios_specifics_pb2.py +27 -0
- chromesync/_proto/components/sync/protocol/theme_specifics_pb2.py +33 -0
- chromesync/_proto/components/sync/protocol/theme_types_pb2.py +30 -0
- chromesync/_proto/components/sync/protocol/typed_url_specifics_pb2.py +30 -0
- chromesync/_proto/components/sync/protocol/unencrypted_sharing_message_pb2.py +36 -0
- chromesync/_proto/components/sync/protocol/unique_position_pb2.py +32 -0
- chromesync/_proto/components/sync/protocol/user_consent_specifics_pb2.py +45 -0
- chromesync/_proto/components/sync/protocol/user_consent_types_pb2.py +50 -0
- chromesync/_proto/components/sync/protocol/user_event_specifics_pb2.py +37 -0
- chromesync/_proto/components/sync/protocol/web_app_specifics_pb2.py +32 -0
- chromesync/_proto/components/sync/protocol/webauthn_credential_specifics_pb2.py +32 -0
- chromesync/_proto/components/sync/protocol/wifi_configuration_specifics_pb2.py +42 -0
- chromesync/_proto/components/sync/protocol/workspace_desk_specifics_pb2.py +65 -0
- chromesync/_proto/components/trusted_vault/__init__.py +0 -0
- chromesync/_proto/components/trusted_vault/proto/__init__.py +0 -0
- chromesync/_proto/components/trusted_vault/proto/local_trusted_vault_pb2.py +42 -0
- chromesync/_tags.py +32 -0
- chromesync/cli.py +96 -0
- chromesync/passwords.py +173 -0
- chromesync-0.2.0.dist-info/METADATA +97 -0
- chromesync-0.2.0.dist-info/RECORD +100 -0
- chromesync-0.2.0.dist-info/WHEEL +4 -0
- chromesync-0.2.0.dist-info/entry_points.txt +2 -0
- chromesync-0.2.0.dist-info/licenses/LICENSE +21 -0
chromesync/__init__.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""chromesync: a Chrome Sync protocol client, starting with saved passwords.
|
|
2
|
+
|
|
3
|
+
from chromesync import open_passwords
|
|
4
|
+
store = open_passwords() # the local Chrome profile's account
|
|
5
|
+
for p in store.find(fingerprint_of_password="f52fbd32b2b3"):
|
|
6
|
+
store.set_password(p, new_value) # Chrome downloads it within seconds
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
from chromesync._client import CommitError, SyncClient, SyncError, access_token
|
|
13
|
+
from chromesync._nigori import Nigori
|
|
14
|
+
from chromesync._profile import ChromeProfile, OAuthClient, chrome_oauth_client
|
|
15
|
+
from chromesync.passwords import KeyBag, Password, PasswordStore, fingerprint
|
|
16
|
+
|
|
17
|
+
__all__ = ["ChromeProfile", "CommitError", "KeyBag", "Nigori", "OAuthClient", "Password", "PasswordStore",
|
|
18
|
+
"SyncClient", "SyncError", "access_token", "chrome_oauth_client", "fingerprint", "open_client",
|
|
19
|
+
"open_passwords"]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def open_client(profile: ChromeProfile | None = None, binary: Path | None = None) -> SyncClient:
|
|
23
|
+
"""A SyncClient authenticated as the account signed in to a local Chrome profile."""
|
|
24
|
+
profile = profile or ChromeProfile()
|
|
25
|
+
oauth = chrome_oauth_client(binary) if binary else chrome_oauth_client()
|
|
26
|
+
token = access_token(profile.refresh_token(), oauth.client_id, oauth.client_secret)
|
|
27
|
+
return SyncClient(token, profile.account_email())
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def open_passwords(profile: ChromeProfile | None = None, binary: Path | None = None,
|
|
31
|
+
custom_passphrase: str | None = None) -> PasswordStore:
|
|
32
|
+
"""The saved passwords of the account signed in to a local Chrome profile."""
|
|
33
|
+
profile = profile or ChromeProfile()
|
|
34
|
+
client = open_client(profile, binary)
|
|
35
|
+
vault = profile.trusted_vault_keys() if (profile.path / "trusted_vault.pb").exists() else []
|
|
36
|
+
return PasswordStore.open(client, trusted_vault_keys=vault, custom_passphrase=custom_passphrase)
|
chromesync/_client.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""The Chrome Sync wire protocol: protobuf over HTTPS (components/sync/engine/net)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import base64
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import urllib.parse
|
|
8
|
+
import urllib.request
|
|
9
|
+
from collections.abc import Callable
|
|
10
|
+
from dataclasses import dataclass, field
|
|
11
|
+
|
|
12
|
+
from chromesync._proto.components.sync.protocol import sync_entity_pb2, sync_pb2
|
|
13
|
+
|
|
14
|
+
SYNC_URL = "https://clients4.google.com/chrome-sync/command/"
|
|
15
|
+
TOKEN_URL = "https://oauth2.googleapis.com/token"
|
|
16
|
+
SCOPE = "https://www.googleapis.com/auth/chromesync"
|
|
17
|
+
PROTOCOL_VERSION = 99
|
|
18
|
+
_PERIODIC = 4 # SyncEnums.GetUpdatesOrigin.PERIODIC
|
|
19
|
+
|
|
20
|
+
# (url, body, headers) -> response body
|
|
21
|
+
Transport = Callable[[str, bytes, dict[str, str]], bytes]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def http_post(url: str, body: bytes, headers: dict[str, str]) -> bytes:
|
|
25
|
+
with urllib.request.urlopen(urllib.request.Request(url, body, headers), timeout=60) as r:
|
|
26
|
+
return bytes(r.read())
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def access_token(refresh_token: str, client_id: str, client_secret: str, post: Transport = http_post) -> str:
|
|
30
|
+
"""Exchange a refresh token for a chromesync access token."""
|
|
31
|
+
body = urllib.parse.urlencode({"client_id": client_id, "client_secret": client_secret,
|
|
32
|
+
"grant_type": "refresh_token", "refresh_token": refresh_token,
|
|
33
|
+
"scope": SCOPE}).encode()
|
|
34
|
+
reply = json.loads(post(TOKEN_URL, body, {"Content-Type": "application/x-www-form-urlencoded"}))
|
|
35
|
+
return str(reply["access_token"])
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class SyncError(RuntimeError):
|
|
39
|
+
"""The sync server answered with an error code."""
|
|
40
|
+
|
|
41
|
+
def __init__(self, code: int, message: str) -> None:
|
|
42
|
+
super().__init__(f"sync error {code}: {message}")
|
|
43
|
+
self.code = code
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class CommitError(RuntimeError):
|
|
47
|
+
"""The server refused a committed entity."""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass
|
|
51
|
+
class Updates:
|
|
52
|
+
entities: list[sync_entity_pb2.SyncEntity]
|
|
53
|
+
encryption_keys: list[bytes]
|
|
54
|
+
progress_token: bytes
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass
|
|
58
|
+
class SyncClient:
|
|
59
|
+
"""One sync client (cache GUID) of the account `share` (its email)."""
|
|
60
|
+
|
|
61
|
+
access_token: str
|
|
62
|
+
share: str
|
|
63
|
+
post: Transport = http_post
|
|
64
|
+
cache_guid: str = field(default_factory=lambda: base64.b64encode(os.urandom(16)).decode())
|
|
65
|
+
store_birthday: str | None = None
|
|
66
|
+
_chips: sync_pb2.ChipBag | None = None
|
|
67
|
+
|
|
68
|
+
def send(self, msg: sync_pb2.ClientToServerMessage) -> sync_pb2.ClientToServerResponse:
|
|
69
|
+
msg.share = self.share
|
|
70
|
+
msg.protocol_version = PROTOCOL_VERSION
|
|
71
|
+
if self.store_birthday:
|
|
72
|
+
msg.store_birthday = self.store_birthday
|
|
73
|
+
if self._chips is not None:
|
|
74
|
+
msg.bag_of_chips.CopyFrom(self._chips)
|
|
75
|
+
url = SYNC_URL + "?" + urllib.parse.urlencode({"client": "Google Chrome", "client_id": self.cache_guid})
|
|
76
|
+
raw = self.post(url, msg.SerializeToString(), {"Authorization": f"Bearer {self.access_token}",
|
|
77
|
+
"Content-Type": "application/octet-stream"})
|
|
78
|
+
resp = sync_pb2.ClientToServerResponse.FromString(raw)
|
|
79
|
+
if resp.HasField("store_birthday"):
|
|
80
|
+
self.store_birthday = resp.store_birthday
|
|
81
|
+
if resp.HasField("new_bag_of_chips"):
|
|
82
|
+
self._chips = resp.new_bag_of_chips
|
|
83
|
+
if resp.error_code != 0:
|
|
84
|
+
raise SyncError(resp.error_code, resp.error_message)
|
|
85
|
+
return resp
|
|
86
|
+
|
|
87
|
+
def get_updates(self, data_type_id: int, need_encryption_key: bool = False) -> Updates:
|
|
88
|
+
"""Every entity of one data type (follows changes_remaining)."""
|
|
89
|
+
out = Updates([], [], b"")
|
|
90
|
+
while True:
|
|
91
|
+
msg = sync_pb2.ClientToServerMessage(message_contents=sync_pb2.ClientToServerMessage.GET_UPDATES)
|
|
92
|
+
msg.get_updates.get_updates_origin = _PERIODIC
|
|
93
|
+
msg.get_updates.need_encryption_key = need_encryption_key
|
|
94
|
+
marker = msg.get_updates.from_progress_marker.add()
|
|
95
|
+
marker.data_type_id, marker.token = data_type_id, out.progress_token
|
|
96
|
+
r = self.send(msg).get_updates
|
|
97
|
+
out.entities += r.entries
|
|
98
|
+
out.encryption_keys += r.encryption_keys
|
|
99
|
+
out.progress_token = next((m.token for m in r.new_progress_marker if m.data_type_id == data_type_id),
|
|
100
|
+
out.progress_token)
|
|
101
|
+
if r.changes_remaining == 0 or not r.entries:
|
|
102
|
+
return out
|
|
103
|
+
|
|
104
|
+
def commit(self, entity: sync_entity_pb2.SyncEntity) -> sync_pb2.CommitResponse.EntryResponse:
|
|
105
|
+
"""Commit one entity; returns the server's entry response (new id_string and version)."""
|
|
106
|
+
msg = sync_pb2.ClientToServerMessage(message_contents=sync_pb2.ClientToServerMessage.COMMIT)
|
|
107
|
+
msg.commit.cache_guid = self.cache_guid
|
|
108
|
+
msg.commit.entries.add().CopyFrom(entity)
|
|
109
|
+
reply = self.send(msg).commit.entryresponse[0]
|
|
110
|
+
if reply.response_type != sync_pb2.CommitResponse.SUCCESS:
|
|
111
|
+
raise CommitError(f"commit refused: {sync_pb2.CommitResponse.ResponseType.Name(reply.response_type)} "
|
|
112
|
+
f"{reply.error_message}")
|
|
113
|
+
return reply
|
chromesync/_nigori.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""Nigori: the symmetric encryption of Chrome Sync (components/sync/model/crypto/nigori.cc)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import base64
|
|
5
|
+
import hashlib
|
|
6
|
+
import hmac
|
|
7
|
+
import os
|
|
8
|
+
import struct
|
|
9
|
+
|
|
10
|
+
from cryptography.hazmat.primitives import padding
|
|
11
|
+
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
|
12
|
+
|
|
13
|
+
# PBKDF2 salt, historically PBKDF2_HMAC_SHA1(Ns("dummy") + Ns("localhost"), "saltsalt", 1001, 128).
|
|
14
|
+
_SALT = bytes.fromhex("c7cafb23ec2a9d4c035a90aeed8ba498")
|
|
15
|
+
_PASSWORD_TYPE = 1 # Nigori::Type::Password
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Nigori:
|
|
19
|
+
"""A pair of AES-128 encryption and HMAC-SHA256 keys."""
|
|
20
|
+
|
|
21
|
+
def __init__(self, encryption_key: bytes, mac_key: bytes) -> None:
|
|
22
|
+
if len(encryption_key) != 16 or len(mac_key) != 16:
|
|
23
|
+
raise ValueError("Nigori keys are 16 bytes")
|
|
24
|
+
self.encryption_key, self.mac_key = encryption_key, mac_key
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def derive_pbkdf2(cls, password: bytes) -> Nigori:
|
|
28
|
+
"""Keys for keystore and trusted-vault passphrases (and old custom passphrases)."""
|
|
29
|
+
return cls(hashlib.pbkdf2_hmac("sha1", password, _SALT, 1003, 16),
|
|
30
|
+
hashlib.pbkdf2_hmac("sha1", password, _SALT, 1004, 16))
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def derive_scrypt(cls, password: bytes, salt: bytes) -> Nigori:
|
|
34
|
+
"""Keys for custom passphrases (scrypt N=8192, r=8, p=11)."""
|
|
35
|
+
keys = hashlib.scrypt(password, salt=salt, n=8192, r=8, p=11, maxmem=64 * 1024 * 1024, dklen=32)
|
|
36
|
+
return cls(keys[:16], keys[16:])
|
|
37
|
+
|
|
38
|
+
def _cbc_encrypt(self, iv: bytes, data: bytes) -> bytes:
|
|
39
|
+
padder = padding.PKCS7(128).padder()
|
|
40
|
+
enc = Cipher(algorithms.AES(self.encryption_key), modes.CBC(iv)).encryptor()
|
|
41
|
+
return enc.update(padder.update(data) + padder.finalize()) + enc.finalize()
|
|
42
|
+
|
|
43
|
+
def key_name(self) -> str:
|
|
44
|
+
"""Permute[Kenc,Kmac](Password || "nigori-key"): how records name the key that encrypted them."""
|
|
45
|
+
stream = struct.pack(">II", 4, _PASSWORD_TYPE) + struct.pack(">I", 10) + b"nigori-key"
|
|
46
|
+
ct = self._cbc_encrypt(bytes(16), stream)
|
|
47
|
+
return base64.b64encode(ct + hmac.new(self.mac_key, ct, "sha256").digest()).decode()
|
|
48
|
+
|
|
49
|
+
def encrypt(self, plaintext: bytes) -> str:
|
|
50
|
+
"""base64(IV ‖ AES-CBC ‖ HMAC-SHA256(ciphertext)); the MAC form every Chrome version accepts."""
|
|
51
|
+
iv = os.urandom(16)
|
|
52
|
+
ct = self._cbc_encrypt(iv, plaintext)
|
|
53
|
+
return base64.b64encode(iv + ct + hmac.new(self.mac_key, ct, "sha256").digest()).decode()
|
|
54
|
+
|
|
55
|
+
def decrypt(self, blob: str) -> bytes:
|
|
56
|
+
"""Inverse of encrypt; also accepts the newer MAC over IV ‖ ciphertext. Raises ValueError."""
|
|
57
|
+
raw = base64.b64decode(blob)
|
|
58
|
+
if len(raw) < 64:
|
|
59
|
+
raise ValueError("Nigori blob too short")
|
|
60
|
+
iv, ct, tag = raw[:16], raw[16:-32], raw[-32:]
|
|
61
|
+
if not (hmac.compare_digest(hmac.new(self.mac_key, raw[:-32], "sha256").digest(), tag)
|
|
62
|
+
or hmac.compare_digest(hmac.new(self.mac_key, ct, "sha256").digest(), tag)):
|
|
63
|
+
raise ValueError("Nigori MAC mismatch")
|
|
64
|
+
dec = Cipher(algorithms.AES(self.encryption_key), modes.CBC(iv)).decryptor()
|
|
65
|
+
unpadder = padding.PKCS7(128).unpadder()
|
|
66
|
+
return unpadder.update(dec.update(ct) + dec.finalize()) + unpadder.finalize()
|
chromesync/_oscrypt.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Chrome's OSCrypt on Linux: how it encrypts tokens, passwords and cookies at rest."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import hashlib
|
|
5
|
+
|
|
6
|
+
from cryptography.hazmat.primitives import padding
|
|
7
|
+
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
|
8
|
+
|
|
9
|
+
_IV = b" " * 16
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def derive_key(password: bytes) -> bytes:
|
|
13
|
+
return hashlib.pbkdf2_hmac("sha1", password, b"saltysalt", 1, 16)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def keyring_password(application: str = "chrome") -> bytes:
|
|
17
|
+
"""The "<Browser> Safe Storage" secret Chrome keeps in the Secret Service (libsecret backend)."""
|
|
18
|
+
import secretstorage
|
|
19
|
+
|
|
20
|
+
conn = secretstorage.dbus_init()
|
|
21
|
+
for col in secretstorage.get_all_collections(conn):
|
|
22
|
+
if col.is_locked():
|
|
23
|
+
continue
|
|
24
|
+
for item in col.search_items({"application": application}):
|
|
25
|
+
if item.get_label().endswith("Safe Storage"):
|
|
26
|
+
return bytes(item.get_secret())
|
|
27
|
+
raise LookupError(f"no unlocked Safe Storage secret for application {application!r}")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class OSCrypt:
|
|
31
|
+
"""v10 (fixed "peanuts" key) and v11 (keyring key) AES-128-CBC blobs."""
|
|
32
|
+
|
|
33
|
+
def __init__(self, v11_password: bytes | None) -> None:
|
|
34
|
+
self.keys = {b"v10": derive_key(b"peanuts")}
|
|
35
|
+
if v11_password is not None:
|
|
36
|
+
self.keys[b"v11"] = derive_key(v11_password)
|
|
37
|
+
|
|
38
|
+
def decrypt(self, blob: bytes) -> bytes:
|
|
39
|
+
key = self.keys.get(bytes(blob[:3]))
|
|
40
|
+
if key is None:
|
|
41
|
+
raise ValueError(f"unsupported OSCrypt version {bytes(blob[:3])!r}")
|
|
42
|
+
dec = Cipher(algorithms.AES(key), modes.CBC(_IV)).decryptor()
|
|
43
|
+
unpadder = padding.PKCS7(128).unpadder()
|
|
44
|
+
return unpadder.update(dec.update(bytes(blob[3:])) + dec.finalize()) + unpadder.finalize()
|
|
45
|
+
|
|
46
|
+
def encrypt(self, plaintext: bytes, version: bytes = b"v11") -> bytes:
|
|
47
|
+
padder = padding.PKCS7(128).padder()
|
|
48
|
+
enc = Cipher(algorithms.AES(self.keys[version]), modes.CBC(_IV)).encryptor()
|
|
49
|
+
return version + enc.update(padder.update(plaintext) + padder.finalize()) + enc.finalize()
|
chromesync/_profile.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"""Read what a local Chrome profile knows about its sync account: token, account, trusted-vault keys."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import hashlib
|
|
5
|
+
import json
|
|
6
|
+
import re
|
|
7
|
+
import shutil
|
|
8
|
+
import sqlite3
|
|
9
|
+
import tempfile
|
|
10
|
+
from dataclasses import dataclass
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
from chromesync._oscrypt import OSCrypt, keyring_password
|
|
14
|
+
from chromesync._proto.components.trusted_vault.proto import local_trusted_vault_pb2
|
|
15
|
+
|
|
16
|
+
DEFAULT_USER_DATA_DIR = Path.home() / ".config" / "google-chrome"
|
|
17
|
+
DEFAULT_BINARY = Path("/opt/google/chrome/chrome")
|
|
18
|
+
# Google Chrome's OAuth client id. Its secret is not shipped here: it is found in the installed binary
|
|
19
|
+
# as the 24-character token whose SHA-256 is _SECRET_SHA256.
|
|
20
|
+
CHROME_CLIENT_ID = "77185425430.apps.googleusercontent.com"
|
|
21
|
+
_SECRET_SHA256 = "05d9d0c04b7f1d1db0fe1e217c794a62d0a7e1a0e099aafcdded05d2465c4df4"
|
|
22
|
+
_TOKEN_NUL = re.compile(rb"(?<=\x00)[A-Za-z0-9_-]{24}(?=\x00)")
|
|
23
|
+
_TOKEN_ANY = re.compile(rb"(?<![A-Za-z0-9_-])[A-Za-z0-9_-]{24}(?![A-Za-z0-9_-])")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass(frozen=True)
|
|
27
|
+
class OAuthClient:
|
|
28
|
+
client_id: str
|
|
29
|
+
client_secret: str
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def find_secret(data: bytes, sha256_hex: str = _SECRET_SHA256) -> str | None:
|
|
33
|
+
"""The 24-character token in data whose SHA-256 is sha256_hex (NUL-delimited strings first: fast)."""
|
|
34
|
+
for pattern in (_TOKEN_NUL, _TOKEN_ANY):
|
|
35
|
+
for m in pattern.finditer(data):
|
|
36
|
+
if hashlib.sha256(m.group()).hexdigest() == sha256_hex:
|
|
37
|
+
return m.group().decode()
|
|
38
|
+
return None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def chrome_oauth_client(binary: Path = DEFAULT_BINARY) -> OAuthClient:
|
|
42
|
+
"""Google Chrome's OAuth client, its secret read from the installed Chrome binary."""
|
|
43
|
+
secret = find_secret(binary.read_bytes())
|
|
44
|
+
if secret is None:
|
|
45
|
+
raise LookupError(f"Chrome's OAuth client secret not found in {binary}")
|
|
46
|
+
return OAuthClient(CHROME_CLIENT_ID, secret)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _query(db: Path, sql: str) -> list[tuple[object, ...]]:
|
|
50
|
+
"""Read a Chrome sqlite file through a copy: Chrome holds it open and locked."""
|
|
51
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
52
|
+
copy = Path(tmp) / db.name
|
|
53
|
+
shutil.copy(db, copy)
|
|
54
|
+
con = sqlite3.connect(copy)
|
|
55
|
+
try:
|
|
56
|
+
return con.execute(sql).fetchall()
|
|
57
|
+
finally:
|
|
58
|
+
con.close()
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class ChromeProfile:
|
|
62
|
+
"""A Chrome profile directory, e.g. ~/.config/google-chrome/Default."""
|
|
63
|
+
|
|
64
|
+
def __init__(self, path: Path | str | None = None, keyring_application: str = "chrome",
|
|
65
|
+
oscrypt: OSCrypt | None = None) -> None:
|
|
66
|
+
self.path = Path(path) if path else DEFAULT_USER_DATA_DIR / "Default"
|
|
67
|
+
self._oscrypt = oscrypt
|
|
68
|
+
self._keyring_application = keyring_application
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def oscrypt(self) -> OSCrypt:
|
|
72
|
+
if self._oscrypt is None:
|
|
73
|
+
self._oscrypt = OSCrypt(keyring_password(self._keyring_application))
|
|
74
|
+
return self._oscrypt
|
|
75
|
+
|
|
76
|
+
def account_email(self) -> str:
|
|
77
|
+
prefs = json.loads((self.path / "Preferences").read_text())
|
|
78
|
+
return str(prefs["google"]["services"]["last_username"])
|
|
79
|
+
|
|
80
|
+
def refresh_token(self) -> str:
|
|
81
|
+
"""The signed-in account's OAuth refresh token (Web Data, table token_service)."""
|
|
82
|
+
rows = _query(self.path / "Web Data", "SELECT service, encrypted_token FROM token_service")
|
|
83
|
+
tokens = [self.oscrypt.decrypt(bytes(t)) for s, t in rows if str(s).startswith("AccountId-")] # type: ignore[call-overload]
|
|
84
|
+
if len(tokens) != 1:
|
|
85
|
+
raise LookupError(f"expected one signed-in account token, found {len(tokens)}")
|
|
86
|
+
return tokens[0].decode()
|
|
87
|
+
|
|
88
|
+
def trusted_vault_keys(self) -> list[bytes]:
|
|
89
|
+
"""Keys of the account's trusted vault ("on-device encryption"), oldest first."""
|
|
90
|
+
content = local_trusted_vault_pb2.LocalTrustedVaultFileContent.FromString(
|
|
91
|
+
(self.path / "trusted_vault.pb").read_bytes())
|
|
92
|
+
raw = content.serialized_local_trusted_vault
|
|
93
|
+
vault = local_trusted_vault_pb2.LocalTrustedVault.FromString(
|
|
94
|
+
raw.encode("latin-1") if isinstance(raw, str) else raw)
|
|
95
|
+
return [k.key_material for user in vault.user for k in user.vault_key]
|
|
96
|
+
|
|
97
|
+
def local_passwords(self) -> list[tuple[str, str, bytes]]:
|
|
98
|
+
"""(origin_url, username, password) rows of the profile's local password store."""
|
|
99
|
+
rows = _query(self.path / "Login Data", "SELECT origin_url, username_value, password_value FROM logins")
|
|
100
|
+
return [(str(o), str(u), self.oscrypt.decrypt(bytes(p)) if p else b"") # type: ignore[call-overload]
|
|
101
|
+
for o, u, p in rows]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: components/sync/protocol/account_setting_specifics.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf.internal import builder as _builder
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n8components/sync/protocol/account_setting_specifics.proto\x12\x07sync_pb\"s\n\x17\x41\x63\x63ountSettingSpecifics\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\nbool_value\x18\x02 \x01(\x08H\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x13\n\tint_value\x18\x04 \x01(\x03H\x00\x42\x07\n\x05ValueB+\n%org.chromium.components.sync.protocolH\x03P\x01')
|
|
17
|
+
|
|
18
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
19
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'components.sync.protocol.account_setting_specifics_pb2', globals())
|
|
20
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
21
|
+
|
|
22
|
+
DESCRIPTOR._options = None
|
|
23
|
+
DESCRIPTOR._serialized_options = b'\n%org.chromium.components.sync.protocolH\003P\001'
|
|
24
|
+
_ACCOUNTSETTINGSPECIFICS._serialized_start=69
|
|
25
|
+
_ACCOUNTSETTINGSPECIFICS._serialized_end=184
|
|
26
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: components/sync/protocol/agile_encryption_keys.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf.internal import builder as _builder
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
from chromesync._proto.components.sync.protocol import nigori_specifics_pb2 as components_dot_sync_dot_protocol_dot_nigori__specifics__pb2
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n4components/sync/protocol/agile_encryption_keys.proto\x12\x07sync_pb\x1a/components/sync/protocol/nigori_specifics.proto\"\x9a\x02\n\x11\x41gileSymmetricKey\x12+\n\rlegacy_nigori\x18\x01 \x01(\x0b\x32\x12.sync_pb.NigoriKeyH\x00\x12>\n\x0b\x61\x65s_256_gcm\x18\x02 \x01(\x0b\x32\'.sync_pb.AgileSymmetricKey.Aes256GcmKeyH\x00\x12K\n\x11\x63hacha20_poly1305\x18\x03 \x01(\x0b\x32..sync_pb.AgileSymmetricKey.Chacha20Poly1305KeyH\x00\x1a\x1b\n\x0c\x41\x65s256GcmKey\x12\x0b\n\x03key\x18\x01 \x01(\x0c\x1a\"\n\x13\x43hacha20Poly1305Key\x12\x0b\n\x03key\x18\x01 \x01(\x0c\x42\n\n\x08key_type\"\xa3\x01\n\x14\x41gileSymmetricKeySet\x12\x16\n\x0eprimary_key_id\x18\x01 \x01(\r\x12.\n\x03key\x18\x02 \x03(\x0b\x32!.sync_pb.AgileSymmetricKeySet.Key\x1a\x43\n\x03Key\x12,\n\x08key_data\x18\x01 \x01(\x0b\x32\x1a.sync_pb.AgileSymmetricKey\x12\x0e\n\x06key_id\x18\x02 \x01(\rB1\n%org.chromium.components.sync.protocolH\x03P\x01\xa2\x02\x03GCR')
|
|
18
|
+
|
|
19
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
20
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'components.sync.protocol.agile_encryption_keys_pb2', globals())
|
|
21
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
22
|
+
|
|
23
|
+
DESCRIPTOR._options = None
|
|
24
|
+
DESCRIPTOR._serialized_options = b'\n%org.chromium.components.sync.protocolH\003P\001\242\002\003GCR'
|
|
25
|
+
_AGILESYMMETRICKEY._serialized_start=115
|
|
26
|
+
_AGILESYMMETRICKEY._serialized_end=397
|
|
27
|
+
_AGILESYMMETRICKEY_AES256GCMKEY._serialized_start=322
|
|
28
|
+
_AGILESYMMETRICKEY_AES256GCMKEY._serialized_end=349
|
|
29
|
+
_AGILESYMMETRICKEY_CHACHA20POLY1305KEY._serialized_start=351
|
|
30
|
+
_AGILESYMMETRICKEY_CHACHA20POLY1305KEY._serialized_end=385
|
|
31
|
+
_AGILESYMMETRICKEYSET._serialized_start=400
|
|
32
|
+
_AGILESYMMETRICKEYSET._serialized_end=563
|
|
33
|
+
_AGILESYMMETRICKEYSET_KEY._serialized_start=496
|
|
34
|
+
_AGILESYMMETRICKEYSET_KEY._serialized_end=563
|
|
35
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: components/sync/protocol/ai_thread_specifics.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf.internal import builder as _builder
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n2components/sync/protocol/ai_thread_specifics.proto\x12\x07sync_pb\"\xda\x01\n\x11\x41iThreadSpecifics\x12\x33\n\x04type\x18\x01 \x01(\x0e\x32%.sync_pb.AiThreadSpecifics.ThreadType\x12\x11\n\tserver_id\x18\x02 \x01(\t\x12\x1c\n\x14\x63onversation_turn_id\x18\x03 \x01(\t\x12\r\n\x05title\x18\x04 \x01(\t\x12(\n last_turn_time_unix_epoch_millis\x18\x05 \x01(\x03\"&\n\nThreadType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0b\n\x07\x41I_MODE\x10\x01\x42+\n%org.chromium.components.sync.protocolH\x03P\x01')
|
|
17
|
+
|
|
18
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
19
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'components.sync.protocol.ai_thread_specifics_pb2', globals())
|
|
20
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
21
|
+
|
|
22
|
+
DESCRIPTOR._options = None
|
|
23
|
+
DESCRIPTOR._serialized_options = b'\n%org.chromium.components.sync.protocolH\003P\001'
|
|
24
|
+
_AITHREADSPECIFICS._serialized_start=64
|
|
25
|
+
_AITHREADSPECIFICS._serialized_end=282
|
|
26
|
+
_AITHREADSPECIFICS_THREADTYPE._serialized_start=244
|
|
27
|
+
_AITHREADSPECIFICS_THREADTYPE._serialized_end=282
|
|
28
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: components/sync/protocol/app_list_specifics.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf.internal import builder as _builder
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n1components/sync/protocol/app_list_specifics.proto\x12\x07sync_pb\"\xb3\x05\n\x10\x41ppListSpecifics\x12\x0f\n\x07item_id\x18\x01 \x01(\t\x12<\n\titem_type\x18\x02 \x01(\x0e\x32).sync_pb.AppListSpecifics.AppListItemType\x12\x11\n\titem_name\x18\x03 \x01(\t\x12\x11\n\tparent_id\x18\x04 \x01(\t\x12!\n\x15OBSOLETE_page_ordinal\x18\x05 \x01(\tB\x02\x18\x01\x12\x14\n\x0citem_ordinal\x18\x06 \x01(\t\x12\x18\n\x10item_pin_ordinal\x18\x07 \x01(\t\x12\x37\n\nitem_color\x18\x08 \x01(\x0b\x32#.sync_pb.AppListSpecifics.IconColor\x12\x1a\n\x12promise_package_id\x18\n \x01(\t\x1aX\n\tIconColor\x12>\n\x10\x62\x61\x63kground_color\x18\x01 \x01(\x0e\x32$.sync_pb.AppListSpecifics.ColorGroup\x12\x0b\n\x03hue\x18\x02 \x01(\x05\"y\n\x0f\x41ppListItemType\x12\x0c\n\x08TYPE_APP\x10\x01\x12\x1b\n\x17TYPE_REMOVE_DEFAULT_APP\x10\x02\x12\x0f\n\x0bTYPE_FOLDER\x10\x03\x12\x15\n\x11TYPE_OBSOLETE_URL\x10\x04\x12\x13\n\x0fTYPE_PAGE_BREAK\x10\x05\"\xa6\x01\n\nColorGroup\x12\x0f\n\x0b\x43OLOR_EMPTY\x10\x00\x12\x0f\n\x0b\x43OLOR_WHITE\x10\x01\x12\r\n\tCOLOR_RED\x10\x02\x12\x10\n\x0c\x43OLOR_ORANGE\x10\x03\x12\x10\n\x0c\x43OLOR_YELLOW\x10\x04\x12\x0f\n\x0b\x43OLOR_GREEN\x10\x05\x12\x0e\n\nCOLOR_BLUE\x10\x06\x12\x11\n\rCOLOR_MAGENTA\x10\x07\x12\x0f\n\x0b\x43OLOR_BLACK\x10\x08J\x04\x08\t\x10\nB+\n%org.chromium.components.sync.protocolH\x03P\x01')
|
|
17
|
+
|
|
18
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
19
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'components.sync.protocol.app_list_specifics_pb2', globals())
|
|
20
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
21
|
+
|
|
22
|
+
DESCRIPTOR._options = None
|
|
23
|
+
DESCRIPTOR._serialized_options = b'\n%org.chromium.components.sync.protocolH\003P\001'
|
|
24
|
+
_APPLISTSPECIFICS.fields_by_name['OBSOLETE_page_ordinal']._options = None
|
|
25
|
+
_APPLISTSPECIFICS.fields_by_name['OBSOLETE_page_ordinal']._serialized_options = b'\030\001'
|
|
26
|
+
_APPLISTSPECIFICS._serialized_start=63
|
|
27
|
+
_APPLISTSPECIFICS._serialized_end=754
|
|
28
|
+
_APPLISTSPECIFICS_ICONCOLOR._serialized_start=368
|
|
29
|
+
_APPLISTSPECIFICS_ICONCOLOR._serialized_end=456
|
|
30
|
+
_APPLISTSPECIFICS_APPLISTITEMTYPE._serialized_start=458
|
|
31
|
+
_APPLISTSPECIFICS_APPLISTITEMTYPE._serialized_end=579
|
|
32
|
+
_APPLISTSPECIFICS_COLORGROUP._serialized_start=582
|
|
33
|
+
_APPLISTSPECIFICS_COLORGROUP._serialized_end=748
|
|
34
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: components/sync/protocol/app_setting_specifics.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf.internal import builder as _builder
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
from chromesync._proto.components.sync.protocol import extension_setting_specifics_pb2 as components_dot_sync_dot_protocol_dot_extension__setting__specifics__pb2
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n4components/sync/protocol/app_setting_specifics.proto\x12\x07sync_pb\x1a:components/sync/protocol/extension_setting_specifics.proto\"T\n\x13\x41ppSettingSpecifics\x12=\n\x11\x65xtension_setting\x18\x01 \x01(\x0b\x32\".sync_pb.ExtensionSettingSpecificsB+\n%org.chromium.components.sync.protocolH\x03P\x01')
|
|
18
|
+
|
|
19
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
20
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'components.sync.protocol.app_setting_specifics_pb2', globals())
|
|
21
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
22
|
+
|
|
23
|
+
DESCRIPTOR._options = None
|
|
24
|
+
DESCRIPTOR._serialized_options = b'\n%org.chromium.components.sync.protocolH\003P\001'
|
|
25
|
+
_APPSETTINGSPECIFICS._serialized_start=125
|
|
26
|
+
_APPSETTINGSPECIFICS._serialized_end=209
|
|
27
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: components/sync/protocol/app_specifics.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf.internal import builder as _builder
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
from chromesync._proto.components.sync.protocol import extension_specifics_pb2 as components_dot_sync_dot_protocol_dot_extension__specifics__pb2
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n,components/sync/protocol/app_specifics.proto\x12\x07sync_pb\x1a\x32\x63omponents/sync/protocol/extension_specifics.proto\"d\n\x17\x41ppNotificationSettings\x12\x1e\n\x12initial_setup_done\x18\x01 \x01(\x08\x42\x02\x18\x01\x12\x10\n\x08\x64isabled\x18\x02 \x01(\x08\x12\x17\n\x0foauth_client_id\x18\x03 \x01(\t\".\n\x11LinkedAppIconInfo\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x0c\n\x04size\x18\x02 \x01(\r\"\x90\x04\n\x0c\x41ppSpecifics\x12.\n\textension\x18\x01 \x01(\x0b\x32\x1b.sync_pb.ExtensionSpecifics\x12?\n\x15notification_settings\x18\x02 \x01(\x0b\x32 .sync_pb.AppNotificationSettings\x12\x1a\n\x12\x61pp_launch_ordinal\x18\x03 \x01(\t\x12\x14\n\x0cpage_ordinal\x18\x04 \x01(\t\x12\x35\n\x0blaunch_type\x18\x05 \x01(\x0e\x32 .sync_pb.AppSpecifics.LaunchType\x12\x1c\n\x10\x62ookmark_app_url\x18\x06 \x01(\tB\x02\x18\x01\x12$\n\x18\x62ookmark_app_description\x18\x07 \x01(\tB\x02\x18\x01\x12#\n\x17\x62ookmark_app_icon_color\x18\x08 \x01(\tB\x02\x18\x01\x12\x34\n\x10linked_app_icons\x18\t \x03(\x0b\x32\x1a.sync_pb.LinkedAppIconInfo\x12\x1e\n\x12\x62ookmark_app_scope\x18\n \x01(\tB\x02\x18\x01\x12$\n\x18\x62ookmark_app_theme_color\x18\x0b \x01(\rB\x02\x18\x01\"A\n\nLaunchType\x12\n\n\x06PINNED\x10\x00\x12\x0b\n\x07REGULAR\x10\x01\x12\x0e\n\nFULLSCREEN\x10\x02\x12\n\n\x06WINDOW\x10\x03\x42+\n%org.chromium.components.sync.protocolH\x03P\x01')
|
|
18
|
+
|
|
19
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
20
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'components.sync.protocol.app_specifics_pb2', globals())
|
|
21
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
22
|
+
|
|
23
|
+
DESCRIPTOR._options = None
|
|
24
|
+
DESCRIPTOR._serialized_options = b'\n%org.chromium.components.sync.protocolH\003P\001'
|
|
25
|
+
_APPNOTIFICATIONSETTINGS.fields_by_name['initial_setup_done']._options = None
|
|
26
|
+
_APPNOTIFICATIONSETTINGS.fields_by_name['initial_setup_done']._serialized_options = b'\030\001'
|
|
27
|
+
_APPSPECIFICS.fields_by_name['bookmark_app_url']._options = None
|
|
28
|
+
_APPSPECIFICS.fields_by_name['bookmark_app_url']._serialized_options = b'\030\001'
|
|
29
|
+
_APPSPECIFICS.fields_by_name['bookmark_app_description']._options = None
|
|
30
|
+
_APPSPECIFICS.fields_by_name['bookmark_app_description']._serialized_options = b'\030\001'
|
|
31
|
+
_APPSPECIFICS.fields_by_name['bookmark_app_icon_color']._options = None
|
|
32
|
+
_APPSPECIFICS.fields_by_name['bookmark_app_icon_color']._serialized_options = b'\030\001'
|
|
33
|
+
_APPSPECIFICS.fields_by_name['bookmark_app_scope']._options = None
|
|
34
|
+
_APPSPECIFICS.fields_by_name['bookmark_app_scope']._serialized_options = b'\030\001'
|
|
35
|
+
_APPSPECIFICS.fields_by_name['bookmark_app_theme_color']._options = None
|
|
36
|
+
_APPSPECIFICS.fields_by_name['bookmark_app_theme_color']._serialized_options = b'\030\001'
|
|
37
|
+
_APPNOTIFICATIONSETTINGS._serialized_start=109
|
|
38
|
+
_APPNOTIFICATIONSETTINGS._serialized_end=209
|
|
39
|
+
_LINKEDAPPICONINFO._serialized_start=211
|
|
40
|
+
_LINKEDAPPICONINFO._serialized_end=257
|
|
41
|
+
_APPSPECIFICS._serialized_start=260
|
|
42
|
+
_APPSPECIFICS._serialized_end=788
|
|
43
|
+
_APPSPECIFICS_LAUNCHTYPE._serialized_start=723
|
|
44
|
+
_APPSPECIFICS_LAUNCHTYPE._serialized_end=788
|
|
45
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: components/sync/protocol/arc_package_specifics.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf.internal import builder as _builder
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n4components/sync/protocol/arc_package_specifics.proto\x12\x07sync_pb\"~\n\x13\x41rcPackageSpecifics\x12\x14\n\x0cpackage_name\x18\x01 \x01(\t\x12\x17\n\x0fpackage_version\x18\x02 \x01(\x05\x12\x1e\n\x16last_backup_android_id\x18\x03 \x01(\x03\x12\x18\n\x10last_backup_time\x18\x04 \x01(\x03\x42+\n%org.chromium.components.sync.protocolH\x03P\x01')
|
|
17
|
+
|
|
18
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
19
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'components.sync.protocol.arc_package_specifics_pb2', globals())
|
|
20
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
21
|
+
|
|
22
|
+
DESCRIPTOR._options = None
|
|
23
|
+
DESCRIPTOR._serialized_options = b'\n%org.chromium.components.sync.protocolH\003P\001'
|
|
24
|
+
_ARCPACKAGESPECIFICS._serialized_start=65
|
|
25
|
+
_ARCPACKAGESPECIFICS._serialized_end=191
|
|
26
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: components/sync/protocol/attachment.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf.internal import builder as _builder
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n)components/sync/protocol/attachment.proto\x12\x07sync_pb\"T\n\nAttachment\x12\x19\n\x11temporary_blob_id\x18\x01 \x01(\t\x12+\n#modification_time_unix_epoch_millis\x18\x02 \x01(\x03\x42+\n%org.chromium.components.sync.protocolH\x03P\x01')
|
|
17
|
+
|
|
18
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
19
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'components.sync.protocol.attachment_pb2', globals())
|
|
20
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
21
|
+
|
|
22
|
+
DESCRIPTOR._options = None
|
|
23
|
+
DESCRIPTOR._serialized_options = b'\n%org.chromium.components.sync.protocolH\003P\001'
|
|
24
|
+
_ATTACHMENT._serialized_start=54
|
|
25
|
+
_ATTACHMENT._serialized_end=138
|
|
26
|
+
# @@protoc_insertion_point(module_scope)
|