@fluidframework/azure-service-utils 0.58.2002 → 0.59.1000
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/.eslintrc.js +1 -3
- package/dist/generateToken.d.ts +1 -1
- package/dist/generateToken.d.ts.map +1 -1
- package/dist/generateToken.js +3 -2
- package/dist/generateToken.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/generateToken.d.ts +1 -1
- package/lib/generateToken.d.ts.map +1 -1
- package/lib/generateToken.js +3 -2
- package/lib/generateToken.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +12 -5
- package/src/generateToken.ts +5 -4
- package/src/packageVersion.ts +1 -1
- package/tsconfig.json +2 -2
package/.eslintrc.js
CHANGED
|
@@ -8,10 +8,8 @@ module.exports = {
|
|
|
8
8
|
"@fluidframework/eslint-config-fluid"
|
|
9
9
|
],
|
|
10
10
|
"parserOptions": {
|
|
11
|
-
"project": ["./tsconfig.json"]
|
|
11
|
+
"project": ["./tsconfig.json", "./src/test/tsconfig.json"]
|
|
12
12
|
},
|
|
13
13
|
"rules": {
|
|
14
|
-
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
15
|
-
"import/no-extraneous-dependencies": "off"
|
|
16
14
|
}
|
|
17
15
|
}
|
package/dist/generateToken.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IUser, ScopeType } from "@fluidframework/protocol-definitions";
|
|
5
|
+
import type { IUser, ScopeType } from "@fluidframework/protocol-definitions";
|
|
6
6
|
/**
|
|
7
7
|
* Generates a JWT token to authorize routerlicious. This function uses a browser friendly auth library (jsrsasign)
|
|
8
8
|
* and should only be used in client context.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateToken.d.ts","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"generateToken.d.ts","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAgB,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAI3F;;;;;;GAMG;AACH,wBAAgB,aAAa,CACzB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,EAAE,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,KAAK,EACZ,QAAQ,GAAE,MAAgB,EAC1B,GAAG,GAAE,MAAc,GAAG,MAAM,CAuB/B;AAED,wBAAgB,YAAY,IAAI,KAAK,CAOpC"}
|
package/dist/generateToken.js
CHANGED
|
@@ -20,9 +20,10 @@ function generateToken(tenantId, key, scopes, documentId, user, lifetime = 60 *
|
|
|
20
20
|
userClaim = generateUser();
|
|
21
21
|
}
|
|
22
22
|
// Current time in seconds
|
|
23
|
-
const now = Math.round(
|
|
23
|
+
const now = Math.round(Date.now() / 1000);
|
|
24
|
+
const docId = documentId !== null && documentId !== void 0 ? documentId : "";
|
|
24
25
|
const claims = {
|
|
25
|
-
documentId,
|
|
26
|
+
documentId: docId,
|
|
26
27
|
scopes,
|
|
27
28
|
tenantId,
|
|
28
29
|
user: userClaim,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateToken.js","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yCAA8C;AAC9C,+BAAkC;AAElC;;;;;;GAMG;AACH,SAAgB,aAAa,CACzB,QAAgB,EAChB,GAAW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;QACnB,GAAG;QACH,GAAG,EAAE,SAAI,EAAE;KACd,CAAC;IAEF,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IAC9B,OAAO,gBAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACvG,CAAC;AA9BD,sCA8BC;AAED,SAAgB,YAAY;IACxB,MAAM,UAAU,GAAG;QACf,EAAE,EAAE,SAAI,EAAE;QACV,IAAI,EAAE,SAAI,EAAE;KACf,CAAC;IAEF,OAAO,UAAU,CAAC;AACtB,CAAC;AAPD,oCAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITokenClaims, IUser, ScopeType } from \"@fluidframework/protocol-definitions\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * Generates a JWT token to authorize routerlicious. This function uses a browser friendly auth library (jsrsasign)\n * and should only be used in client context.\n * If a token ever needs to be generated on the client side, it should re-use this function. If it needs to be used on\n * the service side, please use the copy available in the server-services-client package in order to avoid\n * interdependencies between service and client packages\n */\nexport function generateToken(\n tenantId: string,\n key: string,\n scopes: ScopeType[],\n documentId?: string,\n user?: IUser,\n lifetime: number = 60 * 60,\n ver: string = \"1.0\"): string {\n let userClaim = (user) ? user : generateUser();\n if (userClaim.id === \"\" || userClaim.id === undefined) {\n userClaim = generateUser();\n }\n\n // Current time in seconds\n const now = Math.round(Date.now() / 1000);\n const docId = documentId ?? \"\";\n\n const claims: ITokenClaims & { jti: string } = {\n documentId: docId,\n scopes,\n tenantId,\n user: userClaim,\n iat: now,\n exp: now + lifetime,\n ver,\n jti: uuid(),\n };\n\n const utf8Key = { utf8: key };\n return jsrsasign.jws.JWS.sign(null, JSON.stringify({ alg: \"HS256\", typ: \"JWT\" }), claims, utf8Key);\n}\n\nexport function generateUser(): IUser {\n const randomUser = {\n id: uuid(),\n name: uuid(),\n };\n\n return randomUser;\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/azure-service-utils";
|
|
8
|
-
export declare const pkgVersion = "0.
|
|
8
|
+
export declare const pkgVersion = "0.59.1000";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/azure-service-utils";
|
|
11
|
-
exports.pkgVersion = "0.
|
|
11
|
+
exports.pkgVersion = "0.59.1000";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,qCAAqC,CAAC;AAChD,QAAA,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/azure-service-utils\";\nexport const pkgVersion = \"0.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,qCAAqC,CAAC;AAChD,QAAA,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/azure-service-utils\";\nexport const pkgVersion = \"0.59.1000\";\n"]}
|
package/lib/generateToken.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IUser, ScopeType } from "@fluidframework/protocol-definitions";
|
|
5
|
+
import type { IUser, ScopeType } from "@fluidframework/protocol-definitions";
|
|
6
6
|
/**
|
|
7
7
|
* Generates a JWT token to authorize routerlicious. This function uses a browser friendly auth library (jsrsasign)
|
|
8
8
|
* and should only be used in client context.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateToken.d.ts","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"generateToken.d.ts","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAgB,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAI3F;;;;;;GAMG;AACH,wBAAgB,aAAa,CACzB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,EAAE,EACnB,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,KAAK,EACZ,QAAQ,GAAE,MAAgB,EAC1B,GAAG,GAAE,MAAc,GAAG,MAAM,CAuB/B;AAED,wBAAgB,YAAY,IAAI,KAAK,CAOpC"}
|
package/lib/generateToken.js
CHANGED
|
@@ -17,9 +17,10 @@ export function generateToken(tenantId, key, scopes, documentId, user, lifetime
|
|
|
17
17
|
userClaim = generateUser();
|
|
18
18
|
}
|
|
19
19
|
// Current time in seconds
|
|
20
|
-
const now = Math.round(
|
|
20
|
+
const now = Math.round(Date.now() / 1000);
|
|
21
|
+
const docId = documentId !== null && documentId !== void 0 ? documentId : "";
|
|
21
22
|
const claims = {
|
|
22
|
-
documentId,
|
|
23
|
+
documentId: docId,
|
|
23
24
|
scopes,
|
|
24
25
|
tenantId,
|
|
25
26
|
user: userClaim,
|
package/lib/generateToken.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateToken.js","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CACzB,QAAgB,EAChB,GAAW,EACX,MAAmB,EACnB,UAAmB,EACnB,IAAY,EACZ,WAAmB,EAAE,GAAG,EAAE,EAC1B,MAAc,KAAK;IACnB,IAAI,SAAS,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;IAC/C,IAAI,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,SAAS,CAAC,EAAE,KAAK,SAAS,EAAE;QACnD,SAAS,GAAG,YAAY,EAAE,CAAC;KAC9B;IAED,0BAA0B;IAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"generateToken.js","sourceRoot":"","sources":["../src/generateToken.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,EAAE,IAAI,IAA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/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITokenClaims, IUser, ScopeType } from \"@fluidframework/protocol-definitions\";\nimport { KJUR as jsrsasign } from \"jsrsasign\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * Generates a JWT token to authorize routerlicious. This function uses a browser friendly auth library (jsrsasign)\n * and should only be used in client context.\n * If a token ever needs to be generated on the client side, it should re-use this function. If it needs to be used on\n * the service side, please use the copy available in the server-services-client package in order to avoid\n * interdependencies between service and client packages\n */\nexport function generateToken(\n tenantId: string,\n key: string,\n scopes: ScopeType[],\n documentId?: string,\n user?: IUser,\n lifetime: number = 60 * 60,\n ver: string = \"1.0\"): string {\n let userClaim = (user) ? user : generateUser();\n if (userClaim.id === \"\" || userClaim.id === undefined) {\n userClaim = generateUser();\n }\n\n // Current time in seconds\n const now = Math.round(Date.now() / 1000);\n const docId = documentId ?? \"\";\n\n const claims: ITokenClaims & { jti: string } = {\n documentId: docId,\n scopes,\n tenantId,\n user: userClaim,\n iat: now,\n exp: now + lifetime,\n ver,\n jti: uuid(),\n };\n\n const utf8Key = { utf8: key };\n return jsrsasign.jws.JWS.sign(null, JSON.stringify({ alg: \"HS256\", typ: \"JWT\" }), claims, utf8Key);\n}\n\nexport function generateUser(): IUser {\n const randomUser = {\n id: uuid(),\n name: uuid(),\n };\n\n return randomUser;\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/azure-service-utils";
|
|
8
|
-
export declare const pkgVersion = "0.
|
|
8
|
+
export declare const pkgVersion = "0.59.1000";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,qCAAqC,CAAC;AAC7D,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/azure-service-utils\";\nexport const pkgVersion = \"0.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,qCAAqC,CAAC;AAC7D,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/azure-service-utils\";\nexport const pkgVersion = \"0.59.1000\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/azure-service-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.1000",
|
|
4
4
|
"description": "Helper service-side utilities for connecting to Azure Fluid Relay service",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -16,13 +16,14 @@
|
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
|
|
19
|
-
"build:commonjs": "npm run tsc",
|
|
19
|
+
"build:commonjs": "npm run tsc && npm run build:test",
|
|
20
20
|
"build:compile": "concurrently npm:build:commonjs npm:build:esnext",
|
|
21
21
|
"build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
|
|
22
22
|
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
23
23
|
"build:full": "npm run build",
|
|
24
24
|
"build:full:compile": "npm run build:compile",
|
|
25
25
|
"build:genver": "gen-version",
|
|
26
|
+
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
26
27
|
"ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
|
|
27
28
|
"clean": "rimraf dist *.tsbuildinfo *.build.log",
|
|
28
29
|
"eslint": "eslint --format stylish src",
|
|
@@ -35,12 +36,14 @@
|
|
|
35
36
|
"tsfmt:fix": "tsfmt --replace"
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"@fluidframework/protocol-definitions": "^0.
|
|
39
|
-
"jsrsasign": "^10.2.0"
|
|
39
|
+
"@fluidframework/protocol-definitions": "^0.1028.1000",
|
|
40
|
+
"jsrsasign": "^10.2.0",
|
|
41
|
+
"uuid": "^8.3.1"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
44
|
+
"@fluidframework/azure-service-utils-previous": "npm:@fluidframework/azure-service-utils@^0.58.0",
|
|
42
45
|
"@fluidframework/build-common": "^0.23.0",
|
|
43
|
-
"@fluidframework/eslint-config-fluid": "^0.
|
|
46
|
+
"@fluidframework/eslint-config-fluid": "^0.28.1000",
|
|
44
47
|
"@microsoft/api-extractor": "^7.16.1",
|
|
45
48
|
"@rushstack/eslint-config": "^2.5.1",
|
|
46
49
|
"@types/jsrsasign": "^8.0.8",
|
|
@@ -58,5 +61,9 @@
|
|
|
58
61
|
"rimraf": "^2.6.2",
|
|
59
62
|
"typescript": "~4.1.3",
|
|
60
63
|
"typescript-formatter": "7.1.0"
|
|
64
|
+
},
|
|
65
|
+
"typeValidation": {
|
|
66
|
+
"version": "0.59.1000",
|
|
67
|
+
"broken": {}
|
|
61
68
|
}
|
|
62
69
|
}
|
package/src/generateToken.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ITokenClaims, IUser, ScopeType } from "@fluidframework/protocol-definitions";
|
|
6
|
+
import type { ITokenClaims, IUser, ScopeType } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { KJUR as jsrsasign } from "jsrsasign";
|
|
8
8
|
import { v4 as uuid } from "uuid";
|
|
9
9
|
|
|
@@ -28,10 +28,11 @@ export function generateToken(
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// Current time in seconds
|
|
31
|
-
const now = Math.round(
|
|
31
|
+
const now = Math.round(Date.now() / 1000);
|
|
32
|
+
const docId = documentId ?? "";
|
|
32
33
|
|
|
33
34
|
const claims: ITokenClaims & { jti: string } = {
|
|
34
|
-
documentId,
|
|
35
|
+
documentId: docId,
|
|
35
36
|
scopes,
|
|
36
37
|
tenantId,
|
|
37
38
|
user: userClaim,
|
|
@@ -42,7 +43,7 @@ export function generateToken(
|
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
const utf8Key = { utf8: key };
|
|
45
|
-
return jsrsasign.jws.JWS.sign(null, JSON.stringify({ alg:"HS256", typ: "JWT" }), claims, utf8Key);
|
|
46
|
+
return jsrsasign.jws.JWS.sign(null, JSON.stringify({ alg: "HS256", typ: "JWT" }), claims, utf8Key);
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
export function generateUser(): IUser {
|
package/src/packageVersion.ts
CHANGED