From 1ffbddf2f44947e714a2c6b24019478a242490cb Mon Sep 17 00:00:00 2001 From: Marko Bencun Date: Wed, 1 Jul 2026 23:09:18 +0200 Subject: [PATCH] vendor: update bitbox02-api-go Updated using: ``` go get github.com/BitBoxSwiss/bitbox02-api-go@54ce69d38ae338a91a59ea73bf2dfee342c14284 go mod tidy && go mod vendor ``` --- go.mod | 4 +- go.sum | 10 +- .../api/firmware/bitboxsync.go | 223 +++++ .../api/firmware/messages/antiklepto.pb.go | 2 +- .../firmware/messages/backup_commands.pb.go | 2 +- .../firmware/messages/bitbox02_system.pb.go | 2 +- .../api/firmware/messages/bitboxsync.pb.go | 932 ++++++++++++++++++ .../api/firmware/messages/bitboxsync.proto | 72 ++ .../api/firmware/messages/bluetooth.pb.go | 2 +- .../api/firmware/messages/btc.pb.go | 2 +- .../api/firmware/messages/cardano.pb.go | 2 +- .../api/firmware/messages/common.pb.go | 2 +- .../api/firmware/messages/eth.pb.go | 2 +- .../api/firmware/messages/generate.sh | 1 + .../api/firmware/messages/hww.pb.go | 125 ++- .../api/firmware/messages/hww.proto | 3 + .../api/firmware/messages/keystore.pb.go | 2 +- .../api/firmware/messages/mnemonic.pb.go | 2 +- .../messages/perform_attestation.pb.go | 2 +- .../api/firmware/messages/system.pb.go | 2 +- .../testify/assert/assertion_compare.go | 22 +- .../testify/assert/assertion_format.go | 51 +- .../testify/assert/assertion_forward.go | 102 +- .../testify/assert/assertion_order.go | 2 +- .../stretchr/testify/assert/assertions.go | 367 ++++--- .../github.com/stretchr/testify/assert/doc.go | 4 + .../testify/assert/http_assertions.go | 4 +- .../testify/assert/yaml/yaml_custom.go | 1 - .../testify/assert/yaml/yaml_default.go | 1 - .../stretchr/testify/assert/yaml/yaml_fail.go | 1 - .../github.com/stretchr/testify/mock/mock.go | 22 +- .../stretchr/testify/require/doc.go | 2 + .../stretchr/testify/require/require.go | 108 +- .../testify/require/require_forward.go | 102 +- .../stretchr/testify/suite/stats.go | 16 +- .../stretchr/testify/suite/suite.go | 110 +-- vendor/modules.txt | 6 +- 37 files changed, 1945 insertions(+), 370 deletions(-) create mode 100644 vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/bitboxsync.go create mode 100644 vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bitboxsync.pb.go create mode 100644 vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bitboxsync.proto diff --git a/go.mod b/go.mod index 57653c1a7c..a152319b16 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/BitBoxSwiss/bitbox-wallet-app go 1.26.0 require ( - github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20260420184007-d546462995df + github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20260701210453-54ce69d38ae3 github.com/BitBoxSwiss/block-client-go v0.0.0-20250813114605-c276f6470c3d github.com/btcsuite/btcd v0.25.0 github.com/btcsuite/btcd/btcec/v2 v2.3.5 @@ -19,7 +19,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.4 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e - github.com/stretchr/testify v1.10.0 + github.com/stretchr/testify v1.11.1 go.etcd.io/bbolt v1.4.3 golang.org/x/crypto v0.46.0 golang.org/x/mobile v0.0.0-20240716161057-1ad2df20a8b6 diff --git a/go.sum b/go.sum index fd296e430e..a3ace334ad 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ -github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20260420184007-d546462995df h1:VED96kXmXl3mqPaE9lhm9/ZXcWVJdLPZ7RKK1R98T7I= -github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20260420184007-d546462995df/go.mod h1:0A/jvQgsh2/nLvbFTF9cCwO0QXlAsx0fZqkFNbsCCnM= +github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20260701210453-54ce69d38ae3 h1:3/aRvkDo+kPYz1tNu4SM6qD+mpKZYtfuMH1kF6Og2T8= +github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20260701210453-54ce69d38ae3/go.mod h1:gYGATM7SO5m3xGPOgldD/erAVbXKfWQTDbfgC0RNfwo= +github.com/BitBoxSwiss/bitboxsync-client-go v0.0.0-20260701061324-f7e835814680 h1:yGUYDddOzTmUdyBUX4FDGUW+O3VX2g2OfjtdZGIuRZ4= +github.com/BitBoxSwiss/bitboxsync-client-go v0.0.0-20260701061324-f7e835814680/go.mod h1:NlTH3nCt38trIQH357yq7ugzI61WbZ+SFeq6B0bK/EU= github.com/BitBoxSwiss/block-client-go v0.0.0-20250813114605-c276f6470c3d h1:HdoIlaUcNyEBajUoQgsxZtDMyCFyE7qv1kpeFe/u7nQ= github.com/BitBoxSwiss/block-client-go v0.0.0-20250813114605-c276f6470c3d/go.mod h1:SJTiQZU9ggBzVKMni97rpNS9GddPKErndFXNSDrfEGc= github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= @@ -263,8 +265,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe h1:nbdqkIGOGfUAD54q1s2YBcBz/WcsxCO9HUQ4aGV5hUw= github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/bitboxsync.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/bitboxsync.go new file mode 100644 index 0000000000..e6ec108b77 --- /dev/null +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/bitboxsync.go @@ -0,0 +1,223 @@ +// SPDX-License-Identifier: Apache-2.0 + +package firmware + +import ( + "crypto/ed25519" + + "github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages" + "github.com/BitBoxSwiss/bitbox02-api-go/util/errp" + "github.com/BitBoxSwiss/bitbox02-api-go/util/semver" +) + +const ( + bitBoxSyncChallengeLength = 32 + bitBoxSyncWrapPublicKeyLen = 32 + bitBoxSyncNamespaceIDLen = 16 + bitBoxSyncNamespaceDEKLen = 32 + bitBoxSyncInviteIDLen = 16 + bitBoxSyncInviteServerSecretHashLen = 32 + bitBoxSyncWrappedDEKLenV1 = 97 +) + +var bitBoxSyncMinVersion = semver.NewSemVer(9, 27, 0) + +// BitBoxSyncIdentity contains the public keys of the hardware BitBoxSync identity. +type BitBoxSyncIdentity struct { + AuthPublicKey ed25519.PublicKey + WrapPublicKey []byte +} + +func requireLen(name string, value []byte, expected int) error { + if len(value) != expected { + return errp.Newf("%s must be %d bytes", name, expected) + } + return nil +} + +func (device *Device) queryBitBoxSync(request *messages.BitBoxSyncRequest) (*messages.BitBoxSyncResponse, error) { + if !device.version.AtLeast(bitBoxSyncMinVersion) { + return nil, UnsupportedError(bitBoxSyncMinVersion.String()) + } + response, err := device.query(&messages.Request{ + Request: &messages.Request_BitboxSync{ + BitboxSync: request, + }, + }) + if err != nil { + return nil, err + } + bitBoxSyncResponse, ok := response.Response.(*messages.Response_BitboxSync) + if !ok { + return nil, errp.New("unexpected response") + } + return bitBoxSyncResponse.BitboxSync, nil +} + +// BitBoxSyncIdentity returns the hardware BitBoxSync identity public keys. +func (device *Device) BitBoxSyncIdentity() (*BitBoxSyncIdentity, error) { + response, err := device.queryBitBoxSync(&messages.BitBoxSyncRequest{ + Request: &messages.BitBoxSyncRequest_Identity{ + Identity: &messages.BitBoxSyncIdentityRequest{}, + }, + }) + if err != nil { + return nil, err + } + identity := response.GetIdentity() + if identity == nil { + return nil, errp.New("unexpected response") + } + if err := requireLen("auth public key", identity.AuthPublicKey, ed25519.PublicKeySize); err != nil { + return nil, err + } + if err := requireLen("wrap public key", identity.WrapPublicKey, bitBoxSyncWrapPublicKeyLen); err != nil { + return nil, err + } + return &BitBoxSyncIdentity{ + AuthPublicKey: ed25519.PublicKey(identity.AuthPublicKey), + WrapPublicKey: identity.WrapPublicKey, + }, nil +} + +func (device *Device) bitBoxSyncSignature(request *messages.BitBoxSyncRequest) ([]byte, error) { + response, err := device.queryBitBoxSync(request) + if err != nil { + return nil, err + } + signature := response.GetSignature() + if signature == nil { + return nil, errp.New("unexpected response") + } + if err := requireLen("signature", signature.Signature, ed25519.SignatureSize); err != nil { + return nil, err + } + return signature.Signature, nil +} + +// BitBoxSyncSignLoginIntent signs the canonical BitBoxSync login intent. +func (device *Device) BitBoxSyncSignLoginIntent(challenge []byte) ([]byte, error) { + if err := requireLen("challenge", challenge, bitBoxSyncChallengeLength); err != nil { + return nil, err + } + return device.bitBoxSyncSignature(&messages.BitBoxSyncRequest{ + Request: &messages.BitBoxSyncRequest_SignLoginIntent{ + SignLoginIntent: &messages.BitBoxSyncSignLoginIntentRequest{ + Challenge: challenge, + }, + }, + }) +} + +// BitBoxSyncSignRefreshIntent signs the canonical BitBoxSync refresh intent. +func (device *Device) BitBoxSyncSignRefreshIntent(challenge []byte) ([]byte, error) { + if err := requireLen("challenge", challenge, bitBoxSyncChallengeLength); err != nil { + return nil, err + } + return device.bitBoxSyncSignature(&messages.BitBoxSyncRequest{ + Request: &messages.BitBoxSyncRequest_SignRefreshIntent{ + SignRefreshIntent: &messages.BitBoxSyncSignRefreshIntentRequest{ + Challenge: challenge, + }, + }, + }) +} + +// BitBoxSyncSignRevokeAllTokensIntent signs the canonical BitBoxSync revoke-all-tokens intent. +func (device *Device) BitBoxSyncSignRevokeAllTokensIntent(challenge []byte) ([]byte, error) { + if err := requireLen("challenge", challenge, bitBoxSyncChallengeLength); err != nil { + return nil, err + } + return device.bitBoxSyncSignature(&messages.BitBoxSyncRequest{ + Request: &messages.BitBoxSyncRequest_SignRevokeAllTokensIntent{ + SignRevokeAllTokensIntent: &messages.BitBoxSyncSignRevokeAllTokensIntentRequest{ + Challenge: challenge, + }, + }, + }) +} + +// BitBoxSyncSignCreateNamespaceInviteIntent signs the canonical BitBoxSync create-namespace-invite intent. +func (device *Device) BitBoxSyncSignCreateNamespaceInviteIntent( + challenge, namespaceID, inviteID, inviteServerSecretHash []byte, + expiresAt uint64, + maxAccepted uint32, +) ([]byte, error) { + if err := requireLen("challenge", challenge, bitBoxSyncChallengeLength); err != nil { + return nil, err + } + if err := requireLen("namespace ID", namespaceID, bitBoxSyncNamespaceIDLen); err != nil { + return nil, err + } + if err := requireLen("invite ID", inviteID, bitBoxSyncInviteIDLen); err != nil { + return nil, err + } + if err := requireLen("invite server secret hash", inviteServerSecretHash, bitBoxSyncInviteServerSecretHashLen); err != nil { + return nil, err + } + return device.bitBoxSyncSignature(&messages.BitBoxSyncRequest{ + Request: &messages.BitBoxSyncRequest_SignCreateNamespaceInviteIntent{ + SignCreateNamespaceInviteIntent: &messages.BitBoxSyncSignCreateNamespaceInviteIntentRequest{ + Challenge: challenge, + NamespaceId: namespaceID, + InviteId: inviteID, + InviteServerSecretHash: inviteServerSecretHash, + ExpiresAt: expiresAt, + MaxAccepted: maxAccepted, + }, + }, + }) +} + +// BitBoxSyncSignJoinRequestIntent signs the canonical BitBoxSync join-request payload. +func (device *Device) BitBoxSyncSignJoinRequestIntent( + namespaceID, inviteID []byte, + serverOrigin string, + expiresAt uint64, +) ([]byte, error) { + if err := requireLen("namespace ID", namespaceID, bitBoxSyncNamespaceIDLen); err != nil { + return nil, err + } + if err := requireLen("invite ID", inviteID, bitBoxSyncInviteIDLen); err != nil { + return nil, err + } + return device.bitBoxSyncSignature(&messages.BitBoxSyncRequest{ + Request: &messages.BitBoxSyncRequest_SignJoinRequestIntent{ + SignJoinRequestIntent: &messages.BitBoxSyncSignJoinRequestIntentRequest{ + NamespaceId: namespaceID, + InviteId: inviteID, + ServerOrigin: serverOrigin, + ExpiresAt: expiresAt, + }, + }, + }) +} + +// BitBoxSyncUnwrapNamespaceDEK unwraps a namespace DEK with the hardware BitBoxSync identity. +func (device *Device) BitBoxSyncUnwrapNamespaceDEK(namespaceID, wrappedDEK []byte) ([]byte, error) { + if err := requireLen("namespace ID", namespaceID, bitBoxSyncNamespaceIDLen); err != nil { + return nil, err + } + if err := requireLen("wrapped DEK", wrappedDEK, bitBoxSyncWrappedDEKLenV1); err != nil { + return nil, err + } + response, err := device.queryBitBoxSync(&messages.BitBoxSyncRequest{ + Request: &messages.BitBoxSyncRequest_UnwrapNamespaceDek{ + UnwrapNamespaceDek: &messages.BitBoxSyncUnwrapNamespaceDEKRequest{ + NamespaceId: namespaceID, + WrappedDek: wrappedDEK, + }, + }, + }) + if err != nil { + return nil, err + } + unwrapped := response.GetUnwrapNamespaceDek() + if unwrapped == nil { + return nil, errp.New("unexpected response") + } + if err := requireLen("namespace DEK", unwrapped.NamespaceDek, bitBoxSyncNamespaceDEKLen); err != nil { + return nil, err + } + return unwrapped.NamespaceDek, nil +} diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/antiklepto.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/antiklepto.pb.go index 9b0c91856f..6297aa6b9b 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/antiklepto.pb.go +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/antiklepto.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v3.21.12 // source: antiklepto.proto diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/backup_commands.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/backup_commands.pb.go index 8ba9cebc57..17362e91bc 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/backup_commands.pb.go +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/backup_commands.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v3.21.12 // source: backup_commands.proto diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bitbox02_system.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bitbox02_system.pb.go index 259d20b493..b623c46a71 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bitbox02_system.pb.go +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bitbox02_system.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v3.21.12 // source: bitbox02_system.proto diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bitboxsync.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bitboxsync.pb.go new file mode 100644 index 0000000000..7bd1d1433e --- /dev/null +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bitboxsync.pb.go @@ -0,0 +1,932 @@ +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v3.21.12 +// source: bitboxsync.proto + +package messages + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type BitBoxSyncIdentityRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BitBoxSyncIdentityRequest) Reset() { + *x = BitBoxSyncIdentityRequest{} + mi := &file_bitboxsync_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BitBoxSyncIdentityRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BitBoxSyncIdentityRequest) ProtoMessage() {} + +func (x *BitBoxSyncIdentityRequest) ProtoReflect() protoreflect.Message { + mi := &file_bitboxsync_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BitBoxSyncIdentityRequest.ProtoReflect.Descriptor instead. +func (*BitBoxSyncIdentityRequest) Descriptor() ([]byte, []int) { + return file_bitboxsync_proto_rawDescGZIP(), []int{0} +} + +type BitBoxSyncIdentityResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + AuthPublicKey []byte `protobuf:"bytes,1,opt,name=auth_public_key,json=authPublicKey,proto3" json:"auth_public_key,omitempty"` + WrapPublicKey []byte `protobuf:"bytes,2,opt,name=wrap_public_key,json=wrapPublicKey,proto3" json:"wrap_public_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BitBoxSyncIdentityResponse) Reset() { + *x = BitBoxSyncIdentityResponse{} + mi := &file_bitboxsync_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BitBoxSyncIdentityResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BitBoxSyncIdentityResponse) ProtoMessage() {} + +func (x *BitBoxSyncIdentityResponse) ProtoReflect() protoreflect.Message { + mi := &file_bitboxsync_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BitBoxSyncIdentityResponse.ProtoReflect.Descriptor instead. +func (*BitBoxSyncIdentityResponse) Descriptor() ([]byte, []int) { + return file_bitboxsync_proto_rawDescGZIP(), []int{1} +} + +func (x *BitBoxSyncIdentityResponse) GetAuthPublicKey() []byte { + if x != nil { + return x.AuthPublicKey + } + return nil +} + +func (x *BitBoxSyncIdentityResponse) GetWrapPublicKey() []byte { + if x != nil { + return x.WrapPublicKey + } + return nil +} + +type BitBoxSyncSignLoginIntentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Challenge []byte `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BitBoxSyncSignLoginIntentRequest) Reset() { + *x = BitBoxSyncSignLoginIntentRequest{} + mi := &file_bitboxsync_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BitBoxSyncSignLoginIntentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BitBoxSyncSignLoginIntentRequest) ProtoMessage() {} + +func (x *BitBoxSyncSignLoginIntentRequest) ProtoReflect() protoreflect.Message { + mi := &file_bitboxsync_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BitBoxSyncSignLoginIntentRequest.ProtoReflect.Descriptor instead. +func (*BitBoxSyncSignLoginIntentRequest) Descriptor() ([]byte, []int) { + return file_bitboxsync_proto_rawDescGZIP(), []int{2} +} + +func (x *BitBoxSyncSignLoginIntentRequest) GetChallenge() []byte { + if x != nil { + return x.Challenge + } + return nil +} + +type BitBoxSyncSignRefreshIntentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Challenge []byte `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BitBoxSyncSignRefreshIntentRequest) Reset() { + *x = BitBoxSyncSignRefreshIntentRequest{} + mi := &file_bitboxsync_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BitBoxSyncSignRefreshIntentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BitBoxSyncSignRefreshIntentRequest) ProtoMessage() {} + +func (x *BitBoxSyncSignRefreshIntentRequest) ProtoReflect() protoreflect.Message { + mi := &file_bitboxsync_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BitBoxSyncSignRefreshIntentRequest.ProtoReflect.Descriptor instead. +func (*BitBoxSyncSignRefreshIntentRequest) Descriptor() ([]byte, []int) { + return file_bitboxsync_proto_rawDescGZIP(), []int{3} +} + +func (x *BitBoxSyncSignRefreshIntentRequest) GetChallenge() []byte { + if x != nil { + return x.Challenge + } + return nil +} + +type BitBoxSyncSignRevokeAllTokensIntentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Challenge []byte `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BitBoxSyncSignRevokeAllTokensIntentRequest) Reset() { + *x = BitBoxSyncSignRevokeAllTokensIntentRequest{} + mi := &file_bitboxsync_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BitBoxSyncSignRevokeAllTokensIntentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BitBoxSyncSignRevokeAllTokensIntentRequest) ProtoMessage() {} + +func (x *BitBoxSyncSignRevokeAllTokensIntentRequest) ProtoReflect() protoreflect.Message { + mi := &file_bitboxsync_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BitBoxSyncSignRevokeAllTokensIntentRequest.ProtoReflect.Descriptor instead. +func (*BitBoxSyncSignRevokeAllTokensIntentRequest) Descriptor() ([]byte, []int) { + return file_bitboxsync_proto_rawDescGZIP(), []int{4} +} + +func (x *BitBoxSyncSignRevokeAllTokensIntentRequest) GetChallenge() []byte { + if x != nil { + return x.Challenge + } + return nil +} + +type BitBoxSyncSignCreateNamespaceInviteIntentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Challenge []byte `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"` + NamespaceId []byte `protobuf:"bytes,2,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` + InviteId []byte `protobuf:"bytes,3,opt,name=invite_id,json=inviteId,proto3" json:"invite_id,omitempty"` + InviteServerSecretHash []byte `protobuf:"bytes,4,opt,name=invite_server_secret_hash,json=inviteServerSecretHash,proto3" json:"invite_server_secret_hash,omitempty"` + ExpiresAt uint64 `protobuf:"varint,5,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` + MaxAccepted uint32 `protobuf:"varint,6,opt,name=max_accepted,json=maxAccepted,proto3" json:"max_accepted,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BitBoxSyncSignCreateNamespaceInviteIntentRequest) Reset() { + *x = BitBoxSyncSignCreateNamespaceInviteIntentRequest{} + mi := &file_bitboxsync_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BitBoxSyncSignCreateNamespaceInviteIntentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BitBoxSyncSignCreateNamespaceInviteIntentRequest) ProtoMessage() {} + +func (x *BitBoxSyncSignCreateNamespaceInviteIntentRequest) ProtoReflect() protoreflect.Message { + mi := &file_bitboxsync_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BitBoxSyncSignCreateNamespaceInviteIntentRequest.ProtoReflect.Descriptor instead. +func (*BitBoxSyncSignCreateNamespaceInviteIntentRequest) Descriptor() ([]byte, []int) { + return file_bitboxsync_proto_rawDescGZIP(), []int{5} +} + +func (x *BitBoxSyncSignCreateNamespaceInviteIntentRequest) GetChallenge() []byte { + if x != nil { + return x.Challenge + } + return nil +} + +func (x *BitBoxSyncSignCreateNamespaceInviteIntentRequest) GetNamespaceId() []byte { + if x != nil { + return x.NamespaceId + } + return nil +} + +func (x *BitBoxSyncSignCreateNamespaceInviteIntentRequest) GetInviteId() []byte { + if x != nil { + return x.InviteId + } + return nil +} + +func (x *BitBoxSyncSignCreateNamespaceInviteIntentRequest) GetInviteServerSecretHash() []byte { + if x != nil { + return x.InviteServerSecretHash + } + return nil +} + +func (x *BitBoxSyncSignCreateNamespaceInviteIntentRequest) GetExpiresAt() uint64 { + if x != nil { + return x.ExpiresAt + } + return 0 +} + +func (x *BitBoxSyncSignCreateNamespaceInviteIntentRequest) GetMaxAccepted() uint32 { + if x != nil { + return x.MaxAccepted + } + return 0 +} + +type BitBoxSyncSignJoinRequestIntentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + NamespaceId []byte `protobuf:"bytes,1,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` + InviteId []byte `protobuf:"bytes,2,opt,name=invite_id,json=inviteId,proto3" json:"invite_id,omitempty"` + ServerOrigin string `protobuf:"bytes,3,opt,name=server_origin,json=serverOrigin,proto3" json:"server_origin,omitempty"` + ExpiresAt uint64 `protobuf:"varint,4,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BitBoxSyncSignJoinRequestIntentRequest) Reset() { + *x = BitBoxSyncSignJoinRequestIntentRequest{} + mi := &file_bitboxsync_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BitBoxSyncSignJoinRequestIntentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BitBoxSyncSignJoinRequestIntentRequest) ProtoMessage() {} + +func (x *BitBoxSyncSignJoinRequestIntentRequest) ProtoReflect() protoreflect.Message { + mi := &file_bitboxsync_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BitBoxSyncSignJoinRequestIntentRequest.ProtoReflect.Descriptor instead. +func (*BitBoxSyncSignJoinRequestIntentRequest) Descriptor() ([]byte, []int) { + return file_bitboxsync_proto_rawDescGZIP(), []int{6} +} + +func (x *BitBoxSyncSignJoinRequestIntentRequest) GetNamespaceId() []byte { + if x != nil { + return x.NamespaceId + } + return nil +} + +func (x *BitBoxSyncSignJoinRequestIntentRequest) GetInviteId() []byte { + if x != nil { + return x.InviteId + } + return nil +} + +func (x *BitBoxSyncSignJoinRequestIntentRequest) GetServerOrigin() string { + if x != nil { + return x.ServerOrigin + } + return "" +} + +func (x *BitBoxSyncSignJoinRequestIntentRequest) GetExpiresAt() uint64 { + if x != nil { + return x.ExpiresAt + } + return 0 +} + +type BitBoxSyncUnwrapNamespaceDEKRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + NamespaceId []byte `protobuf:"bytes,1,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` + WrappedDek []byte `protobuf:"bytes,2,opt,name=wrapped_dek,json=wrappedDek,proto3" json:"wrapped_dek,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BitBoxSyncUnwrapNamespaceDEKRequest) Reset() { + *x = BitBoxSyncUnwrapNamespaceDEKRequest{} + mi := &file_bitboxsync_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BitBoxSyncUnwrapNamespaceDEKRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BitBoxSyncUnwrapNamespaceDEKRequest) ProtoMessage() {} + +func (x *BitBoxSyncUnwrapNamespaceDEKRequest) ProtoReflect() protoreflect.Message { + mi := &file_bitboxsync_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BitBoxSyncUnwrapNamespaceDEKRequest.ProtoReflect.Descriptor instead. +func (*BitBoxSyncUnwrapNamespaceDEKRequest) Descriptor() ([]byte, []int) { + return file_bitboxsync_proto_rawDescGZIP(), []int{7} +} + +func (x *BitBoxSyncUnwrapNamespaceDEKRequest) GetNamespaceId() []byte { + if x != nil { + return x.NamespaceId + } + return nil +} + +func (x *BitBoxSyncUnwrapNamespaceDEKRequest) GetWrappedDek() []byte { + if x != nil { + return x.WrappedDek + } + return nil +} + +type BitBoxSyncSignatureResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BitBoxSyncSignatureResponse) Reset() { + *x = BitBoxSyncSignatureResponse{} + mi := &file_bitboxsync_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BitBoxSyncSignatureResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BitBoxSyncSignatureResponse) ProtoMessage() {} + +func (x *BitBoxSyncSignatureResponse) ProtoReflect() protoreflect.Message { + mi := &file_bitboxsync_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BitBoxSyncSignatureResponse.ProtoReflect.Descriptor instead. +func (*BitBoxSyncSignatureResponse) Descriptor() ([]byte, []int) { + return file_bitboxsync_proto_rawDescGZIP(), []int{8} +} + +func (x *BitBoxSyncSignatureResponse) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +type BitBoxSyncUnwrapNamespaceDEKResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + NamespaceDek []byte `protobuf:"bytes,1,opt,name=namespace_dek,json=namespaceDek,proto3" json:"namespace_dek,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BitBoxSyncUnwrapNamespaceDEKResponse) Reset() { + *x = BitBoxSyncUnwrapNamespaceDEKResponse{} + mi := &file_bitboxsync_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BitBoxSyncUnwrapNamespaceDEKResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BitBoxSyncUnwrapNamespaceDEKResponse) ProtoMessage() {} + +func (x *BitBoxSyncUnwrapNamespaceDEKResponse) ProtoReflect() protoreflect.Message { + mi := &file_bitboxsync_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BitBoxSyncUnwrapNamespaceDEKResponse.ProtoReflect.Descriptor instead. +func (*BitBoxSyncUnwrapNamespaceDEKResponse) Descriptor() ([]byte, []int) { + return file_bitboxsync_proto_rawDescGZIP(), []int{9} +} + +func (x *BitBoxSyncUnwrapNamespaceDEKResponse) GetNamespaceDek() []byte { + if x != nil { + return x.NamespaceDek + } + return nil +} + +type BitBoxSyncRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Request: + // + // *BitBoxSyncRequest_Identity + // *BitBoxSyncRequest_SignLoginIntent + // *BitBoxSyncRequest_SignRefreshIntent + // *BitBoxSyncRequest_SignRevokeAllTokensIntent + // *BitBoxSyncRequest_SignCreateNamespaceInviteIntent + // *BitBoxSyncRequest_SignJoinRequestIntent + // *BitBoxSyncRequest_UnwrapNamespaceDek + Request isBitBoxSyncRequest_Request `protobuf_oneof:"request"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BitBoxSyncRequest) Reset() { + *x = BitBoxSyncRequest{} + mi := &file_bitboxsync_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BitBoxSyncRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BitBoxSyncRequest) ProtoMessage() {} + +func (x *BitBoxSyncRequest) ProtoReflect() protoreflect.Message { + mi := &file_bitboxsync_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BitBoxSyncRequest.ProtoReflect.Descriptor instead. +func (*BitBoxSyncRequest) Descriptor() ([]byte, []int) { + return file_bitboxsync_proto_rawDescGZIP(), []int{10} +} + +func (x *BitBoxSyncRequest) GetRequest() isBitBoxSyncRequest_Request { + if x != nil { + return x.Request + } + return nil +} + +func (x *BitBoxSyncRequest) GetIdentity() *BitBoxSyncIdentityRequest { + if x != nil { + if x, ok := x.Request.(*BitBoxSyncRequest_Identity); ok { + return x.Identity + } + } + return nil +} + +func (x *BitBoxSyncRequest) GetSignLoginIntent() *BitBoxSyncSignLoginIntentRequest { + if x != nil { + if x, ok := x.Request.(*BitBoxSyncRequest_SignLoginIntent); ok { + return x.SignLoginIntent + } + } + return nil +} + +func (x *BitBoxSyncRequest) GetSignRefreshIntent() *BitBoxSyncSignRefreshIntentRequest { + if x != nil { + if x, ok := x.Request.(*BitBoxSyncRequest_SignRefreshIntent); ok { + return x.SignRefreshIntent + } + } + return nil +} + +func (x *BitBoxSyncRequest) GetSignRevokeAllTokensIntent() *BitBoxSyncSignRevokeAllTokensIntentRequest { + if x != nil { + if x, ok := x.Request.(*BitBoxSyncRequest_SignRevokeAllTokensIntent); ok { + return x.SignRevokeAllTokensIntent + } + } + return nil +} + +func (x *BitBoxSyncRequest) GetSignCreateNamespaceInviteIntent() *BitBoxSyncSignCreateNamespaceInviteIntentRequest { + if x != nil { + if x, ok := x.Request.(*BitBoxSyncRequest_SignCreateNamespaceInviteIntent); ok { + return x.SignCreateNamespaceInviteIntent + } + } + return nil +} + +func (x *BitBoxSyncRequest) GetSignJoinRequestIntent() *BitBoxSyncSignJoinRequestIntentRequest { + if x != nil { + if x, ok := x.Request.(*BitBoxSyncRequest_SignJoinRequestIntent); ok { + return x.SignJoinRequestIntent + } + } + return nil +} + +func (x *BitBoxSyncRequest) GetUnwrapNamespaceDek() *BitBoxSyncUnwrapNamespaceDEKRequest { + if x != nil { + if x, ok := x.Request.(*BitBoxSyncRequest_UnwrapNamespaceDek); ok { + return x.UnwrapNamespaceDek + } + } + return nil +} + +type isBitBoxSyncRequest_Request interface { + isBitBoxSyncRequest_Request() +} + +type BitBoxSyncRequest_Identity struct { + Identity *BitBoxSyncIdentityRequest `protobuf:"bytes,1,opt,name=identity,proto3,oneof"` +} + +type BitBoxSyncRequest_SignLoginIntent struct { + SignLoginIntent *BitBoxSyncSignLoginIntentRequest `protobuf:"bytes,2,opt,name=sign_login_intent,json=signLoginIntent,proto3,oneof"` +} + +type BitBoxSyncRequest_SignRefreshIntent struct { + SignRefreshIntent *BitBoxSyncSignRefreshIntentRequest `protobuf:"bytes,3,opt,name=sign_refresh_intent,json=signRefreshIntent,proto3,oneof"` +} + +type BitBoxSyncRequest_SignRevokeAllTokensIntent struct { + SignRevokeAllTokensIntent *BitBoxSyncSignRevokeAllTokensIntentRequest `protobuf:"bytes,4,opt,name=sign_revoke_all_tokens_intent,json=signRevokeAllTokensIntent,proto3,oneof"` +} + +type BitBoxSyncRequest_SignCreateNamespaceInviteIntent struct { + SignCreateNamespaceInviteIntent *BitBoxSyncSignCreateNamespaceInviteIntentRequest `protobuf:"bytes,5,opt,name=sign_create_namespace_invite_intent,json=signCreateNamespaceInviteIntent,proto3,oneof"` +} + +type BitBoxSyncRequest_SignJoinRequestIntent struct { + SignJoinRequestIntent *BitBoxSyncSignJoinRequestIntentRequest `protobuf:"bytes,6,opt,name=sign_join_request_intent,json=signJoinRequestIntent,proto3,oneof"` +} + +type BitBoxSyncRequest_UnwrapNamespaceDek struct { + UnwrapNamespaceDek *BitBoxSyncUnwrapNamespaceDEKRequest `protobuf:"bytes,7,opt,name=unwrap_namespace_dek,json=unwrapNamespaceDek,proto3,oneof"` +} + +func (*BitBoxSyncRequest_Identity) isBitBoxSyncRequest_Request() {} + +func (*BitBoxSyncRequest_SignLoginIntent) isBitBoxSyncRequest_Request() {} + +func (*BitBoxSyncRequest_SignRefreshIntent) isBitBoxSyncRequest_Request() {} + +func (*BitBoxSyncRequest_SignRevokeAllTokensIntent) isBitBoxSyncRequest_Request() {} + +func (*BitBoxSyncRequest_SignCreateNamespaceInviteIntent) isBitBoxSyncRequest_Request() {} + +func (*BitBoxSyncRequest_SignJoinRequestIntent) isBitBoxSyncRequest_Request() {} + +func (*BitBoxSyncRequest_UnwrapNamespaceDek) isBitBoxSyncRequest_Request() {} + +type BitBoxSyncResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Response: + // + // *BitBoxSyncResponse_Identity + // *BitBoxSyncResponse_Signature + // *BitBoxSyncResponse_UnwrapNamespaceDek + Response isBitBoxSyncResponse_Response `protobuf_oneof:"response"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BitBoxSyncResponse) Reset() { + *x = BitBoxSyncResponse{} + mi := &file_bitboxsync_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BitBoxSyncResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BitBoxSyncResponse) ProtoMessage() {} + +func (x *BitBoxSyncResponse) ProtoReflect() protoreflect.Message { + mi := &file_bitboxsync_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BitBoxSyncResponse.ProtoReflect.Descriptor instead. +func (*BitBoxSyncResponse) Descriptor() ([]byte, []int) { + return file_bitboxsync_proto_rawDescGZIP(), []int{11} +} + +func (x *BitBoxSyncResponse) GetResponse() isBitBoxSyncResponse_Response { + if x != nil { + return x.Response + } + return nil +} + +func (x *BitBoxSyncResponse) GetIdentity() *BitBoxSyncIdentityResponse { + if x != nil { + if x, ok := x.Response.(*BitBoxSyncResponse_Identity); ok { + return x.Identity + } + } + return nil +} + +func (x *BitBoxSyncResponse) GetSignature() *BitBoxSyncSignatureResponse { + if x != nil { + if x, ok := x.Response.(*BitBoxSyncResponse_Signature); ok { + return x.Signature + } + } + return nil +} + +func (x *BitBoxSyncResponse) GetUnwrapNamespaceDek() *BitBoxSyncUnwrapNamespaceDEKResponse { + if x != nil { + if x, ok := x.Response.(*BitBoxSyncResponse_UnwrapNamespaceDek); ok { + return x.UnwrapNamespaceDek + } + } + return nil +} + +type isBitBoxSyncResponse_Response interface { + isBitBoxSyncResponse_Response() +} + +type BitBoxSyncResponse_Identity struct { + Identity *BitBoxSyncIdentityResponse `protobuf:"bytes,1,opt,name=identity,proto3,oneof"` +} + +type BitBoxSyncResponse_Signature struct { + Signature *BitBoxSyncSignatureResponse `protobuf:"bytes,2,opt,name=signature,proto3,oneof"` +} + +type BitBoxSyncResponse_UnwrapNamespaceDek struct { + UnwrapNamespaceDek *BitBoxSyncUnwrapNamespaceDEKResponse `protobuf:"bytes,3,opt,name=unwrap_namespace_dek,json=unwrapNamespaceDek,proto3,oneof"` +} + +func (*BitBoxSyncResponse_Identity) isBitBoxSyncResponse_Response() {} + +func (*BitBoxSyncResponse_Signature) isBitBoxSyncResponse_Response() {} + +func (*BitBoxSyncResponse_UnwrapNamespaceDek) isBitBoxSyncResponse_Response() {} + +var File_bitboxsync_proto protoreflect.FileDescriptor + +const file_bitboxsync_proto_rawDesc = "" + + "\n" + + "\x10bitboxsync.proto\x12\x14shiftcrypto.bitbox02\"\x1b\n" + + "\x19BitBoxSyncIdentityRequest\"l\n" + + "\x1aBitBoxSyncIdentityResponse\x12&\n" + + "\x0fauth_public_key\x18\x01 \x01(\fR\rauthPublicKey\x12&\n" + + "\x0fwrap_public_key\x18\x02 \x01(\fR\rwrapPublicKey\"@\n" + + " BitBoxSyncSignLoginIntentRequest\x12\x1c\n" + + "\tchallenge\x18\x01 \x01(\fR\tchallenge\"B\n" + + "\"BitBoxSyncSignRefreshIntentRequest\x12\x1c\n" + + "\tchallenge\x18\x01 \x01(\fR\tchallenge\"J\n" + + "*BitBoxSyncSignRevokeAllTokensIntentRequest\x12\x1c\n" + + "\tchallenge\x18\x01 \x01(\fR\tchallenge\"\x8d\x02\n" + + "0BitBoxSyncSignCreateNamespaceInviteIntentRequest\x12\x1c\n" + + "\tchallenge\x18\x01 \x01(\fR\tchallenge\x12!\n" + + "\fnamespace_id\x18\x02 \x01(\fR\vnamespaceId\x12\x1b\n" + + "\tinvite_id\x18\x03 \x01(\fR\binviteId\x129\n" + + "\x19invite_server_secret_hash\x18\x04 \x01(\fR\x16inviteServerSecretHash\x12\x1d\n" + + "\n" + + "expires_at\x18\x05 \x01(\x04R\texpiresAt\x12!\n" + + "\fmax_accepted\x18\x06 \x01(\rR\vmaxAccepted\"\xac\x01\n" + + "&BitBoxSyncSignJoinRequestIntentRequest\x12!\n" + + "\fnamespace_id\x18\x01 \x01(\fR\vnamespaceId\x12\x1b\n" + + "\tinvite_id\x18\x02 \x01(\fR\binviteId\x12#\n" + + "\rserver_origin\x18\x03 \x01(\tR\fserverOrigin\x12\x1d\n" + + "\n" + + "expires_at\x18\x04 \x01(\x04R\texpiresAt\"i\n" + + "#BitBoxSyncUnwrapNamespaceDEKRequest\x12!\n" + + "\fnamespace_id\x18\x01 \x01(\fR\vnamespaceId\x12\x1f\n" + + "\vwrapped_dek\x18\x02 \x01(\fR\n" + + "wrappedDek\";\n" + + "\x1bBitBoxSyncSignatureResponse\x12\x1c\n" + + "\tsignature\x18\x01 \x01(\fR\tsignature\"K\n" + + "$BitBoxSyncUnwrapNamespaceDEKResponse\x12#\n" + + "\rnamespace_dek\x18\x01 \x01(\fR\fnamespaceDek\"\xc7\x06\n" + + "\x11BitBoxSyncRequest\x12M\n" + + "\bidentity\x18\x01 \x01(\v2/.shiftcrypto.bitbox02.BitBoxSyncIdentityRequestH\x00R\bidentity\x12d\n" + + "\x11sign_login_intent\x18\x02 \x01(\v26.shiftcrypto.bitbox02.BitBoxSyncSignLoginIntentRequestH\x00R\x0fsignLoginIntent\x12j\n" + + "\x13sign_refresh_intent\x18\x03 \x01(\v28.shiftcrypto.bitbox02.BitBoxSyncSignRefreshIntentRequestH\x00R\x11signRefreshIntent\x12\x84\x01\n" + + "\x1dsign_revoke_all_tokens_intent\x18\x04 \x01(\v2@.shiftcrypto.bitbox02.BitBoxSyncSignRevokeAllTokensIntentRequestH\x00R\x19signRevokeAllTokensIntent\x12\x96\x01\n" + + "#sign_create_namespace_invite_intent\x18\x05 \x01(\v2F.shiftcrypto.bitbox02.BitBoxSyncSignCreateNamespaceInviteIntentRequestH\x00R\x1fsignCreateNamespaceInviteIntent\x12w\n" + + "\x18sign_join_request_intent\x18\x06 \x01(\v2<.shiftcrypto.bitbox02.BitBoxSyncSignJoinRequestIntentRequestH\x00R\x15signJoinRequestIntent\x12m\n" + + "\x14unwrap_namespace_dek\x18\a \x01(\v29.shiftcrypto.bitbox02.BitBoxSyncUnwrapNamespaceDEKRequestH\x00R\x12unwrapNamespaceDekB\t\n" + + "\arequest\"\xb3\x02\n" + + "\x12BitBoxSyncResponse\x12N\n" + + "\bidentity\x18\x01 \x01(\v20.shiftcrypto.bitbox02.BitBoxSyncIdentityResponseH\x00R\bidentity\x12Q\n" + + "\tsignature\x18\x02 \x01(\v21.shiftcrypto.bitbox02.BitBoxSyncSignatureResponseH\x00R\tsignature\x12n\n" + + "\x14unwrap_namespace_dek\x18\x03 \x01(\v2:.shiftcrypto.bitbox02.BitBoxSyncUnwrapNamespaceDEKResponseH\x00R\x12unwrapNamespaceDekB\n" + + "\n" + + "\bresponseb\x06proto3" + +var ( + file_bitboxsync_proto_rawDescOnce sync.Once + file_bitboxsync_proto_rawDescData []byte +) + +func file_bitboxsync_proto_rawDescGZIP() []byte { + file_bitboxsync_proto_rawDescOnce.Do(func() { + file_bitboxsync_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_bitboxsync_proto_rawDesc), len(file_bitboxsync_proto_rawDesc))) + }) + return file_bitboxsync_proto_rawDescData +} + +var file_bitboxsync_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_bitboxsync_proto_goTypes = []any{ + (*BitBoxSyncIdentityRequest)(nil), // 0: shiftcrypto.bitbox02.BitBoxSyncIdentityRequest + (*BitBoxSyncIdentityResponse)(nil), // 1: shiftcrypto.bitbox02.BitBoxSyncIdentityResponse + (*BitBoxSyncSignLoginIntentRequest)(nil), // 2: shiftcrypto.bitbox02.BitBoxSyncSignLoginIntentRequest + (*BitBoxSyncSignRefreshIntentRequest)(nil), // 3: shiftcrypto.bitbox02.BitBoxSyncSignRefreshIntentRequest + (*BitBoxSyncSignRevokeAllTokensIntentRequest)(nil), // 4: shiftcrypto.bitbox02.BitBoxSyncSignRevokeAllTokensIntentRequest + (*BitBoxSyncSignCreateNamespaceInviteIntentRequest)(nil), // 5: shiftcrypto.bitbox02.BitBoxSyncSignCreateNamespaceInviteIntentRequest + (*BitBoxSyncSignJoinRequestIntentRequest)(nil), // 6: shiftcrypto.bitbox02.BitBoxSyncSignJoinRequestIntentRequest + (*BitBoxSyncUnwrapNamespaceDEKRequest)(nil), // 7: shiftcrypto.bitbox02.BitBoxSyncUnwrapNamespaceDEKRequest + (*BitBoxSyncSignatureResponse)(nil), // 8: shiftcrypto.bitbox02.BitBoxSyncSignatureResponse + (*BitBoxSyncUnwrapNamespaceDEKResponse)(nil), // 9: shiftcrypto.bitbox02.BitBoxSyncUnwrapNamespaceDEKResponse + (*BitBoxSyncRequest)(nil), // 10: shiftcrypto.bitbox02.BitBoxSyncRequest + (*BitBoxSyncResponse)(nil), // 11: shiftcrypto.bitbox02.BitBoxSyncResponse +} +var file_bitboxsync_proto_depIdxs = []int32{ + 0, // 0: shiftcrypto.bitbox02.BitBoxSyncRequest.identity:type_name -> shiftcrypto.bitbox02.BitBoxSyncIdentityRequest + 2, // 1: shiftcrypto.bitbox02.BitBoxSyncRequest.sign_login_intent:type_name -> shiftcrypto.bitbox02.BitBoxSyncSignLoginIntentRequest + 3, // 2: shiftcrypto.bitbox02.BitBoxSyncRequest.sign_refresh_intent:type_name -> shiftcrypto.bitbox02.BitBoxSyncSignRefreshIntentRequest + 4, // 3: shiftcrypto.bitbox02.BitBoxSyncRequest.sign_revoke_all_tokens_intent:type_name -> shiftcrypto.bitbox02.BitBoxSyncSignRevokeAllTokensIntentRequest + 5, // 4: shiftcrypto.bitbox02.BitBoxSyncRequest.sign_create_namespace_invite_intent:type_name -> shiftcrypto.bitbox02.BitBoxSyncSignCreateNamespaceInviteIntentRequest + 6, // 5: shiftcrypto.bitbox02.BitBoxSyncRequest.sign_join_request_intent:type_name -> shiftcrypto.bitbox02.BitBoxSyncSignJoinRequestIntentRequest + 7, // 6: shiftcrypto.bitbox02.BitBoxSyncRequest.unwrap_namespace_dek:type_name -> shiftcrypto.bitbox02.BitBoxSyncUnwrapNamespaceDEKRequest + 1, // 7: shiftcrypto.bitbox02.BitBoxSyncResponse.identity:type_name -> shiftcrypto.bitbox02.BitBoxSyncIdentityResponse + 8, // 8: shiftcrypto.bitbox02.BitBoxSyncResponse.signature:type_name -> shiftcrypto.bitbox02.BitBoxSyncSignatureResponse + 9, // 9: shiftcrypto.bitbox02.BitBoxSyncResponse.unwrap_namespace_dek:type_name -> shiftcrypto.bitbox02.BitBoxSyncUnwrapNamespaceDEKResponse + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_bitboxsync_proto_init() } +func file_bitboxsync_proto_init() { + if File_bitboxsync_proto != nil { + return + } + file_bitboxsync_proto_msgTypes[10].OneofWrappers = []any{ + (*BitBoxSyncRequest_Identity)(nil), + (*BitBoxSyncRequest_SignLoginIntent)(nil), + (*BitBoxSyncRequest_SignRefreshIntent)(nil), + (*BitBoxSyncRequest_SignRevokeAllTokensIntent)(nil), + (*BitBoxSyncRequest_SignCreateNamespaceInviteIntent)(nil), + (*BitBoxSyncRequest_SignJoinRequestIntent)(nil), + (*BitBoxSyncRequest_UnwrapNamespaceDek)(nil), + } + file_bitboxsync_proto_msgTypes[11].OneofWrappers = []any{ + (*BitBoxSyncResponse_Identity)(nil), + (*BitBoxSyncResponse_Signature)(nil), + (*BitBoxSyncResponse_UnwrapNamespaceDek)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_bitboxsync_proto_rawDesc), len(file_bitboxsync_proto_rawDesc)), + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_bitboxsync_proto_goTypes, + DependencyIndexes: file_bitboxsync_proto_depIdxs, + MessageInfos: file_bitboxsync_proto_msgTypes, + }.Build() + File_bitboxsync_proto = out.File + file_bitboxsync_proto_goTypes = nil + file_bitboxsync_proto_depIdxs = nil +} diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bitboxsync.proto b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bitboxsync.proto new file mode 100644 index 0000000000..6c0e8f1b1c --- /dev/null +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bitboxsync.proto @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: Apache-2.0 + +syntax = "proto3"; +package shiftcrypto.bitbox02; + +message BitBoxSyncIdentityRequest {} + +message BitBoxSyncIdentityResponse { + bytes auth_public_key = 1; + bytes wrap_public_key = 2; +} + +message BitBoxSyncSignLoginIntentRequest { + bytes challenge = 1; +} + +message BitBoxSyncSignRefreshIntentRequest { + bytes challenge = 1; +} + +message BitBoxSyncSignRevokeAllTokensIntentRequest { + bytes challenge = 1; +} + +message BitBoxSyncSignCreateNamespaceInviteIntentRequest { + bytes challenge = 1; + bytes namespace_id = 2; + bytes invite_id = 3; + bytes invite_server_secret_hash = 4; + uint64 expires_at = 5; + uint32 max_accepted = 6; +} + +message BitBoxSyncSignJoinRequestIntentRequest { + bytes namespace_id = 1; + bytes invite_id = 2; + string server_origin = 3; + uint64 expires_at = 4; +} + +message BitBoxSyncUnwrapNamespaceDEKRequest { + bytes namespace_id = 1; + bytes wrapped_dek = 2; +} + +message BitBoxSyncSignatureResponse { + bytes signature = 1; +} + +message BitBoxSyncUnwrapNamespaceDEKResponse { + bytes namespace_dek = 1; +} + +message BitBoxSyncRequest { + oneof request { + BitBoxSyncIdentityRequest identity = 1; + BitBoxSyncSignLoginIntentRequest sign_login_intent = 2; + BitBoxSyncSignRefreshIntentRequest sign_refresh_intent = 3; + BitBoxSyncSignRevokeAllTokensIntentRequest sign_revoke_all_tokens_intent = 4; + BitBoxSyncSignCreateNamespaceInviteIntentRequest sign_create_namespace_invite_intent = 5; + BitBoxSyncSignJoinRequestIntentRequest sign_join_request_intent = 6; + BitBoxSyncUnwrapNamespaceDEKRequest unwrap_namespace_dek = 7; + } +} + +message BitBoxSyncResponse { + oneof response { + BitBoxSyncIdentityResponse identity = 1; + BitBoxSyncSignatureResponse signature = 2; + BitBoxSyncUnwrapNamespaceDEKResponse unwrap_namespace_dek = 3; + } +} diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bluetooth.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bluetooth.pb.go index dcd965f946..a7eed77360 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bluetooth.pb.go +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/bluetooth.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v3.21.12 // source: bluetooth.proto diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/btc.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/btc.pb.go index c6c9cb80e6..d1b2c9f098 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/btc.pb.go +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/btc.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v3.21.12 // source: btc.proto diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/cardano.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/cardano.pb.go index 0bf1c78374..96a3350afa 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/cardano.pb.go +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/cardano.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v3.21.12 // source: cardano.proto diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/common.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/common.pb.go index 21459b77fa..9edaab9dfb 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/common.pb.go +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/common.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v3.21.12 // source: common.proto diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/eth.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/eth.pb.go index 8845194dd7..d996253074 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/eth.pb.go +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/eth.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v3.21.12 // source: eth.proto diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/generate.sh b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/generate.sh index fc041e9e97..da140ff769 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/generate.sh +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/generate.sh @@ -10,6 +10,7 @@ do OPTS="${OPTS} --go_opt=M$(basename ${f})=github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages" done protoc --proto_path=${DIR} \ + --proto_path=/usr/include \ ${OPTS} \ --go_out="paths=source_relative:${DIR}" \ $FILES diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/hww.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/hww.pb.go index 8f38d287b2..8b931d240c 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/hww.pb.go +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/hww.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v3.21.12 // source: hww.proto @@ -143,6 +143,7 @@ type Request struct { // *Request_Bip85 // *Request_Bluetooth // *Request_ChangePassword + // *Request_BitboxSync Request isRequest_Request `protobuf_oneof:"request"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -437,6 +438,15 @@ func (x *Request) GetChangePassword() *ChangePasswordRequest { return nil } +func (x *Request) GetBitboxSync() *BitBoxSyncRequest { + if x != nil { + if x, ok := x.Request.(*Request_BitboxSync); ok { + return x.BitboxSync + } + } + return nil +} + type isRequest_Request interface { isRequest_Request() } @@ -555,6 +565,10 @@ type Request_ChangePassword struct { ChangePassword *ChangePasswordRequest `protobuf:"bytes,30,opt,name=change_password,json=changePassword,proto3,oneof"` } +type Request_BitboxSync struct { + BitboxSync *BitBoxSyncRequest `protobuf:"bytes,31,opt,name=bitbox_sync,json=bitboxSync,proto3,oneof"` +} + func (*Request_DeviceName) isRequest_Request() {} func (*Request_DeviceLanguage) isRequest_Request() {} @@ -611,6 +625,8 @@ func (*Request_Bluetooth) isRequest_Request() {} func (*Request_ChangePassword) isRequest_Request() {} +func (*Request_BitboxSync) isRequest_Request() {} + type Response struct { state protoimpl.MessageState `protogen:"open.v1"` // Types that are valid to be assigned to Response: @@ -631,6 +647,7 @@ type Response struct { // *Response_Cardano // *Response_Bip85 // *Response_Bluetooth + // *Response_BitboxSync Response isResponse_Response `protobuf_oneof:"response"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -817,6 +834,15 @@ func (x *Response) GetBluetooth() *BluetoothResponse { return nil } +func (x *Response) GetBitboxSync() *BitBoxSyncResponse { + if x != nil { + if x, ok := x.Response.(*Response_BitboxSync); ok { + return x.BitboxSync + } + } + return nil +} + type isResponse_Response interface { isResponse_Response() } @@ -886,6 +912,10 @@ type Response_Bluetooth struct { Bluetooth *BluetoothResponse `protobuf:"bytes,17,opt,name=bluetooth,proto3,oneof"` } +type Response_BitboxSync struct { + BitboxSync *BitBoxSyncResponse `protobuf:"bytes,18,opt,name=bitbox_sync,json=bitboxSync,proto3,oneof"` +} + func (*Response_Success) isResponse_Response() {} func (*Response_Error) isResponse_Response() {} @@ -918,15 +948,17 @@ func (*Response_Bip85) isResponse_Response() {} func (*Response_Bluetooth) isResponse_Response() {} +func (*Response_BitboxSync) isResponse_Response() {} + var File_hww_proto protoreflect.FileDescriptor const file_hww_proto_rawDesc = "" + "\n" + - "\thww.proto\x12\x14shiftcrypto.bitbox02\x1a\fcommon.proto\x1a\x15backup_commands.proto\x1a\x15bitbox02_system.proto\x1a\x0fbluetooth.proto\x1a\tbtc.proto\x1a\rcardano.proto\x1a\teth.proto\x1a\x0ekeystore.proto\x1a\x0emnemonic.proto\x1a\fsystem.proto\x1a\x19perform_attestation.proto\"5\n" + + "\thww.proto\x12\x14shiftcrypto.bitbox02\x1a\fcommon.proto\x1a\x15backup_commands.proto\x1a\x15bitbox02_system.proto\x1a\x10bitboxsync.proto\x1a\x0fbluetooth.proto\x1a\tbtc.proto\x1a\rcardano.proto\x1a\teth.proto\x1a\x0ekeystore.proto\x1a\x0emnemonic.proto\x1a\fsystem.proto\x1a\x19perform_attestation.proto\"5\n" + "\x05Error\x12\x12\n" + "\x04code\x18\x01 \x01(\x05R\x04code\x12\x18\n" + "\amessage\x18\x02 \x01(\tR\amessage\"\t\n" + - "\aSuccess\"\xff\x11\n" + + "\aSuccess\"\xcb\x12\n" + "\aRequest\x12M\n" + "\vdevice_name\x18\x02 \x01(\v2*.shiftcrypto.bitbox02.SetDeviceNameRequestH\x00R\n" + "deviceName\x12Y\n" + @@ -958,8 +990,10 @@ const file_hww_proto_rawDesc = "" + "\acardano\x18\x1b \x01(\v2$.shiftcrypto.bitbox02.CardanoRequestH\x00R\acardano\x12:\n" + "\x05bip85\x18\x1c \x01(\v2\".shiftcrypto.bitbox02.BIP85RequestH\x00R\x05bip85\x12F\n" + "\tbluetooth\x18\x1d \x01(\v2&.shiftcrypto.bitbox02.BluetoothRequestH\x00R\tbluetooth\x12V\n" + - "\x0fchange_password\x18\x1e \x01(\v2+.shiftcrypto.bitbox02.ChangePasswordRequestH\x00R\x0echangePasswordB\t\n" + - "\arequestJ\x04\b\x01\x10\x02J\x04\b\x17\x10\x18\"\xaf\t\n" + + "\x0fchange_password\x18\x1e \x01(\v2+.shiftcrypto.bitbox02.ChangePasswordRequestH\x00R\x0echangePassword\x12J\n" + + "\vbitbox_sync\x18\x1f \x01(\v2'.shiftcrypto.bitbox02.BitBoxSyncRequestH\x00R\n" + + "bitboxSyncB\t\n" + + "\arequestJ\x04\b\x01\x10\x02J\x04\b\x17\x10\x18\"\xfc\t\n" + "\bResponse\x129\n" + "\asuccess\x18\x01 \x01(\v2\x1d.shiftcrypto.bitbox02.SuccessH\x00R\asuccess\x123\n" + "\x05error\x18\x02 \x01(\v2\x1b.shiftcrypto.bitbox02.ErrorH\x00R\x05error\x12K\n" + @@ -978,7 +1012,9 @@ const file_hww_proto_rawDesc = "" + "\x17electrum_encryption_key\x18\x0e \x01(\v23.shiftcrypto.bitbox02.ElectrumEncryptionKeyResponseH\x00R\x15electrumEncryptionKey\x12A\n" + "\acardano\x18\x0f \x01(\v2%.shiftcrypto.bitbox02.CardanoResponseH\x00R\acardano\x12;\n" + "\x05bip85\x18\x10 \x01(\v2#.shiftcrypto.bitbox02.BIP85ResponseH\x00R\x05bip85\x12G\n" + - "\tbluetooth\x18\x11 \x01(\v2'.shiftcrypto.bitbox02.BluetoothResponseH\x00R\tbluetoothB\n" + + "\tbluetooth\x18\x11 \x01(\v2'.shiftcrypto.bitbox02.BluetoothResponseH\x00R\tbluetooth\x12K\n" + + "\vbitbox_sync\x18\x12 \x01(\v2(.shiftcrypto.bitbox02.BitBoxSyncResponseH\x00R\n" + + "bitboxSyncB\n" + "\n" + "\bresponseJ\x04\b\x03\x10\x04b\x06proto3" @@ -1028,20 +1064,22 @@ var file_hww_proto_goTypes = []any{ (*BIP85Request)(nil), // 29: shiftcrypto.bitbox02.BIP85Request (*BluetoothRequest)(nil), // 30: shiftcrypto.bitbox02.BluetoothRequest (*ChangePasswordRequest)(nil), // 31: shiftcrypto.bitbox02.ChangePasswordRequest - (*DeviceInfoResponse)(nil), // 32: shiftcrypto.bitbox02.DeviceInfoResponse - (*PubResponse)(nil), // 33: shiftcrypto.bitbox02.PubResponse - (*BTCSignNextResponse)(nil), // 34: shiftcrypto.bitbox02.BTCSignNextResponse - (*ListBackupsResponse)(nil), // 35: shiftcrypto.bitbox02.ListBackupsResponse - (*CheckBackupResponse)(nil), // 36: shiftcrypto.bitbox02.CheckBackupResponse - (*PerformAttestationResponse)(nil), // 37: shiftcrypto.bitbox02.PerformAttestationResponse - (*CheckSDCardResponse)(nil), // 38: shiftcrypto.bitbox02.CheckSDCardResponse - (*ETHResponse)(nil), // 39: shiftcrypto.bitbox02.ETHResponse - (*RootFingerprintResponse)(nil), // 40: shiftcrypto.bitbox02.RootFingerprintResponse - (*BTCResponse)(nil), // 41: shiftcrypto.bitbox02.BTCResponse - (*ElectrumEncryptionKeyResponse)(nil), // 42: shiftcrypto.bitbox02.ElectrumEncryptionKeyResponse - (*CardanoResponse)(nil), // 43: shiftcrypto.bitbox02.CardanoResponse - (*BIP85Response)(nil), // 44: shiftcrypto.bitbox02.BIP85Response - (*BluetoothResponse)(nil), // 45: shiftcrypto.bitbox02.BluetoothResponse + (*BitBoxSyncRequest)(nil), // 32: shiftcrypto.bitbox02.BitBoxSyncRequest + (*DeviceInfoResponse)(nil), // 33: shiftcrypto.bitbox02.DeviceInfoResponse + (*PubResponse)(nil), // 34: shiftcrypto.bitbox02.PubResponse + (*BTCSignNextResponse)(nil), // 35: shiftcrypto.bitbox02.BTCSignNextResponse + (*ListBackupsResponse)(nil), // 36: shiftcrypto.bitbox02.ListBackupsResponse + (*CheckBackupResponse)(nil), // 37: shiftcrypto.bitbox02.CheckBackupResponse + (*PerformAttestationResponse)(nil), // 38: shiftcrypto.bitbox02.PerformAttestationResponse + (*CheckSDCardResponse)(nil), // 39: shiftcrypto.bitbox02.CheckSDCardResponse + (*ETHResponse)(nil), // 40: shiftcrypto.bitbox02.ETHResponse + (*RootFingerprintResponse)(nil), // 41: shiftcrypto.bitbox02.RootFingerprintResponse + (*BTCResponse)(nil), // 42: shiftcrypto.bitbox02.BTCResponse + (*ElectrumEncryptionKeyResponse)(nil), // 43: shiftcrypto.bitbox02.ElectrumEncryptionKeyResponse + (*CardanoResponse)(nil), // 44: shiftcrypto.bitbox02.CardanoResponse + (*BIP85Response)(nil), // 45: shiftcrypto.bitbox02.BIP85Response + (*BluetoothResponse)(nil), // 46: shiftcrypto.bitbox02.BluetoothResponse + (*BitBoxSyncResponse)(nil), // 47: shiftcrypto.bitbox02.BitBoxSyncResponse } var file_hww_proto_depIdxs = []int32{ 4, // 0: shiftcrypto.bitbox02.Request.device_name:type_name -> shiftcrypto.bitbox02.SetDeviceNameRequest @@ -1072,27 +1110,29 @@ var file_hww_proto_depIdxs = []int32{ 29, // 25: shiftcrypto.bitbox02.Request.bip85:type_name -> shiftcrypto.bitbox02.BIP85Request 30, // 26: shiftcrypto.bitbox02.Request.bluetooth:type_name -> shiftcrypto.bitbox02.BluetoothRequest 31, // 27: shiftcrypto.bitbox02.Request.change_password:type_name -> shiftcrypto.bitbox02.ChangePasswordRequest - 1, // 28: shiftcrypto.bitbox02.Response.success:type_name -> shiftcrypto.bitbox02.Success - 0, // 29: shiftcrypto.bitbox02.Response.error:type_name -> shiftcrypto.bitbox02.Error - 32, // 30: shiftcrypto.bitbox02.Response.device_info:type_name -> shiftcrypto.bitbox02.DeviceInfoResponse - 33, // 31: shiftcrypto.bitbox02.Response.pub:type_name -> shiftcrypto.bitbox02.PubResponse - 34, // 32: shiftcrypto.bitbox02.Response.btc_sign_next:type_name -> shiftcrypto.bitbox02.BTCSignNextResponse - 35, // 33: shiftcrypto.bitbox02.Response.list_backups:type_name -> shiftcrypto.bitbox02.ListBackupsResponse - 36, // 34: shiftcrypto.bitbox02.Response.check_backup:type_name -> shiftcrypto.bitbox02.CheckBackupResponse - 37, // 35: shiftcrypto.bitbox02.Response.perform_attestation:type_name -> shiftcrypto.bitbox02.PerformAttestationResponse - 38, // 36: shiftcrypto.bitbox02.Response.check_sdcard:type_name -> shiftcrypto.bitbox02.CheckSDCardResponse - 39, // 37: shiftcrypto.bitbox02.Response.eth:type_name -> shiftcrypto.bitbox02.ETHResponse - 40, // 38: shiftcrypto.bitbox02.Response.fingerprint:type_name -> shiftcrypto.bitbox02.RootFingerprintResponse - 41, // 39: shiftcrypto.bitbox02.Response.btc:type_name -> shiftcrypto.bitbox02.BTCResponse - 42, // 40: shiftcrypto.bitbox02.Response.electrum_encryption_key:type_name -> shiftcrypto.bitbox02.ElectrumEncryptionKeyResponse - 43, // 41: shiftcrypto.bitbox02.Response.cardano:type_name -> shiftcrypto.bitbox02.CardanoResponse - 44, // 42: shiftcrypto.bitbox02.Response.bip85:type_name -> shiftcrypto.bitbox02.BIP85Response - 45, // 43: shiftcrypto.bitbox02.Response.bluetooth:type_name -> shiftcrypto.bitbox02.BluetoothResponse - 44, // [44:44] is the sub-list for method output_type - 44, // [44:44] is the sub-list for method input_type - 44, // [44:44] is the sub-list for extension type_name - 44, // [44:44] is the sub-list for extension extendee - 0, // [0:44] is the sub-list for field type_name + 32, // 28: shiftcrypto.bitbox02.Request.bitbox_sync:type_name -> shiftcrypto.bitbox02.BitBoxSyncRequest + 1, // 29: shiftcrypto.bitbox02.Response.success:type_name -> shiftcrypto.bitbox02.Success + 0, // 30: shiftcrypto.bitbox02.Response.error:type_name -> shiftcrypto.bitbox02.Error + 33, // 31: shiftcrypto.bitbox02.Response.device_info:type_name -> shiftcrypto.bitbox02.DeviceInfoResponse + 34, // 32: shiftcrypto.bitbox02.Response.pub:type_name -> shiftcrypto.bitbox02.PubResponse + 35, // 33: shiftcrypto.bitbox02.Response.btc_sign_next:type_name -> shiftcrypto.bitbox02.BTCSignNextResponse + 36, // 34: shiftcrypto.bitbox02.Response.list_backups:type_name -> shiftcrypto.bitbox02.ListBackupsResponse + 37, // 35: shiftcrypto.bitbox02.Response.check_backup:type_name -> shiftcrypto.bitbox02.CheckBackupResponse + 38, // 36: shiftcrypto.bitbox02.Response.perform_attestation:type_name -> shiftcrypto.bitbox02.PerformAttestationResponse + 39, // 37: shiftcrypto.bitbox02.Response.check_sdcard:type_name -> shiftcrypto.bitbox02.CheckSDCardResponse + 40, // 38: shiftcrypto.bitbox02.Response.eth:type_name -> shiftcrypto.bitbox02.ETHResponse + 41, // 39: shiftcrypto.bitbox02.Response.fingerprint:type_name -> shiftcrypto.bitbox02.RootFingerprintResponse + 42, // 40: shiftcrypto.bitbox02.Response.btc:type_name -> shiftcrypto.bitbox02.BTCResponse + 43, // 41: shiftcrypto.bitbox02.Response.electrum_encryption_key:type_name -> shiftcrypto.bitbox02.ElectrumEncryptionKeyResponse + 44, // 42: shiftcrypto.bitbox02.Response.cardano:type_name -> shiftcrypto.bitbox02.CardanoResponse + 45, // 43: shiftcrypto.bitbox02.Response.bip85:type_name -> shiftcrypto.bitbox02.BIP85Response + 46, // 44: shiftcrypto.bitbox02.Response.bluetooth:type_name -> shiftcrypto.bitbox02.BluetoothResponse + 47, // 45: shiftcrypto.bitbox02.Response.bitbox_sync:type_name -> shiftcrypto.bitbox02.BitBoxSyncResponse + 46, // [46:46] is the sub-list for method output_type + 46, // [46:46] is the sub-list for method input_type + 46, // [46:46] is the sub-list for extension type_name + 46, // [46:46] is the sub-list for extension extendee + 0, // [0:46] is the sub-list for field type_name } func init() { file_hww_proto_init() } @@ -1103,6 +1143,7 @@ func file_hww_proto_init() { file_common_proto_init() file_backup_commands_proto_init() file_bitbox02_system_proto_init() + file_bitboxsync_proto_init() file_bluetooth_proto_init() file_btc_proto_init() file_cardano_proto_init() @@ -1140,6 +1181,7 @@ func file_hww_proto_init() { (*Request_Bip85)(nil), (*Request_Bluetooth)(nil), (*Request_ChangePassword)(nil), + (*Request_BitboxSync)(nil), } file_hww_proto_msgTypes[3].OneofWrappers = []any{ (*Response_Success)(nil), @@ -1158,6 +1200,7 @@ func file_hww_proto_init() { (*Response_Cardano)(nil), (*Response_Bip85)(nil), (*Response_Bluetooth)(nil), + (*Response_BitboxSync)(nil), } type x struct{} out := protoimpl.TypeBuilder{ diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/hww.proto b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/hww.proto index 07cb66054d..39c7a05361 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/hww.proto +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/hww.proto @@ -7,6 +7,7 @@ import "common.proto"; import "backup_commands.proto"; import "bitbox02_system.proto"; +import "bitboxsync.proto"; import "bluetooth.proto"; import "btc.proto"; import "cardano.proto"; @@ -58,6 +59,7 @@ message Request { BIP85Request bip85 = 28; BluetoothRequest bluetooth = 29; ChangePasswordRequest change_password = 30; + BitBoxSyncRequest bitbox_sync = 31; } } @@ -81,5 +83,6 @@ message Response { CardanoResponse cardano = 15; BIP85Response bip85 = 16; BluetoothResponse bluetooth = 17; + BitBoxSyncResponse bitbox_sync = 18; } } diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/keystore.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/keystore.pb.go index ef2563dc87..e8120a5447 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/keystore.pb.go +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/keystore.pb.go @@ -5,7 +5,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v3.21.12 // source: keystore.proto diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/mnemonic.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/mnemonic.pb.go index ca26bc650b..eac7df74d0 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/mnemonic.pb.go +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/mnemonic.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v3.21.12 // source: mnemonic.proto diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/perform_attestation.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/perform_attestation.pb.go index 1c3ed23986..52788f5f60 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/perform_attestation.pb.go +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/perform_attestation.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v3.21.12 // source: perform_attestation.proto diff --git a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/system.pb.go b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/system.pb.go index 28b16b493a..73560c7b79 100644 --- a/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/system.pb.go +++ b/vendor/github.com/BitBoxSwiss/bitbox02-api-go/api/firmware/messages/system.pb.go @@ -2,7 +2,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.11 +// protoc-gen-go v1.36.6 // protoc v3.21.12 // source: system.proto diff --git a/vendor/github.com/stretchr/testify/assert/assertion_compare.go b/vendor/github.com/stretchr/testify/assert/assertion_compare.go index 7e19eba090..ffb24e8e31 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_compare.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_compare.go @@ -390,7 +390,8 @@ func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []compareResult{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not greater than \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareGreater}, failMessage, msgAndArgs...) } // GreaterOrEqual asserts that the first element is greater than or equal to the second @@ -403,7 +404,8 @@ func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...in if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []compareResult{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not greater than or equal to \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareGreater, compareEqual}, failMessage, msgAndArgs...) } // Less asserts that the first element is less than the second @@ -415,7 +417,8 @@ func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []compareResult{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not less than \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareLess}, failMessage, msgAndArgs...) } // LessOrEqual asserts that the first element is less than or equal to the second @@ -428,7 +431,8 @@ func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...inter if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []compareResult{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not less than or equal to \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareLess, compareEqual}, failMessage, msgAndArgs...) } // Positive asserts that the specified element is positive @@ -440,7 +444,8 @@ func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { h.Helper() } zero := reflect.Zero(reflect.TypeOf(e)) - return compareTwoValues(t, e, zero.Interface(), []compareResult{compareGreater}, "\"%v\" is not positive", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not positive", e) + return compareTwoValues(t, e, zero.Interface(), []compareResult{compareGreater}, failMessage, msgAndArgs...) } // Negative asserts that the specified element is negative @@ -452,7 +457,8 @@ func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { h.Helper() } zero := reflect.Zero(reflect.TypeOf(e)) - return compareTwoValues(t, e, zero.Interface(), []compareResult{compareLess}, "\"%v\" is not negative", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not negative", e) + return compareTwoValues(t, e, zero.Interface(), []compareResult{compareLess}, failMessage, msgAndArgs...) } func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool { @@ -468,11 +474,11 @@ func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedCompare compareResult, isComparable := compare(e1, e2, e1Kind) if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\"", reflect.TypeOf(e1)), msgAndArgs...) + return Fail(t, fmt.Sprintf(`Can not compare type "%T"`, e1), msgAndArgs...) } if !containsValue(allowedComparesResults, compareResult) { - return Fail(t, fmt.Sprintf(failMessage, e1, e2), msgAndArgs...) + return Fail(t, failMessage, msgAndArgs...) } return true diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go b/vendor/github.com/stretchr/testify/assert/assertion_format.go index 1906341657..c592f6ad5f 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_format.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_format.go @@ -50,10 +50,19 @@ func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) } -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Emptyf asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // assert.Emptyf(t, obj, "error message %s", "formatted") +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -117,10 +126,8 @@ func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg stri // Errorf asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if assert.Errorf(t, err, "error message %s", "formatted") { -// assert.Equal(t, expectedErrorf, err) -// } +// actualObj, err := SomeFunction() +// assert.Errorf(t, err, "error message %s", "formatted") func Errorf(t TestingT, err error, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -438,7 +445,19 @@ func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interf return IsNonIncreasing(t, object, append([]interface{}{msg}, args...)...) } +// IsNotTypef asserts that the specified objects are not of the same type. +// +// assert.IsNotTypef(t, &NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") +func IsNotTypef(t TestingT, theType interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return IsNotType(t, theType, object, append([]interface{}{msg}, args...)...) +} + // IsTypef asserts that the specified objects are of the same type. +// +// assert.IsTypef(t, &MyStruct{}, &MyStruct{}, "error message %s", "formatted") func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -585,8 +604,7 @@ func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg str return NotElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) } -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmptyf asserts that the specified object is NOT [Empty]. // // if assert.NotEmptyf(t, obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) @@ -693,12 +711,15 @@ func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, return NotSame(t, expected, actual, append([]interface{}{msg}, args...)...) } -// NotSubsetf asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // assert.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted") // assert.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") +// assert.NotSubsetf(t, [1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") +// assert.NotSubsetf(t, {"x": 1, "y": 2}, ["z"], "error message %s", "formatted") func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -782,11 +803,15 @@ func Samef(t TestingT, expected interface{}, actual interface{}, msg string, arg return Same(t, expected, actual, append([]interface{}{msg}, args...)...) } -// Subsetf asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subsetf asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // assert.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted") // assert.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") +// assert.Subsetf(t, [1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") +// assert.Subsetf(t, {"x": 1, "y": 2}, ["x"], "error message %s", "formatted") func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go index 21629087ba..58db928450 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go @@ -92,10 +92,19 @@ func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg st return ElementsMatchf(a.t, listA, listB, msg, args...) } -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Empty asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // a.Empty(obj) +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -103,10 +112,19 @@ func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { return Empty(a.t, object, msgAndArgs...) } -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Emptyf asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // a.Emptyf(obj, "error message %s", "formatted") +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -224,10 +242,8 @@ func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string // Error asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if a.Error(err) { -// assert.Equal(t, expectedError, err) -// } +// actualObj, err := SomeFunction() +// a.Error(err) func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -297,10 +313,8 @@ func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...inter // Errorf asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if a.Errorf(err, "error message %s", "formatted") { -// assert.Equal(t, expectedErrorf, err) -// } +// actualObj, err := SomeFunction() +// a.Errorf(err, "error message %s", "formatted") func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -868,7 +882,29 @@ func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...in return IsNonIncreasingf(a.t, object, msg, args...) } +// IsNotType asserts that the specified objects are not of the same type. +// +// a.IsNotType(&NotMyStruct{}, &MyStruct{}) +func (a *Assertions) IsNotType(theType interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNotType(a.t, theType, object, msgAndArgs...) +} + +// IsNotTypef asserts that the specified objects are not of the same type. +// +// a.IsNotTypef(&NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") +func (a *Assertions) IsNotTypef(theType interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNotTypef(a.t, theType, object, msg, args...) +} + // IsType asserts that the specified objects are of the same type. +// +// a.IsType(&MyStruct{}, &MyStruct{}) func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -877,6 +913,8 @@ func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAnd } // IsTypef asserts that the specified objects are of the same type. +// +// a.IsTypef(&MyStruct{}, &MyStruct{}, "error message %s", "formatted") func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1162,8 +1200,7 @@ func (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg return NotElementsMatchf(a.t, listA, listB, msg, args...) } -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmpty asserts that the specified object is NOT [Empty]. // // if a.NotEmpty(obj) { // assert.Equal(t, "two", obj[1]) @@ -1175,8 +1212,7 @@ func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) boo return NotEmpty(a.t, object, msgAndArgs...) } -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmptyf asserts that the specified object is NOT [Empty]. // // if a.NotEmptyf(obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) @@ -1378,12 +1414,15 @@ func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg stri return NotSamef(a.t, expected, actual, msg, args...) } -// NotSubset asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubset asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.NotSubset([1, 3, 4], [1, 2]) // a.NotSubset({"x": 1, "y": 2}, {"z": 3}) +// a.NotSubset([1, 3, 4], {1: "one", 2: "two"}) +// a.NotSubset({"x": 1, "y": 2}, ["z"]) func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1391,12 +1430,15 @@ func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs return NotSubset(a.t, list, subset, msgAndArgs...) } -// NotSubsetf asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted") // a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") +// a.NotSubsetf([1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") +// a.NotSubsetf({"x": 1, "y": 2}, ["z"], "error message %s", "formatted") func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1556,11 +1598,15 @@ func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, return Samef(a.t, expected, actual, msg, args...) } -// Subset asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subset asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.Subset([1, 2, 3], [1, 2]) // a.Subset({"x": 1, "y": 2}, {"x": 1}) +// a.Subset([1, 2, 3], {1: "one", 2: "two"}) +// a.Subset({"x": 1, "y": 2}, ["x"]) func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1568,11 +1614,15 @@ func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ... return Subset(a.t, list, subset, msgAndArgs...) } -// Subsetf asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subsetf asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted") // a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") +// a.Subsetf([1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") +// a.Subsetf({"x": 1, "y": 2}, ["x"], "error message %s", "formatted") func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() diff --git a/vendor/github.com/stretchr/testify/assert/assertion_order.go b/vendor/github.com/stretchr/testify/assert/assertion_order.go index 1d2f71824a..2fdf80fdd3 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_order.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_order.go @@ -33,7 +33,7 @@ func isOrdered(t TestingT, object interface{}, allowedComparesResults []compareR compareResult, isComparable := compare(prevValueInterface, valueInterface, firstValueKind) if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\" and \"%s\"", reflect.TypeOf(value), reflect.TypeOf(prevValue)), msgAndArgs...) + return Fail(t, fmt.Sprintf(`Can not compare type "%T" and "%T"`, value, prevValue), msgAndArgs...) } if !containsValue(allowedComparesResults, compareResult) { diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go index 4e91332bb5..de8de0cb6c 100644 --- a/vendor/github.com/stretchr/testify/assert/assertions.go +++ b/vendor/github.com/stretchr/testify/assert/assertions.go @@ -210,59 +210,77 @@ the problem actually occurred in calling code.*/ // of each stack frame leading from the current test to the assert call that // failed. func CallerInfo() []string { - var pc uintptr - var ok bool var file string var line int var name string + const stackFrameBufferSize = 10 + pcs := make([]uintptr, stackFrameBufferSize) + callers := []string{} - for i := 0; ; i++ { - pc, file, line, ok = runtime.Caller(i) - if !ok { - // The breaks below failed to terminate the loop, and we ran off the - // end of the call stack. - break - } + offset := 1 - // This is a huge edge case, but it will panic if this is the case, see #180 - if file == "" { - break - } + for { + n := runtime.Callers(offset, pcs) - f := runtime.FuncForPC(pc) - if f == nil { - break - } - name = f.Name() - - // testing.tRunner is the standard library function that calls - // tests. Subtests are called directly by tRunner, without going through - // the Test/Benchmark/Example function that contains the t.Run calls, so - // with subtests we should break when we hit tRunner, without adding it - // to the list of callers. - if name == "testing.tRunner" { + if n == 0 { break } - parts := strings.Split(file, "/") - if len(parts) > 1 { - filename := parts[len(parts)-1] - dir := parts[len(parts)-2] - if (dir != "assert" && dir != "mock" && dir != "require") || filename == "mock_test.go" { - callers = append(callers, fmt.Sprintf("%s:%d", file, line)) + frames := runtime.CallersFrames(pcs[:n]) + + for { + frame, more := frames.Next() + pc = frame.PC + file = frame.File + line = frame.Line + + // This is a huge edge case, but it will panic if this is the case, see #180 + if file == "" { + break } - } - // Drop the package - segments := strings.Split(name, ".") - name = segments[len(segments)-1] - if isTest(name, "Test") || - isTest(name, "Benchmark") || - isTest(name, "Example") { - break + f := runtime.FuncForPC(pc) + if f == nil { + break + } + name = f.Name() + + // testing.tRunner is the standard library function that calls + // tests. Subtests are called directly by tRunner, without going through + // the Test/Benchmark/Example function that contains the t.Run calls, so + // with subtests we should break when we hit tRunner, without adding it + // to the list of callers. + if name == "testing.tRunner" { + break + } + + parts := strings.Split(file, "/") + if len(parts) > 1 { + filename := parts[len(parts)-1] + dir := parts[len(parts)-2] + if (dir != "assert" && dir != "mock" && dir != "require") || filename == "mock_test.go" { + callers = append(callers, fmt.Sprintf("%s:%d", file, line)) + } + } + + // Drop the package + dotPos := strings.LastIndexByte(name, '.') + name = name[dotPos+1:] + if isTest(name, "Test") || + isTest(name, "Benchmark") || + isTest(name, "Example") { + break + } + + if !more { + break + } } + + // Next batch + offset += cap(pcs) } return callers @@ -437,17 +455,34 @@ func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, return true } +func isType(expectedType, object interface{}) bool { + return ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) +} + // IsType asserts that the specified objects are of the same type. -func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { +// +// assert.IsType(t, &MyStruct{}, &MyStruct{}) +func IsType(t TestingT, expectedType, object interface{}, msgAndArgs ...interface{}) bool { + if isType(expectedType, object) { + return true + } if h, ok := t.(tHelper); ok { h.Helper() } + return Fail(t, fmt.Sprintf("Object expected to be of type %T, but was %T", expectedType, object), msgAndArgs...) +} - if !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) { - return Fail(t, fmt.Sprintf("Object expected to be of type %v, but was %v", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...) +// IsNotType asserts that the specified objects are not of the same type. +// +// assert.IsNotType(t, &NotMyStruct{}, &MyStruct{}) +func IsNotType(t TestingT, theType, object interface{}, msgAndArgs ...interface{}) bool { + if !isType(theType, object) { + return true } - - return true + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Fail(t, fmt.Sprintf("Object type expected to be different than %T", theType), msgAndArgs...) } // Equal asserts that two objects are equal. @@ -475,7 +510,6 @@ func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) } return true - } // validateEqualArgs checks whether provided arguments can be safely used in the @@ -510,8 +544,9 @@ func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) b if !same { // both are pointers but not the same type & pointing to the same address return Fail(t, fmt.Sprintf("Not same: \n"+ - "expected: %p %#v\n"+ - "actual : %p %#v", expected, expected, actual, actual), msgAndArgs...) + "expected: %p %#[1]v\n"+ + "actual : %p %#[2]v", + expected, actual), msgAndArgs...) } return true @@ -530,14 +565,14 @@ func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} same, ok := samePointers(expected, actual) if !ok { - //fails when the arguments are not pointers + // fails when the arguments are not pointers return !(Fail(t, "Both arguments must be pointers", msgAndArgs...)) } if same { return Fail(t, fmt.Sprintf( - "Expected and actual point to the same object: %p %#v", - expected, expected), msgAndArgs...) + "Expected and actual point to the same object: %p %#[1]v", + expected), msgAndArgs...) } return true } @@ -549,7 +584,7 @@ func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} func samePointers(first, second interface{}) (same bool, ok bool) { firstPtr, secondPtr := reflect.ValueOf(first), reflect.ValueOf(second) if firstPtr.Kind() != reflect.Ptr || secondPtr.Kind() != reflect.Ptr { - return false, false //not both are pointers + return false, false // not both are pointers } firstType, secondType := reflect.TypeOf(first), reflect.TypeOf(second) @@ -610,7 +645,6 @@ func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interfa } return true - } // EqualExportedValues asserts that the types of two objects are equal and their public @@ -665,7 +699,6 @@ func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} } return Equal(t, expected, actual, msgAndArgs...) - } // NotNil asserts that the specified object is not nil. @@ -715,37 +748,45 @@ func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { // isEmpty gets whether the specified object is considered empty or not. func isEmpty(object interface{}) bool { - // get nil case out of the way if object == nil { return true } - objValue := reflect.ValueOf(object) + return isEmptyValue(reflect.ValueOf(object)) +} +// isEmptyValue gets whether the specified reflect.Value is considered empty or not. +func isEmptyValue(objValue reflect.Value) bool { + if objValue.IsZero() { + return true + } + // Special cases of non-zero values that we consider empty switch objValue.Kind() { // collection types are empty when they have no element + // Note: array types are empty when they match their zero-initialized state. case reflect.Chan, reflect.Map, reflect.Slice: return objValue.Len() == 0 - // pointers are empty if nil or if the value they point to is empty + // non-nil pointers are empty if the value they point to is empty case reflect.Ptr: - if objValue.IsNil() { - return true - } - deref := objValue.Elem().Interface() - return isEmpty(deref) - // for all other types, compare against the zero value - // array types are empty when they match their zero-initialized state - default: - zero := reflect.Zero(objValue.Type()) - return reflect.DeepEqual(object, zero.Interface()) + return isEmptyValue(objValue.Elem()) } + return false } -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Empty asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // assert.Empty(t, obj) +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { pass := isEmpty(object) if !pass { @@ -756,11 +797,9 @@ func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { } return pass - } -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmpty asserts that the specified object is NOT [Empty]. // // if assert.NotEmpty(t, obj) { // assert.Equal(t, "two", obj[1]) @@ -775,7 +814,6 @@ func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { } return pass - } // getLen tries to get the length of an object. @@ -819,7 +857,6 @@ func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { } return true - } // False asserts that the specified value is false. @@ -834,7 +871,6 @@ func False(t TestingT, value bool, msgAndArgs ...interface{}) bool { } return true - } // NotEqual asserts that the specified values are NOT equal. @@ -857,7 +893,6 @@ func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{ } return true - } // NotEqualValues asserts that two objects are not equal even when converted to the same type @@ -880,7 +915,6 @@ func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...inte // return (true, false) if element was not found. // return (true, true) if element was found. func containsElement(list interface{}, element interface{}) (ok, found bool) { - listValue := reflect.ValueOf(list) listType := reflect.TypeOf(list) if listType == nil { @@ -915,7 +949,6 @@ func containsElement(list interface{}, element interface{}) (ok, found bool) { } } return true, false - } // Contains asserts that the specified string, list(array, slice...) or map contains the @@ -938,7 +971,6 @@ func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bo } return true - } // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the @@ -961,14 +993,17 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) } return true - } -// Subset asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subset asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // assert.Subset(t, [1, 2, 3], [1, 2]) // assert.Subset(t, {"x": 1, "y": 2}, {"x": 1}) +// assert.Subset(t, [1, 2, 3], {1: "one", 2: "two"}) +// assert.Subset(t, {"x": 1, "y": 2}, ["x"]) func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { if h, ok := t.(tHelper); ok { h.Helper() @@ -983,7 +1018,7 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok } subsetKind := reflect.TypeOf(subset).Kind() - if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map { + if subsetKind != reflect.Array && subsetKind != reflect.Slice && subsetKind != reflect.Map { return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) } @@ -1007,6 +1042,13 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok } subsetList := reflect.ValueOf(subset) + if subsetKind == reflect.Map { + keys := make([]interface{}, subsetList.Len()) + for idx, key := range subsetList.MapKeys() { + keys[idx] = key.Interface() + } + subsetList = reflect.ValueOf(keys) + } for i := 0; i < subsetList.Len(); i++ { element := subsetList.Index(i).Interface() ok, found := containsElement(list, element) @@ -1021,12 +1063,15 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok return true } -// NotSubset asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubset asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // assert.NotSubset(t, [1, 3, 4], [1, 2]) // assert.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}) +// assert.NotSubset(t, [1, 3, 4], {1: "one", 2: "two"}) +// assert.NotSubset(t, {"x": 1, "y": 2}, ["z"]) func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1041,7 +1086,7 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) } subsetKind := reflect.TypeOf(subset).Kind() - if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map { + if subsetKind != reflect.Array && subsetKind != reflect.Slice && subsetKind != reflect.Map { return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) } @@ -1065,11 +1110,18 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) } subsetList := reflect.ValueOf(subset) + if subsetKind == reflect.Map { + keys := make([]interface{}, subsetList.Len()) + for idx, key := range subsetList.MapKeys() { + keys[idx] = key.Interface() + } + subsetList = reflect.ValueOf(keys) + } for i := 0; i < subsetList.Len(); i++ { element := subsetList.Index(i).Interface() ok, found := containsElement(list, element) if !ok { - return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...) + return Fail(t, fmt.Sprintf("%q could not be applied builtin len()", list), msgAndArgs...) } if !found { return true @@ -1591,10 +1643,8 @@ func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { // Error asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if assert.Error(t, err) { -// assert.Equal(t, expectedError, err) -// } +// actualObj, err := SomeFunction() +// assert.Error(t, err) func Error(t TestingT, err error, msgAndArgs ...interface{}) bool { if err == nil { if h, ok := t.(tHelper); ok { @@ -1667,7 +1717,6 @@ func matchRegexp(rx interface{}, str interface{}) bool { default: return r.MatchString(fmt.Sprint(v)) } - } // Regexp asserts that a specified regexp matches a string. @@ -1703,7 +1752,6 @@ func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interf } return !match - } // Zero asserts that i is the zero value for its type. @@ -1814,6 +1862,11 @@ func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{ return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid json.\nJSON parsing error: '%s'", expected, err.Error()), msgAndArgs...) } + // Shortcut if same bytes + if actual == expected { + return true + } + if err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil { return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid json.\nJSON parsing error: '%s'", actual, err.Error()), msgAndArgs...) } @@ -1832,6 +1885,11 @@ func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{ return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid yaml.\nYAML parsing error: '%s'", expected, err.Error()), msgAndArgs...) } + // Shortcut if same bytes + if actual == expected { + return true + } + if err := yaml.Unmarshal([]byte(actual), &actualYAMLAsInterface); err != nil { return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid yaml.\nYAML error: '%s'", actual, err.Error()), msgAndArgs...) } @@ -1933,6 +1991,7 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t } ch := make(chan bool, 1) + checkCond := func() { ch <- condition() } timer := time.NewTimer(waitFor) defer timer.Stop() @@ -1940,18 +1999,23 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t ticker := time.NewTicker(tick) defer ticker.Stop() - for tick := ticker.C; ; { + var tickC <-chan time.Time + + // Check the condition once first on the initial call. + go checkCond() + + for { select { case <-timer.C: return Fail(t, "Condition never satisfied", msgAndArgs...) - case <-tick: - tick = nil - go func() { ch <- condition() }() + case <-tickC: + tickC = nil + go checkCond() case v := <-ch: if v { return true } - tick = ticker.C + tickC = ticker.C } } } @@ -1964,6 +2028,9 @@ type CollectT struct { errors []error } +// Helper is like [testing.T.Helper] but does nothing. +func (CollectT) Helper() {} + // Errorf collects the error. func (c *CollectT) Errorf(format string, args ...interface{}) { c.errors = append(c.errors, fmt.Errorf(format, args...)) @@ -2021,35 +2088,42 @@ func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time var lastFinishedTickErrs []error ch := make(chan *CollectT, 1) + checkCond := func() { + collect := new(CollectT) + defer func() { + ch <- collect + }() + condition(collect) + } + timer := time.NewTimer(waitFor) defer timer.Stop() ticker := time.NewTicker(tick) defer ticker.Stop() - for tick := ticker.C; ; { + var tickC <-chan time.Time + + // Check the condition once first on the initial call. + go checkCond() + + for { select { case <-timer.C: for _, err := range lastFinishedTickErrs { t.Errorf("%v", err) } return Fail(t, "Condition never satisfied", msgAndArgs...) - case <-tick: - tick = nil - go func() { - collect := new(CollectT) - defer func() { - ch <- collect - }() - condition(collect) - }() + case <-tickC: + tickC = nil + go checkCond() case collect := <-ch: if !collect.failed() { return true } // Keep the errors from the last ended condition, so that they can be copied to t if timeout is reached. lastFinishedTickErrs = collect.errors - tick = ticker.C + tickC = ticker.C } } } @@ -2064,6 +2138,7 @@ func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.D } ch := make(chan bool, 1) + checkCond := func() { ch <- condition() } timer := time.NewTimer(waitFor) defer timer.Stop() @@ -2071,18 +2146,23 @@ func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.D ticker := time.NewTicker(tick) defer ticker.Stop() - for tick := ticker.C; ; { + var tickC <-chan time.Time + + // Check the condition once first on the initial call. + go checkCond() + + for { select { case <-timer.C: return true - case <-tick: - tick = nil - go func() { ch <- condition() }() + case <-tickC: + tickC = nil + go checkCond() case v := <-ch: if v { return Fail(t, "Condition satisfied", msgAndArgs...) } - tick = ticker.C + tickC = ticker.C } } } @@ -2100,9 +2180,12 @@ func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { var expectedText string if target != nil { expectedText = target.Error() + if err == nil { + return Fail(t, fmt.Sprintf("Expected error with %q in chain but got nil.", expectedText), msgAndArgs...) + } } - chain := buildErrorChainString(err) + chain := buildErrorChainString(err, false) return Fail(t, fmt.Sprintf("Target error should be in err chain:\n"+ "expected: %q\n"+ @@ -2125,7 +2208,7 @@ func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { expectedText = target.Error() } - chain := buildErrorChainString(err) + chain := buildErrorChainString(err, false) return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ "found: %q\n"+ @@ -2143,11 +2226,17 @@ func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{ return true } - chain := buildErrorChainString(err) + expectedType := reflect.TypeOf(target).Elem().String() + if err == nil { + return Fail(t, fmt.Sprintf("An error is expected but got nil.\n"+ + "expected: %s", expectedType), msgAndArgs...) + } + + chain := buildErrorChainString(err, true) return Fail(t, fmt.Sprintf("Should be in error chain:\n"+ - "expected: %q\n"+ - "in chain: %s", target, chain, + "expected: %s\n"+ + "in chain: %s", expectedType, chain, ), msgAndArgs...) } @@ -2161,24 +2250,46 @@ func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interfa return true } - chain := buildErrorChainString(err) + chain := buildErrorChainString(err, true) return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ - "found: %q\n"+ - "in chain: %s", target, chain, + "found: %s\n"+ + "in chain: %s", reflect.TypeOf(target).Elem().String(), chain, ), msgAndArgs...) } -func buildErrorChainString(err error) string { +func unwrapAll(err error) (errs []error) { + errs = append(errs, err) + switch x := err.(type) { + case interface{ Unwrap() error }: + err = x.Unwrap() + if err == nil { + return + } + errs = append(errs, unwrapAll(err)...) + case interface{ Unwrap() []error }: + for _, err := range x.Unwrap() { + errs = append(errs, unwrapAll(err)...) + } + } + return +} + +func buildErrorChainString(err error, withType bool) string { if err == nil { return "" } - e := errors.Unwrap(err) - chain := fmt.Sprintf("%q", err.Error()) - for e != nil { - chain += fmt.Sprintf("\n\t%q", e.Error()) - e = errors.Unwrap(e) + var chain string + errs := unwrapAll(err) + for i := range errs { + if i != 0 { + chain += "\n\t" + } + chain += fmt.Sprintf("%q", errs[i].Error()) + if withType { + chain += fmt.Sprintf(" (%T)", errs[i]) + } } return chain } diff --git a/vendor/github.com/stretchr/testify/assert/doc.go b/vendor/github.com/stretchr/testify/assert/doc.go index 4953981d38..a0b953aa5c 100644 --- a/vendor/github.com/stretchr/testify/assert/doc.go +++ b/vendor/github.com/stretchr/testify/assert/doc.go @@ -1,5 +1,9 @@ // Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. // +// # Note +// +// All functions in this package return a bool value indicating whether the assertion has passed. +// // # Example Usage // // The following is a complete example using assert in a standard test function: diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go index 861ed4b7ce..5a6bb75f2c 100644 --- a/vendor/github.com/stretchr/testify/assert/http_assertions.go +++ b/vendor/github.com/stretchr/testify/assert/http_assertions.go @@ -138,7 +138,7 @@ func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, contains := strings.Contains(body, fmt.Sprint(str)) if !contains { - Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...) + Fail(t, fmt.Sprintf("Expected response body for %q to contain %q but found %q", url+"?"+values.Encode(), str, body), msgAndArgs...) } return contains @@ -158,7 +158,7 @@ func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url strin contains := strings.Contains(body, fmt.Sprint(str)) if contains { - Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...) + Fail(t, fmt.Sprintf("Expected response body for %q to NOT contain %q but found %q", url+"?"+values.Encode(), str, body), msgAndArgs...) } return !contains diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go index baa0cc7d7f..5a74c4f4d5 100644 --- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go @@ -1,5 +1,4 @@ //go:build testify_yaml_custom && !testify_yaml_fail && !testify_yaml_default -// +build testify_yaml_custom,!testify_yaml_fail,!testify_yaml_default // Package yaml is an implementation of YAML functions that calls a pluggable implementation. // diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go index b83c6cf64c..0bae80e34a 100644 --- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go @@ -1,5 +1,4 @@ //go:build !testify_yaml_fail && !testify_yaml_custom -// +build !testify_yaml_fail,!testify_yaml_custom // Package yaml is just an indirection to handle YAML deserialization. // diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go index e78f7dfe69..8041803fd2 100644 --- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go @@ -1,5 +1,4 @@ //go:build testify_yaml_fail && !testify_yaml_custom && !testify_yaml_default -// +build testify_yaml_fail,!testify_yaml_custom,!testify_yaml_default // Package yaml is an implementation of YAML functions that always fail. // diff --git a/vendor/github.com/stretchr/testify/mock/mock.go b/vendor/github.com/stretchr/testify/mock/mock.go index eb5682df97..efc89deff3 100644 --- a/vendor/github.com/stretchr/testify/mock/mock.go +++ b/vendor/github.com/stretchr/testify/mock/mock.go @@ -208,9 +208,16 @@ func (c *Call) On(methodName string, arguments ...interface{}) *Call { return c.Parent.On(methodName, arguments...) } -// Unset removes a mock handler from being called. +// Unset removes all mock handlers that satisfy the call instance arguments from being +// called. Only supported on call instances with static input arguments. // -// test.On("func", mock.Anything).Unset() +// For example, the only handler remaining after the following would be "MyMethod(2, 2)": +// +// Mock. +// On("MyMethod", 2, 2).Return(0). +// On("MyMethod", 3, 3).Return(0). +// On("MyMethod", Anything, Anything).Return(0) +// Mock.On("MyMethod", 3, 3).Unset() func (c *Call) Unset() *Call { var unlockOnce sync.Once @@ -331,7 +338,10 @@ func (m *Mock) TestData() objx.Map { Setting expectations */ -// Test sets the test struct variable of the mock object +// Test sets the [TestingT] on which errors will be reported, otherwise errors +// will cause a panic. +// Test should not be called on an object that is going to be used in a +// goroutine other than the one running the test function. func (m *Mock) Test(t TestingT) { m.mutex.Lock() defer m.mutex.Unlock() @@ -494,7 +504,7 @@ func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Argumen // expected call found, but it has already been called with repeatable times if call != nil { m.mutex.Unlock() - m.fail("\nassert: mock: The method has been called over %d times.\n\tEither do one more Mock.On(\"%s\").Return(...), or remove extra call.\n\tThis call was unexpected:\n\t\t%s\n\tat: %s", call.totalCalls, methodName, callString(methodName, arguments, true), assert.CallerInfo()) + m.fail("\nassert: mock: The method has been called over %d times.\n\tEither do one more Mock.On(%#v).Return(...), or remove extra call.\n\tThis call was unexpected:\n\t\t%s\n\tat: %s", call.totalCalls, methodName, callString(methodName, arguments, true), assert.CallerInfo()) } // we have to fail here - because we don't know what to do // as the return arguments. This is because: @@ -514,7 +524,7 @@ func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Argumen assert.CallerInfo(), ) } else { - m.fail("\nassert: mock: I don't know what to return because the method call was unexpected.\n\tEither do Mock.On(\"%s\").Return(...) first, or remove the %s() call.\n\tThis method was unexpected:\n\t\t%s\n\tat: %s", methodName, methodName, callString(methodName, arguments, true), assert.CallerInfo()) + m.fail("\nassert: mock: I don't know what to return because the method call was unexpected.\n\tEither do Mock.On(%#v).Return(...) first, or remove the %s() call.\n\tThis method was unexpected:\n\t\t%s\n\tat: %s", methodName, methodName, callString(methodName, arguments, true), assert.CallerInfo()) } } @@ -661,7 +671,7 @@ func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls actualCalls++ } } - return assert.Equal(t, expectedCalls, actualCalls, fmt.Sprintf("Expected number of calls (%d) does not match the actual number of calls (%d).", expectedCalls, actualCalls)) + return assert.Equal(t, expectedCalls, actualCalls, fmt.Sprintf("Expected number of calls (%d) of method %s does not match the actual number of calls (%d).", expectedCalls, methodName, actualCalls)) } // AssertCalled asserts that the method was called. diff --git a/vendor/github.com/stretchr/testify/require/doc.go b/vendor/github.com/stretchr/testify/require/doc.go index 9684347245..c8e3f94a80 100644 --- a/vendor/github.com/stretchr/testify/require/doc.go +++ b/vendor/github.com/stretchr/testify/require/doc.go @@ -23,6 +23,8 @@ // // The `require` package have same global functions as in the `assert` package, // but instead of returning a boolean result they call `t.FailNow()`. +// A consequence of this is that it must be called from the goroutine running +// the test function, not from other goroutines created during the test. // // Every assertion function also takes an optional string message as the final argument, // allowing custom error messages to be appended to the message the assertion method outputs. diff --git a/vendor/github.com/stretchr/testify/require/require.go b/vendor/github.com/stretchr/testify/require/require.go index d8921950d7..2d02f9bcef 100644 --- a/vendor/github.com/stretchr/testify/require/require.go +++ b/vendor/github.com/stretchr/testify/require/require.go @@ -117,10 +117,19 @@ func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string t.FailNow() } -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Empty asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // require.Empty(t, obj) +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -131,10 +140,19 @@ func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) { t.FailNow() } -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Emptyf asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // require.Emptyf(t, obj, "error message %s", "formatted") +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -279,10 +297,8 @@ func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, ar // Error asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if require.Error(t, err) { -// require.Equal(t, expectedError, err) -// } +// actualObj, err := SomeFunction() +// require.Error(t, err) func Error(t TestingT, err error, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -373,10 +389,8 @@ func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface // Errorf asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if require.Errorf(t, err, "error message %s", "formatted") { -// require.Equal(t, expectedErrorf, err) -// } +// actualObj, err := SomeFunction() +// require.Errorf(t, err, "error message %s", "formatted") func Errorf(t TestingT, err error, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1097,7 +1111,35 @@ func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interf t.FailNow() } +// IsNotType asserts that the specified objects are not of the same type. +// +// require.IsNotType(t, &NotMyStruct{}, &MyStruct{}) +func IsNotType(t TestingT, theType interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsNotType(t, theType, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// IsNotTypef asserts that the specified objects are not of the same type. +// +// require.IsNotTypef(t, &NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") +func IsNotTypef(t TestingT, theType interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsNotTypef(t, theType, object, msg, args...) { + return + } + t.FailNow() +} + // IsType asserts that the specified objects are of the same type. +// +// require.IsType(t, &MyStruct{}, &MyStruct{}) func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1109,6 +1151,8 @@ func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs } // IsTypef asserts that the specified objects are of the same type. +// +// require.IsTypef(t, &MyStruct{}, &MyStruct{}, "error message %s", "formatted") func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1469,8 +1513,7 @@ func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg str t.FailNow() } -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmpty asserts that the specified object is NOT [Empty]. // // if require.NotEmpty(t, obj) { // require.Equal(t, "two", obj[1]) @@ -1485,8 +1528,7 @@ func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) { t.FailNow() } -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmptyf asserts that the specified object is NOT [Empty]. // // if require.NotEmptyf(t, obj, "error message %s", "formatted") { // require.Equal(t, "two", obj[1]) @@ -1745,12 +1787,15 @@ func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, t.FailNow() } -// NotSubset asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubset asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // require.NotSubset(t, [1, 3, 4], [1, 2]) // require.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}) +// require.NotSubset(t, [1, 3, 4], {1: "one", 2: "two"}) +// require.NotSubset(t, {"x": 1, "y": 2}, ["z"]) func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1761,12 +1806,15 @@ func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...i t.FailNow() } -// NotSubsetf asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // require.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted") // require.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") +// require.NotSubsetf(t, [1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") +// require.NotSubsetf(t, {"x": 1, "y": 2}, ["z"], "error message %s", "formatted") func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1971,11 +2019,15 @@ func Samef(t TestingT, expected interface{}, actual interface{}, msg string, arg t.FailNow() } -// Subset asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subset asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // require.Subset(t, [1, 2, 3], [1, 2]) // require.Subset(t, {"x": 1, "y": 2}, {"x": 1}) +// require.Subset(t, [1, 2, 3], {1: "one", 2: "two"}) +// require.Subset(t, {"x": 1, "y": 2}, ["x"]) func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1986,11 +2038,15 @@ func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...inte t.FailNow() } -// Subsetf asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subsetf asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // require.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted") // require.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") +// require.Subsetf(t, [1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") +// require.Subsetf(t, {"x": 1, "y": 2}, ["x"], "error message %s", "formatted") func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go index 1bd87304f4..e6f7e94468 100644 --- a/vendor/github.com/stretchr/testify/require/require_forward.go +++ b/vendor/github.com/stretchr/testify/require/require_forward.go @@ -93,10 +93,19 @@ func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg st ElementsMatchf(a.t, listA, listB, msg, args...) } -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Empty asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // a.Empty(obj) +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -104,10 +113,19 @@ func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) { Empty(a.t, object, msgAndArgs...) } -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Emptyf asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // a.Emptyf(obj, "error message %s", "formatted") +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -225,10 +243,8 @@ func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string // Error asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if a.Error(err) { -// assert.Equal(t, expectedError, err) -// } +// actualObj, err := SomeFunction() +// a.Error(err) func (a *Assertions) Error(err error, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -298,10 +314,8 @@ func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...inter // Errorf asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if a.Errorf(err, "error message %s", "formatted") { -// assert.Equal(t, expectedErrorf, err) -// } +// actualObj, err := SomeFunction() +// a.Errorf(err, "error message %s", "formatted") func (a *Assertions) Errorf(err error, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -869,7 +883,29 @@ func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...in IsNonIncreasingf(a.t, object, msg, args...) } +// IsNotType asserts that the specified objects are not of the same type. +// +// a.IsNotType(&NotMyStruct{}, &MyStruct{}) +func (a *Assertions) IsNotType(theType interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsNotType(a.t, theType, object, msgAndArgs...) +} + +// IsNotTypef asserts that the specified objects are not of the same type. +// +// a.IsNotTypef(&NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") +func (a *Assertions) IsNotTypef(theType interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsNotTypef(a.t, theType, object, msg, args...) +} + // IsType asserts that the specified objects are of the same type. +// +// a.IsType(&MyStruct{}, &MyStruct{}) func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -878,6 +914,8 @@ func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAnd } // IsTypef asserts that the specified objects are of the same type. +// +// a.IsTypef(&MyStruct{}, &MyStruct{}, "error message %s", "formatted") func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1163,8 +1201,7 @@ func (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg NotElementsMatchf(a.t, listA, listB, msg, args...) } -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmpty asserts that the specified object is NOT [Empty]. // // if a.NotEmpty(obj) { // assert.Equal(t, "two", obj[1]) @@ -1176,8 +1213,7 @@ func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) { NotEmpty(a.t, object, msgAndArgs...) } -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmptyf asserts that the specified object is NOT [Empty]. // // if a.NotEmptyf(obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) @@ -1379,12 +1415,15 @@ func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg stri NotSamef(a.t, expected, actual, msg, args...) } -// NotSubset asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubset asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.NotSubset([1, 3, 4], [1, 2]) // a.NotSubset({"x": 1, "y": 2}, {"z": 3}) +// a.NotSubset([1, 3, 4], {1: "one", 2: "two"}) +// a.NotSubset({"x": 1, "y": 2}, ["z"]) func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1392,12 +1431,15 @@ func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs NotSubset(a.t, list, subset, msgAndArgs...) } -// NotSubsetf asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted") // a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") +// a.NotSubsetf([1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") +// a.NotSubsetf({"x": 1, "y": 2}, ["z"], "error message %s", "formatted") func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1557,11 +1599,15 @@ func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, Samef(a.t, expected, actual, msg, args...) } -// Subset asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subset asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.Subset([1, 2, 3], [1, 2]) // a.Subset({"x": 1, "y": 2}, {"x": 1}) +// a.Subset([1, 2, 3], {1: "one", 2: "two"}) +// a.Subset({"x": 1, "y": 2}, ["x"]) func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1569,11 +1615,15 @@ func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ... Subset(a.t, list, subset, msgAndArgs...) } -// Subsetf asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subsetf asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted") // a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") +// a.Subsetf([1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") +// a.Subsetf({"x": 1, "y": 2}, ["x"], "error message %s", "formatted") func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() diff --git a/vendor/github.com/stretchr/testify/suite/stats.go b/vendor/github.com/stretchr/testify/suite/stats.go index 261da37f78..be4ccd6799 100644 --- a/vendor/github.com/stretchr/testify/suite/stats.go +++ b/vendor/github.com/stretchr/testify/suite/stats.go @@ -16,26 +16,30 @@ type TestInformation struct { } func newSuiteInformation() *SuiteInformation { - testStats := make(map[string]*TestInformation) - return &SuiteInformation{ - TestStats: testStats, + TestStats: make(map[string]*TestInformation), } } -func (s SuiteInformation) start(testName string) { +func (s *SuiteInformation) start(testName string) { + if s == nil { + return + } s.TestStats[testName] = &TestInformation{ TestName: testName, Start: time.Now(), } } -func (s SuiteInformation) end(testName string, passed bool) { +func (s *SuiteInformation) end(testName string, passed bool) { + if s == nil { + return + } s.TestStats[testName].End = time.Now() s.TestStats[testName].Passed = passed } -func (s SuiteInformation) Passed() bool { +func (s *SuiteInformation) Passed() bool { for _, stats := range s.TestStats { if !stats.Passed { return false diff --git a/vendor/github.com/stretchr/testify/suite/suite.go b/vendor/github.com/stretchr/testify/suite/suite.go index 18443a91c8..1b19be3bcd 100644 --- a/vendor/github.com/stretchr/testify/suite/suite.go +++ b/vendor/github.com/stretchr/testify/suite/suite.go @@ -7,6 +7,7 @@ import ( "reflect" "regexp" "runtime/debug" + "strings" "sync" "testing" "time" @@ -15,7 +16,6 @@ import ( "github.com/stretchr/testify/require" ) -var allTestsFilter = func(_, _ string) (bool, error) { return true, nil } var matchMethod = flag.String("testify.m", "", "regular expression to select tests of the testify suite to run") // Suite is a basic testing suite with methods for storing and @@ -116,6 +116,11 @@ func (suite *Suite) Run(name string, subtest func()) bool { }) } +type test = struct { + name string + run func(t *testing.T) +} + // Run takes a testing suite and runs all of the tests attached // to it. func Run(t *testing.T, suite TestingSuite) { @@ -124,45 +129,39 @@ func Run(t *testing.T, suite TestingSuite) { suite.SetT(t) suite.SetS(suite) - var suiteSetupDone bool - var stats *SuiteInformation if _, ok := suite.(WithStats); ok { stats = newSuiteInformation() } - tests := []testing.InternalTest{} + var tests []test methodFinder := reflect.TypeOf(suite) suiteName := methodFinder.Elem().Name() - for i := 0; i < methodFinder.NumMethod(); i++ { - method := methodFinder.Method(i) - - ok, err := methodFilter(method.Name) + var matchMethodRE *regexp.Regexp + if *matchMethod != "" { + var err error + matchMethodRE, err = regexp.Compile(*matchMethod) if err != nil { fmt.Fprintf(os.Stderr, "testify: invalid regexp for -m: %s\n", err) os.Exit(1) } + } - if !ok { + for i := 0; i < methodFinder.NumMethod(); i++ { + method := methodFinder.Method(i) + + if !strings.HasPrefix(method.Name, "Test") { continue } - - if !suiteSetupDone { - if stats != nil { - stats.Start = time.Now() - } - - if setupAllSuite, ok := suite.(SetupAllSuite); ok { - setupAllSuite.SetupSuite() - } - - suiteSetupDone = true + // Apply -testify.m filter + if matchMethodRE != nil && !matchMethodRE.MatchString(method.Name) { + continue } - test := testing.InternalTest{ - Name: method.Name, - F: func(t *testing.T) { + test := test{ + name: method.Name, + run: func(t *testing.T) { parentT := suite.T() suite.SetT(t) defer recoverAndFailOnPanic(t) @@ -171,10 +170,7 @@ func Run(t *testing.T, suite TestingSuite) { r := recover() - if stats != nil { - passed := !t.Failed() && r == nil - stats.end(method.Name, passed) - } + stats.end(method.Name, !t.Failed() && r == nil) if afterTestSuite, ok := suite.(AfterTest); ok { afterTestSuite.AfterTest(suiteName, method.Name) @@ -195,59 +191,47 @@ func Run(t *testing.T, suite TestingSuite) { beforeTestSuite.BeforeTest(methodFinder.Elem().Name(), method.Name) } - if stats != nil { - stats.start(method.Name) - } + stats.start(method.Name) method.Func.Call([]reflect.Value{reflect.ValueOf(suite)}) }, } tests = append(tests, test) } - if suiteSetupDone { - defer func() { - if tearDownAllSuite, ok := suite.(TearDownAllSuite); ok { - tearDownAllSuite.TearDownSuite() - } - - if suiteWithStats, measureStats := suite.(WithStats); measureStats { - stats.End = time.Now() - suiteWithStats.HandleStats(suiteName, stats) - } - }() + + if len(tests) == 0 { + return } - runTests(t, tests) -} + if stats != nil { + stats.Start = time.Now() + } -// Filtering method according to set regular expression -// specified command-line argument -m -func methodFilter(name string) (bool, error) { - if ok, _ := regexp.MatchString("^Test", name); !ok { - return false, nil + if setupAllSuite, ok := suite.(SetupAllSuite); ok { + setupAllSuite.SetupSuite() } - return regexp.MatchString(*matchMethod, name) + + defer func() { + if tearDownAllSuite, ok := suite.(TearDownAllSuite); ok { + tearDownAllSuite.TearDownSuite() + } + + if suiteWithStats, measureStats := suite.(WithStats); measureStats { + stats.End = time.Now() + suiteWithStats.HandleStats(suiteName, stats) + } + }() + + runTests(t, tests) } -func runTests(t testing.TB, tests []testing.InternalTest) { +func runTests(t *testing.T, tests []test) { if len(tests) == 0 { t.Log("warning: no tests to run") return } - r, ok := t.(runner) - if !ok { // backwards compatibility with Go 1.6 and below - if !testing.RunTests(allTestsFilter, tests) { - t.Fail() - } - return - } - for _, test := range tests { - r.Run(test.Name, test.F) + t.Run(test.name, test.run) } } - -type runner interface { - Run(name string, f func(t *testing.T)) bool -} diff --git a/vendor/modules.txt b/vendor/modules.txt index aef712f2a3..72bef8762c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,5 +1,5 @@ -# github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20260420184007-d546462995df -## explicit; go 1.24 +# github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20260701210453-54ce69d38ae3 +## explicit; go 1.26 github.com/BitBoxSwiss/bitbox02-api-go/api/bootloader github.com/BitBoxSwiss/bitbox02-api-go/api/common github.com/BitBoxSwiss/bitbox02-api-go/api/firmware @@ -219,7 +219,7 @@ github.com/skip2/go-qrcode/reedsolomon # github.com/stretchr/objx v0.5.2 ## explicit; go 1.20 github.com/stretchr/objx -# github.com/stretchr/testify v1.10.0 +# github.com/stretchr/testify v1.11.1 ## explicit; go 1.17 github.com/stretchr/testify/assert github.com/stretchr/testify/assert/yaml