Signing Keys Service
The Signing Keys Service lists the JWT signing keys, forces a rotation and expires a leaked key.
These methods require a BSH_ADMIN user, or an API key owned by one. See Signing Keys API.
Docs
Methods
list
Lists keys with query parameters. Keys are sorted by activatedAt descending by default.
await bshEngine.signingKeys.list({
queryParams: {
page: '0',
size: '10',
sort: 'activatedAt:desc',
filter: 'status:eq:Retired'
}
});| Property | Type | Required | Description |
|---|---|---|---|
queryParams.page | string | no | Page number |
queryParams.size | string | no | Page size |
queryParams.sort | string | no | Sort, for example activatedAt:desc |
queryParams.filter | string | no | Filter, for example status:eq:Active |
search
Searches keys with a BSH Search payload.
await bshEngine.signingKeys.search({
payload: {
filters: [{ field: 'status', operator: 'eq', value: 'Retired' }]
}
});rotate
Replaces the active key now. With expire, the previous key (previous) or every retired key (all) is expired at the same time, and every user holding tokens signed by them is logged out.
// Routine rotation: no one is logged out
await bshEngine.signingKeys.rotate({ payload: {} });
// The current key leaked
const response = await bshEngine.signingKeys.rotate({
payload: { expire: 'previous', reason: 'Key exposed in application logs' }
});| Property | Type | Required | Description |
|---|---|---|---|
payload.expire | 'none'|'previous'|'all' | no | Keys to expire right away. |
payload.reason | string | when expiring | Why the key needs to expire |
expire
Expires a retired key now.
await bshEngine.signingKeys.expire({
kid: 'a82791af-3c4d-4e5f-8a9b-0c1d2e3f4a5b',
payload: { reason: 'Key exposed in a backup' }
});| Property | Type | Required | Description |
|---|---|---|---|
kid | string | yes | The key id |
payload.reason | string | yes | At least 5 characters |
Last updated on