From 4644027eda571a86805f1069addd886572f309a4 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Tue, 24 Mar 2020 12:14:55 -0700 Subject: [PATCH] chore: change credentials.expiration from number to Date (#1040) --- .../src/remoteProvider/ImdsCredentials.spec.ts | 4 +--- .../src/remoteProvider/ImdsCredentials.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/credential-provider-imds/src/remoteProvider/ImdsCredentials.spec.ts b/packages/credential-provider-imds/src/remoteProvider/ImdsCredentials.spec.ts index 4dd6899798e..072123c77e9 100644 --- a/packages/credential-provider-imds/src/remoteProvider/ImdsCredentials.spec.ts +++ b/packages/credential-provider-imds/src/remoteProvider/ImdsCredentials.spec.ts @@ -48,8 +48,6 @@ describe("fromImdsCredentials", () => { expect(converted.accessKeyId).toEqual(creds.AccessKeyId); expect(converted.secretAccessKey).toEqual(creds.SecretAccessKey); expect(converted.sessionToken).toEqual(creds.Token); - expect(converted.expiration).toEqual( - Math.floor(new Date(creds.Expiration).valueOf() / 1000) - ); + expect(converted.expiration).toEqual(new Date(creds.Expiration)); }); }); diff --git a/packages/credential-provider-imds/src/remoteProvider/ImdsCredentials.ts b/packages/credential-provider-imds/src/remoteProvider/ImdsCredentials.ts index 1bdd48d5b67..f3798c0be29 100644 --- a/packages/credential-provider-imds/src/remoteProvider/ImdsCredentials.ts +++ b/packages/credential-provider-imds/src/remoteProvider/ImdsCredentials.ts @@ -23,6 +23,6 @@ export function fromImdsCredentials(creds: ImdsCredentials): Credentials { accessKeyId: creds.AccessKeyId, secretAccessKey: creds.SecretAccessKey, sessionToken: creds.Token, - expiration: Math.floor(new Date(creds.Expiration).valueOf() / 1000) + expiration: new Date(creds.Expiration) }; }