Comment on page
📄
Credentials Module
The Credentials module, accessible via
ssx.credentials
, provides functionality to retrieve credentials issued by the SpruceKit Issuer. This module requires the Storage Module to be properly configured.All credentials issued by the SpruceKit Issuer are stored on Kepler at
/shared/credentials
. This module makes it easier to retrieve these credentials by:- Requesting read access to this shared folder
- Encapsulating the prefix management to retrieve the data
By using Kepler via the credentials module within SSX, you hereby agree to the Kepler Developer Terms found here.
To use the credentials module within SSX, you will need to configure the
modules
parameter in the SSX configuration object.modules: {
settings?: boolean | SSXStorageModuleConfig;
credentials?: boolean;
};
SSXStorageModuleConfig: {
prefix?: string;
hosts?: Array<string>;
autoCreateNewOrbit?: boolean;
};
Below is an example of initializing an SSX instance with the storage enabled:
You must enable the storage module to use the credentials module. See the Storage Module section for more information about the storage module.
import { SSX } from '@spruceid/ssx';
const ssx = new SSX({
modules: {
storage: true,
credentials: true
},
});
Having credentials issued by the SpruceKit Issuer is not required to use the credentials module, but if you want to test all methods, you must issue at least one credential to be retrieved. You can issue credentials by following these steps:
- 1.
- 2.Sign in with your Ethereum account
- 3.Follow the instructions to get a credential of your choice issued
Gets the stored credential associated with a specific key.
get = (credential: string) => Promise<Response>;
Here is an example of how to use it:
const { data } = await ssx.credentials.get('your_key_here');
Lists all the credentials currently stored.
list = (
options?: {
credentialType?: string, // Identifies the credentialType (path) to be combined with the prefix
removePrefix?: boolean, // Removes or not the prefix from the file names
request?: Request,
}
) => Promise<Response>;
Here is an example of how to use it:
const { data } = ssx.credentials.list();
Last modified 4mo ago