yalgaar 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6dd09d3069d064ace5193b955d3940d96d475b6d
4
- data.tar.gz: 41f5bc9de06c68925e0248ca14b420c30774a5a7
3
+ metadata.gz: 10249762f35446b0099f00b7af453815157ba804
4
+ data.tar.gz: 08a2813bf4290e9af699aa77d7f720d843c83f6a
5
5
  SHA512:
6
- metadata.gz: 9a0e71afa8cfd9e8836c0c2a62cb60e2e916ded07d10f3944df6b3b844fdb2ca8806756355f9b2e9055c87d431b83a7c1ff35b0dea0f7e417cceba66d4de5004
7
- data.tar.gz: 6dbc43a669f04c5c500591ddec0dbf55930ecae3b088b89f9f00a7393996bb6e188eab395a5adb6f62d106c318bdacde4c10fd513e9b30059d9f3f1663e384a9
6
+ metadata.gz: 60676b29e736a5ab99cb1b249a3f9f8662fab2683b8dfade272525a4b2581f31f57fc29aba9083cd6f0a03a04f44463bb0386e45b20cbf8ee41e25e0c484ed05
7
+ data.tar.gz: 818fd3fc1583104e530da19569d4ded1d6d0bde6eb6012b1128fc50a577a685e8f014a359b222fc0830776eb0940c587e2b520c96f118f39bfa51cc346dfb01e
File without changes
@@ -25,13 +25,13 @@ yalgaarClient.yalgaarDisconnect($connectionCallback)
25
25
  sleep 2
26
26
 
27
27
  #yalgaarConnect(clientKey,isSecure,AESSecretKey,AESType,$connectionCallback)#
28
- yalgaarClient.yalgaarConnect("ck-47046d75cf64402f",1,"SystemLevelSolution",1,$connectionCallback)
28
+ yalgaarClient.yalgaarConnect("ck-47046d75cf64402f",1,"SystemSystemSLSS",128,$connectionCallback)
29
29
  sleep 2
30
30
  yalgaarClient.yalgaarDisconnect($connectionCallback)
31
31
  sleep 2
32
32
 
33
33
  #yalgaarConnect(clientKey,isSecure,UUID,AESSecretKey,AESType,$connectionCallback)#
34
- yalgaarClient.yalgaarConnect("ck-47046d75cf64402f",1,"123","SystemLevelSolution",1,$connectionCallback)
34
+ yalgaarClient.yalgaarConnect("ck-47046d75cf64402f",1,"123","SystemSystemSLSS",128,$connectionCallback)
35
35
  sleep 2
36
36
  yalgaarClient.yalgaarDisconnect($connectionCallback)
37
37
  ########################################################END####################################################################
@@ -74,7 +74,9 @@ end
74
74
 
75
75
  ########################################################User Area for Calling Pub-sub######################################
76
76
  yalgaarClient = Yalgaar.new
77
- yalgaarClient.yalgaarConnect("ck-47046d75cf64402f",1,"123",$connectionCallback)
77
+ #~ yalgaarClient.yalgaarConnect("ck-47046d75cf64402f",1,"123",$connectionCallback)
78
+
79
+ yalgaarClient.yalgaarConnect("ck-47046d75cf64402f",1,"12","1234567812345678",128,$connectionCallback)
78
80
  yalgaarClient.yalgaarSubcribe("SLS",$subscribeReturnMessageCallback,$presenceMessageCallback,$errorMsgCallback)
79
81
  #~ yalgaarClient.yalgaarHistory("@@@@@!!!!test@@!!","100",$HistoryMessageCallback,$errorMsgCallback)
80
82
  loop {
@@ -2,7 +2,7 @@
2
2
  #@brief - <methods>
3
3
  #
4
4
  #Revision Log:
5
- # v1.0.1 : Aug 4, 2016 INITIAL OF PROGRAMMER - REVISION DETAIL_1 <- THIS IS THE LATEST REVISION
5
+ # v1.0.2 : Aug 4, 2016 INITIAL OF PROGRAMMER - REVISION DETAIL_1 <- THIS IS THE LATEST REVISION
6
6
  #Description:
7
7
  #YalgaarInitModule contents methods and variables and enum..
8
8
  #
@@ -2,7 +2,7 @@
2
2
  #@brief - <Connect all varialbes and common methods>
3
3
  #
4
4
  #Revision Log:
5
- # v1.0.1 : Aug 4, 2016 INITIAL OF PROGRAMMER - REVISION DETAIL_1 <- THIS IS THE LATEST REVISION
5
+ # v1.0.2 : Aug 4, 2016 INITIAL OF PROGRAMMER - REVISION DETAIL_1 <- THIS IS THE LATEST REVISION
6
6
  #Description:
7
7
  #YalgaarInitModule contents methods and variables and enum..
8
8
  #
@@ -52,7 +52,7 @@ require_relative 'YalgaarInitModule'
52
52
  #~ puts args.size
53
53
  case args.size
54
54
  when TWOARGV
55
- isEncrpt=0
55
+ @@isEncrpt=0
56
56
  @@clientKey=args[0]
57
57
  @@isSecure=args[1]
58
58
  @@uuid=generateUUID(3)
@@ -92,11 +92,11 @@ require_relative 'YalgaarInitModule'
92
92
 
93
93
  th = Thread.new do |client|
94
94
  @@client.get do |topic,message|
95
- messageParsing(topic,message,isEncrpt)
95
+ messageParsing(topic,message,@@isEncrpt)
96
96
  end
97
97
  end
98
98
  when THREEARGV
99
- isEncrpt=0
99
+ @@isEncrpt=0
100
100
  @@clientKey=args[0]
101
101
  @@isSecure=args[1]
102
102
  @@uuid=args[2]
@@ -141,21 +141,42 @@ require_relative 'YalgaarInitModule'
141
141
  th = Thread.new do |client|
142
142
  @@client.get do |topic,message|
143
143
  #~ puts "#{topic}: #{message}"
144
- messageParsing(topic,message,isEncrpt)
144
+ messageParsing(topic,message,@@isEncrpt)
145
145
  end
146
146
  end
147
147
  when FOURARGV
148
- isEncrpt=1
148
+ @@isEncrpt=1
149
149
  @@clientKey=args[0]
150
150
  @@isSecure=args[1]
151
151
  @@uuid=generateUUID(3)
152
152
  @@aesSecretKey=args[2]
153
153
  if args[3]==YALGAR_AES_128
154
154
  @@aesType='AES-128-ECB'
155
+ validAESKey = /^[a-zA-Z0-9]{16}$/
156
+ validAES = validAESKey.match(@@aesSecretKey)
157
+ if validAES == nil
158
+ errmesg=showErrCode(YALGAAR_INVALID_AES_KEY_LENGTH)
159
+ @@lErrorConnectionCallback.call(errmesg)
160
+ return
161
+ end
155
162
  elsif args[3]==YALGAR_AES_192
156
163
  @@aesType='AES-192-ECB'
164
+ validAESKey = /^[a-zA-Z0-9]{24}$/
165
+ validAES = validAESKey.match(@@aesSecretKey)
166
+ if validAES == nil
167
+ errmesg=showErrCode(YALGAAR_INVALID_AES_KEY_LENGTH)
168
+ @@lErrorConnectionCallback.call(errmesg)
169
+ return
170
+ end
157
171
  elsif args[3]==YALGAR_AES_256
158
172
  @@aesType='AES-256-ECB'
173
+ validAESKey = /^[a-zA-Z0-9]{32}$/
174
+ validAES = validAESKey.match(@@aesSecretKey)
175
+ if validAES == nil
176
+ errmesg=showErrCode(YALGAAR_INVALID_AES_KEY_LENGTH)
177
+ @@lErrorConnectionCallback.call(errmesg)
178
+ return
179
+ end
159
180
  else
160
181
  errmesg=showErrCode(YALGAAR_INVALID_AES_TYPE)
161
182
  @@lErrorConnectionCallback.call(errmesg)
@@ -196,11 +217,11 @@ require_relative 'YalgaarInitModule'
196
217
 
197
218
  th = Thread.new do |client|
198
219
  @@client.get do |topic,message|
199
- messageParsing(topic,message,isEncrpt)
220
+ messageParsing(topic,message,@@isEncrpt)
200
221
  end
201
222
  end
202
223
  when FIVEARGV
203
- isEncrpt=1
224
+ @@isEncrpt=1
204
225
  @@clientKey=args[0]
205
226
  @@isSecure=args[1]
206
227
  @@uuid=args[2]
@@ -210,10 +231,31 @@ require_relative 'YalgaarInitModule'
210
231
  @@aesSecretKey=args[3]
211
232
  if args[4]==YALGAR_AES_128
212
233
  @@aesType='AES-128-ECB'
234
+ validAESKey = /^[a-zA-Z0-9]{16}$/
235
+ validAES = validAESKey.match(@@aesSecretKey)
236
+ if validAES == nil
237
+ errmesg=showErrCode(YALGAAR_INVALID_AES_KEY_LENGTH)
238
+ @@lErrorConnectionCallback.call(errmesg)
239
+ return
240
+ end
213
241
  elsif args[4]==YALGAR_AES_192
214
242
  @@aesType='AES-192-ECB'
243
+ validAESKey = /^[a-zA-Z0-9]{24}$/
244
+ validAES = validAESKey.match(@@aesSecretKey)
245
+ if validAES == nil
246
+ errmesg=showErrCode(YALGAAR_INVALID_AES_KEY_LENGTH)
247
+ @@lErrorConnectionCallback.call(errmesg)
248
+ return
249
+ end
215
250
  elsif args[4]==YALGAR_AES_256
216
251
  @@aesType='AES-256-ECB'
252
+ validAESKey = /^[a-zA-Z0-9]{32}$/
253
+ validAES = validAESKey.match(@@aesSecretKey)
254
+ if validAES == nil
255
+ errmesg=showErrCode(YALGAAR_INVALID_AES_KEY_LENGTH)
256
+ @@lErrorConnectionCallback.call(errmesg)
257
+ return
258
+ end
217
259
  else
218
260
  errmesg=showErrCode(YALGAAR_INVALID_AES_TYPE)
219
261
  @@lErrorConnectionCallback.call(errmesg)
@@ -254,7 +296,7 @@ require_relative 'YalgaarInitModule'
254
296
  th = Thread.new do |client|
255
297
  @@client.get do |topic,message|
256
298
  #puts "#{topic}: #{message}"
257
- messageParsing(topic,message,isEncrpt)
299
+ messageParsing(topic,message,@@isEncrpt)
258
300
  end
259
301
  end
260
302
  else
@@ -2,7 +2,7 @@
2
2
  #@brief - <methods>
3
3
  #
4
4
  #Revision Log:
5
- # v1.0.1 : Aug 4, 2016 INITIAL OF PROGRAMMER - REVISION DETAIL_1 <- THIS IS THE LATEST REVISION
5
+ # v1.0.2 : Aug 4, 2016 INITIAL OF PROGRAMMER - REVISION DETAIL_1 <- THIS IS THE LATEST REVISION
6
6
  #Description:
7
7
  #YalgaarInitModule contents methods and variables and enum..
8
8
  #
@@ -3,7 +3,7 @@
3
3
  #@brief - <Initialize all varialbes and common methods>
4
4
  #
5
5
  #Revision Log:
6
- # v1.0.1 : Aug 4, 2016 INITIAL OF PROGRAMMER - REVISION DETAIL_1 <- THIS IS THE LATEST REVISION
6
+ # v1.0.2 : Aug 4, 2016 INITIAL OF PROGRAMMER - REVISION DETAIL_1 <- THIS IS THE LATEST REVISION
7
7
  #Description:
8
8
  #YalgaarInitModule contents methods and variables and enum..
9
9
  #
@@ -76,6 +76,7 @@ require_relative 'mqtt'
76
76
  YALGAAR_150=150,
77
77
  YALGAAR_NO_SERVER_CONNECTION=151,
78
78
  YALGAAR_INVALID_AES_TYPE=152,
79
+ YALGAAR_INVALID_AES_KEY_LENGTH=153,
79
80
  YALGAAR_MAX=200
80
81
  ]
81
82
  #init(message);
@@ -101,7 +102,8 @@ require_relative 'mqtt'
101
102
  @@lHistoryCallback=nil
102
103
  @@lChannelList=nil
103
104
  @@lUserList=nil
104
- @@host='192.168.60.6'
105
+ @@host='api.yalgaar.io'
106
+ @@isEncrpt=nil
105
107
  end
106
108
  end
107
109
 
@@ -235,12 +237,14 @@ end
235
237
  cipher = OpenSSL::Cipher.new(@@aesType)
236
238
  cipher.encrypt()
237
239
  cipher.key = @@aesSecretKey
240
+ cipher.iv = @@aesSecretKey[0..15]
238
241
  crypt = cipher.update(msg) + cipher.final()
239
242
  crypt_string = (Base64.encode64(crypt))
240
243
  return crypt_string
241
244
  rescue Exception => exc
242
- puts ("Message for the encryption log file for message #{msg} = #{exc.message}")
245
+ puts "Message for the encryption log file for message #{msg} = #{exc.message}"
243
246
  end
247
+
244
248
  end
245
249
 
246
250
  #decryption(channel);
@@ -252,6 +256,7 @@ end
252
256
  cipher = OpenSSL::Cipher.new(@@aesType)
253
257
  cipher.decrypt()
254
258
  cipher.key = @@aesSecretKey
259
+ cipher.iv = @@aesSecretKey[0..15]
255
260
  tempkey = Base64.decode64(msg)
256
261
  crypt = cipher.update(tempkey)
257
262
  crypt << cipher.final()
@@ -324,6 +329,8 @@ end
324
329
  errMessage="No server connection found."
325
330
  when YALGAAR_INVALID_AES_TYPE
326
331
  errMessage="Invalid AES Type."
332
+ when YALGAAR_INVALID_AES_KEY_LENGTH
333
+ errMessage="Invalid AES key length."
327
334
  else
328
335
  errMessage="Success"
329
336
  end
@@ -2,7 +2,7 @@
2
2
  #@brief - <Publish methods>
3
3
  #
4
4
  #Revision Log:
5
- # v1.0.1 : Aug 4, 2016 INITIAL OF PROGRAMMER - REVISION DETAIL_1 <- THIS IS THE LATEST REVISION
5
+ # v1.0.2 : Aug 4, 2016 INITIAL OF PROGRAMMER - REVISION DETAIL_1 <- THIS IS THE LATEST REVISION
6
6
  #Description:
7
7
  #YalgaarInitModule contents methods and variables and enum..
8
8
  #
@@ -31,7 +31,12 @@
31
31
  def yalgaarPublish(channel,message)
32
32
  if @@isConnected==true
33
33
  topic=@@clientKey+'/'+channel
34
- @@client.publish(topic, message, retain=false)
34
+ if @@isEncrpt==1
35
+ cyperText=encryption(message)
36
+ @@client.publish(topic, cyperText, retain=false)
37
+ else
38
+ @@client.publish(topic, message, retain=false)
39
+ end
35
40
  else
36
41
  return YALGAAR_NO_SERVER_CONNECTION
37
42
  end
@@ -2,7 +2,7 @@
2
2
  #@brief - <Subscribe methods>
3
3
  #
4
4
  #Revision Log:
5
- # v1.0.1 : Aug 4, 2016 INITIAL OF PROGRAMMER - REVISION DETAIL_1 <- THIS IS THE LATEST REVISION
5
+ # v1.0.2 : Aug 4, 2016 INITIAL OF PROGRAMMER - REVISION DETAIL_1 <- THIS IS THE LATEST REVISION
6
6
  #Description:
7
7
  #YalgaarInitModule contents methods and variables and enum..
8
8
  #
@@ -1,4 +1,4 @@
1
1
  module YALGAAR
2
2
  # The version number of the Yalgaar MQTT gem
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yalgaar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yalgaar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-13 00:00:00.000000000 Z
11
+ date: 2017-01-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Pure Ruby gem that implements the Yalgaar MQTT protocol, a lightweight
14
- protocol for publish/subscribe messaging.
13
+ description: yalgaar Ruby SDK for real-time messaging
15
14
  email: yalgaar@slscorp.com
16
15
  executables: []
17
16
  extensions: []
@@ -171,8 +170,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
170
  version: '0'
172
171
  requirements: []
173
172
  rubyforge_project:
174
- rubygems_version: 2.5.1
173
+ rubygems_version: 2.6.6
175
174
  signing_key:
176
175
  specification_version: 4
177
- summary: Implementation of the Yalgaar MQTT protocol
176
+ summary: Yalgaar Ruby SDK for real-time messaging
178
177
  test_files: []