Skip to content

Commit ed92e52

Browse files
committed
Merge pull request #3 from ClearBlade/develop
Develop - cleanup all the appKey stuff out of the js sdk
2 parents 9d398fd + 53c0512 commit ed92e52

2 files changed

Lines changed: 49 additions & 49 deletions

File tree

ClearBlade.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if (!window.console) {
2121
* This is the base module for the ClearBlade Platform API
2222
* @namespace ClearBlade
2323
* @example <caption>Initialize ClearBladeAPI</caption>
24-
* initOptions = {appKey: 'asdfknafikjasd3853n34kj2vc', appSecret: 'SHHG245F6GH7SDFG823HGSDFG9'};
24+
* initOptions = {systemKey: 'asdfknafikjasd3853n34kj2vc', systemSecret: 'SHHG245F6GH7SDFG823HGSDFG9'};
2525
* ClearBlade.init(initOptions);
2626
*
2727
*/
@@ -54,11 +54,11 @@ if (!window.console) {
5454
if (!options || typeof options !== 'object')
5555
throw new Error('Options must be an object or it is undefined');
5656

57-
if (!options.appKey || typeof options.appKey !== 'string')
58-
throw new Error('appKey must be defined/a string');
57+
if (!options.systemKey || typeof options.systemKey !== 'string')
58+
throw new Error('systemKey must be defined/a string');
5959

60-
if (!options.appSecret || typeof options.appSecret !== 'string')
61-
throw new Error('appSecret must be defined/a string');
60+
if (!options.systemSecret || typeof options.systemSecret !== 'string')
61+
throw new Error('systemSecret must be defined/a string');
6262

6363
//check for optional params.
6464
if (options.logging && typeof options.logging !== 'boolean')
@@ -102,16 +102,16 @@ if (!window.console) {
102102
// store keys
103103
/**
104104
* This is the app key that will identify your app in order to connect to the Platform
105-
* @property appKey
105+
* @property systemKey
106106
* @type String
107107
*/
108-
ClearBlade.appKey = options.appKey;
108+
ClearBlade.systemKey = options.systemKey;
109109
/**
110-
* This is the app secret that will be used in combination with the appKey to authenticate your app
111-
* @property appSecret
110+
* This is the app secret that will be used in combination with the systemKey to authenticate your app
111+
* @property systemSecret
112112
* @type String
113113
*/
114-
ClearBlade.appSecret = options.appSecret;
114+
ClearBlade.systemSecret = options.systemSecret;
115115
/**
116116
* This is the master secret that is used during development to test many apps at a time
117117
* This is not currently not in use
@@ -398,8 +398,8 @@ if (!window.console) {
398398
if (authToken) {
399399
httpRequest.setRequestHeader("CLEARBLADE-USERTOKEN", authToken);
400400
} else {
401-
httpRequest.setRequestHeader("ClearBlade-SystemKey", ClearBlade.appKey);
402-
httpRequest.setRequestHeader("ClearBlade-SystemSecret", ClearBlade.appSecret);
401+
httpRequest.setRequestHeader("ClearBlade-SystemKey", ClearBlade.systemKey);
402+
httpRequest.setRequestHeader("ClearBlade-SystemSecret", ClearBlade.systemSecret);
403403
}
404404

405405
if (!isObjectEmpty(body) || params) {
@@ -415,7 +415,7 @@ if (!window.console) {
415415
//set Authorization header
416416
if (typeof ClearBlade.masterSecret === 'String') {
417417
// if masterSecret exists as a string use it for Authorization
418-
httpRequest.setRequestHeader("Authorization", "Basic " + window.btoa(ClearBlade.appKey + ':' + ClearBlade.masterSecret));
418+
httpRequest.setRequestHeader("Authorization", "Basic " + window.btoa(ClearBlade.systemKey + ':' + ClearBlade.masterSecret));
419419
} else if (currentUser && currentUser.getToken()) {
420420
// if there is a current user then use the current Access token
421421
httpRequest.setRequestHeader("Authorization", "Bearer " + self.getToken());
@@ -1106,7 +1106,7 @@ if (!window.console) {
11061106
ClearBlade.Code.execute = function(name, params, callback){
11071107
var reqOptions = {
11081108
method: 'POST',
1109-
endpoint: 'api/v/1/code/' + ClearBlade.appKey + '/' + name,
1109+
endpoint: 'api/v/1/code/' + ClearBlade.systemKey + '/' + name,
11101110
body: params
11111111
};
11121112
if (typeof callback === 'function') {
@@ -1176,7 +1176,7 @@ if (!window.console) {
11761176
//roll through the config
11771177
var conf = {};
11781178
conf.userName = ClearBlade.user.authToken;
1179-
conf.password = ClearBlade.appSecret;
1179+
conf.password = ClearBlade.systemSecret;
11801180
conf.cleanSession = options.cleanSession || true;
11811181
conf.useSSL = options.useSSL || false; //up for debate. ole' perf vs sec argument
11821182
conf.hosts = options.hosts || [ClearBlade.messagingURI];

test/ClearBladeSpec.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ var RTP_INFO = {
1212
serverAddress: "https://rtp.clearblade.com",
1313
messagingURI: "rtp.clearblade.com",
1414
messagingPort: 8904,
15-
noAuthAppKey: "8cc896b40a82d0d2b4e18bbbed0f",
16-
noAuthAppSecret: "8CC896B40A90DEA898C197B5E357",
15+
noAuthsystemKey: "8cc896b40a82d0d2b4e18bbbed0f",
16+
noAuthsystemSecret: "8CC896B40A90DEA898C197B5E357",
1717
safariNoAuthCollection: "ccc896b40ae083ea8af480d4868401",
1818
chromeNoAuthCollection: "e8c896b40a90bfcd9bc78df5ca5d",
1919
generalNoAuthCollection: "82c996b40a90fab0dbf7ff83e312",
2020
firefoxNoAuthCollection: "a8c996b40aacdd919dadce92c430",
21-
appKey: "d6d096b40ab4f3c7ddb4899b8a30",
22-
appSecret: "D6D096B40ADAA885E0BF8F8D93CB01",
21+
systemKey: "d6d096b40ab4f3c7ddb4899b8a30",
22+
systemSecret: "D6D096B40ADAA885E0BF8F8D93CB01",
2323
safariCollection: "84d196b40aa883bec8cfdaf697df01",
2424
firefoxCollection: "9ed196b40a8083efa485e58aa9b901",
2525
generalCollection: "9cd296b40acac5e2f797a485ec8e01",
@@ -29,14 +29,14 @@ var STAGING_INFO = {
2929
serverAddress: "https://staging.clearblade.com",
3030
messagingURI: "staging.clearblade.com",
3131
messagingPort: 8904,
32-
noAuthAppKey: "e6a1c1ba0a8690f7a6aaacde9fff01",
33-
noAuthAppSecret: "E6A1C1BA0A98E3D384D7D8F6C6F901",
32+
noAuthsystemKey: "e6a1c1ba0a8690f7a6aaacde9fff01",
33+
noAuthsystemSecret: "E6A1C1BA0A98E3D384D7D8F6C6F901",
3434
safariNoAuthCollection: "bea3c1ba0ae8cc97f2d0e897e6cb01",
3535
chromeNoAuthCollection: "aea2c1ba0a8495d2bdb7d0e3bca701",
3636
generalNoAuthCollection: "90a3c1ba0ab2e3dcfccab5d8bbb101",
3737
firefoxNoAuthCollection: "dca2c1ba0aa0ecd89bbe80ba8b8501",
38-
appKey: "8c9ac1ba0adeb7f68fced7fb9049",
39-
appSecret: "8C9AC1BA0AE2D697A0DCA78DC179",
38+
systemKey: "8c9ac1ba0adeb7f68fced7fb9049",
39+
systemSecret: "8C9AC1BA0AE2D697A0DCA78DC179",
4040
safariCollection: "d49dc1ba0a8ae8dfb5b5f6a996c301",
4141
firefoxCollection: "fe9bc1ba0af08893def9f9fceeef01",
4242
generalCollection: "b49cc1ba0adac69fc9f4d8a0fe52",
@@ -45,10 +45,10 @@ var STAGING_INFO = {
4545
var PLATFORM_INFO = {
4646
serverAddress: "https://platform.clearblade.com",
4747
messagingURI: "platform.clearblade.com",
48-
appKey: 'f2f5f8aa0aba8bc7e4bdcd8ef142',
49-
appSecret: 'F2F5F8AA0AB4F2C4A4E1C387F3F801',
50-
noAuthAppKey: "b48abbb10af2f9bfffd9f793dc9a01",
51-
noAuthAppSecret: "B48ABBB10AE8EB9AD7D1B3B7FC62",
48+
systemKey: 'f2f5f8aa0aba8bc7e4bdcd8ef142',
49+
systemSecret: 'F2F5F8AA0AB4F2C4A4E1C387F3F801',
50+
noAuthsystemKey: "b48abbb10af2f9bfffd9f793dc9a01",
51+
noAuthsystemSecret: "B48ABBB10AE8EB9AD7D1B3B7FC62",
5252
safariCollection: "82f7f8aa0ab8929ab1c3cad7e534",
5353
chromeCollection:"84f6f8aa0abcf9fbb6ae97a6c9da01",
5454
firefoxCollection:"d8f6f8aa0ababdbbc5b8fdf49356",
@@ -71,8 +71,8 @@ describe("ClearBlade initialization should", function () {
7171
beforeEach(function () {
7272
var isClearBladeInit = false;
7373
var initOptions = {
74-
appKey: TargetPlatform.noAuthAppKey,
75-
appSecret: TargetPlatform.noAuthAppSecret,
74+
systemKey: TargetPlatform.noAuthsystemKey,
75+
systemSecret: TargetPlatform.noAuthsystemSecret,
7676
URI: TargetPlatform.serverAddress,
7777
messagingURI: TargetPlatform.messagingURI,
7878
callback: function(err, user) {
@@ -86,12 +86,12 @@ describe("ClearBlade initialization should", function () {
8686
}, "ClearBlade should be initialized", TEST_TIMEOUT);
8787
});
8888

89-
it("have the appKey stored", function () {
90-
expect(ClearBlade.appKey).toEqual(TargetPlatform.noAuthAppKey);
89+
it("have the systemKey stored", function () {
90+
expect(ClearBlade.systemKey).toEqual(TargetPlatform.noAuthsystemKey);
9191
});
9292

93-
it("have the appSecret stored", function () {
94-
expect(ClearBlade.appSecret).toEqual(TargetPlatform.noAuthAppSecret);
93+
it("have the systemSecret stored", function () {
94+
expect(ClearBlade.systemSecret).toEqual(TargetPlatform.noAuthsystemSecret);
9595
});
9696

9797
// it("have defaulted the URI to the Platform", function () {
@@ -115,8 +115,8 @@ describe("ClearBlade users should", function () {
115115
var initOptions;
116116
beforeEach(function () {
117117
initOptions = {
118-
appKey: TargetPlatform.appKey,
119-
appSecret: TargetPlatform.appSecret,
118+
systemKey: TargetPlatform.systemKey,
119+
systemSecret: TargetPlatform.systemSecret,
120120
URI: TargetPlatform.serverAddress,
121121
messagingURI: TargetPlatform.messagingURI,
122122
};
@@ -155,8 +155,8 @@ describe("ClearBlade anonymous users", function () {
155155
var initOptions;
156156
beforeEach(function () {
157157
initOptions = {
158-
appKey: TargetPlatform.noAuthAppKey,
159-
appSecret: TargetPlatform.noAuthAppSecret,
158+
systemKey: TargetPlatform.noAuthsystemKey,
159+
systemSecret: TargetPlatform.noAuthsystemSecret,
160160
URI: TargetPlatform.serverAddress,
161161
messagingURI: TargetPlatform.messagingURI,
162162
};
@@ -180,8 +180,8 @@ describe("ClearBlade collection fetching with users", function () {
180180
var flag, returnedData, isAaronCreated;
181181
var isClearBladeInit = false;
182182
var initOptions = {
183-
appKey: TargetPlatform.appKey,
184-
appSecret: TargetPlatform.appSecret,
183+
systemKey: TargetPlatform.systemKey,
184+
systemSecret: TargetPlatform.systemSecret,
185185
URI: TargetPlatform.serverAddress,
186186
messagingURI: TargetPlatform.messagingURI,
187187
email: "test_" + Math.floor(Math.random() * 10000) + "@test.com",
@@ -242,8 +242,8 @@ describe("ClearBlade Query usage with anonymous user", function() {
242242
beforeEach(function () {
243243
var isClearBladeInit = false;
244244
var initOptions = {
245-
appKey: TargetPlatform.noAuthAppKey,
246-
appSecret: TargetPlatform.noAuthAppSecret,
245+
systemKey: TargetPlatform.noAuthsystemKey,
246+
systemSecret: TargetPlatform.noAuthsystemSecret,
247247
URI: TargetPlatform.serverAddress,
248248
messagingURI: TargetPlatform.messagingURI,
249249
callback: function(err, user) {
@@ -461,8 +461,8 @@ describe("ClearBlade collections fetching", function () {
461461
beforeEach(function () {
462462
var isClearBladeInit = false;
463463
var initOptions = {
464-
appKey: TargetPlatform.noAuthAppKey,
465-
appSecret: TargetPlatform.noAuthAppSecret,
464+
systemKey: TargetPlatform.noAuthsystemKey,
465+
systemSecret: TargetPlatform.noAuthsystemSecret,
466466
URI: TargetPlatform.serverAddress,
467467
messagingURI: TargetPlatform.messagingURI,
468468
callback: function(err, user) {
@@ -535,8 +535,8 @@ describe("ClearBlade collections CRUD should", function () {
535535
beforeEach(function () {
536536
var finishedRemoval = false;
537537
var initOptions = {
538-
appKey: TargetPlatform.noAuthAppKey,
539-
appSecret: TargetPlatform.noAuthAppSecret,
538+
systemKey: TargetPlatform.noAuthsystemKey,
539+
systemSecret: TargetPlatform.noAuthsystemSecret,
540540
URI: TargetPlatform.serverAddress,
541541
messagingURI: TargetPlatform.messagingURI,
542542
callback: function (err, user) {
@@ -684,8 +684,8 @@ describe("Query objects should", function () {
684684
beforeEach(function () {
685685
var isJohnInserted = false;
686686
var initOptions = {
687-
appKey: TargetPlatform.noAuthAppKey,
688-
appSecret: TargetPlatform.noAuthAppSecret,
687+
systemKey: TargetPlatform.noAuthsystemKey,
688+
systemSecret: TargetPlatform.noAuthsystemSecret,
689689
URI: TargetPlatform.serverAddress,
690690
messagingURI: TargetPlatform.messagingURI,
691691
callback: function (err, user) {
@@ -811,8 +811,8 @@ describe("The ClearBlade Messaging module", function() {
811811
beforeEach(function () {
812812
var isClearBladeInit = false;
813813
var initOptions = {
814-
appKey: TargetPlatform.noAuthAppKey,
815-
appSecret: TargetPlatform.noAuthAppSecret,
814+
systemKey: TargetPlatform.noAuthsystemKey,
815+
systemSecret: TargetPlatform.noAuthsystemSecret,
816816
URI: TargetPlatform.serverAddress,
817817
messagingURI: TargetPlatform.messagingURI,
818818
callback: function(err, user) {

0 commit comments

Comments
 (0)