func CreateAuthorizedKey(info *vault.AccountInfo, targetKey *bmcrypto.PubKey, validUntil time.Duration, desc string) (string, error) {
	var expiry = time.Time{}
	if validUntil > 0 {
		expiry = pkginternal.TimeNow().Add(validUntil)
	}

	// Create and sign key
	k := key.NewAuthKey(info.Address.Hash(), targetKey, "", expiry, desc)
	err := k.Sign(info.GetActiveKey().PrivKey)
	if err != nil {
		return "", err
	}

	// Send key
	client, err := getAPIClient(info)
	if err != nil {
		return "", err
	}

	return client.CreateAuthKey(info.Address.Hash(), k)
}
// CreateAuthorizedKey creates a new authorized key
CreateAuthorizedKey creates a new authorized key
// CreateAuthorizedKey creates a new authorized key
func CreateAuthorizedKey(info *vault.AccountInfo, targetKey *bmcrypto.PubKey, validUntil time.Duration, desc string) (string, error) {
	var expiry = time.Time{}
	if validUntil > 0 {
		expiry = pkginternal.TimeNow().Add(validUntil)
	}
	k := key.NewAuthKey(info.Address.Hash(), targetKey, "", expiry, desc)
	err := k.Sign(info.GetActiveKey().PrivKey)
	if err != nil {
		return "", err
	}
	client, err := getAPIClient(info)
	if err != nil {
		return "", err
	}
	return client.CreateAuthKey(info.Address.Hash(), k)
}
func CreateAuthorizedKey ( info * vault . AccountInfo , targetKey * bmcrypto . PubKey , validUntil time . Duration , desc string ) ( string , error ) { var expiry = time . Time { } if validUntil > 0 { expiry = pkginternal . TimeNow ( ) . Add ( validUntil ) } k := key . NewAuthKey ( info . Address . Hash ( ) , targetKey , " " , expiry , desc ) err := k . Sign ( info . GetActiveKey ( ) . PrivKey ) if err != nil { return " " , err } client , err := getAPIClient ( info ) if err != nil { return " " , err } return client . CreateAuthKey ( info . Address . Hash ( ) , k ) }
CreateAuthorizedKey creates a new authorized key
CreateAuthorizedKey creates a new authorized key
// Create and sign key // Send key