func NewAuthenticated(addr address.Address, key bmcrypto.PrivKey, host string, f serverErrorFunc) (*API, error) {
	// Create token based on the private key of the user
	jwtToken, err := GenerateJWTToken(addr.Hash(), key)
	if err != nil {
		return nil, err
	}

	return NewClient(ClientOpts{
		Host:          host,
		JWTToken:      jwtToken,
		Address:       addr,
		Key:           &key,
		AllowInsecure: config.Client.Server.AllowInsecure || config.Server.Server.AllowInsecure,
		Debug:         config.Client.Server.DebugHTTP,
		ErrorFunc:     f,
	})
}
// NewAuthenticated creates a new client that connects to a BitMaelum Server with specific credentials (normally client-to-server communications)
NewAuthenticated creates a new client that connects to a BitMaelum Server with specific credentials (normally client-to-server communications)
// NewAuthenticated creates a new client that connects to a BitMaelum Server with specific credentials ( normally client - to - server communications )
func NewAuthenticated(addr address.Address, key bmcrypto.PrivKey, host string, f serverErrorFunc) (*API, error) {
	jwtToken, err := GenerateJWTToken(addr.Hash(), key)
	if err != nil {
		return nil, err
	}
	return NewClient(ClientOpts{
		Host:          host,
		JWTToken:      jwtToken,
		Address:       addr,
		Key:           &key,
		AllowInsecure: config.Client.Server.AllowInsecure || config.Server.Server.AllowInsecure,
		Debug:         config.Client.Server.DebugHTTP,
		ErrorFunc:     f,
	})
}
func NewAuthenticated ( addr address . Address , key bmcrypto . PrivKey , host string , f serverErrorFunc ) ( * API , error ) { jwtToken , err := GenerateJWTToken ( addr . Hash ( ) , key ) if err != nil { return nil , err } return NewClient ( ClientOpts { Host : host , JWTToken : jwtToken , Address : addr , Key : & key , AllowInsecure : config . Client . Server . AllowInsecure || config . Server . Server . AllowInsecure , Debug : config . Client . Server . DebugHTTP , ErrorFunc : f , } ) }
NewAuthenticated creates a new client that connects to a BitMaelum Server with specific credentials (normally client-to-server communications)
NewAuthenticated creates a new client that connects to a BitMaelum Server with specific credentials ( normally client - to - server communications )
// Create token based on the private key of the user