@cocreate/authenticate 1.0.18 → 1.2.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ # [1.2.0](https://github.com/CoCreate-app/CoCreate-authenticate/compare/v1.1.0...v1.2.0) (2023-08-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * bump cocreate dependencies for the latest updates and features ([d4323a2](https://github.com/CoCreate-app/CoCreate-authenticate/commit/d4323a2ea2e8b774adfa6afbe4508c6d479fa943))
7
+
8
+ # [1.1.0](https://github.com/CoCreate-app/CoCreate-authenticate/compare/v1.0.18...v1.1.0) (2023-08-16)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * crud attributes renamed ([626bca8](https://github.com/CoCreate-app/CoCreate-authenticate/commit/626bca8659eaa87cea1067c35ff07a28a9d2cf56))
14
+ * Refactored *-target to *-selector ([ad7247e](https://github.com/CoCreate-app/CoCreate-authenticate/commit/ad7247eecc4bb3c73a0b32841194fb2a15021cf8))
15
+
16
+
17
+ ### Features
18
+
19
+ * name attribute and variable renamed to key ([e695800](https://github.com/CoCreate-app/CoCreate-authenticate/commit/e695800527c17d6ce7dd7f91825a7f99408064d6))
20
+
1
21
  ## [1.0.18](https://github.com/CoCreate-app/CoCreate-authenticate/compare/v1.0.17...v1.0.18) (2023-06-14)
2
22
 
3
23
 
@@ -4,8 +4,8 @@ module.exports = {
4
4
  "host": "",
5
5
  "sources": [
6
6
  {
7
- "collection": "files",
8
- "document": {
7
+ "array": "files",
8
+ "object": {
9
9
  "_id": "6204253480b409001727b73d",
10
10
  "name": "index.html",
11
11
  "path": "/docs/authenticate/index.html",
package/docs/index.html CHANGED
@@ -11,10 +11,10 @@
11
11
  sizes="32x32"
12
12
  href="https://cocreate.app/images/favicon.ico" />
13
13
  <meta
14
- name="description"
14
+ key="description"
15
15
  content="A simple HTML5 and pure javascript component. Easy configuration using data-attributes and highly styleable." />
16
16
  <meta
17
- name="keywords"
17
+ key="keywords"
18
18
  content="helper classes, utility classes, css framework, css library, inline style classes" />
19
19
  <meta name="robots" content="index,follow" />
20
20
 
@@ -26,7 +26,7 @@
26
26
  </head>
27
27
 
28
28
  <body>
29
- <div collection="" document_id="" name="" id="cocreate-authenticate">
29
+ <div array="" object="" key="" id="cocreate-authenticate">
30
30
  <div
31
31
  class="display:flex flex-wrap:wrap justify-content:space-between margin:10px">
32
32
  <div class="display:flex align-items:center">
@@ -151,9 +151,9 @@
151
151
  <textarea
152
152
  type="code"
153
153
  lang="html"
154
- collection="demos"
155
- document_id=""
156
- name="demo"
154
+ array="demos"
155
+ object=""
156
+ key="demo"
157
157
  save="false"
158
158
  id="demo"
159
159
  class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
@@ -176,7 +176,7 @@
176
176
  show="#eye-slash"
177
177
  hide="#eye, #demo-preview"
178
178
  toggle="code-height"
179
- toggle-target="#demo-code"
179
+ toggle-selector="#demo-code"
180
180
  ><i class="far fa-eye"></i
181
181
  ></a>
182
182
  <a
@@ -186,7 +186,7 @@
186
186
  show="#eye, #demo-preview"
187
187
  hide="#eye-slash"
188
188
  toggle="code-height"
189
- toggle-target="#demo-code"
189
+ toggle-selector="#demo-code"
190
190
  ><i class="fas fa-eye-slash"></i
191
191
  ></a>
192
192
  <a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/authenticate",
3
- "version": "1.0.18",
3
+ "version": "1.2.0",
4
4
  "description": "A simple authenticate component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "authenticate",
@@ -40,7 +40,7 @@
40
40
  "main": "./src/index.js",
41
41
  "homepage": "https://cocreate.app/docs/authenticate",
42
42
  "dependencies": {
43
- "@cocreate/uuid": "^1.4.27",
43
+ "@cocreate/uuid": "^1.5.0",
44
44
  "jsonwebtoken": "^9.0.0"
45
45
  }
46
46
  }
package/src/index.js CHANGED
@@ -12,14 +12,14 @@ const users = new Map();
12
12
  // TODO: user can have multiple sessions
13
13
  const activeSessions = new Map();
14
14
 
15
- // crud.listen('createDocument', function (data) {
16
- // if (data.document && data.document[0] && data.document[0].type === 'keyPair')
17
- // keyPairs.set(data.document[0]._id, data.document[0]);
15
+ // crud.listen('create.object', function (data) {
16
+ // if (data.object && data.object[0] && data.object[0].type === 'keyPair')
17
+ // keyPairs.set(data.object[0]._id, data.object[0]);
18
18
  // });
19
19
 
20
- // crud.listen('deleteDocument', function (data) {
21
- // if (data.document && data.document[0] && data.document[0].type === 'keyPair')
22
- // keyPairs.delete(data.document[0]._id);
20
+ // crud.listen('delete.object', function (data) {
21
+ // if (data.object && data.object[0] && data.object[0].type === 'keyPair')
22
+ // keyPairs.delete(data.object[0]._id);
23
23
  // });
24
24
 
25
25
  // Create new RSA key pair
@@ -38,9 +38,10 @@ function createKeyPair() {
38
38
 
39
39
  keyPairs.set(keyPair._id, keyPair);
40
40
 
41
- // crud.createDocument({
42
- // collection: 'keys',
43
- // document: {
41
+ // crud.send({
42
+ // method: 'create.object',
43
+ // array: 'keys',
44
+ // object: {
44
45
  // ...keyPair,
45
46
  // },
46
47
  // organization_id: process.env.organization_id,
@@ -51,19 +52,20 @@ function createKeyPair() {
51
52
 
52
53
  // Function to retrieve keys from the database (example using CRUD operations)
53
54
  function readKeyPairs() {
54
- const keys = crud.readDocument({
55
- collection: 'keys',
55
+ const keys = crud.send({
56
+ method: 'read.object',
57
+ array: 'keys',
56
58
  filter: {
57
59
  query: [
58
- { name: 'type', value: 'keyPair' },
60
+ { key: 'type', value: 'keyPair' },
59
61
  ],
60
62
  },
61
63
  organization_id: process.env.organization_id,
62
64
  });
63
65
 
64
66
  // Add retrieved key pairs to the keyPairs array
65
- if (keys.document && keys.document.length) {
66
- keys.document.forEach((keyPair) => {
67
+ if (keys.object && keys.object.length) {
68
+ keys.object.forEach((keyPair) => {
67
69
  keyPairs.set(keyPair._id, keyPair);
68
70
  });
69
71
  }
@@ -72,9 +74,10 @@ function readKeyPairs() {
72
74
  // Delete new RSA key pair
73
75
  function deleteKeyPair(keyPair) {
74
76
  keyPairs.delete(keyPair._id)
75
- // crud.deleteDocument({
76
- // collection: 'keys',
77
- // document: {
77
+ // crud.send({
78
+ // method: 'delete.object',
79
+ // array: 'keys',
80
+ // object: {
78
81
  // _id: keyPair._id,
79
82
  // type: 'keyPair'
80
83
  // },