@jfvilas/kwirth-common 0.4.6 → 0.4.7
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/AccessKey.js +7 -8
- package/package.json +2 -5
package/dist/AccessKey.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.buildResource = exports.parseResources = exports.parseResource = exports.AccessKey = exports.accessKeySerialize = exports.accessKeyDeserialize = exports.accessKeyCreate = exports.accessKeyBuild = void 0;
|
|
7
|
-
const
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
8
5
|
/*
|
|
9
6
|
Access key format is:
|
|
10
7
|
|
|
11
8
|
id|type|resource
|
|
12
9
|
|
|
13
10
|
where:
|
|
14
|
-
id: is a
|
|
11
|
+
id: is a UUID
|
|
15
12
|
type: is 'volatile', 'permanent' (it is persisted when created) or 'bearer:....'
|
|
16
13
|
in case of a bearer accessKey, the type contains the expire for the key, that is, for example:
|
|
17
14
|
bearer:
|
|
@@ -27,7 +24,7 @@ class AccessKey {
|
|
|
27
24
|
exports.AccessKey = AccessKey;
|
|
28
25
|
function accessKeyCreate(type, resources) {
|
|
29
26
|
let accessKey = new AccessKey();
|
|
30
|
-
accessKey.id =
|
|
27
|
+
accessKey.id = (0, uuid_1.v4)();
|
|
31
28
|
accessKey.type = type;
|
|
32
29
|
accessKey.resources = resources;
|
|
33
30
|
return accessKey;
|
|
@@ -62,8 +59,10 @@ function parseResource(key) {
|
|
|
62
59
|
}
|
|
63
60
|
exports.parseResource = parseResource;
|
|
64
61
|
function parseResources(key) {
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
if (!key)
|
|
63
|
+
return [];
|
|
64
|
+
let ress = key.split(';');
|
|
65
|
+
let result = [];
|
|
67
66
|
for (var res of ress) {
|
|
68
67
|
result.push(parseResource(res));
|
|
69
68
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jfvilas/kwirth-common",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Common interfaces for integrating applications with Kwirth",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "del .\\dist\\* /s /q && tsc"
|
|
@@ -33,9 +33,6 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/jfvilas/kwirth-common#readme",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@types/guid": "^1.0.3"
|
|
36
|
+
"uuid": "^11.1.0"
|
|
40
37
|
}
|
|
41
38
|
}
|