From 60b73eeab18e996e46043c8d1d37c374d79c99d7 Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Tue, 29 Aug 2023 16:34:33 +0200 Subject: [PATCH] New NFT metadata test key --- Makefile | 19 ++++++++++++++----- .../ledger_app_clients/ethereum/keychain.py | 1 + .../ethereum/keychain/nft.pem | 8 ++++++++ .../cmd_provideNFTInfo.c | 10 ++++++++-- 4 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 client/src/ledger_app_clients/ethereum/keychain/nft.pem diff --git a/Makefile b/Makefile index c33ca42..f970fac 100644 --- a/Makefile +++ b/Makefile @@ -155,12 +155,21 @@ endif # NFTs ifneq ($(TARGET_NAME),TARGET_NANOS) -DEFINES += HAVE_NFT_SUPPORT -# Enable the NFT staging key -NFT_STAGING_KEY:=0 -ifneq ($(NFT_STAGING_KEY),0) -DEFINES += HAVE_NFT_STAGING_KEY + DEFINES += HAVE_NFT_SUPPORT + NFT_TEST_KEY:=0 + ifneq ($(NFT_TEST_KEY),0) + DEFINES += HAVE_NFT_TEST_KEY + endif + NFT_STAGING_KEY:=0 + ifneq ($(NFT_STAGING_KEY),0) + # Key used by the staging backend + DEFINES += HAVE_NFT_STAGING_KEY + endif endif +ifneq (,$(filter $(DEFINES),HAVE_NFT_TEST_KEY)) + ifneq (, $(filter $(DEFINES),HAVE_NFT_STAGING_KEY)) + $(error Multiple alternative NFT keys set at once) + endif endif # Dynamic memory allocator diff --git a/client/src/ledger_app_clients/ethereum/keychain.py b/client/src/ledger_app_clients/ethereum/keychain.py index b6021af..433d652 100644 --- a/client/src/ledger_app_clients/ethereum/keychain.py +++ b/client/src/ledger_app_clients/ethereum/keychain.py @@ -12,6 +12,7 @@ class Key(Enum): CAL = auto() DOMAIN_NAME = auto() SET_PLUGIN = auto() + NFT = auto() _keys: Dict[Key, SigningKey] = dict() diff --git a/client/src/ledger_app_clients/ethereum/keychain/nft.pem b/client/src/ledger_app_clients/ethereum/keychain/nft.pem new file mode 100644 index 0000000..de6d21a --- /dev/null +++ b/client/src/ledger_app_clients/ethereum/keychain/nft.pem @@ -0,0 +1,8 @@ +-----BEGIN EC PARAMETERS----- +BgUrgQQACg== +-----END EC PARAMETERS----- +-----BEGIN EC PRIVATE KEY----- +MHQCAQEEIK69Gt4o0bzkOaEwUE5X2tI+Ks80FQi785Co+6woU9hioAcGBSuBBAAK +oUQDQgAEPPtfsxkF9L052dU1pAwmqrUcXX0yGbKKyUK5gPsgbPswtRzC3iEZrAOO +uw191lQXcCBKPO06eeKLMvu2cmRowA== +-----END EC PRIVATE KEY----- diff --git a/src_features/provideNFTInformation/cmd_provideNFTInfo.c b/src_features/provideNFTInformation/cmd_provideNFTInfo.c index f6655b9..9068b1e 100644 --- a/src_features/provideNFTInformation/cmd_provideNFTInfo.c +++ b/src_features/provideNFTInformation/cmd_provideNFTInfo.c @@ -29,13 +29,19 @@ #define VERSION_1 1 static const uint8_t LEDGER_NFT_METADATA_PUBLIC_KEY[] = { -#ifdef HAVE_NFT_STAGING_KEY +#if defined(HAVE_NFT_TEST_KEY) + 0x04, 0x3c, 0xfb, 0x5f, 0xb3, 0x19, 0x05, 0xf4, 0xbd, 0x39, 0xd9, 0xd5, 0x35, 0xa4, + 0x0c, 0x26, 0xaa, 0xb5, 0x1c, 0x5d, 0x7d, 0x32, 0x19, 0xb2, 0x8a, 0xc9, 0x42, 0xb9, + 0x80, 0xfb, 0x20, 0x6c, 0xfb, 0x30, 0xb5, 0x1c, 0xc2, 0xde, 0x21, 0x19, 0xac, 0x03, + 0x8e, 0xbb, 0x0d, 0x7d, 0xd6, 0x54, 0x17, 0x70, 0x20, 0x4a, 0x3c, 0xed, 0x3a, 0x79, + 0xe2, 0x8b, 0x32, 0xfb, 0xb6, 0x72, 0x64, 0x68, 0xc0 +#elif defined(HAVE_NFT_STAGING_KEY) 0x04, 0xf5, 0x70, 0x0c, 0xa1, 0xe8, 0x74, 0x24, 0xc7, 0xc7, 0xd1, 0x19, 0xe7, 0xe3, 0xc1, 0x89, 0xb1, 0x62, 0x50, 0x94, 0xdb, 0x6e, 0xa0, 0x40, 0x87, 0xc8, 0x30, 0x00, 0x7d, 0x0b, 0x46, 0x9a, 0x53, 0x11, 0xee, 0x6a, 0x1a, 0xcd, 0x1d, 0xa5, 0xaa, 0xb0, 0xf5, 0xc6, 0xdf, 0x13, 0x15, 0x8d, 0x28, 0xcc, 0x12, 0xd1, 0xdd, 0xa6, 0xec, 0xe9, 0x46, 0xb8, 0x9d, 0x5c, 0x05, 0x49, 0x92, 0x59, 0xc4 -#else +#else // production key 0x04, 0x98, 0x8d, 0xa6, 0xb2, 0x46, 0xf2, 0x8e, 0x77, 0xc1, 0xba, 0xb6, 0x75, 0xcb, 0x2a, 0x27, 0x44, 0xf7, 0xf5, 0xce, 0xc5, 0x6a, 0xe6, 0xe0, 0x32, 0x23, 0x33, 0x7b, 0x57, 0x94, 0xcd, 0x6a, 0xe0, 0x7d, 0x48, 0xb3, 0x0d, 0xb9, 0xcc, 0xb4, 0x0f, 0x5a,