2021-05-31 17:25:34 +00:00
|
|
|
package neofscontract
|
|
|
|
|
|
|
|
import (
|
|
|
|
neofscontract "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofs"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ManageKeys binds/unbinds list of public keys from NeoFS account by script hash.
|
|
|
|
func (x *ClientWrapper) ManageKeys(scriptHash []byte, ks [][]byte, bind bool) error {
|
|
|
|
type args interface {
|
|
|
|
SetScriptHash([]byte)
|
|
|
|
SetKeys([][]byte)
|
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
|
|
|
a args
|
|
|
|
call func(args) error
|
|
|
|
)
|
|
|
|
|
|
|
|
if bind {
|
|
|
|
a = new(neofscontract.BindKeysArgs)
|
|
|
|
call = func(a args) error {
|
2021-09-15 10:48:00 +00:00
|
|
|
return x.client.BindKeys(*a.(*neofscontract.BindKeysArgs))
|
2021-05-31 17:25:34 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
a = new(neofscontract.UnbindKeysArgs)
|
|
|
|
call = func(a args) error {
|
2021-09-15 10:48:00 +00:00
|
|
|
return x.client.UnbindKeys(*a.(*neofscontract.UnbindKeysArgs))
|
2021-05-31 17:25:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
a.SetScriptHash(scriptHash)
|
|
|
|
a.SetKeys(ks)
|
|
|
|
|
|
|
|
return call(a)
|
|
|
|
}
|