3 * Copyright 2015 gRPC authors.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 #ifndef NET_GRPC_NODE_CHANNEL_CREDENTIALS_H_
20 #define NET_GRPC_NODE_CHANNEL_CREDENTIALS_H_
24 #include "grpc/grpc.h"
25 #include "grpc/grpc_security.h"
30 /* Wrapper class for grpc_channel_credentials structs */
31 class ChannelCredentials : public Nan::ObjectWrap {
33 static void Init(v8::Local<v8::Object> exports);
34 static bool HasInstance(v8::Local<v8::Value> val);
35 /* Wrap a grpc_channel_credentials struct in a javascript object */
36 static v8::Local<v8::Value> WrapStruct(grpc_channel_credentials *credentials);
38 /* Returns the grpc_channel_credentials struct that this object wraps */
39 grpc_channel_credentials *GetWrappedCredentials();
42 explicit ChannelCredentials(grpc_channel_credentials *credentials);
43 ~ChannelCredentials();
46 ChannelCredentials(const ChannelCredentials &);
47 ChannelCredentials &operator=(const ChannelCredentials &);
49 static NAN_METHOD(New);
50 static NAN_METHOD(CreateSsl);
51 static NAN_METHOD(CreateInsecure);
53 static NAN_METHOD(Compose);
54 static Nan::Callback *constructor;
55 // Used for typechecking instances of this javascript class
56 static Nan::Persistent<v8::FunctionTemplate> fun_tpl;
58 grpc_channel_credentials *wrapped_credentials;
64 #endif // NET_GRPC_NODE_CHANNEL_CREDENTIALS_H_