@nibssplc/cams-sdk-react 1.0.0-rc.34 → 1.0.0-rc.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -21,155 +21,127 @@ import axios from 'axios';
21
21
  import https from 'https';
22
22
 
23
23
  // Crypto polyfill for MSAL browser compatibility
24
- if (typeof window !== 'undefined') {
24
+ (function () {
25
+ var _this = this;
26
+ if (typeof window === 'undefined')
27
+ return;
25
28
  // Ensure crypto object exists
26
29
  if (!window.crypto) {
27
- try {
28
- Object.defineProperty(window, 'crypto', {
29
- value: {},
30
- writable: true,
31
- configurable: true
32
- });
33
- }
34
- catch (e) {
35
- // Ignore if crypto cannot be defined
36
- }
30
+ window.crypto = {};
37
31
  }
38
32
  // Polyfill getRandomValues
39
- if (window.crypto && !window.crypto.getRandomValues) {
40
- try {
41
- Object.defineProperty(window.crypto, 'getRandomValues', {
42
- value: function (array) {
43
- var bytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
44
- for (var i = 0; i < bytes.length; i++) {
45
- bytes[i] = Math.floor(Math.random() * 256);
46
- }
47
- return array;
48
- },
49
- writable: true,
50
- configurable: true
51
- });
52
- }
53
- catch (e) {
54
- // Ignore if getRandomValues cannot be defined
55
- }
33
+ if (!window.crypto.getRandomValues) {
34
+ window.crypto.getRandomValues = function (array) {
35
+ var bytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
36
+ for (var i = 0; i < bytes.length; i++) {
37
+ bytes[i] = Math.floor(Math.random() * 256);
38
+ }
39
+ return array;
40
+ };
56
41
  }
57
- // Force polyfill crypto.subtle on localhost and non-HTTPS contexts
58
- if (window.crypto) {
59
- var sha256_1 = function (data) { return __awaiter(void 0, void 0, void 0, function () {
60
- var bytes, hash, k, ml, msg, i, w, j, j, s0, s1, a, b, c, d, e, f, g, h, j, S1, ch, temp1, S0, maj, temp2, result, i;
61
- return __generator(this, function (_a) {
62
- bytes = new Uint8Array(data);
63
- hash = new Uint32Array(8);
64
- k = new Uint32Array([
65
- 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
66
- 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
67
- 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
68
- 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
69
- 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
70
- 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
71
- 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
72
- 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
73
- ]);
74
- hash[0] = 0x6a09e667;
75
- hash[1] = 0xbb67ae85;
76
- hash[2] = 0x3c6ef372;
77
- hash[3] = 0xa54ff53a;
78
- hash[4] = 0x510e527f;
79
- hash[5] = 0x9b05688c;
80
- hash[6] = 0x1f83d9ab;
81
- hash[7] = 0x5be0cd19;
82
- ml = bytes.length * 8;
83
- msg = new Uint8Array(bytes.length + 64 + ((64 - ((bytes.length + 9) % 64)) % 64));
84
- msg.set(bytes);
85
- msg[bytes.length] = 0x80;
86
- new DataView(msg.buffer).setUint32(msg.length - 4, ml, false);
87
- for (i = 0; i < msg.length; i += 64) {
88
- w = new Uint32Array(64);
89
- for (j = 0; j < 16; j++)
90
- w[j] = new DataView(msg.buffer).getUint32(i + j * 4, false);
91
- for (j = 16; j < 64; j++) {
92
- s0 = ((w[j - 15] >>> 7) | (w[j - 15] << 25)) ^ ((w[j - 15] >>> 18) | (w[j - 15] << 14)) ^ (w[j - 15] >>> 3);
93
- s1 = ((w[j - 2] >>> 17) | (w[j - 2] << 15)) ^ ((w[j - 2] >>> 19) | (w[j - 2] << 13)) ^ (w[j - 2] >>> 10);
94
- w[j] = (w[j - 16] + s0 + w[j - 7] + s1) >>> 0;
95
- }
96
- a = hash[0], b = hash[1], c = hash[2], d = hash[3], e = hash[4], f = hash[5], g = hash[6], h = hash[7];
97
- for (j = 0; j < 64; j++) {
98
- S1 = ((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7));
99
- ch = (e & f) ^ (~e & g);
100
- temp1 = (h + S1 + ch + k[j] + w[j]) >>> 0;
101
- S0 = ((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10));
102
- maj = (a & b) ^ (a & c) ^ (b & c);
103
- temp2 = (S0 + maj) >>> 0;
104
- h = g;
105
- g = f;
106
- f = e;
107
- e = (d + temp1) >>> 0;
108
- d = c;
109
- c = b;
110
- b = a;
111
- a = (temp1 + temp2) >>> 0;
112
- }
113
- hash[0] = (hash[0] + a) >>> 0;
114
- hash[1] = (hash[1] + b) >>> 0;
115
- hash[2] = (hash[2] + c) >>> 0;
116
- hash[3] = (hash[3] + d) >>> 0;
117
- hash[4] = (hash[4] + e) >>> 0;
118
- hash[5] = (hash[5] + f) >>> 0;
119
- hash[6] = (hash[6] + g) >>> 0;
120
- hash[7] = (hash[7] + h) >>> 0;
42
+ var sha256 = function (data) { return __awaiter(_this, void 0, void 0, function () {
43
+ var bytes, hash, k, ml, msg, i, w, j, j, s0, s1, a, b, c, d, e, f, g, h, j, S1, ch, temp1, S0, maj, temp2, result, i;
44
+ return __generator(this, function (_a) {
45
+ bytes = new Uint8Array(data);
46
+ hash = new Uint32Array(8);
47
+ k = new Uint32Array([
48
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
49
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
50
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
51
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
52
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
53
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
54
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
55
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
56
+ ]);
57
+ hash[0] = 0x6a09e667;
58
+ hash[1] = 0xbb67ae85;
59
+ hash[2] = 0x3c6ef372;
60
+ hash[3] = 0xa54ff53a;
61
+ hash[4] = 0x510e527f;
62
+ hash[5] = 0x9b05688c;
63
+ hash[6] = 0x1f83d9ab;
64
+ hash[7] = 0x5be0cd19;
65
+ ml = bytes.length * 8;
66
+ msg = new Uint8Array(bytes.length + 64 + ((64 - ((bytes.length + 9) % 64)) % 64));
67
+ msg.set(bytes);
68
+ msg[bytes.length] = 0x80;
69
+ new DataView(msg.buffer).setUint32(msg.length - 4, ml, false);
70
+ for (i = 0; i < msg.length; i += 64) {
71
+ w = new Uint32Array(64);
72
+ for (j = 0; j < 16; j++)
73
+ w[j] = new DataView(msg.buffer).getUint32(i + j * 4, false);
74
+ for (j = 16; j < 64; j++) {
75
+ s0 = ((w[j - 15] >>> 7) | (w[j - 15] << 25)) ^ ((w[j - 15] >>> 18) | (w[j - 15] << 14)) ^ (w[j - 15] >>> 3);
76
+ s1 = ((w[j - 2] >>> 17) | (w[j - 2] << 15)) ^ ((w[j - 2] >>> 19) | (w[j - 2] << 13)) ^ (w[j - 2] >>> 10);
77
+ w[j] = (w[j - 16] + s0 + w[j - 7] + s1) >>> 0;
121
78
  }
122
- result = new Uint8Array(32);
123
- for (i = 0; i < 8; i++)
124
- new DataView(result.buffer).setUint32(i * 4, hash[i], false);
125
- return [2 /*return*/, result.buffer];
126
- });
127
- }); };
128
- var originalSubtle_1 = window.crypto.subtle;
129
- try {
130
- Object.defineProperty(window.crypto, 'subtle', {
131
- value: {
132
- digest: function (algorithm, data) { return __awaiter(void 0, void 0, void 0, function () {
133
- var alg;
134
- return __generator(this, function (_a) {
135
- alg = typeof algorithm === 'string' ? algorithm : algorithm.name;
136
- if (alg === 'SHA-256')
137
- return [2 /*return*/, sha256_1(data)];
138
- // Fallback to original if available
139
- if (originalSubtle_1 === null || originalSubtle_1 === void 0 ? void 0 : originalSubtle_1.digest)
140
- return [2 /*return*/, originalSubtle_1.digest(algorithm, data)];
141
- throw new Error("Unsupported algorithm: ".concat(alg));
142
- });
143
- }); }
144
- },
145
- writable: true,
146
- configurable: true
147
- });
148
- }
149
- catch (e) {
150
- // Ignore if subtle cannot be defined
151
- }
152
- }
79
+ a = hash[0], b = hash[1], c = hash[2], d = hash[3], e = hash[4], f = hash[5], g = hash[6], h = hash[7];
80
+ for (j = 0; j < 64; j++) {
81
+ S1 = ((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7));
82
+ ch = (e & f) ^ (~e & g);
83
+ temp1 = (h + S1 + ch + k[j] + w[j]) >>> 0;
84
+ S0 = ((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10));
85
+ maj = (a & b) ^ (a & c) ^ (b & c);
86
+ temp2 = (S0 + maj) >>> 0;
87
+ h = g;
88
+ g = f;
89
+ f = e;
90
+ e = (d + temp1) >>> 0;
91
+ d = c;
92
+ c = b;
93
+ b = a;
94
+ a = (temp1 + temp2) >>> 0;
95
+ }
96
+ hash[0] = (hash[0] + a) >>> 0;
97
+ hash[1] = (hash[1] + b) >>> 0;
98
+ hash[2] = (hash[2] + c) >>> 0;
99
+ hash[3] = (hash[3] + d) >>> 0;
100
+ hash[4] = (hash[4] + e) >>> 0;
101
+ hash[5] = (hash[5] + f) >>> 0;
102
+ hash[6] = (hash[6] + g) >>> 0;
103
+ hash[7] = (hash[7] + h) >>> 0;
104
+ }
105
+ result = new Uint8Array(32);
106
+ for (i = 0; i < 8; i++)
107
+ new DataView(result.buffer).setUint32(i * 4, hash[i], false);
108
+ return [2 /*return*/, result.buffer];
109
+ });
110
+ }); };
111
+ // Force override crypto.subtle
112
+ var originalSubtle = window.crypto.subtle;
113
+ Object.defineProperty(window.crypto, 'subtle', {
114
+ value: {
115
+ digest: function (algorithm, data) { return __awaiter(_this, void 0, void 0, function () {
116
+ var alg;
117
+ return __generator(this, function (_a) {
118
+ alg = typeof algorithm === 'string' ? algorithm : algorithm.name;
119
+ if (alg === 'SHA-256')
120
+ return [2 /*return*/, sha256(data)];
121
+ if (originalSubtle === null || originalSubtle === void 0 ? void 0 : originalSubtle.digest)
122
+ return [2 /*return*/, originalSubtle.digest(algorithm, data)];
123
+ throw new Error("Unsupported algorithm: ".concat(alg));
124
+ });
125
+ }); }
126
+ },
127
+ writable: true,
128
+ configurable: true
129
+ });
153
130
  // Polyfill randomUUID
154
- if (window.crypto && !window.crypto.randomUUID) {
155
- try {
156
- Object.defineProperty(window.crypto, 'randomUUID', {
157
- value: function () {
158
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
159
- var r = (Math.random() * 16) | 0;
160
- var v = c === 'x' ? r : (r & 0x3) | 0x8;
161
- return v.toString(16);
162
- });
163
- },
164
- writable: true,
165
- configurable: true
166
- });
167
- }
168
- catch (e) {
169
- // Ignore if randomUUID cannot be defined
170
- }
131
+ if (!window.crypto.randomUUID) {
132
+ Object.defineProperty(window.crypto, 'randomUUID', {
133
+ value: function () {
134
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
135
+ var r = (Math.random() * 16) | 0;
136
+ var v = c === 'x' ? r : (r & 0x3) | 0x8;
137
+ return v.toString(16);
138
+ });
139
+ },
140
+ writable: true,
141
+ configurable: true
142
+ });
171
143
  }
172
- }
144
+ })();
173
145
 
174
146
  /******************************************************************************
175
147
  Copyright (c) Microsoft Corporation.