You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
558 B
19 lines
558 B
package app |
|
|
|
import ( |
|
"golang.org/x/crypto/curve25519" |
|
|
|
"git.mleku.dev/mleku/nostr/crypto/keys" |
|
) |
|
|
|
// derivePublicKey derives a Curve25519 public key from a private key. |
|
func derivePublicKey(privateKey []byte) ([]byte, error) { |
|
publicKey := make([]byte, 32) |
|
curve25519.ScalarBaseMult((*[32]byte)(publicKey), (*[32]byte)(privateKey)) |
|
return publicKey, nil |
|
} |
|
|
|
// deriveSecp256k1PublicKey derives a secp256k1 public key from a secret key. |
|
func deriveSecp256k1PublicKey(secretKey []byte) ([]byte, error) { |
|
return keys.SecretBytesToPubKeyBytes(secretKey) |
|
}
|
|
|