summaryrefslogtreecommitdiff
path: root/cli/vendor/github.com/btcsuite/btcd/btcec/v2/privkey.go
diff options
context:
space:
mode:
authord0x471b <0x471@protonmail.com>2022-12-31 03:45:30 +0300
committerd0x471b <0x471@protonmail.com>2022-12-31 03:45:30 +0300
commit0f1d7d51de1baa21256fdb7ddafe54aab66172f7 (patch)
tree30373f9b64ba6301096f26cdade55ebac4f5e59f /cli/vendor/github.com/btcsuite/btcd/btcec/v2/privkey.go
parent517ad8d13a6b23328927154226575605be70669f (diff)
Add webappHEADmaster
Diffstat (limited to 'cli/vendor/github.com/btcsuite/btcd/btcec/v2/privkey.go')
-rw-r--r--cli/vendor/github.com/btcsuite/btcd/btcec/v2/privkey.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/cli/vendor/github.com/btcsuite/btcd/btcec/v2/privkey.go b/cli/vendor/github.com/btcsuite/btcd/btcec/v2/privkey.go
new file mode 100644
index 0000000..4efa806
--- /dev/null
+++ b/cli/vendor/github.com/btcsuite/btcd/btcec/v2/privkey.go
@@ -0,0 +1,37 @@
+// Copyright (c) 2013-2016 The btcsuite developers
+// Use of this source code is governed by an ISC
+// license that can be found in the LICENSE file.
+
+package btcec
+
+import (
+ secp "github.com/decred/dcrd/dcrec/secp256k1/v4"
+)
+
+// PrivateKey wraps an ecdsa.PrivateKey as a convenience mainly for signing
+// things with the the private key without having to directly import the ecdsa
+// package.
+type PrivateKey = secp.PrivateKey
+
+// PrivKeyFromBytes returns a private and public key for `curve' based on the
+// private key passed as an argument as a byte slice.
+func PrivKeyFromBytes(pk []byte) (*PrivateKey, *PublicKey) {
+ privKey := secp.PrivKeyFromBytes(pk)
+
+ return privKey, privKey.PubKey()
+}
+
+// NewPrivateKey is a wrapper for ecdsa.GenerateKey that returns a PrivateKey
+// instead of the normal ecdsa.PrivateKey.
+func NewPrivateKey() (*PrivateKey, error) {
+ return secp.GeneratePrivateKey()
+}
+
+// PrivKeyFromScalar instantiates a new private key from a scalar encoded as a
+// big integer.
+func PrivKeyFromScalar(key *ModNScalar) *PrivateKey {
+ return &PrivateKey{Key: *key}
+}
+
+// PrivKeyBytesLen defines the length in bytes of a serialized private key.
+const PrivKeyBytesLen = 32