@knowlearning/agents 0.6.4 → 0.7.1
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/agents/browser/auth.js +2 -10
- package/browser.js +0 -1
- package/node.js +0 -1
- package/package.json +1 -1
package/agents/browser/auth.js
CHANGED
|
@@ -9,20 +9,12 @@ function login() {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function logout() {
|
|
12
|
-
|
|
12
|
+
// TODO: hit logout url to refresh cookie
|
|
13
13
|
window.location.reload()
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
async function getToken() {
|
|
17
|
-
|
|
18
|
-
if (token) return token
|
|
19
|
-
else {
|
|
20
|
-
const randArr = new Uint32Array(16)
|
|
21
|
-
crypto.getRandomValues(randArr)
|
|
22
|
-
const anonymousCredential = [...randArr].map(x => x.toString(16).padStart(2, '0')).join('')
|
|
23
|
-
localStorage.setItem('token', anonymousCredential)
|
|
24
|
-
return anonymousCredential
|
|
25
|
-
}
|
|
17
|
+
return localStorage.getItem('token')
|
|
26
18
|
}
|
|
27
19
|
|
|
28
20
|
export {
|
package/browser.js
CHANGED
package/node.js
CHANGED