Skip to content

Commit

Permalink
CYOK implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharpandey13 committed Sep 30, 2024
1 parent 34497ef commit 797d732
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/management/__generated/managers/keys-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,24 @@ export class KeysManager extends BaseAPI {
return runtime.JSONApiResponse.fromResponse(response);
}

/**
* Perform rekeying operation on the key hierarchy.
* Rekey the key hierarchy
*
* @throws {RequiredError}
*/
async postEncryptionRekey(initOverrides?: InitOverride): Promise<ApiResponse<void>> {
const response = await this.request(
{
path: `/keys/encryption/rekey`,
method: 'POST',
},
initOverrides
);

return runtime.VoidApiResponse.fromResponse(response);
}

/**
* Rotate the Application Signing Key
*
Expand Down
7 changes: 7 additions & 0 deletions test/management/fixtures/keys.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
"status": 200,
"response": {}
},
{
"scope": "https://test-domain.auth0.com",
"method": "POST",
"path": "/api/v2/keys/encryption/rekey",
"status": 200,
"response": {}
},
{
"scope": "https://test-domain.auth0.com",
"method": "PUT",
Expand Down
8 changes: 7 additions & 1 deletion test/management/keys-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { afterAll, beforeAll } from '@jest/globals';

const { back: nockBack } = nock;

describe('AnomalyManager', () => {
describe('KeysManager', () => {
let keysManager: KeysManager;

let nockDone: () => void;
Expand Down Expand Up @@ -46,4 +46,10 @@ describe('AnomalyManager', () => {
status: 200,
});
});

it('should rekey the tenant key heirarchy', async () => {
await expect(keysManager.postEncryptionRekey()).resolves.toMatchObject({
status: 200,
});
});
});

0 comments on commit 797d732

Please sign in to comment.