-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
6,641 additions
and
6,205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,58 @@ | ||
import { Credentials } from './Credentials.js' | ||
import { Credentials } from './Credentials.ts' | ||
|
||
export class CredentialProvider { | ||
constructor({ accessKey, secretKey, sessionToken }) { | ||
private credentials: Credentials | ||
|
||
constructor({ | ||
accessKey, | ||
secretKey, | ||
sessionToken, | ||
}: { | ||
accessKey?: string | ||
secretKey?: string | ||
sessionToken?: string | ||
}) { | ||
this.credentials = new Credentials({ | ||
accessKey, | ||
secretKey, | ||
sessionToken, | ||
}) | ||
} | ||
|
||
getCredentials() { | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
async getCredentials(): Promise<Credentials | null> { | ||
return this.credentials.get() | ||
} | ||
|
||
setCredentials(credentials) { | ||
setCredentials(credentials: Credentials) { | ||
if (credentials instanceof Credentials) { | ||
this.credentials = credentials | ||
} else { | ||
throw new Error('Unable to set Credentials . it should be an instance of Credentials class') | ||
throw new Error('Unable to set Credentials. it should be an instance of Credentials class') | ||
} | ||
} | ||
|
||
setAccessKey(accessKey) { | ||
setAccessKey(accessKey: string) { | ||
this.credentials.setAccessKey(accessKey) | ||
} | ||
|
||
getAccessKey() { | ||
return this.credentials.getAccessKey() | ||
} | ||
|
||
setSecretKey(secretKey) { | ||
setSecretKey(secretKey: string) { | ||
this.credentials.setSecretKey(secretKey) | ||
} | ||
|
||
getSecretKey() { | ||
return this.credentials.getSecretKey() | ||
} | ||
|
||
setSessionToken(sessionToken) { | ||
setSessionToken(sessionToken: string) { | ||
this.credentials.setSessionToken(sessionToken) | ||
} | ||
|
||
getSessionToken() { | ||
return this.credentials.getSessionToken() | ||
} | ||
} | ||
|
||
// deprecated default export, please use named exports. | ||
// keep for backward compatibility. | ||
// eslint-disable-next-line import/no-default-export | ||
export default CredentialProvider |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.