Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@acoustic-content-sdk/cli-credentials
Advanced tools
Helper library to store and retrieve credentials for the CLI.
Utility library to manage credentials for use with WCH CLI projects.
Local install for use from an NPM script:
npm install --save-dev @acoustic-content-sdk/cli-credentials
Refer to the API documentation.
The credentials used to access a tenant can be stored securely on your development machine. Depending on the operating system, use one of the following options.
Under Windows use the Credential Manager to store your credentials for WCH. You can start the credential manager by navigating to Control Panel\User Accounts and Family Safety\Credential Manager
. Create a new Generic Credential
. As Internet or network address
choose the API URL from WCH, make sure end the URL with a trailing slash. Enter your WCH username and password and hit OK
.
Under macOS use the Keychain Access to store your credentials for WCH. Use the API URL from WCH as the name of the credenitial, this will automatically make it an internet
credential. Enter your WCH username and password and hit OK
.
Under Linux the credentials are read from the ${home}/.ibm-wch-sdk-cli/.credentials
file. Use the store credentials
command to securely persist the credentials in this file.
Stores a user name and password WCH in the file ${home}/.ibm-wch-sdk-cli/.credentials
. The password is encrypted using the private SSH key found in ${home}/.ssh/id_rsa
. This command has been designed to work in a Unix
environment, but it will also for for Windows
provided an SSH key exists at the specified location. Disclaimer this method requires password free access to the SSH key.
If the file ${home}/.ssh/id_rsa
does not exist, you can create one using the following shell command:
ssh-keygen -t rsa -q -f ~/.ssh/id_rsa -P ""
The module exports the following functions to work with credentials:
Reads the credentials for the given API URL.
function wchGetCredentials(
aApiUrl: string,
aOptions?: Options
): Promise<Credentials>;
aApiUrl
: the API URL for your tenantaOptions
: optional options to control loggingStores the given credentials in the ${home}/.ibm-wch-sdk-cli/.credentials
file in every environment (including Windows).
function wchStoreCredentials(
aWchToolsOptions: WchToolsOptions,
aOptions?: Options
): Promise<string>;
aWchToolsOptions
: credentials and API URLaOptions
: optional options to control loggingRemoves the credentials for the given API URL from the ${home}/.ibm-wch-sdk-cli/.credentials
file in every environment (including Windows).
function wchRemoveCredentials(
aApiUrl: string,
aOptions?: Options
): Promise<string>;
aApiUrl
: the API URL for your tenantaOptions
: optional options to control loggingChecks if a password is valid syntactically
function isValidPassword(aValue: any): aValue is string;
Checks if a URL is valid syntactically
function isValidUrl(aValue: any): aValue is string;
Checks if a username is valid syntactically. This is the case if it is either an email or the term apikey
.
function isValidUserName(aValue: any): aValue is string;
Checks if the credentials object is valid syntactically.
function isValidCredentials(aCred: any): aCred is Credentials;
Checks if a string is a valid API URL by trying to access well known API routes.
function isValidApiUrl(aValue: any): Promise<boolean>;
Checks if the WchToolsOptions
combination of API URL, username and password is valid by trying to login to the targeted server.
function isValidWchToolsOptions(
aCredentials: WchToolsOptions
): Promise<boolean>;
Home > @acoustic-content-sdk/cli-credentials
Function | Description |
---|---|
isValidApiUrl(aValue) | Checks if the URL is a valid WCH API URL by making a test call |
isValidPassword(aValue) | Checks if a password is valid |
isValidUrl(aValue) | Checks if the url is syntactically a valid URL |
isValidUserName(aValue) | Checks if a username is valid, i.e. either an email or the term 'apikey' |
isValidWchToolsOptions(aCredentials) | Validates the credentials by trying to login |
wchGetCredentials(aApiUrl, aOptions) | Reads the credentials for the given API URL |
wchRemoveCredentials(aApiUrl, aOptions) | |
wchStoreCredentials(aWchToolsOptions, aOptions) |
Interface | Description |
---|---|
Credentials | WCH credentials |
Options | Contextual options |
WchToolsOptions | Extension of the credentials to also carry the API URL that the credentials apply to |
Variable | Description |
---|---|
VERSION | Version and build number of the package |
Type Alias | Description |
---|---|
Logger | Simple logger interface that this library used to print debug logs |
Home > @acoustic-content-sdk/cli-credentials > isValidApiUrl
Checks if the URL is a valid WCH API URL by making a test call
Signature:
export declare function isValidApiUrl(aValue: any): Promise<boolean>;
Parameter | Type | Description |
---|---|---|
aValue | any |
Returns:
Promise<boolean>
true if the URL is valid, else false
Home > @acoustic-content-sdk/cli-credentials > isValidPassword
Checks if a password is valid
Signature:
export declare function isValidPassword(aValue: any): aValue is string;
Parameter | Type | Description |
---|---|---|
aValue | any | the value to test |
Returns:
aValue is string
true if the password is valid, else false
Home > @acoustic-content-sdk/cli-credentials > isValidUrl
Checks if the url is syntactically a valid URL
Signature:
export declare function isValidUrl(aValue: any): aValue is string;
Parameter | Type | Description |
---|---|---|
aValue | any | the value |
Returns:
aValue is string
true if the value is a valid URL, else false
Home > @acoustic-content-sdk/cli-credentials > isValidUserName
Checks if a username is valid, i.e. either an email or the term 'apikey'
Signature:
export declare function isValidUserName(aValue: any): aValue is string;
Parameter | Type | Description |
---|---|---|
aValue | any | the value to test |
Returns:
aValue is string
true if the name is valid, else false
Home > @acoustic-content-sdk/cli-credentials > isValidWchToolsOptions
Validates the credentials by trying to login
Signature:
export declare function isValidWchToolsOptions(aCredentials: WchToolsOptions): Promise<boolean>;
Parameter | Type | Description |
---|---|---|
aCredentials | WchToolsOptions | the credentials |
Returns:
Promise<boolean>
true if the credentials were correct, else false
Home > @acoustic-content-sdk/cli-credentials > wchGetCredentials
Reads the credentials for the given API URL
Signature:
export declare function wchGetCredentials(aApiUrl: string, aOptions?: Options): Promise<Credentials>;
Parameter | Type | Description |
---|---|---|
aApiUrl | string | the API URL |
aOptions | Options | options for debugging and logging |
Returns:
Promise<Credentials>
a promise of the loaded credentials
Home > @acoustic-content-sdk/cli-credentials > wchRemoveCredentials
Signature:
declare function _removeCredentials(aApiUrl: string, aOptions?: Options): Promise<string>;
Parameter | Type | Description |
---|---|---|
aApiUrl | string | |
aOptions | Options |
Returns:
Promise<string>
Home > @acoustic-content-sdk/cli-credentials > wchStoreCredentials
Signature:
declare function _writeCredentials(aWchToolsOptions: WchToolsOptions, aOptions?: Options): Promise<string>;
Parameter | Type | Description |
---|---|---|
aWchToolsOptions | WchToolsOptions | |
aOptions | Options |
Returns:
Promise<string>
Home > @acoustic-content-sdk/cli-credentials > Credentials
WCH credentials
Signature:
export interface Credentials
Property | Type | Description |
---|---|---|
password | string | The WCH password |
username | string | The WCH username, typically an email or the string 'apikey' |
Home > @acoustic-content-sdk/cli-credentials > Options
Contextual options
Signature:
export interface Options
Property | Type | Description |
---|---|---|
debug | boolean | If set to true, print debug logs |
logger | Logger | If provided, the logger to be used to print debug logs |
Home > @acoustic-content-sdk/cli-credentials > WchToolsOptions
Extension of the credentials to also carry the API URL that the credentials apply to
Signature:
export interface WchToolsOptions extends Credentials
Property | Type | Description |
---|---|---|
baseUrl | string | The WCH AP URL |
Home > @acoustic-content-sdk/cli-credentials > VERSION
Version and build number of the package
Signature:
VERSION: {
version: {
major: string;
minor: string;
patch: string;
branch: string;
};
build: Date;
}
Home > @acoustic-content-sdk/cli-credentials > Logger
Simple logger interface that this library used to print debug logs
Signature:
export declare type Logger = (...optionalParams: any[]) => void;
Home > @acoustic-content-sdk/cli-credentials > Credentials > password
The WCH password
Signature:
password: string;
Home > @acoustic-content-sdk/cli-credentials > Credentials > username
The WCH username, typically an email or the string 'apikey'
Signature:
username: string;
Home > @acoustic-content-sdk/cli-credentials > Options > debug
If set to true, print debug logs
Signature:
debug?: boolean;
Home > @acoustic-content-sdk/cli-credentials > Options > logger
If provided, the logger to be used to print debug logs
Signature:
logger?: Logger;
Home > @acoustic-content-sdk/cli-credentials > WchToolsOptions > baseUrl
The WCH AP URL
Signature:
baseUrl: string;
FAQs
Helper library to store and retrieve credentials for the CLI.
The npm package @acoustic-content-sdk/cli-credentials receives a total of 18 weekly downloads. As such, @acoustic-content-sdk/cli-credentials popularity was classified as not popular.
We found that @acoustic-content-sdk/cli-credentials demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.