Compare commits

...

4 Commits

6 changed files with 24 additions and 14 deletions

View File

@@ -25,7 +25,7 @@ jobs:
strategy: strategy:
matrix: matrix:
goos: [linux, freebsd, darwin, windows] goos: [linux, freebsd, darwin, windows]
goarch: [amd64, arm64, riscv64] goarch: [arm, amd64, arm64, riscv64]
exclude: exclude:
- goarch: arm64 - goarch: arm64
goos: windows goos: windows
@@ -33,6 +33,12 @@ jobs:
goos: windows goos: windows
- goarch: riscv64 - goarch: riscv64
goos: darwin goos: darwin
- goarch: arm
goos: windows
- goarch: arm
goos: darwin
- goarch: arm
goos: freebsd
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@v1.40 - uses: wangyoucao577/go-release-action@v1.40

View File

@@ -58,7 +58,7 @@ var encrypt = &cli.Command{
stdout(ciphertext) stdout(ciphertext)
} }
} else { } else {
kr, err := gatherKeyerFromArguments(ctx, c) kr, _, err := gatherKeyerFromArguments(ctx, c)
if err != nil { if err != nil {
return err return err
} }
@@ -123,7 +123,7 @@ var decrypt = &cli.Command{
stdout(plaintext) stdout(plaintext)
} }
} else { } else {
kr, err := gatherKeyerFromArguments(ctx, c) kr, _, err := gatherKeyerFromArguments(ctx, c)
if err != nil { if err != nil {
return err return err
} }

View File

@@ -148,11 +148,10 @@ example:
} }
}() }()
kr, err := gatherKeyerFromArguments(ctx, c) kr, sec, err := gatherKeyerFromArguments(ctx, c)
if err != nil { if err != nil {
return err return err
} }
sec, _, _ := gatherSecretKeyOrBunkerFromArguments(ctx, c)
doAuth := c.Bool("auth") doAuth := c.Bool("auth")
@@ -227,6 +226,10 @@ example:
mustRehashAndResign = true mustRehashAndResign = true
} }
if c.IsSet("musig") || c.IsSet("sec") || c.IsSet("prompt-sec") {
mustRehashAndResign = true
}
if difficulty := c.Uint("pow"); difficulty > 0 { if difficulty := c.Uint("pow"); difficulty > 0 {
// before doing pow we need the pubkey // before doing pow we need the pubkey
if numSigners := c.Uint("musig"); numSigners > 1 { if numSigners := c.Uint("musig"); numSigners > 1 {
@@ -250,7 +253,8 @@ example:
} }
if evt.Sig == "" || mustRehashAndResign { if evt.Sig == "" || mustRehashAndResign {
if numSigners := c.Uint("musig"); numSigners > 1 && sec != "" { if numSigners := c.Uint("musig"); numSigners > 1 {
// must do musig
pubkeys := c.StringSlice("musig-pubkey") pubkeys := c.StringSlice("musig-pubkey")
secNonce := c.String("musig-nonce-secret") secNonce := c.String("musig-nonce-secret")
pubNonces := c.StringSlice("musig-nonce") pubNonces := c.StringSlice("musig-nonce")
@@ -300,7 +304,7 @@ example:
} }
// error publishing // error publishing
if strings.HasPrefix(err.Error(), "msg: auth-required:") && (sec != "" || bunker != nil) && doAuth { if strings.HasPrefix(err.Error(), "msg: auth-required:") && kr != nil && doAuth {
// if the relay is requesting auth and we can auth, let's do it // if the relay is requesting auth and we can auth, let's do it
pk, _ := kr.GetPublicKey(ctx) pk, _ := kr.GetPublicKey(ctx)
log("performing auth as %s... ", pk) log("performing auth as %s... ", pk)

View File

@@ -38,20 +38,20 @@ var defaultKeyFlags = []cli.Flag{
}, },
} }
func gatherKeyerFromArguments(ctx context.Context, c *cli.Command) (keyer.Keyer, error) { func gatherKeyerFromArguments(ctx context.Context, c *cli.Command) (nostr.Keyer, string, error) {
key, bunker, err := gatherSecretKeyOrBunkerFromArguments(ctx, c) key, bunker, err := gatherSecretKeyOrBunkerFromArguments(ctx, c)
if err != nil { if err != nil {
return nil, err return nil, "", err
} }
var kr keyer.Keyer var kr nostr.Keyer
if bunker != nil { if bunker != nil {
kr = keyer.NewBunkerSignerFromBunkerClient(bunker) kr = keyer.NewBunkerSignerFromBunkerClient(bunker)
} else { } else {
kr, err = keyer.NewPlainKeySigner(key) kr, err = keyer.NewPlainKeySigner(key)
} }
return kr, err return kr, key, err
} }
func gatherSecretKeyOrBunkerFromArguments(ctx context.Context, c *cli.Command) (string, *nip46.BunkerClient, error) { func gatherSecretKeyOrBunkerFromArguments(ctx context.Context, c *cli.Command) (string, *nip46.BunkerClient, error) {

View File

@@ -95,7 +95,7 @@ var relay = &cli.Command{
return nil return nil
} }
kr, err := gatherKeyerFromArguments(ctx, c) kr, _, err := gatherKeyerFromArguments(ctx, c)
if err != nil { if err != nil {
return err return err
} }

4
req.go
View File

@@ -80,7 +80,7 @@ example:
if !c.Bool("auth") && !c.Bool("force-pre-auth") { if !c.Bool("auth") && !c.Bool("force-pre-auth") {
return fmt.Errorf("auth not authorized") return fmt.Errorf("auth not authorized")
} }
kr, err := gatherKeyerFromArguments(ctx, c) kr, _, err := gatherKeyerFromArguments(ctx, c)
if err != nil { if err != nil {
return err return err
} }
@@ -231,7 +231,7 @@ func applyFlagsToFilter(c *cli.Command, filter *nostr.Filter) error {
} }
tags := make([][]string, 0, 5) tags := make([][]string, 0, 5)
for _, tagFlag := range c.StringSlice("tag") { for _, tagFlag := range c.StringSlice("tag") {
spl := strings.Split(tagFlag, "=") spl := strings.SplitN(tagFlag, "=", 2)
if len(spl) == 2 && len(spl[0]) == 1 { if len(spl) == 2 && len(spl[0]) == 1 {
tags = append(tags, spl) tags = append(tags, spl)
} else { } else {