1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

refactor(core): convert if/elif chains to if-chains

This way AST parsers won't get stack exceeded (because an elif counts as
an else { if {}} to an AST parser apparently?) and so automated tools
will like tokens.py and friends.
This commit is contained in:
matejcik 2021-12-08 10:16:19 +01:00 committed by matejcik
parent c3f2db3be5
commit dec89ea59e
9 changed files with 2020 additions and 2069 deletions

View File

@ -90,9 +90,7 @@ class CoinInfo:
# fmt: off # fmt: off
def by_name(name: str) -> CoinInfo: def by_name(name: str) -> CoinInfo:
if False: if name == "Bitcoin":
pass
elif name == "Bitcoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="BTC", coin_shortcut="BTC",
@ -121,7 +119,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Regtest": if name == "Regtest":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="REGTEST", coin_shortcut="REGTEST",
@ -150,7 +148,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Testnet": if name == "Testnet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="TEST", coin_shortcut="TEST",
@ -180,9 +178,7 @@ def by_name(name: str) -> CoinInfo:
confidential_assets=None, confidential_assets=None,
) )
if not utils.BITCOIN_ONLY: if not utils.BITCOIN_ONLY:
if False: if name == "Actinium":
pass
elif name == "Actinium":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="ACM", coin_shortcut="ACM",
@ -211,7 +207,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Axe": if name == "Axe":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="AXE", coin_shortcut="AXE",
@ -240,7 +236,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Bcash": if name == "Bcash":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="BCH", coin_shortcut="BCH",
@ -269,7 +265,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Bcash Testnet": if name == "Bcash Testnet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="TBCH", coin_shortcut="TBCH",
@ -298,7 +294,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Bgold": if name == "Bgold":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="BTG", coin_shortcut="BTG",
@ -327,7 +323,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Bgold Testnet": if name == "Bgold Testnet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="TBTG", coin_shortcut="TBTG",
@ -356,7 +352,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Bprivate": if name == "Bprivate":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="BTCP", coin_shortcut="BTCP",
@ -385,7 +381,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Bitcore": if name == "Bitcore":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="BTX", coin_shortcut="BTX",
@ -414,7 +410,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "CPUchain": if name == "CPUchain":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="CPU", coin_shortcut="CPU",
@ -443,7 +439,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Crown": if name == "Crown":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="CRW", coin_shortcut="CRW",
@ -472,7 +468,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Dash": if name == "Dash":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="DASH", coin_shortcut="DASH",
@ -501,7 +497,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Dash Testnet": if name == "Dash Testnet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="tDASH", coin_shortcut="tDASH",
@ -530,7 +526,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Decred": if name == "Decred":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="DCR", coin_shortcut="DCR",
@ -559,7 +555,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Decred Testnet": if name == "Decred Testnet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="TDCR", coin_shortcut="TDCR",
@ -588,7 +584,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "DigiByte": if name == "DigiByte":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="DGB", coin_shortcut="DGB",
@ -617,7 +613,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Dogecoin": if name == "Dogecoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="DOGE", coin_shortcut="DOGE",
@ -646,7 +642,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Elements": if name == "Elements":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="ELEMENTS", coin_shortcut="ELEMENTS",
@ -675,7 +671,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets={'address_prefix': 4, 'blech32_prefix': 'el'}, confidential_assets={'address_prefix': 4, 'blech32_prefix': 'el'},
) )
elif name == "Feathercoin": if name == "Feathercoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="FTC", coin_shortcut="FTC",
@ -704,7 +700,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Firo": if name == "Firo":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="FIRO", coin_shortcut="FIRO",
@ -733,7 +729,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Firo Testnet": if name == "Firo Testnet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="tFIRO", coin_shortcut="tFIRO",
@ -762,7 +758,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Florincoin": if name == "Florincoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="FLO", coin_shortcut="FLO",
@ -791,7 +787,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Fujicoin": if name == "Fujicoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="FJC", coin_shortcut="FJC",
@ -820,7 +816,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "GameCredits": if name == "GameCredits":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="GAME", coin_shortcut="GAME",
@ -849,7 +845,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Groestlcoin": if name == "Groestlcoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="GRS", coin_shortcut="GRS",
@ -878,7 +874,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Groestlcoin Testnet": if name == "Groestlcoin Testnet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="tGRS", coin_shortcut="tGRS",
@ -907,7 +903,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Komodo": if name == "Komodo":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="KMD", coin_shortcut="KMD",
@ -936,7 +932,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=True, overwintered=True,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Koto": if name == "Koto":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="KOTO", coin_shortcut="KOTO",
@ -965,7 +961,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=True, overwintered=True,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Litecoin": if name == "Litecoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="LTC", coin_shortcut="LTC",
@ -994,7 +990,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Litecoin Testnet": if name == "Litecoin Testnet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="tLTC", coin_shortcut="tLTC",
@ -1023,7 +1019,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Monacoin": if name == "Monacoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="MONA", coin_shortcut="MONA",
@ -1052,7 +1048,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "MonetaryUnit": if name == "MonetaryUnit":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="MUE", coin_shortcut="MUE",
@ -1081,7 +1077,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "NIX": if name == "NIX":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="NIX", coin_shortcut="NIX",
@ -1110,7 +1106,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Namecoin": if name == "Namecoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="NMC", coin_shortcut="NMC",
@ -1139,7 +1135,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Peercoin": if name == "Peercoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="PPC", coin_shortcut="PPC",
@ -1168,7 +1164,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Peercoin Testnet": if name == "Peercoin Testnet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="tPPC", coin_shortcut="tPPC",
@ -1197,7 +1193,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Polis": if name == "Polis":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="POLIS", coin_shortcut="POLIS",
@ -1226,7 +1222,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Primecoin": if name == "Primecoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="XPM", coin_shortcut="XPM",
@ -1255,7 +1251,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Qtum": if name == "Qtum":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="QTUM", coin_shortcut="QTUM",
@ -1284,7 +1280,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Qtum Testnet": if name == "Qtum Testnet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="tQTUM", coin_shortcut="tQTUM",
@ -1313,7 +1309,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Ravencoin": if name == "Ravencoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="RVN", coin_shortcut="RVN",
@ -1342,7 +1338,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Ravencoin Testnet": if name == "Ravencoin Testnet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="tRVN", coin_shortcut="tRVN",
@ -1371,7 +1367,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Ritocoin": if name == "Ritocoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="RITO", coin_shortcut="RITO",
@ -1400,7 +1396,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "SmartCash": if name == "SmartCash":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="SMART", coin_shortcut="SMART",
@ -1429,7 +1425,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "SmartCash Testnet": if name == "SmartCash Testnet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="tSMART", coin_shortcut="tSMART",
@ -1458,7 +1454,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Stakenet": if name == "Stakenet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="XSN", coin_shortcut="XSN",
@ -1487,7 +1483,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Syscoin": if name == "Syscoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="SYS", coin_shortcut="SYS",
@ -1516,7 +1512,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Unobtanium": if name == "Unobtanium":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="UNO", coin_shortcut="UNO",
@ -1545,7 +1541,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "VIPSTARCOIN": if name == "VIPSTARCOIN":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="VIPS", coin_shortcut="VIPS",
@ -1574,7 +1570,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Verge": if name == "Verge":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="XVG", coin_shortcut="XVG",
@ -1603,7 +1599,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Vertcoin": if name == "Vertcoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="VTC", coin_shortcut="VTC",
@ -1632,7 +1628,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Viacoin": if name == "Viacoin":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="VIA", coin_shortcut="VIA",
@ -1661,7 +1657,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "ZCore": if name == "ZCore":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="ZCR", coin_shortcut="ZCR",
@ -1690,7 +1686,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=False, overwintered=False,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Zcash": if name == "Zcash":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="ZEC", coin_shortcut="ZEC",
@ -1719,7 +1715,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=True, overwintered=True,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Zcash Testnet": if name == "Zcash Testnet":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="TAZ", coin_shortcut="TAZ",
@ -1748,7 +1744,7 @@ def by_name(name: str) -> CoinInfo:
overwintered=True, overwintered=True,
confidential_assets=None, confidential_assets=None,
) )
elif name == "Brhodium": if name == "Brhodium":
return CoinInfo( return CoinInfo(
coin_name=name, coin_name=name,
coin_shortcut="XRC", coin_shortcut="XRC",

View File

@ -140,10 +140,8 @@ for c in coins_btc + coins_alt:
%>\ %>\
def by_name(name: str) -> CoinInfo: def by_name(name: str) -> CoinInfo:
if False:
pass
% for coin in coins_btc: % for coin in coins_btc:
elif name == ${black_repr(coin["coin_name"])}: if name == ${black_repr(coin["coin_name"])}:
return CoinInfo( return CoinInfo(
% for attr, func in ATTRIBUTES: % for attr, func in ATTRIBUTES:
${attr}=${func(coin[attr])}, ${attr}=${func(coin[attr])},
@ -151,10 +149,8 @@ def by_name(name: str) -> CoinInfo:
) )
% endfor % endfor
if not utils.BITCOIN_ONLY: if not utils.BITCOIN_ONLY:
if False:
pass
% for coin in coins_alt: % for coin in coins_alt:
elif name == ${black_repr(coin["coin_name"])}: if name == ${black_repr(coin["coin_name"])}:
return CoinInfo( return CoinInfo(
% for attr, func in ATTRIBUTES: % for attr, func in ATTRIBUTES:
${attr}=${func(coin[attr])}, ${attr}=${func(coin[attr])},

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,5 @@
# generated from tokens.py.mako # generated from tokens.py.mako
# do not edit manually! # do not edit manually!
# flake8: noqa
# fmt: off # fmt: off
<% <%
from collections import defaultdict from collections import defaultdict
@ -12,24 +11,20 @@ def group_tokens(tokens):
return r return r
%>\ %>\
class TokenInfo: class TokenInfo:
def __init__(self, symbol: str, decimals: int) -> None: def __init__(self, symbol: str, decimals: int) -> None:
self.symbol = symbol self.symbol = symbol
self.decimals = decimals self.decimals = decimals
UNKNOWN_TOKEN = TokenInfo("Wei UNKN", 0) UNKNOWN_TOKEN = TokenInfo("Wei UNKN", 0)
def token_by_chain_address(chain_id: int, address: bytes) -> TokenInfo: def token_by_chain_address(chain_id: int, address: bytes) -> TokenInfo:
if False:
pass
% for token_chain_id, tokens in group_tokens(supported_on("trezor2", erc20)).items(): % for token_chain_id, tokens in group_tokens(supported_on("trezor2", erc20)).items():
elif chain_id == ${token_chain_id}: if chain_id == ${token_chain_id}:
if False:
pass
% for t in tokens: % for t in tokens:
elif address == ${black_repr(t.address_bytes)}: if address == ${black_repr(t.address_bytes)}:
return TokenInfo(${black_repr(t.symbol)}, ${t.decimals}) # ${t.chain} / ${t.name.strip()} return TokenInfo(${black_repr(t.symbol)}, ${t.decimals}) # ${t.chain} / ${t.name.strip()}
% endfor % endfor
% endfor % endfor

View File

@ -1,6 +1,5 @@
# generated from knownapps.py.mako # generated from knownapps.py.mako
# do not edit manually! # do not edit manually!
# flake8: noqa
class FIDOApp: class FIDOApp:
@ -19,9 +18,7 @@ class FIDOApp:
# fmt: off # fmt: off
def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None: def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
if False: if rp_id_hash == b"\x96\x89\x78\xa2\x99\x53\xde\x52\xd3\xef\x0f\x0c\x71\xb7\xb7\xb6\xb1\xaf\x9f\x08\xe2\x57\x89\x6a\x8d\x81\x26\x91\x85\x30\x29\x3b":
raise RuntimeError # if false
elif rp_id_hash == b"\x96\x89\x78\xa2\x99\x53\xde\x52\xd3\xef\x0f\x0c\x71\xb7\xb7\xb6\xb1\xaf\x9f\x08\xe2\x57\x89\x6a\x8d\x81\x26\x91\x85\x30\x29\x3b":
# U2F key for Amazon Web Services # U2F key for Amazon Web Services
return FIDOApp( return FIDOApp(
label="aws.amazon.com", label="aws.amazon.com",
@ -29,7 +26,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xc3\x40\x8c\x04\x47\x88\xae\xa5\xb3\xdf\x30\x89\x52\xfd\x8c\xa3\xc7\x0e\x21\xfe\xf4\xf6\xc1\xc2\x37\x4c\xaa\x1d\xf9\xb2\x8d\xdd": if rp_id_hash == b"\xc3\x40\x8c\x04\x47\x88\xae\xa5\xb3\xdf\x30\x89\x52\xfd\x8c\xa3\xc7\x0e\x21\xfe\xf4\xf6\xc1\xc2\x37\x4c\xaa\x1d\xf9\xb2\x8d\xdd":
# WebAuthn key for Binance # WebAuthn key for Binance
return FIDOApp( return FIDOApp(
label="www.binance.com", label="www.binance.com",
@ -37,7 +34,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=False, use_sign_count=False,
use_self_attestation=True, use_self_attestation=True,
) )
elif rp_id_hash == b"\x20\xf6\x61\xb1\x94\x0c\x34\x70\xac\x54\xfa\x2e\xb4\x99\x90\xfd\x33\xb5\x6d\xe8\xde\x60\x18\x70\xff\x02\xa8\x06\x0f\x3b\x7c\x58": if rp_id_hash == b"\x20\xf6\x61\xb1\x94\x0c\x34\x70\xac\x54\xfa\x2e\xb4\x99\x90\xfd\x33\xb5\x6d\xe8\xde\x60\x18\x70\xff\x02\xa8\x06\x0f\x3b\x7c\x58":
# WebAuthn key for Binance # WebAuthn key for Binance
return FIDOApp( return FIDOApp(
label="binance.com", label="binance.com",
@ -45,7 +42,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=False, use_sign_count=False,
use_self_attestation=True, use_self_attestation=True,
) )
elif rp_id_hash == b"\x12\x74\x3b\x92\x12\x97\xb7\x7f\x11\x35\xe4\x1f\xde\xdd\x4a\x84\x6a\xfe\x82\xe1\xf3\x69\x32\xa9\x91\x2f\x3b\x0d\x8d\xfb\x7d\x0e": if rp_id_hash == b"\x12\x74\x3b\x92\x12\x97\xb7\x7f\x11\x35\xe4\x1f\xde\xdd\x4a\x84\x6a\xfe\x82\xe1\xf3\x69\x32\xa9\x91\x2f\x3b\x0d\x8d\xfb\x7d\x0e":
# U2F key for Bitbucket # U2F key for Bitbucket
return FIDOApp( return FIDOApp(
label="bitbucket.org", label="bitbucket.org",
@ -53,7 +50,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x30\x2f\xd5\xb4\x49\x2a\x07\xb9\xfe\xbb\x30\xe7\x32\x69\xec\xa5\x01\x20\x5c\xcf\xe0\xc2\x0b\xf7\xb4\x72\xfa\x2d\x31\xe2\x1e\x63": if rp_id_hash == b"\x30\x2f\xd5\xb4\x49\x2a\x07\xb9\xfe\xbb\x30\xe7\x32\x69\xec\xa5\x01\x20\x5c\xcf\xe0\xc2\x0b\xf7\xb4\x72\xfa\x2d\x31\xe2\x1e\x63":
# U2F key for Bitfinex # U2F key for Bitfinex
return FIDOApp( return FIDOApp(
label="www.bitfinex.com", label="www.bitfinex.com",
@ -61,7 +58,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xa3\x4d\x30\x9f\xfa\x28\xc1\x24\x14\xb8\xba\x6c\x07\xee\x1e\xfa\xe1\xa8\x5e\x8a\x04\x61\x48\x59\xa6\x7c\x04\x93\xb6\x95\x61\x90": if rp_id_hash == b"\xa3\x4d\x30\x9f\xfa\x28\xc1\x24\x14\xb8\xba\x6c\x07\xee\x1e\xfa\xe1\xa8\x5e\x8a\x04\x61\x48\x59\xa6\x7c\x04\x93\xb6\x95\x61\x90":
# U2F key for Bitwarden # U2F key for Bitwarden
return FIDOApp( return FIDOApp(
label="vault.bitwarden.com", label="vault.bitwarden.com",
@ -69,7 +66,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xe2\x7d\x61\xb4\xe9\x9d\xe0\xed\x98\x16\x3c\xb3\x8b\x7a\xf9\x33\xc6\x66\x5e\x55\x09\xe8\x49\x08\x37\x05\x58\x13\x77\x8e\x23\x6a": if rp_id_hash == b"\xe2\x7d\x61\xb4\xe9\x9d\xe0\xed\x98\x16\x3c\xb3\x8b\x7a\xf9\x33\xc6\x66\x5e\x55\x09\xe8\x49\x08\x37\x05\x58\x13\x77\x8e\x23\x6a":
# WebAuthn key for Coinbase # WebAuthn key for Coinbase
return FIDOApp( return FIDOApp(
label="coinbase.com", label="coinbase.com",
@ -77,7 +74,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x68\x20\x19\x15\xd7\x4c\xb4\x2a\xf5\xb3\xcc\x5c\x95\xb9\x55\x3e\x3e\x3a\x83\xb4\xd2\xa9\x3b\x45\xfb\xad\xaa\x84\x69\xff\x8e\x6e": if rp_id_hash == b"\x68\x20\x19\x15\xd7\x4c\xb4\x2a\xf5\xb3\xcc\x5c\x95\xb9\x55\x3e\x3e\x3a\x83\xb4\xd2\xa9\x3b\x45\xfb\xad\xaa\x84\x69\xff\x8e\x6e":
# U2F key for Dashlane # U2F key for Dashlane
return FIDOApp( return FIDOApp(
label="www.dashlane.com", label="www.dashlane.com",
@ -85,7 +82,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xc5\x0f\x8a\x7b\x70\x8e\x92\xf8\x2e\x7a\x50\xe2\xbd\xc5\x5d\x8f\xd9\x1a\x22\xfe\x6b\x29\xc0\xcd\xf7\x80\x55\x30\x84\x2a\xf5\x81": if rp_id_hash == b"\xc5\x0f\x8a\x7b\x70\x8e\x92\xf8\x2e\x7a\x50\xe2\xbd\xc5\x5d\x8f\xd9\x1a\x22\xfe\x6b\x29\xc0\xcd\xf7\x80\x55\x30\x84\x2a\xf5\x81":
# U2F key for Dropbox # U2F key for Dropbox
return FIDOApp( return FIDOApp(
label="www.dropbox.com", label="www.dropbox.com",
@ -93,7 +90,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=False, use_sign_count=False,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x82\xf4\xa8\xc9\x5f\xec\x94\xb2\x6b\xaf\x9e\x37\x25\x0e\x95\x63\xd9\xa3\x66\xc7\xbe\x26\x1c\xa4\xdd\x01\x01\xf4\xd5\xef\xcb\x83": if rp_id_hash == b"\x82\xf4\xa8\xc9\x5f\xec\x94\xb2\x6b\xaf\x9e\x37\x25\x0e\x95\x63\xd9\xa3\x66\xc7\xbe\x26\x1c\xa4\xdd\x01\x01\xf4\xd5\xef\xcb\x83":
# WebAuthn key for Dropbox # WebAuthn key for Dropbox
return FIDOApp( return FIDOApp(
label="www.dropbox.com", label="www.dropbox.com",
@ -101,7 +98,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=False, use_sign_count=False,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xf3\xe2\x04\x2f\x94\x60\x7d\xa0\xa9\xc1\xf3\xb9\x5e\x0d\x2f\x2b\xb2\xe0\x69\xc5\xbb\x4f\xa7\x64\xaf\xfa\x64\x7d\x84\x7b\x7e\xd6": if rp_id_hash == b"\xf3\xe2\x04\x2f\x94\x60\x7d\xa0\xa9\xc1\xf3\xb9\x5e\x0d\x2f\x2b\xb2\xe0\x69\xc5\xbb\x4f\xa7\x64\xaf\xfa\x64\x7d\x84\x7b\x7e\xd6":
# U2F key for Duo # U2F key for Duo
return FIDOApp( return FIDOApp(
label="duosecurity.com", label="duosecurity.com",
@ -109,7 +106,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x31\x19\x33\x28\xf8\xe2\x1d\xfb\x6c\x99\xf3\x22\xd2\x2d\x7b\x0b\x50\x87\x78\xe6\x4f\xfb\xba\x86\xe5\x22\x93\x37\x90\x31\xb8\x74": if rp_id_hash == b"\x31\x19\x33\x28\xf8\xe2\x1d\xfb\x6c\x99\xf3\x22\xd2\x2d\x7b\x0b\x50\x87\x78\xe6\x4f\xfb\xba\x86\xe5\x22\x93\x37\x90\x31\xb8\x74":
# WebAuthn key for Facebook # WebAuthn key for Facebook
return FIDOApp( return FIDOApp(
label="facebook.com", label="facebook.com",
@ -117,7 +114,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x69\x66\xab\xe3\x67\x4e\xa2\xf5\x30\x79\xeb\x71\x01\x97\x84\x8c\x9b\xe6\xf3\x63\x99\x2f\xd0\x29\xe9\x89\x84\x47\xcb\x9f\x00\x84": if rp_id_hash == b"\x69\x66\xab\xe3\x67\x4e\xa2\xf5\x30\x79\xeb\x71\x01\x97\x84\x8c\x9b\xe6\xf3\x63\x99\x2f\xd0\x29\xe9\x89\x84\x47\xcb\x9f\x00\x84":
# U2F key for FastMail # U2F key for FastMail
return FIDOApp( return FIDOApp(
label="www.fastmail.com", label="www.fastmail.com",
@ -125,7 +122,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x9d\x61\x44\x2f\x5c\xe1\x33\xbd\x46\x54\x4f\xc4\x2f\x0a\x6d\x54\xc0\xde\xb8\x88\x40\xca\xc2\xb6\xae\xfa\x65\x14\xf8\x93\x49\xe9": if rp_id_hash == b"\x9d\x61\x44\x2f\x5c\xe1\x33\xbd\x46\x54\x4f\xc4\x2f\x0a\x6d\x54\xc0\xde\xb8\x88\x40\xca\xc2\xb6\xae\xfa\x65\x14\xf8\x93\x49\xe9":
# U2F key for Fedora # U2F key for Fedora
return FIDOApp( return FIDOApp(
label="fedoraproject.org", label="fedoraproject.org",
@ -133,7 +130,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xa4\xe2\x2d\xca\xfe\xa7\xe9\x0e\x12\x89\x50\x11\x39\x89\xfc\x45\x97\x8d\xc9\xfb\x87\x76\x75\x60\x51\x6c\x1c\x69\xdf\xdf\xd1\x96": if rp_id_hash == b"\xa4\xe2\x2d\xca\xfe\xa7\xe9\x0e\x12\x89\x50\x11\x39\x89\xfc\x45\x97\x8d\xc9\xfb\x87\x76\x75\x60\x51\x6c\x1c\x69\xdf\xdf\xd1\x96":
# U2F key for Gandi # U2F key for Gandi
return FIDOApp( return FIDOApp(
label="gandi.net", label="gandi.net",
@ -141,7 +138,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=False, use_sign_count=False,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x54\xce\x65\x1e\xd7\x15\xb4\xaa\xa7\x55\xee\xce\xbd\x4e\xa0\x95\x08\x15\xb3\x34\xbd\x07\xd1\x09\x89\x3e\x96\x30\x18\xcd\xdb\xd9": if rp_id_hash == b"\x54\xce\x65\x1e\xd7\x15\xb4\xaa\xa7\x55\xee\xce\xbd\x4e\xa0\x95\x08\x15\xb3\x34\xbd\x07\xd1\x09\x89\x3e\x96\x30\x18\xcd\xdb\xd9":
# WebAuthn key for Gandi # WebAuthn key for Gandi
return FIDOApp( return FIDOApp(
label="gandi.net", label="gandi.net",
@ -149,7 +146,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=False, use_sign_count=False,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x86\x06\xc1\x68\xe5\x1f\xc1\x31\xe5\x46\xad\x57\xa1\x9f\x32\x97\xb1\x1e\x0e\x5c\xe8\x3e\x8e\x89\x31\xb2\x85\x08\x11\xcf\xa8\x81": if rp_id_hash == b"\x86\x06\xc1\x68\xe5\x1f\xc1\x31\xe5\x46\xad\x57\xa1\x9f\x32\x97\xb1\x1e\x0e\x5c\xe8\x3e\x8e\x89\x31\xb2\x85\x08\x11\xcf\xa8\x81":
# WebAuthn key for Gemini # WebAuthn key for Gemini
return FIDOApp( return FIDOApp(
label="gemini.com", label="gemini.com",
@ -157,7 +154,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=False, use_sign_count=False,
use_self_attestation=True, use_self_attestation=True,
) )
elif rp_id_hash == b"\x70\x61\x7d\xfe\xd0\x65\x86\x3a\xf4\x7c\x15\x55\x6c\x91\x79\x88\x80\x82\x8c\xc4\x07\xfd\xf7\x0a\xe8\x50\x11\x56\x94\x65\xa0\x75": if rp_id_hash == b"\x70\x61\x7d\xfe\xd0\x65\x86\x3a\xf4\x7c\x15\x55\x6c\x91\x79\x88\x80\x82\x8c\xc4\x07\xfd\xf7\x0a\xe8\x50\x11\x56\x94\x65\xa0\x75":
# U2F key for GitHub # U2F key for GitHub
return FIDOApp( return FIDOApp(
label="github.com", label="github.com",
@ -165,7 +162,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=True, use_sign_count=True,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x3a\xeb\x00\x24\x60\x38\x1c\x6f\x25\x8e\x83\x95\xd3\x02\x6f\x57\x1f\x0d\x9a\x76\x48\x8d\xcd\x83\x76\x39\xb1\x3a\xed\x31\x65\x60": if rp_id_hash == b"\x3a\xeb\x00\x24\x60\x38\x1c\x6f\x25\x8e\x83\x95\xd3\x02\x6f\x57\x1f\x0d\x9a\x76\x48\x8d\xcd\x83\x76\x39\xb1\x3a\xed\x31\x65\x60":
# WebAuthn key for GitHub # WebAuthn key for GitHub
return FIDOApp( return FIDOApp(
label="github.com", label="github.com",
@ -173,7 +170,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=True, use_sign_count=True,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xe7\xbe\x96\xa5\x1b\xd0\x19\x2a\x72\x84\x0d\x2e\x59\x09\xf7\x2b\xa8\x2a\x2f\xe9\x3f\xaa\x62\x4f\x03\x39\x6b\x30\xe4\x94\xc8\x04": if rp_id_hash == b"\xe7\xbe\x96\xa5\x1b\xd0\x19\x2a\x72\x84\x0d\x2e\x59\x09\xf7\x2b\xa8\x2a\x2f\xe9\x3f\xaa\x62\x4f\x03\x39\x6b\x30\xe4\x94\xc8\x04":
# U2F key for GitLab # U2F key for GitLab
return FIDOApp( return FIDOApp(
label="gitlab.com", label="gitlab.com",
@ -181,7 +178,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xa5\x46\x72\xb2\x22\xc4\xcf\x95\xe1\x51\xed\x8d\x4d\x3c\x76\x7a\x6c\xc3\x49\x43\x59\x43\x79\x4e\x88\x4f\x3d\x02\x3a\x82\x29\xfd": if rp_id_hash == b"\xa5\x46\x72\xb2\x22\xc4\xcf\x95\xe1\x51\xed\x8d\x4d\x3c\x76\x7a\x6c\xc3\x49\x43\x59\x43\x79\x4e\x88\x4f\x3d\x02\x3a\x82\x29\xfd":
# U2F key for Google # U2F key for Google
return FIDOApp( return FIDOApp(
label="google.com", label="google.com",
@ -189,7 +186,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xd4\xc9\xd9\x02\x73\x26\x27\x1a\x89\xce\x51\xfc\xaf\x32\x8e\xd6\x73\xf1\x7b\xe3\x34\x69\xff\x97\x9e\x8a\xb8\xdd\x50\x1e\x66\x4f": if rp_id_hash == b"\xd4\xc9\xd9\x02\x73\x26\x27\x1a\x89\xce\x51\xfc\xaf\x32\x8e\xd6\x73\xf1\x7b\xe3\x34\x69\xff\x97\x9e\x8a\xb8\xdd\x50\x1e\x66\x4f":
# WebAuthn key for Google # WebAuthn key for Google
return FIDOApp( return FIDOApp(
label="google.com", label="google.com",
@ -197,7 +194,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x53\xa1\x5b\xa4\x2a\x7c\x03\x25\xb8\xdb\xee\x28\x96\x34\xa4\x8f\x58\xae\xa3\x24\x66\x45\xd5\xff\x41\x8f\x9b\xb8\x81\x98\x85\xa9": if rp_id_hash == b"\x53\xa1\x5b\xa4\x2a\x7c\x03\x25\xb8\xdb\xee\x28\x96\x34\xa4\x8f\x58\xae\xa3\x24\x66\x45\xd5\xff\x41\x8f\x9b\xb8\x81\x98\x85\xa9":
# U2F key for Keeper # U2F key for Keeper
return FIDOApp( return FIDOApp(
label="keepersecurity.com", label="keepersecurity.com",
@ -205,7 +202,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xd6\x5f\x00\x5e\xf4\xde\xa9\x32\x0c\x99\x73\x05\x3c\x95\xff\x60\x20\x11\x5d\x5f\xec\x1b\x7f\xee\x41\xa5\x78\xe1\x8d\xf9\xca\x8c": if rp_id_hash == b"\xd6\x5f\x00\x5e\xf4\xde\xa9\x32\x0c\x99\x73\x05\x3c\x95\xff\x60\x20\x11\x5d\x5f\xec\x1b\x7f\xee\x41\xa5\x78\xe1\x8d\xf9\xca\x8c":
# U2F key for Keeper # U2F key for Keeper
return FIDOApp( return FIDOApp(
label="keepersecurity.eu", label="keepersecurity.eu",
@ -213,7 +210,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xf8\x3f\xc3\xa1\xb2\x89\xa0\xde\xc5\xc1\xc8\xaa\x07\xe9\xb5\xdd\x9c\xbb\x76\xf6\xb2\xf5\x60\x60\x17\x66\x72\x68\xe5\xb9\xc4\x5e": if rp_id_hash == b"\xf8\x3f\xc3\xa1\xb2\x89\xa0\xde\xc5\xc1\xc8\xaa\x07\xe9\xb5\xdd\x9c\xbb\x76\xf6\xb2\xf5\x60\x60\x17\x66\x72\x68\xe5\xb9\xc4\x5e":
# WebAuthn key for login.gov # WebAuthn key for login.gov
return FIDOApp( return FIDOApp(
label="secure.login.gov", label="secure.login.gov",
@ -221,7 +218,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=False, use_sign_count=False,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x35\x6c\x9e\xd4\xa0\x93\x21\xb9\x69\x5f\x1e\xaf\x91\x82\x03\xf1\xb5\x5f\x68\x9d\xa6\x1f\xbc\x96\x18\x4c\x15\x7d\xda\x68\x0c\x81": if rp_id_hash == b"\x35\x6c\x9e\xd4\xa0\x93\x21\xb9\x69\x5f\x1e\xaf\x91\x82\x03\xf1\xb5\x5f\x68\x9d\xa6\x1f\xbc\x96\x18\x4c\x15\x7d\xda\x68\x0c\x81":
# WebAuthn key for Microsoft # WebAuthn key for Microsoft
return FIDOApp( return FIDOApp(
label="login.microsoft.com", label="login.microsoft.com",
@ -229,7 +226,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=False, use_sign_count=False,
use_self_attestation=False, use_self_attestation=False,
) )
elif rp_id_hash == b"\xab\x2d\xaf\x07\x43\xde\x78\x2a\x70\x18\x9a\x0f\x5e\xfc\x30\x90\x2f\x92\x5b\x9f\x9a\x18\xc5\xd7\x14\x1b\x7b\x12\xf8\xa0\x10\x0c": if rp_id_hash == b"\xab\x2d\xaf\x07\x43\xde\x78\x2a\x70\x18\x9a\x0f\x5e\xfc\x30\x90\x2f\x92\x5b\x9f\x9a\x18\xc5\xd7\x14\x1b\x7b\x12\xf8\xa0\x10\x0c":
# WebAuthn key for mojeID # WebAuthn key for mojeID
return FIDOApp( return FIDOApp(
label="mojeid.cz", label="mojeid.cz",
@ -237,7 +234,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x85\x71\x01\x36\x1b\x20\xa9\x54\x4c\xdb\x9b\xef\x65\x85\x8b\x6b\xac\x70\x13\x55\x0d\x8f\x84\xf7\xef\xee\x25\x2b\x96\xfa\x7c\x1e": if rp_id_hash == b"\x85\x71\x01\x36\x1b\x20\xa9\x54\x4c\xdb\x9b\xef\x65\x85\x8b\x6b\xac\x70\x13\x55\x0d\x8f\x84\xf7\xef\xee\x25\x2b\x96\xfa\x7c\x1e":
# WebAuthn key for Namecheap # WebAuthn key for Namecheap
return FIDOApp( return FIDOApp(
label="www.namecheap.com", label="www.namecheap.com",
@ -245,7 +242,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x08\xb2\xa3\xd4\x19\x39\xaa\x31\x66\x84\x93\xcb\x36\xcd\xcc\x4f\x16\xc4\xd9\xb4\xc8\x23\x8b\x73\xc2\xf6\x72\xc0\x33\x00\x71\x97": if rp_id_hash == b"\x08\xb2\xa3\xd4\x19\x39\xaa\x31\x66\x84\x93\xcb\x36\xcd\xcc\x4f\x16\xc4\xd9\xb4\xc8\x23\x8b\x73\xc2\xf6\x72\xc0\x33\x00\x71\x97":
# U2F key for Slush Pool # U2F key for Slush Pool
return FIDOApp( return FIDOApp(
label="slushpool.com", label="slushpool.com",
@ -253,7 +250,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x38\x80\x4f\x2e\xff\x74\xf2\x28\xb7\x41\x51\xc2\x01\xaa\x82\xe7\xe8\xee\xfc\xac\xfe\xcf\x23\xfa\x14\x6b\x13\xa3\x76\x66\x31\x4f": if rp_id_hash == b"\x38\x80\x4f\x2e\xff\x74\xf2\x28\xb7\x41\x51\xc2\x01\xaa\x82\xe7\xe8\xee\xfc\xac\xfe\xcf\x23\xfa\x14\x6b\x13\xa3\x76\x66\x31\x4f":
# U2F key for Slush Pool # U2F key for Slush Pool
return FIDOApp( return FIDOApp(
label="slushpool.com", label="slushpool.com",
@ -261,7 +258,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x2a\xc6\xad\x09\xa6\xd0\x77\x2c\x44\xda\x73\xa6\x07\x2f\x9d\x24\x0f\xc6\x85\x4a\x70\xd7\x9c\x10\x24\xff\x7c\x75\x59\x59\x32\x92": if rp_id_hash == b"\x2a\xc6\xad\x09\xa6\xd0\x77\x2c\x44\xda\x73\xa6\x07\x2f\x9d\x24\x0f\xc6\x85\x4a\x70\xd7\x9c\x10\x24\xff\x7c\x75\x59\x59\x32\x92":
# U2F key for Stripe # U2F key for Stripe
return FIDOApp( return FIDOApp(
label="stripe.com", label="stripe.com",
@ -269,7 +266,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xfa\xbe\xec\xe3\x98\x2f\xad\x9d\xdc\xc9\x8f\x91\xbd\x2e\x75\xaf\xc7\xd1\xf4\xca\x54\x49\x29\xb2\xd0\xd0\x42\x12\xdf\xfa\x30\xfa": if rp_id_hash == b"\xfa\xbe\xec\xe3\x98\x2f\xad\x9d\xdc\xc9\x8f\x91\xbd\x2e\x75\xaf\xc7\xd1\xf4\xca\x54\x49\x29\xb2\xd0\xd0\x42\x12\xdf\xfa\x30\xfa":
# U2F key for Tutanota # U2F key for Tutanota
return FIDOApp( return FIDOApp(
label="tutanota.com", label="tutanota.com",
@ -277,7 +274,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x1b\x3c\x16\xdd\x2f\x7c\x46\xe2\xb4\xc2\x89\xdc\x16\x74\x6b\xcc\x60\xdf\xcf\x0f\xb8\x18\xe1\x32\x15\x52\x6e\x14\x08\xe7\xf4\x68": if rp_id_hash == b"\x1b\x3c\x16\xdd\x2f\x7c\x46\xe2\xb4\xc2\x89\xdc\x16\x74\x6b\xcc\x60\xdf\xcf\x0f\xb8\x18\xe1\x32\x15\x52\x6e\x14\x08\xe7\xf4\x68":
# U2F key for u2f.bin.coffee # U2F key for u2f.bin.coffee
return FIDOApp( return FIDOApp(
label="u2f.bin.coffee", label="u2f.bin.coffee",
@ -285,7 +282,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xa6\x42\xd2\x1b\x7c\x6d\x55\xe1\xce\x23\xc5\x39\x98\x28\xd2\xc7\x49\xbf\x6a\x6e\xf2\xfe\x03\xcc\x9e\x10\xcd\xf4\xed\x53\x08\x8b": if rp_id_hash == b"\xa6\x42\xd2\x1b\x7c\x6d\x55\xe1\xce\x23\xc5\x39\x98\x28\xd2\xc7\x49\xbf\x6a\x6e\xf2\xfe\x03\xcc\x9e\x10\xcd\xf4\xed\x53\x08\x8b":
# WebAuthn key for webauthn.bin.coffee # WebAuthn key for webauthn.bin.coffee
return FIDOApp( return FIDOApp(
label="webauthn.bin.coffee", label="webauthn.bin.coffee",
@ -293,7 +290,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\x74\xa6\xea\x92\x13\xc9\x9c\x2f\x74\xb2\x24\x92\xb3\x20\xcf\x40\x26\x2a\x94\xc1\xa9\x50\xa0\x39\x7f\x29\x25\x0b\x60\x84\x1e\xf0": if rp_id_hash == b"\x74\xa6\xea\x92\x13\xc9\x9c\x2f\x74\xb2\x24\x92\xb3\x20\xcf\x40\x26\x2a\x94\xc1\xa9\x50\xa0\x39\x7f\x29\x25\x0b\x60\x84\x1e\xf0":
# WebAuthn key for WebAuthn.io # WebAuthn key for WebAuthn.io
return FIDOApp( return FIDOApp(
label="webauthn.io", label="webauthn.io",
@ -301,7 +298,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xf9\x5b\xc7\x38\x28\xee\x21\x0f\x9f\xd3\xbb\xe7\x2d\x97\x90\x80\x13\xb0\xa3\x75\x9e\x9a\xea\x3d\x0a\xe3\x18\x76\x6c\xd2\xe1\xad": if rp_id_hash == b"\xf9\x5b\xc7\x38\x28\xee\x21\x0f\x9f\xd3\xbb\xe7\x2d\x97\x90\x80\x13\xb0\xa3\x75\x9e\x9a\xea\x3d\x0a\xe3\x18\x76\x6c\xd2\xe1\xad":
# WebAuthn key for WebAuthn.me # WebAuthn key for WebAuthn.me
return FIDOApp( return FIDOApp(
label="webauthn.me", label="webauthn.me",
@ -309,7 +306,7 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
elif rp_id_hash == b"\xc4\x6c\xef\x82\xad\x1b\x54\x64\x77\x59\x1d\x00\x8b\x08\x75\x9e\xc3\xe6\xd2\xec\xb4\xf3\x94\x74\xbf\xea\x69\x69\x92\x5d\x03\xb7": if rp_id_hash == b"\xc4\x6c\xef\x82\xad\x1b\x54\x64\x77\x59\x1d\x00\x8b\x08\x75\x9e\xc3\xe6\xd2\xec\xb4\xf3\x94\x74\xbf\xea\x69\x69\x92\x5d\x03\xb7":
# WebAuthn key for demo.yubico.com # WebAuthn key for demo.yubico.com
return FIDOApp( return FIDOApp(
label="demo.yubico.com", label="demo.yubico.com",
@ -317,5 +314,5 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_sign_count=None, use_sign_count=None,
use_self_attestation=None, use_self_attestation=None,
) )
else:
return None return None

View File

@ -1,6 +1,5 @@
# generated from knownapps.py.mako # generated from knownapps.py.mako
# do not edit manually! # do not edit manually!
# flake8: noqa
class FIDOApp: class FIDOApp:
@ -34,10 +33,8 @@ for app in fido:
%>\ %>\
# fmt: off # fmt: off
def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None: def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
if False:
raise RuntimeError # if false
% for label, rp_id_hash, type, app in fido_entries: % for label, rp_id_hash, type, app in fido_entries:
elif rp_id_hash == ${black_repr(rp_id_hash)}: if rp_id_hash == ${black_repr(rp_id_hash)}:
# ${type} key for ${app.name} # ${type} key for ${app.name}
return FIDOApp( return FIDOApp(
label=${black_repr(label)}, label=${black_repr(label)},
@ -46,5 +43,5 @@ def by_rp_id_hash(rp_id_hash: bytes) -> FIDOApp | None:
use_self_attestation=${black_repr(app.use_self_attestation)}, use_self_attestation=${black_repr(app.use_self_attestation)},
) )
% endfor % endfor
else:
return None return None

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,5 @@
# generated from resources.py.mako # generated from resources.py.mako
# do not edit manually! # do not edit manually!
# flake8: noqa
# fmt: off # fmt: off
<% <%
from pathlib import Path from pathlib import Path
@ -18,11 +17,9 @@ resfiles = chain.from_iterable(sorted(SRCDIR.glob(p)) for p in PATTERNS)
%>\ %>\
def load_resource(name: str) -> bytes: def load_resource(name: str) -> bytes:
if False:
raise RuntimeError
% for resfile in resfiles: % for resfile in resfiles:
elif name == "${resfile.relative_to(SRCDIR)}": if name == "${resfile.relative_to(SRCDIR)}":
return ${repr(resfile.read_bytes())} return ${repr(resfile.read_bytes())}
% endfor % endfor
else:
return bytes() return bytes()

View File

@ -57,16 +57,13 @@ python_version = 3.10
[pylint.MASTER] [pylint.MASTER]
ignore-paths= ignore-paths=
./core/src/all_modules.py, ./core/src/all_modules.py,
./core/src/apps/ethereum/tokens.py,
./core/src/trezor/res/resources.py, ./core/src/trezor/res/resources.py,
./core/src/trezor/messages.py, ./core/src/trezor/messages.py,
./core/src/trezor/enums, ./core/src/trezor/enums,
./crypto, ./crypto,
./legacy, ./legacy,
./storage, ./storage,
# pylint crashes on anything that touches `tokens.py`:
./core/src/apps/ethereum/tokens.py,
./core/src/apps/ethereum/layout.py,
./core/src/apps/ethereum/sign_tx.py,
fail-under=10.0 fail-under=10.0
jobs=0 jobs=0