From 08a56d1a40eb19f604f7496e1d020e7298ba4930 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Fri, 19 Apr 2024 15:30:22 +0700 Subject: [PATCH 01/11] support AWS Polly RoleArn credential --- lib/synth-audio.js | 33 +++++++++++++++++++++++++-------- test/synth.js | 27 +++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 8 deletions(-) diff --git a/lib/synth-audio.js b/lib/synth-audio.js index 66fcda6..160c061 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -3,6 +3,7 @@ const fs = require('fs'); const bent = require('bent'); const ttsGoogle = require('@google-cloud/text-to-speech'); const { PollyClient, SynthesizeSpeechCommand } = require('@aws-sdk/client-polly'); +const { STSClient, AssumeRoleCommand } = require('@aws-sdk/client-sts'); const sdk = require('microsoft-cognitiveservices-speech-sdk'); const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1'); @@ -265,14 +266,30 @@ async function synthAudio(client, logger, stats, { account_sid, const synthPolly = async(logger, {credentials, stats, language, voice, engine, text}) => { try { - const {region, accessKeyId, secretAccessKey} = credentials; - const polly = new PollyClient({ - region, - credentials: { - accessKeyId, - secretAccessKey - } - }); + const {region, accessKeyId, secretAccessKey, roleArn} = credentials; + let polly; + if (accessKeyId && secretAccessKey) { + polly = new PollyClient({ + region, + credentials: { + accessKeyId, + secretAccessKey + } + }); + } else if (roleArn) { + const stsClient = new STSClient({ region}); + const roleToAssume = { RoleArn: 'myRoleArn', RoleSessionName: 'session1' }; + const command = new AssumeRoleCommand(roleToAssume); + + const response = await stsClient.send(command); + const assumedRoleCreds = response.Credentials; + polly = new PollyClient({ + region, + credentials: assumedRoleCreds, + }); + } else { + throw new Error('Missing Polly credential'); + } const opts = { Engine: engine, OutputFormat: 'mp3', diff --git a/test/synth.js b/test/synth.js index 7177477..a707a13 100644 --- a/test/synth.js +++ b/test/synth.js @@ -162,6 +162,33 @@ test('AWS speech synth tests', async(t) => { client.quit(); }); +test('AWS speech synth tests by RoleArn', async(t) => { + const fn = require('..'); + const {synthAudio, client} = fn(opts, logger); + + if (!process.env.AWS_ROLE_ARN || !process.env.AWS_REGION) { + t.pass('skipping AWS speech synth tests by RoleArn since AWS_ROLE_ARN or AWS_REGION not provided'); + return t.end(); + } + try { + let opts = await synthAudio(stats, { + vendor: 'aws', + credentials: { + roleArn: process.env.AWS_ROLE_ARN, + region: process.env.AWS_REGION, + }, + language: 'en-US', + voice: 'Joey', + text: 'This is a test. This is only a test', + }); + t.ok(!opts.servedFromCache, `successfully synthesized aws by roleArn audio to ${opts.filePath}`); + } catch (err) { + console.error(err); + t.end(err); + } + client.quit(); +}); + test('Azure speech synth tests', async(t) => { const fn = require('..'); const {synthAudio, client} = fn(opts, logger); From 8a5c5c19663563d7766fe24f39af5f5612701989 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Fri, 19 Apr 2024 16:06:53 +0700 Subject: [PATCH 02/11] support mod_google_tts --- lib/synth-audio.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/synth-audio.js b/lib/synth-audio.js index 160c061..ba9fb4f 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -278,7 +278,7 @@ const synthPolly = async(logger, {credentials, stats, language, voice, engine, t }); } else if (roleArn) { const stsClient = new STSClient({ region}); - const roleToAssume = { RoleArn: 'myRoleArn', RoleSessionName: 'session1' }; + const roleToAssume = { RoleArn: roleArn, RoleSessionName: 'Jambonz Speech' }; const command = new AssumeRoleCommand(roleToAssume); const response = await stsClient.send(command); From b4aad7991bb0522edf40e01366784c501b912ea3 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Mon, 22 Apr 2024 16:19:04 +0700 Subject: [PATCH 03/11] update get aws voices --- lib/get-tts-voices.js | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/lib/get-tts-voices.js b/lib/get-tts-voices.js index 4a8f795..c6e2d6f 100644 --- a/lib/get-tts-voices.js +++ b/lib/get-tts-voices.js @@ -6,6 +6,7 @@ const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1'); const { IamAuthenticator } = require('ibm-watson/auth'); const ttsGoogle = require('@google-cloud/text-to-speech'); const { PollyClient, DescribeVoicesCommand } = require('@aws-sdk/client-polly'); +const { STSClient, AssumeRoleCommand } = require('@aws-sdk/client-sts'); const getIbmVoices = async(client, logger, credentials) => { const {tts_region, tts_api_key} = credentials; @@ -89,14 +90,30 @@ const getGoogleVoices = async(_client, logger, credentials) => { const getAwsVoices = async(_client, logger, credentials) => { try { - const {region, accessKeyId, secretAccessKey} = credentials; - const client = new PollyClient({ - region, - credentials: { - accessKeyId, - secretAccessKey - } - }); + const {region, accessKeyId, secretAccessKey, roleArn} = credentials; + let client = null; + if (accessKeyId && secretAccessKey) { + client = new PollyClient({ + region, + credentials: { + accessKeyId, + secretAccessKey + } + }); + } else if (roleArn) { + const stsClient = new STSClient({ region}); + const roleToAssume = { RoleArn: roleArn, RoleSessionName: 'Jambonz Speech' }; + const command = new AssumeRoleCommand(roleToAssume); + + const response = await stsClient.send(command); + const assumedRoleCreds = response.Credentials; + client = new PollyClient({ + region, + credentials: assumedRoleCreds, + }); + } else { + throw new Error('Missing Polly credential'); + } const command = new DescribeVoicesCommand({}); const response = await client.send(command); return response; From 3de8e5ff57dc87b477bed7aa5783920b0137d837 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Mon, 22 Apr 2024 20:02:59 +0700 Subject: [PATCH 04/11] accept aws polly without credential --- lib/get-tts-voices.js | 2 +- lib/synth-audio.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/get-tts-voices.js b/lib/get-tts-voices.js index c6e2d6f..ebd9ee9 100644 --- a/lib/get-tts-voices.js +++ b/lib/get-tts-voices.js @@ -112,7 +112,7 @@ const getAwsVoices = async(_client, logger, credentials) => { credentials: assumedRoleCreds, }); } else { - throw new Error('Missing Polly credential'); + client = new PollyClient(); } const command = new DescribeVoicesCommand({}); const response = await client.send(command); diff --git a/lib/synth-audio.js b/lib/synth-audio.js index ba9fb4f..fda887f 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -288,7 +288,8 @@ const synthPolly = async(logger, {credentials, stats, language, voice, engine, t credentials: assumedRoleCreds, }); } else { - throw new Error('Missing Polly credential'); + // AWS RoleArn assigned to Instance profile + polly = new PollyClient(); } const opts = { Engine: engine, From 0d1cd370978afbeb544885754682b979c53124cf Mon Sep 17 00:00:00 2001 From: Quan HL Date: Tue, 30 Apr 2024 11:20:21 +0700 Subject: [PATCH 05/11] wip --- lib/synth-audio.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/synth-audio.js b/lib/synth-audio.js index fda887f..c3a5e78 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -278,7 +278,7 @@ const synthPolly = async(logger, {credentials, stats, language, voice, engine, t }); } else if (roleArn) { const stsClient = new STSClient({ region}); - const roleToAssume = { RoleArn: roleArn, RoleSessionName: 'Jambonz Speech' }; + const roleToAssume = { RoleArn: roleArn, RoleSessionName: 'Jambonz_Speech' }; const command = new AssumeRoleCommand(roleToAssume); const response = await stsClient.send(command); From 68a7f2b0d4fca6b74320b0ee9dee46641b376c56 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Tue, 30 Apr 2024 15:45:10 +0700 Subject: [PATCH 06/11] wip --- index.js | 4 ++-- lib/get-aws-sts-token.js | 39 +++++++++++++++++++++++++-------------- lib/get-tts-voices.js | 16 +++++----------- lib/synth-audio.js | 18 +++++++----------- 4 files changed, 39 insertions(+), 38 deletions(-) diff --git a/index.js b/index.js index afab371..dad893f 100644 --- a/index.js +++ b/index.js @@ -13,10 +13,10 @@ module.exports = (opts, logger) => { getTtsSize: require('./lib/get-tts-size').bind(null, client, logger), purgeTtsCache: require('./lib/purge-tts-cache').bind(null, client, logger), addFileToCache: require('./lib/add-file-to-cache').bind(null, client, logger), - synthAudio: require('./lib/synth-audio').bind(null, client, logger), + synthAudio: require('./lib/synth-audio').bind(null, client, createHash, retrieveHash, logger), getNuanceAccessToken: require('./lib/get-nuance-access-token').bind(null, client, logger), getIbmAccessToken: require('./lib/get-ibm-access-token').bind(null, client, logger), getAwsAuthToken: require('./lib/get-aws-sts-token').bind(null, logger, createHash, retrieveHash), - getTtsVoices: require('./lib/get-tts-voices').bind(null, client, logger), + getTtsVoices: require('./lib/get-tts-voices').bind(null, client, createHash, retrieveHash, logger), }; }; diff --git a/lib/get-aws-sts-token.js b/lib/get-aws-sts-token.js index 022e0a7..28f02ec 100644 --- a/lib/get-aws-sts-token.js +++ b/lib/get-aws-sts-token.js @@ -1,4 +1,4 @@ -const { STSClient, GetSessionTokenCommand } = require('@aws-sdk/client-sts'); +const { STSClient, GetSessionTokenCommand, AssumeRoleCommand } = require('@aws-sdk/client-sts'); const {makeAwsKey, noopLogger} = require('./utils'); const debug = require('debug')('jambonz:speech-utils'); const EXPIRY = 3600; @@ -6,30 +6,41 @@ const EXPIRY = 3600; async function getAwsAuthToken( logger, createHash, retrieveHash, - awsAccessKeyId, awsSecretAccessKey, awsRegion) { + awsAccessKeyId, awsSecretAccessKey, awsRegion, roleArn = null) { logger = logger || noopLogger; try { - const key = makeAwsKey(awsAccessKeyId); + const key = makeAwsKey(roleArn || awsAccessKeyId); const obj = await retrieveHash(key); if (obj) return {...obj, servedFromCache: true}; - /* access token not found in cache, so generate it using STS */ - const stsClient = new STSClient({ - region: awsRegion, - credentials: { - accessKeyId: awsAccessKeyId, - secretAccessKey: awsSecretAccessKey, - } - }); - const command = new GetSessionTokenCommand({DurationSeconds: EXPIRY}); - const data = await stsClient.send(command); + let data; + if (roleArn) { + const stsClient = new STSClient({ region: awsRegion}); + const roleToAssume = { RoleArn: roleArn, RoleSessionName: 'Jambonz_Speech', DurationSeconds: EXPIRY}; + const command = new AssumeRoleCommand(roleToAssume); + + const response = await stsClient.send(command); + data = response; + } else { + /* access token not found in cache, so generate it using STS */ + const stsClient = new STSClient({ + region: awsRegion, + credentials: { + accessKeyId: awsAccessKeyId, + secretAccessKey: awsSecretAccessKey, + } + }); + const command = new GetSessionTokenCommand({DurationSeconds: EXPIRY}); + data = await stsClient.send(command); + } const credentials = { accessKeyId: data.Credentials.AccessKeyId, secretAccessKey: data.Credentials.SecretAccessKey, - securityToken: data.Credentials.SessionToken + sessionToken: data.Credentials.SessionToken }; + console.log(credentials, 'xquanluu'); /* expire 10 minutes before the hour, so we don't lose the use of it during a call */ createHash(key, credentials, EXPIRY - 600) .catch((err) => logger.error(err, `Error saving hash for key ${key}`)); diff --git a/lib/get-tts-voices.js b/lib/get-tts-voices.js index ebd9ee9..49a542b 100644 --- a/lib/get-tts-voices.js +++ b/lib/get-tts-voices.js @@ -6,7 +6,7 @@ const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1'); const { IamAuthenticator } = require('ibm-watson/auth'); const ttsGoogle = require('@google-cloud/text-to-speech'); const { PollyClient, DescribeVoicesCommand } = require('@aws-sdk/client-polly'); -const { STSClient, AssumeRoleCommand } = require('@aws-sdk/client-sts'); +const getAwsAuthToken = require('./get-aws-sts-token'); const getIbmVoices = async(client, logger, credentials) => { const {tts_region, tts_api_key} = credentials; @@ -88,7 +88,7 @@ const getGoogleVoices = async(_client, logger, credentials) => { return await client.listVoices(); }; -const getAwsVoices = async(_client, logger, credentials) => { +const getAwsVoices = async(_client, createHash, retrieveHash, logger, credentials) => { try { const {region, accessKeyId, secretAccessKey, roleArn} = credentials; let client = null; @@ -101,15 +101,9 @@ const getAwsVoices = async(_client, logger, credentials) => { } }); } else if (roleArn) { - const stsClient = new STSClient({ region}); - const roleToAssume = { RoleArn: roleArn, RoleSessionName: 'Jambonz Speech' }; - const command = new AssumeRoleCommand(roleToAssume); - - const response = await stsClient.send(command); - const assumedRoleCreds = response.Credentials; client = new PollyClient({ region, - credentials: assumedRoleCreds, + credentials: await getAwsAuthToken(logger, createHash, retrieveHash, null, null, region, roleArn), }); } else { client = new PollyClient(); @@ -139,7 +133,7 @@ const getAwsVoices = async(_client, logger, credentials) => { * @returns object containing filepath to an mp3 file in the /tmp folder containing * the synthesized audio, and a variable indicating whether it was served from cache */ -async function getTtsVoices(client, logger, {vendor, credentials}) { +async function getTtsVoices(client, createHash, retrieveHash, logger, {vendor, credentials}) { logger = logger || noopLogger; assert.ok(['nuance', 'ibm', 'google', 'aws', 'polly'].includes(vendor), @@ -154,7 +148,7 @@ async function getTtsVoices(client, logger, {vendor, credentials}) { return getGoogleVoices(client, logger, credentials); case 'aws': case 'polly': - return getAwsVoices(client, logger, credentials); + return getAwsVoices(client, createHash, retrieveHash, logger, credentials); default: break; } diff --git a/lib/synth-audio.js b/lib/synth-audio.js index c3a5e78..245fac1 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -3,7 +3,6 @@ const fs = require('fs'); const bent = require('bent'); const ttsGoogle = require('@google-cloud/text-to-speech'); const { PollyClient, SynthesizeSpeechCommand } = require('@aws-sdk/client-polly'); -const { STSClient, AssumeRoleCommand } = require('@aws-sdk/client-sts'); const sdk = require('microsoft-cognitiveservices-speech-sdk'); const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1'); @@ -40,6 +39,7 @@ const debug = require('debug')('jambonz:realtimedb-helpers'); const EXPIRES = (process.env.JAMBONES_TTS_CACHE_DURATION_MINS || 4 * 60) * 60; // cache tts for 4 hours const TMP_FOLDER = '/tmp'; const OpenAI = require('openai'); +const getAwsAuthToken = require('./get-aws-sts-token'); const trimTrailingSilence = (buffer) => { @@ -76,7 +76,7 @@ const trimTrailingSilence = (buffer) => { * @returns object containing filepath to an mp3 file in the /tmp folder containing * the synthesized audio, and a variable indicating whether it was served from cache */ -async function synthAudio(client, logger, stats, { account_sid, +async function synthAudio(client, createHash, retrieveHash, logger, stats, { account_sid, vendor, language, voice, gender, text, engine, salt, model, credentials, deploymentId, disableTtsCache, renderForCaching, disableTtsStreaming, options }) { @@ -188,7 +188,8 @@ async function synthAudio(client, logger, stats, { account_sid, case 'aws': case 'polly': vendorLabel = 'aws'; - audioBuffer = await synthPolly(logger, {credentials, stats, language, voice, text, engine}); + audioBuffer = await synthPolly(createHash, retrieveHash, logger, + {credentials, stats, language, voice, text, engine}); break; case 'azure': case 'microsoft': @@ -264,7 +265,8 @@ async function synthAudio(client, logger, stats, { account_sid, }); } -const synthPolly = async(logger, {credentials, stats, language, voice, engine, text}) => { +const synthPolly = async(createHash, retrieveHash, logger, + {credentials, stats, language, voice, engine, text}) => { try { const {region, accessKeyId, secretAccessKey, roleArn} = credentials; let polly; @@ -277,15 +279,9 @@ const synthPolly = async(logger, {credentials, stats, language, voice, engine, t } }); } else if (roleArn) { - const stsClient = new STSClient({ region}); - const roleToAssume = { RoleArn: roleArn, RoleSessionName: 'Jambonz_Speech' }; - const command = new AssumeRoleCommand(roleToAssume); - - const response = await stsClient.send(command); - const assumedRoleCreds = response.Credentials; polly = new PollyClient({ region, - credentials: assumedRoleCreds, + credentials: await getAwsAuthToken(logger, createHash, retrieveHash, null, null, region, roleArn), }); } else { // AWS RoleArn assigned to Instance profile From 6144a9c164d65ac77f82b8c8cb52e28f7e99e35e Mon Sep 17 00:00:00 2001 From: Quan HL Date: Tue, 30 Apr 2024 15:45:26 +0700 Subject: [PATCH 07/11] wip --- lib/get-aws-sts-token.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/get-aws-sts-token.js b/lib/get-aws-sts-token.js index 28f02ec..1f7060b 100644 --- a/lib/get-aws-sts-token.js +++ b/lib/get-aws-sts-token.js @@ -4,8 +4,7 @@ const debug = require('debug')('jambonz:speech-utils'); const EXPIRY = 3600; async function getAwsAuthToken( - logger, - createHash, retrieveHash, + logger, createHash, retrieveHash, awsAccessKeyId, awsSecretAccessKey, awsRegion, roleArn = null) { logger = logger || noopLogger; try { @@ -40,7 +39,6 @@ async function getAwsAuthToken( sessionToken: data.Credentials.SessionToken }; - console.log(credentials, 'xquanluu'); /* expire 10 minutes before the hour, so we don't lose the use of it during a call */ createHash(key, credentials, EXPIRY - 600) .catch((err) => logger.error(err, `Error saving hash for key ${key}`)); From c8571af1294495883bf0f9eb1e4c8f074912dc9e Mon Sep 17 00:00:00 2001 From: Quan HL Date: Tue, 30 Apr 2024 15:47:14 +0700 Subject: [PATCH 08/11] wip --- lib/get-aws-sts-token.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/get-aws-sts-token.js b/lib/get-aws-sts-token.js index 1f7060b..223155f 100644 --- a/lib/get-aws-sts-token.js +++ b/lib/get-aws-sts-token.js @@ -18,8 +18,7 @@ async function getAwsAuthToken( const roleToAssume = { RoleArn: roleArn, RoleSessionName: 'Jambonz_Speech', DurationSeconds: EXPIRY}; const command = new AssumeRoleCommand(roleToAssume); - const response = await stsClient.send(command); - data = response; + data = await stsClient.send(command); } else { /* access token not found in cache, so generate it using STS */ const stsClient = new STSClient({ From e6a7017b553dfed202e61cddb6018407fa5eaa6b Mon Sep 17 00:00:00 2001 From: Quan HL Date: Thu, 2 May 2024 14:20:24 +0700 Subject: [PATCH 09/11] wip --- lib/get-tts-voices.js | 2 +- lib/synth-audio.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/get-tts-voices.js b/lib/get-tts-voices.js index 49a542b..913f807 100644 --- a/lib/get-tts-voices.js +++ b/lib/get-tts-voices.js @@ -106,7 +106,7 @@ const getAwsVoices = async(_client, createHash, retrieveHash, logger, credential credentials: await getAwsAuthToken(logger, createHash, retrieveHash, null, null, region, roleArn), }); } else { - client = new PollyClient(); + client = new PollyClient({region}); } const command = new DescribeVoicesCommand({}); const response = await client.send(command); diff --git a/lib/synth-audio.js b/lib/synth-audio.js index 245fac1..ea66053 100644 --- a/lib/synth-audio.js +++ b/lib/synth-audio.js @@ -285,7 +285,7 @@ const synthPolly = async(createHash, retrieveHash, logger, }); } else { // AWS RoleArn assigned to Instance profile - polly = new PollyClient(); + polly = new PollyClient({region}); } const opts = { Engine: engine, From 5998eebdca066082e573c926da3fea2fa8d46cdd Mon Sep 17 00:00:00 2001 From: Quan HL Date: Thu, 2 May 2024 15:48:20 +0700 Subject: [PATCH 10/11] wip --- test/aws.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/aws.js b/test/aws.js index f4671a1..04676f7 100644 --- a/test/aws.js +++ b/test/aws.js @@ -21,12 +21,12 @@ test('AWS - create and cache auth token', async(t) => { try { let obj = await getAwsAuthToken(process.env.AWS_ACCESS_KEY_ID, process.env.AWS_SECRET_ACCESS_KEY, process.env.AWS_REGION); //console.log({obj}, 'received auth token from AWS'); - t.ok(obj.securityToken && !obj.servedFromCache, 'successfullY generated auth token from AWS'); + t.ok(obj.sessionToken && !obj.servedFromCache, 'successfullY generated auth token from AWS'); await sleep(250); obj = await getAwsAuthToken(process.env.AWS_ACCESS_KEY_ID, process.env.AWS_SECRET_ACCESS_KEY, process.env.AWS_REGION); //console.log({obj}, 'received auth token from AWS - second request'); - t.ok(obj.securityToken && obj.servedFromCache, 'successfully received access token from cache'); + t.ok(obj.sessionToken && obj.servedFromCache, 'successfully received access token from cache'); await client.flushall(); t.end(); From 79289a7249958c65d76655dbb2df874077d682b3 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Thu, 2 May 2024 15:51:45 +0700 Subject: [PATCH 11/11] wip --- lib/get-aws-sts-token.js | 3 ++- test/aws.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/get-aws-sts-token.js b/lib/get-aws-sts-token.js index 223155f..7bb7ef5 100644 --- a/lib/get-aws-sts-token.js +++ b/lib/get-aws-sts-token.js @@ -35,7 +35,8 @@ async function getAwsAuthToken( const credentials = { accessKeyId: data.Credentials.AccessKeyId, secretAccessKey: data.Credentials.SecretAccessKey, - sessionToken: data.Credentials.SessionToken + sessionToken: data.Credentials.SessionToken, + securityToken: data.Credentials.SessionToken }; /* expire 10 minutes before the hour, so we don't lose the use of it during a call */ diff --git a/test/aws.js b/test/aws.js index 04676f7..f4671a1 100644 --- a/test/aws.js +++ b/test/aws.js @@ -21,12 +21,12 @@ test('AWS - create and cache auth token', async(t) => { try { let obj = await getAwsAuthToken(process.env.AWS_ACCESS_KEY_ID, process.env.AWS_SECRET_ACCESS_KEY, process.env.AWS_REGION); //console.log({obj}, 'received auth token from AWS'); - t.ok(obj.sessionToken && !obj.servedFromCache, 'successfullY generated auth token from AWS'); + t.ok(obj.securityToken && !obj.servedFromCache, 'successfullY generated auth token from AWS'); await sleep(250); obj = await getAwsAuthToken(process.env.AWS_ACCESS_KEY_ID, process.env.AWS_SECRET_ACCESS_KEY, process.env.AWS_REGION); //console.log({obj}, 'received auth token from AWS - second request'); - t.ok(obj.sessionToken && obj.servedFromCache, 'successfully received access token from cache'); + t.ok(obj.securityToken && obj.servedFromCache, 'successfully received access token from cache'); await client.flushall(); t.end();