@jambonz/speech-utils 0.0.29 → 0.0.31
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/index.js +1 -3
- package/lib/get-aws-sts-token.js +1 -1
- package/package.json +1 -1
- package/test/aws.js +2 -2
package/index.js
CHANGED
|
@@ -2,13 +2,11 @@ const {noopLogger} = require('./lib/utils');
|
|
|
2
2
|
|
|
3
3
|
module.exports = (opts, logger) => {
|
|
4
4
|
logger = logger || noopLogger;
|
|
5
|
-
let client = opts.redis_client;
|
|
6
5
|
const {
|
|
7
|
-
client
|
|
6
|
+
client,
|
|
8
7
|
createHash,
|
|
9
8
|
retrieveHash
|
|
10
9
|
} = require('@jambonz/realtimedb-helpers')(opts, logger);
|
|
11
|
-
client = opts.redis_client || redisClient;
|
|
12
10
|
|
|
13
11
|
return {
|
|
14
12
|
client,
|
package/lib/get-aws-sts-token.js
CHANGED
|
@@ -27,7 +27,7 @@ async function getAwsAuthToken(
|
|
|
27
27
|
const credentials = {
|
|
28
28
|
accessKeyId: data.Credentials.AccessKeyId,
|
|
29
29
|
secretAccessKey: data.Credentials.SecretAccessKey,
|
|
30
|
-
|
|
30
|
+
securityToken: data.Credentials.SessionToken
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/* expire 10 minutes before the hour, so we don't lose the use of it during a call */
|
package/package.json
CHANGED
package/test/aws.js
CHANGED
|
@@ -21,12 +21,12 @@ test('AWS - create and cache auth token', async(t) => {
|
|
|
21
21
|
try {
|
|
22
22
|
let obj = await getAwsAuthToken(process.env.AWS_ACCESS_KEY_ID, process.env.AWS_SECRET_ACCESS_KEY, process.env.AWS_REGION);
|
|
23
23
|
//console.log({obj}, 'received auth token from AWS');
|
|
24
|
-
t.ok(obj.
|
|
24
|
+
t.ok(obj.securityToken && !obj.servedFromCache, 'successfullY generated auth token from AWS');
|
|
25
25
|
|
|
26
26
|
await sleep(250);
|
|
27
27
|
obj = await getAwsAuthToken(process.env.AWS_ACCESS_KEY_ID, process.env.AWS_SECRET_ACCESS_KEY, process.env.AWS_REGION);
|
|
28
28
|
//console.log({obj}, 'received auth token from AWS - second request');
|
|
29
|
-
t.ok(obj.
|
|
29
|
+
t.ok(obj.securityToken && obj.servedFromCache, 'successfully received access token from cache');
|
|
30
30
|
|
|
31
31
|
await client.flushall();
|
|
32
32
|
t.end();
|