Skip to content

Commit

Permalink
Merge pull request #205 from bitmaelum/symlink
Browse files Browse the repository at this point in the history
Redirect address implementation and create org/addr cleanup
  • Loading branch information
jaytaph committed May 5, 2022
2 parents fe6de73 + c2dea5b commit f43387e
Show file tree
Hide file tree
Showing 24 changed files with 510 additions and 578 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Default opening notepad on windows when editting config or messages
- Service support: Now you can install both bm-bridge and bm-server as system services using bm-config
- bm-client: accounts can be activated and deactivated on the key resolver. Deactivated accounts will be removed after a while (not yet defined)
- bm-client: Reserved certain accounts and organisations for registration (see https://github.com/bitmaelum/bitmaelum-suite/wiki/reserved-addresses)
- bm-client: OTP generation works properly

# Security
Expand All @@ -15,6 +16,8 @@
- bm-bridge: Support for mail relay (aka gateway mode) for organizations, this way an organization can "host" using the BitMaelum protocol.
- bm-client: reserved certain accounts and organisations for registration (see https://github.com/bitmaelum/bitmaelum-suite/wiki/reserved-addresses)
- resolver configuration has been overhauled
- bm-client: Added `--debug` flag to display HTTP traffic (override the client config's server.debughttp option)



## 0.1.1-1 (2021-feb-19)
Expand Down
9 changes: 7 additions & 2 deletions cmd/bm-client/cmd/account_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ This assumes you have a BitMaelum invitation token for the specific server.`,
Run: func(cmd *cobra.Command, args []string) {
v := vault.OpenDefaultVault()

if *token == "" && *target == "" {
logrus.Fatal("please specify either --token or --target")
}

kt, err := bmcrypto.FindKeyType(*keytype)
if err != nil {
logrus.Fatal("incorrect key type")
}
handlers.CreateAccount(v, *account, *name, *token, kt)
handlers.CreateAccount(v, *account, *name, *token, kt, *target)
},
}

Expand All @@ -49,6 +53,7 @@ var (
name *string
token *string
keytype *string
target *string
)

func init() {
Expand All @@ -57,9 +62,9 @@ func init() {
account = createAccountCmd.Flags().String("account", "", "Account to create")
name = createAccountCmd.Flags().String("name", "", "Your full name")
token = createAccountCmd.Flags().String("token", "", "Invitation token from server")
target = createAccountCmd.Flags().String("target", "", "Target address to link to")
keytype = createAccountCmd.Flags().String("keytype", "ed25519", "Type of key you want to generate (defaults to ed25519)")

_ = createAccountCmd.MarkFlagRequired("account")
_ = createAccountCmd.MarkFlagRequired("name")
_ = createAccountCmd.MarkFlagRequired("token")
}
13 changes: 12 additions & 1 deletion cmd/bm-client/cmd/account_key_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"github.com/bitmaelum/bitmaelum-suite/cmd/bm-client/internal/container"
"github.com/bitmaelum/bitmaelum-suite/internal"
"github.com/bitmaelum/bitmaelum-suite/internal/resolver"
"github.com/bitmaelum/bitmaelum-suite/internal/vault"
"github.com/bitmaelum/bitmaelum-suite/pkg/bmcrypto"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -89,8 +90,18 @@ WITHOUT THESE WORDS, ALL ACCESS TO YOUR ACCOUNT IS LOST!
if *advertise {
info.SetActiveKey(kp)

addrObj := &resolver.AddressInfo{
Hash: info.Address.Hash().String(),
PublicKey: info.GetActiveKey().PubKey,
RoutingID: info.RoutingID,
RedirHash: info.RedirAddress.Hash().String(),
Pow: info.Pow.String(),
}

pk := info.GetActiveKey().PrivKey

ks := container.Instance.GetResolveService()
err = ks.UploadAddressInfo(*info, "")
err = ks.UploadAddressInfo(*info.Address, *addrObj, &pk)
}

// Error or we didn't advertise
Expand Down
7 changes: 7 additions & 0 deletions cmd/bm-client/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ var rootCmd = &cobra.Command{
if _, exist := cmd.Annotations["dont_load_config"]; !exist {
config.LoadClientConfig(internal.Opts.Config)

if internal.Opts.Debug {
config.Client.Server.DebugHTTP = true
}

// Set vault path if not already set
if vault.VaultPath == "" {
vault.VaultPath = config.Client.Vault.Path
Expand All @@ -65,7 +69,10 @@ func Execute() {
}

func init() {
// These are not used directly, but are here for --help purposes only. These flags are actually located inside the
// internal.opts structure
rootCmd.PersistentFlags().StringP("config", "c", "", "configuration file")
rootCmd.PersistentFlags().StringP("password", "p", "", "password to unlock your account vault")
rootCmd.PersistentFlags().StringP("vault", "", "", "custom vault file")
rootCmd.PersistentFlags().Bool("debug", false, "debug HTTP traffic")
}
Loading

0 comments on commit f43387e

Please sign in to comment.