@knocklabs/node 0.5.0 → 0.5.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/dist/package.json +1 -1
- package/dist/src/knock.d.ts +1 -1
- package/dist/src/knock.js +2 -2
- package/package.json +1 -1
package/dist/package.json
CHANGED
package/dist/src/knock.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ declare class Knock {
|
|
|
28
28
|
* @param options Optionally specify the signing key to use (in PEM or base-64 encoded format), and how long the token should be valid for in seconds
|
|
29
29
|
* @returns {string} A JWT token that can be used to authenticate requests to the Knock API (e.g. by passing into the <KnockFeedProvider /> component)
|
|
30
30
|
*/
|
|
31
|
-
static signUserToken(userId: string, options
|
|
31
|
+
static signUserToken(userId: string, options?: SignUserTokenOptions): string;
|
|
32
32
|
post(path: string, entity: any, options?: PostAndPutOptions): Promise<AxiosResponse>;
|
|
33
33
|
put(path: string, entity: any, options?: PostAndPutOptions): Promise<AxiosResponse>;
|
|
34
34
|
delete(path: string, entity?: any): Promise<AxiosResponse>;
|
package/dist/src/knock.js
CHANGED
|
@@ -66,11 +66,11 @@ class Knock {
|
|
|
66
66
|
*/
|
|
67
67
|
static signUserToken(userId, options) {
|
|
68
68
|
var _a;
|
|
69
|
-
const signingKey = prepareSigningKey(options.signingKey);
|
|
69
|
+
const signingKey = prepareSigningKey(options === null || options === void 0 ? void 0 : options.signingKey);
|
|
70
70
|
// JWT NumericDates specified in seconds:
|
|
71
71
|
const currentTime = Math.floor(Date.now() / 1000);
|
|
72
72
|
// Default to 1 hour from now
|
|
73
|
-
const expireInSeconds = (_a = options.expiresInSeconds) !== null && _a !== void 0 ? _a : 60 * 60;
|
|
73
|
+
const expireInSeconds = (_a = options === null || options === void 0 ? void 0 : options.expiresInSeconds) !== null && _a !== void 0 ? _a : 60 * 60;
|
|
74
74
|
return jsonwebtoken_1.default.sign({
|
|
75
75
|
sub: userId,
|
|
76
76
|
iat: currentTime,
|