Skip to content

Commit 9729368

Browse files
committed
Merge branch 'nanopb-2'
2 parents 0668586 + f4ca479 commit 9729368

28 files changed

+66
-15
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ NOTES.md
1414
bitbox02.egg-info
1515
/py/bitbox02/build
1616
/py/bitbox02/dist
17-
/py/bitbox02/.proto
1817

1918
# Git backup files created on merge conflicts
2019
*_BACKUP_*

messages/backup.options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
* mangle_names:M_STRIP_PACKAGE
16+
1517
// skip `bool has_*` fields for submessages
1618
// https://github.com/nanopb/nanopb/blob/1fdc916e984b27cc0a3824427f70a15def567a2e/docs/migration.rst#submessages-now-have-has-field-in-proto3-mode
1719
* proto3_singular_msgs:true

messages/backup.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
syntax = "proto3";
16+
package shiftcrypto.bitbox02;
1617

1718
enum BackupMode {
1819
PLAINTEXT = 0;

messages/backup_commands.options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
* mangle_names:M_STRIP_PACKAGE
16+
1517
CheckBackupResponse.id fixed_length:true max_size:65
1618
ListBackupsResponse.info max_count:50
1719
// One backup per seed -> 100 seeds may be backed up per SD card. Adapt this number if it is too small.

messages/backup_commands.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// This file is named backup_commands to avoid conflicting header files with top-most backup.proto
1616

1717
syntax = "proto3";
18+
package shiftcrypto.bitbox02;
1819

1920
message CheckBackupRequest {
2021
bool silent = 1;

messages/bitbox02_system.options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
* mangle_names:M_STRIP_PACKAGE
16+
1517
DeviceInfoResponse.name max_size:64
1618
DeviceInfoResponse.version max_size:10
1719
SetDeviceLanguageRequest.language fixed_length:true max_size:5

messages/bitbox02_system.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
syntax = "proto3";
16+
package shiftcrypto.bitbox02;
1617

1718
message CheckSDCardRequest {
1819
}

messages/bitboxbase.options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
* mangle_names:M_STRIP_PACKAGE
16+
1517
BitBoxBaseConfirmPairingRequest.msg fixed_length:true max_size:32
1618
BitBoxBaseSetConfigRequest.hostname fixed_length:true max_size:64
1719
BitBoxBaseSetConfigRequest.ip fixed_length:true max_size:4

messages/bitboxbase.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
syntax = "proto3";
16+
package shiftcrypto.bitbox02;
1617

1718
// Should be sent every X seconds (TBD) unless the firmware already is busy with a command.
1819
message BitBoxBaseHeartbeatRequest {

messages/btc.options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515

16+
* mangle_names:M_STRIP_PACKAGE
17+
1618
// skip `bool has_*` fields for submessages
1719
// https://github.com/nanopb/nanopb/blob/1fdc916e984b27cc0a3824427f70a15def567a2e/docs/migration.rst#submessages-now-have-has-field-in-proto3-mode
1820
* proto3_singular_msgs:true

messages/btc.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// limitations under the License.
1515

1616
syntax = "proto3";
17+
package shiftcrypto.bitbox02;
1718

1819
import "common.proto";
1920

messages/common.options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
* mangle_names:M_STRIP_PACKAGE
16+
1517
PubResponse.pub max_size:500
1618
RootFingerprintResponse.fingerprint fixed_length:true max_size:4
1719

messages/common.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
syntax = "proto3";
16+
package shiftcrypto.bitbox02;
1617

1718
message PubResponse {
1819
string pub = 1;

messages/eth.options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
* mangle_names:M_STRIP_PACKAGE
16+
1517
ETHPubRequest.keypath max_count:10
1618
ETHPubRequest.contract_address fixed_length:true max_size:20
1719
ETHSignRequest.keypath max_count:10

messages/eth.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
syntax = "proto3";
16+
package shiftcrypto.bitbox02;
1617

1718
import "common.proto";
1819

messages/hww.options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
* mangle_names:M_STRIP_PACKAGE
16+
1517
Error.message max_size:255

messages/hww.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
syntax = "proto3";
16+
package shiftcrypto.bitbox02;
1617

1718
import "common.proto";
1819

messages/keystore.options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
* mangle_names:M_STRIP_PACKAGE
16+
1517
ElectrumEncryptionKeyRequest.keypath max_count:2
1618
ElectrumEncryptionKeyResponse.key max_size:500

messages/keystore.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The keypath argument has to be m/4541509'/1112098098'
33

44
syntax = "proto3";
5+
package shiftcrypto.bitbox02;
56

67
message ElectrumEncryptionKeyRequest {
78
repeated uint32 keypath = 1;

messages/mnemonic.options

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2020 Shift Crypto AG
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
* mangle_names:M_STRIP_PACKAGE

messages/mnemonic.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
syntax = "proto3";
16+
package shiftcrypto.bitbox02;
1617

1718
message ShowMnemonicRequest {
1819
}

messages/perform_attestation.options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
* mangle_names:M_STRIP_PACKAGE
16+
1517
PerformAttestationRequest.challenge fixed_length:true max_size:32
1618
PerformAttestationResponse.bootloader_hash fixed_length:true max_size:32
1719
PerformAttestationResponse.device_pubkey fixed_length:true max_size:64

messages/perform_attestation.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
syntax = "proto3";
3+
package shiftcrypto.bitbox02;
34

45
// Deprecated, last used in v1.0.0
56
message PerformAttestationRequest {

messages/random_number.options

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
* mangle_names:M_STRIP_PACKAGE
16+
1517
RandomNumberResponse.number fixed_length:true max_size:32

messages/random_number.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
// limitations under the License.
1414

1515
syntax = "proto3";
16+
package shiftcrypto.bitbox02;
1617

1718
message RandomNumberResponse {
1819
bytes number = 1;
1920
}
2021

2122
message RandomNumberRequest {
2223
}
23-

messages/system.options

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2020 Shift Cryptosecurity AG
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
* mangle_names:M_STRIP_PACKAGE

messages/system.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
syntax = "proto3";
16+
package shiftcrypto.bitbox02;
1617

1718
message RebootRequest {
1819

py/bitbox02/Makefile

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ TARGETS=$(addprefix ${OUT_DIR}/, $(PROTO_FILES:.proto=_pb2.py))
2121

2222
all: ${TARGETS}
2323

24-
# To avoid protobuf name collisions with other packages used elsewhere like the
25-
# electrum app, the pb files for Python are generated from a copy
26-
# of ../../messages where all protos specify a non-empty package directive.
27-
# The proto files need not be committed to the repo. They are created at build time.
28-
PY_PROTO_DIR=.proto
24+
PY_PROTO_DIR=../../messages
2925
PY_PROTO=$(addprefix ${PY_PROTO_DIR}/,${PROTO_FILES})
3026

3127
# Explicit rules cannot have multiple outputs (it will be interpreted as multiple rules and
@@ -43,13 +39,6 @@ ${TMP_TARGETS}: ${PY_PROTO}
4339
sed -i 's/^from \([^.]*_pb2\)/from .\1/g' ${OUT_DIR}/*.pyi
4440
sed -i 's/^import \([^.]*_pb2\) as \([^.]*__pb2\)/from . import \1 as \2/g' ${OUT_DIR}/*.py
4541

46-
# Insert a package name in each protobuf file.
47-
# There can be only one "syntax = ..." directive in a proto file.
48-
# So, that's our anchor and a good place to put the package name at.
49-
${PY_PROTO_DIR}/%: ../../messages/%
50-
@mkdir -p $(@D)
51-
sed 's/^syntax =.*/&\npackage shiftcrypto.bitbox02;/' $< > $@
52-
5342
release-test: all
5443
rm -rf dist/*
5544
python3 setup.py sdist bdist_wheel
@@ -62,4 +51,3 @@ release-live: all
6251

6352
clean:
6453
rm -f ${TARGETS}
65-
rm -rf ${PY_PROTO_DIR}

0 commit comments

Comments
 (0)