Merge pull request #749 from guggero/wasm

internal/prompt: allow compilation in js/wasm environment
This commit is contained in:
Olaoluwa Osuntokun 2021-05-18 16:50:50 -07:00 committed by GitHub
commit c31e149775
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 2 deletions

View file

@ -81,7 +81,7 @@ check: unit
unit:
@$(call print, "Running unit tests.")
$(GOLIST) | $(XARGS) env $(GOTEST)
$(GOLIST) | $(XARGS) env $(GOTEST) -test.timeout=20m
unit-cover: $(GOACC_BIN)
@$(call print, "Running unit coverage tests.")
@ -89,7 +89,7 @@ unit-cover: $(GOACC_BIN)
unit-race:
@$(call print, "Running unit race tests.")
env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOLIST) | $(XARGS) env $(GOTEST) -race
env CGO_ENABLED=1 GORACE="history_size=7 halt_on_errors=1" $(GOLIST) | $(XARGS) env $(GOTEST) -race -test.timeout=20m
# =========
# UTILITIES

View file

@ -2,6 +2,8 @@
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
// +build !js
package prompt
import (

View file

@ -0,0 +1,32 @@
// Copyright (c) 2015-2021 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package prompt
import (
"bufio"
"fmt"
"github.com/btcsuite/btcwallet/internal/legacy/keystore"
)
func ProvideSeed() ([]byte, error) {
return nil, fmt.Errorf("prompt not supported in WebAssembly")
}
func ProvidePrivPassphrase() ([]byte, error) {
return nil, fmt.Errorf("prompt not supported in WebAssembly")
}
func PrivatePass(_ *bufio.Reader, _ *keystore.Store) ([]byte, error) {
return nil, fmt.Errorf("prompt not supported in WebAssembly")
}
func PublicPass(_ *bufio.Reader, _, _, _ []byte) ([]byte, error) {
return nil, fmt.Errorf("prompt not supported in WebAssembly")
}
func Seed(_ *bufio.Reader) ([]byte, error) {
return nil, fmt.Errorf("prompt not supported in WebAssembly")
}