5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 18:50:27 +00:00

Merge pull request #143 from neilalexander/admin

Change box_pub_key to key in admin API
This commit is contained in:
Arceliar 2018-06-22 16:35:48 -05:00 committed by GitHub
commit fd074a4364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,34 +189,34 @@ func (a *admin) init(c *Core, listenaddr string) {
a.addHandler("getAllowedEncryptionPublicKeys", []string{}, func(in admin_info) (admin_info, error) { a.addHandler("getAllowedEncryptionPublicKeys", []string{}, func(in admin_info) (admin_info, error) {
return admin_info{"allowed_box_pubs": a.getAllowedEncryptionPublicKeys()}, nil return admin_info{"allowed_box_pubs": a.getAllowedEncryptionPublicKeys()}, nil
}) })
a.addHandler("addAllowedEncryptionPublicKey", []string{"box_pub_key"}, func(in admin_info) (admin_info, error) { a.addHandler("addAllowedEncryptionPublicKey", []string{"key"}, func(in admin_info) (admin_info, error) {
if a.addAllowedEncryptionPublicKey(in["box_pub_key"].(string)) == nil { if a.addAllowedEncryptionPublicKey(in["key"].(string)) == nil {
return admin_info{ return admin_info{
"added": []string{ "added": []string{
in["box_pub_key"].(string), in["key"].(string),
}, },
}, nil }, nil
} else { } else {
return admin_info{ return admin_info{
"not_added": []string{ "not_added": []string{
in["box_pub_key"].(string), in["key"].(string),
}, },
}, errors.New("Failed to add allowed box pub key") }, errors.New("Failed to add allowed key")
} }
}) })
a.addHandler("removeAllowedEncryptionPublicKey", []string{"box_pub_key"}, func(in admin_info) (admin_info, error) { a.addHandler("removeAllowedEncryptionPublicKey", []string{"key"}, func(in admin_info) (admin_info, error) {
if a.removeAllowedEncryptionPublicKey(in["box_pub_key"].(string)) == nil { if a.removeAllowedEncryptionPublicKey(in["key"].(string)) == nil {
return admin_info{ return admin_info{
"removed": []string{ "removed": []string{
in["box_pub_key"].(string), in["key"].(string),
}, },
}, nil }, nil
} else { } else {
return admin_info{ return admin_info{
"not_removed": []string{ "not_removed": []string{
in["box_pub_key"].(string), in["key"].(string),
}, },
}, errors.New("Failed to remove allowed box pub key") }, errors.New("Failed to remove allowed key")
} }
}) })
} }