mirror of
https://github.com/hanzoai/s3.git
synced 2026-10-30 14:59:09 +00:00
Completes the ZAP-native migration on main's leaderless base (schain
pinned-writer is canonical — NO consensus engine introduced). Every
non-test s3 package is now gRPC-free (`google.golang.org/grpc` importers:
16 -> 0); all gRPC-importing test files converted too, so the root module
has ZERO direct grpc importers.
Source (ported from feat/grpc-final's grpc-free versions onto main, which
do NOT touch the leaderless rewrite):
- pb/grpc_client_server.go: dialoption param thread, ZAP pools only.
- mq/broker/*: status.Errorf(codes.X) -> fmt.Errorf("X: ...").
- server/volume_grpc_admin.go: keeps the v2026.3.1 authz-bypass fix
(fail-closed over peerless ZAP) + grpc-free.
- server/volume_grpc_erasure_coding.go, server/common.go (request_id),
svc/master/stream_server.go (drop grpc.ServerStream embed),
wdclient/masterclient.go, operation/assign_file_id.go (string-match
classification).
- security/tls.go (drop LoadServerTLS/advancedtls/SNIStripping),
security/tls_reload.go + certreload/certreload.go (native mtime/size
keypair watcher, no grpc certprovider/pemfile),
util/http/client/http_client.go.
command/master.go: kept main's leaderless schain coordinator; stripped
only the vestigial reflection-only gRPC server (no master RPC rode it).
Tests: codes/status -> fmt/strings; grpc.ServerStream/metadata mocks ->
grpc-free seams (Send/Recv/Context); integration tests dial ZAP
(transport.Dial + pb.NewZapFilerClient / master.New(...ToMasterZapAddress)).
volume_grpc_admin_zap_authz_test.go still PASSES and still asserts the
admin bypass is CLOSED. Deleted tls_sni_test.go (tested removed SNIStripping).
go-bip39: upstream github.com/tyler-smith/go-bip39 repo is deleted (fetch
fails under GOPROXY=direct), breaking `go mod tidy`. Redirect to the luxfi
fork via an in-tree drop-in module (third_party/go-bip39) under the original
path delegating to github.com/luxfi/go-bip39 v1.1.2 — a plain replace is
impossible (the fork renamed its module path and self-imports
.../wordlists, "used for two different module paths"). `go mod tidy` now
succeeds.
go.mod: google.golang.org/grpc/security/advancedtls DROPPED; grpc demoted
direct -> // indirect. grpc now survives ONLY as a transitive of Google
Cloud SDKs (cloud.google.com/go/{kms,storage,pubsub}) used by the GCP
KMS / GCS storage / Pub/Sub integrations — external API-client transport,
not s3 internal RPC. Fully removing it would mean ripping out all GCP
cloud support (out of scope).
52 lines
2.3 KiB
Go
52 lines
2.3 KiB
Go
// Package bip39 re-exports the luxfi fork (github.com/luxfi/go-bip39) under the
|
|
// original github.com/tyler-smith/go-bip39 module path. See go.mod for why this
|
|
// shim exists. The full public surface of the upstream package is forwarded so
|
|
// the shim is a faithful drop-in, not a partial one tied to today's callers.
|
|
package bip39
|
|
|
|
import bip39 "github.com/luxfi/go-bip39"
|
|
|
|
// Mirror the upstream sentinel errors so callers can compare against them.
|
|
var (
|
|
ErrInvalidMnemonic = bip39.ErrInvalidMnemonic
|
|
ErrEntropyLengthInvalid = bip39.ErrEntropyLengthInvalid
|
|
ErrValidatedSeedLengthMismatch = bip39.ErrValidatedSeedLengthMismatch
|
|
ErrChecksumIncorrect = bip39.ErrChecksumIncorrect
|
|
)
|
|
|
|
// SetWordList sets the word list used package-wide for mnemonics.
|
|
func SetWordList(list []string) { bip39.SetWordList(list) }
|
|
|
|
// GetWordList returns the current word list.
|
|
func GetWordList() []string { return bip39.GetWordList() }
|
|
|
|
// GetWordIndex returns the index of a word in the current word list.
|
|
func GetWordIndex(word string) (int, bool) { return bip39.GetWordIndex(word) }
|
|
|
|
// NewEntropy returns randomly generated entropy of the given bit size.
|
|
func NewEntropy(bitSize int) ([]byte, error) { return bip39.NewEntropy(bitSize) }
|
|
|
|
// EntropyFromMnemonic recovers the entropy that produced the given mnemonic.
|
|
func EntropyFromMnemonic(mnemonic string) ([]byte, error) {
|
|
return bip39.EntropyFromMnemonic(mnemonic)
|
|
}
|
|
|
|
// NewMnemonic returns a mnemonic for the given entropy.
|
|
func NewMnemonic(entropy []byte) (string, error) { return bip39.NewMnemonic(entropy) }
|
|
|
|
// MnemonicToByteArray converts a mnemonic into its byte-array representation.
|
|
func MnemonicToByteArray(mnemonic string, raw ...bool) ([]byte, error) {
|
|
return bip39.MnemonicToByteArray(mnemonic, raw...)
|
|
}
|
|
|
|
// NewSeedWithErrorChecking creates a hashed seed, validating the mnemonic first.
|
|
func NewSeedWithErrorChecking(mnemonic, password string) ([]byte, error) {
|
|
return bip39.NewSeedWithErrorChecking(mnemonic, password)
|
|
}
|
|
|
|
// NewSeed creates a hashed seed from a mnemonic and passphrase.
|
|
func NewSeed(mnemonic, password string) []byte { return bip39.NewSeed(mnemonic, password) }
|
|
|
|
// IsMnemonicValid reports whether a mnemonic is valid for the current word list.
|
|
func IsMnemonicValid(mnemonic string) bool { return bip39.IsMnemonicValid(mnemonic) }
|