-
Notifications
You must be signed in to change notification settings - Fork 9
Update: Readme/Integration test case with key alias extension use cases #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -763,4 +763,54 @@ describe('key protect v2 integration', () => { | |
| done(); | ||
| }); | ||
| }); | ||
| describe('key alias extensions', () => { | ||
| it('checkKeyaliasExtension', async done => { | ||
| let response; | ||
| const samplePlaintext = 'dGhpcyBpcyBhIGJhc2U2NCBzdHJpbmcK'; | ||
| try { | ||
| // create a key alias | ||
| const keyAlias = 'nodejsAlias'; | ||
| const createKeyAliasParams = Object.assign({}, options); | ||
| createKeyAliasParams.id = keyId; | ||
| createKeyAliasParams.alias = keyAlias; | ||
| response = await keyProtectClient.createKeyAlias(createKeyAliasParams); | ||
| expect(response).toBeDefined(); | ||
| expect(response.status).toEqual(201); | ||
|
|
||
| // wrap using key alias | ||
| const wrapKeyParams = Object.assign({}, options); | ||
| wrapKeyParams.id = createKeyAliasParams.alias; | ||
| wrapKeyParams.keyActionWrapBody = { | ||
| plaintext: samplePlaintext, | ||
| }; | ||
| response = await keyProtectClient.wrapKey(wrapKeyParams); | ||
| const ciphertextResult = response.result.ciphertext; | ||
| expect(response).toBeDefined(); | ||
| expect(response.status).toEqual(200); | ||
|
|
||
| // un-wrap using key alias | ||
| const unwrapKeyParams = Object.assign({}, options); | ||
| unwrapKeyParams.id = createKeyAliasParams.alias; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not be setting |
||
| unwrapKeyParams.keyActionUnwrapBody = { | ||
| ciphertext: ciphertextResult, | ||
| }; | ||
| response = await keyProtectClient.unwrapKey(unwrapKeyParams); | ||
| const plaintextResult = response.result.plaintext; | ||
| expect(response).toBeDefined(); | ||
| expect(plaintextResult).toEqual(samplePlaintext); | ||
| expect(response.status).toEqual(200); | ||
|
|
||
| // delete a key using key alias | ||
| const deleteKeyParams = Object.assign({}, options); | ||
| deleteKeyParams.id = createKeyAliasParams.alias; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not be setting |
||
| deleteKeyParams.prefer = 'return=representation'; | ||
| response = await keyProtectClient.deleteKey(deleteKeyParams); | ||
| expect(response).toBeDefined(); | ||
| expect(response.status).toEqual(200); | ||
| } catch (err) { | ||
| done(err); | ||
| } | ||
| done(); | ||
| }); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not be setting
aliastoid.. instead, we should be able to setaliasin input and perform the key action