@stream-io/node-sdk 0.1.2 → 0.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/node-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
@@ -104,13 +104,13 @@ export class StreamClient {
104
104
  *
105
105
  * @param userID
106
106
  * @param exp
107
- * @param iat
107
+ * @param iat deprecated, the default date will be set internally
108
108
  * @param call_cids this parameter is deprecated use `createCallToken` for call tokens
109
109
  * @returns
110
110
  */
111
111
  createToken(
112
112
  userID: string,
113
- exp?: number,
113
+ exp = Math.round(new Date().getTime() / 1000) + 60 * 60,
114
114
  iat = Math.round(Date.now() / 1000),
115
115
  call_cids?: string[]
116
116
  ) {
@@ -121,6 +121,9 @@ export class StreamClient {
121
121
  }
122
122
 
123
123
  if (iat) {
124
+ console.warn(
125
+ `This parameter is deprecated, and will be removed method with version 0.2.0, the client will set this to the current date by deault`
126
+ );
124
127
  extra.iat = iat;
125
128
  }
126
129
 
@@ -134,10 +137,18 @@ export class StreamClient {
134
137
  return JWTUserToken(this.secret, userID, extra);
135
138
  }
136
139
 
140
+ /**
141
+ *
142
+ * @param userID
143
+ * @param call_cids
144
+ * @param exp
145
+ * @param iat this is deprecated, the current date will be set internally
146
+ * @returns
147
+ */
137
148
  createCallToken(
138
149
  userID: string,
139
150
  call_cids: string[],
140
- exp?: number,
151
+ exp = Math.round(new Date().getTime() / 1000) + 60 * 60,
141
152
  iat = Math.round(Date.now() / 1000)
142
153
  ) {
143
154
  const extra: { exp?: number; iat?: number; call_cids?: string[] } = {};
@@ -147,6 +158,9 @@ export class StreamClient {
147
158
  }
148
159
 
149
160
  if (iat) {
161
+ console.warn(
162
+ `This parameter is deprecated, and will be removed method with version 0.2.0, the client will set this to the current date by deault`
163
+ );
150
164
  extra.iat = iat;
151
165
  }
152
166