Skip to content
Snippets Groups Projects
Commit f5244c50 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Add check for previously existing authenticated channels

parent 027bc6b7
No related branches found
No related tags found
No related merge requests found
......@@ -136,7 +136,7 @@ var rootCmd = &cobra.Command{
}
user := client.GetUser()
jww.INFO.Printf("%s", user.ID)
jww.INFO.Printf("User: %s", user.ID)
// Set up reception handler
swboard := client.GetSwitchboard()
......@@ -223,8 +223,17 @@ var rootCmd = &cobra.Command{
func addAuthenticatedChannel(client *api.Client, recipientID *id.ID,
isPrecanPartner bool) {
if client.HasAuthenticatedChannel(recipientID) {
jww.INFO.Printf("Authenticated channel already in place for %s",
recipientID)
return
}
var allowed bool
if viper.GetBool("unsafe-channel-creation") {
msg := "unsafe channel creation enabled\n"
jww.WARN.Printf(msg)
fmt.Printf("WARNING: %s", msg)
allowed = true
} else {
allowed = askToCreateChannel(recipientID)
......@@ -233,6 +242,11 @@ func addAuthenticatedChannel(client *api.Client, recipientID *id.ID,
jww.FATAL.Panicf("User did not allow channel creation!")
}
msg := fmt.Sprintf("Adding authenticated channel for: %s\n",
recipientID)
jww.INFO.Printf(msg)
fmt.Printf(msg)
if isPrecanPartner {
jww.WARN.Printf("Precanned user id detected: %s",
recipientID)
......
......@@ -528,6 +528,8 @@ func (s *Session) generate(kv *versioned.KV) *versioned.KV {
s.baseKey = dh.GenerateSessionKey(s.myPrivKey, s.partnerPubKey, grp)
}
s.partnerPubKey.Text(16))
kv = kv.Prefix(makeSessionPrefix(s.GetID()))
//generate ttl and keying info
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment