Skip to content

feat: Adds CreateKey API to create a branch key#1645

Open
sharmabikram wants to merge 2 commits intoshbikram/create-version-keyfrom
shbikram/create-key
Open

feat: Adds CreateKey API to create a branch key#1645
sharmabikram wants to merge 2 commits intoshbikram/create-version-keyfrom
shbikram/create-key

Conversation

@sharmabikram
Copy link
Contributor

Issue #, if available:

Description of changes:
This change adds createKey API which creates a branch key following the spec: https://github.com/awslabs/aws-encryption-sdk-specification/blob/6fd8f886f708afeb89bcfb2a618ca57bb2bd48cd/framework/branch-key-store.md#createkey

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Check any applicable:

  • Were any files moved? Moving files changes their URL, which breaks all hyperlinks to the files.

@sharmabikram sharmabikram requested a review from a team as a code owner March 11, 2026 06:39
//= aws-encryption-sdk-specification/framework/branch-key-store.md#decrypt_only-encryption-context
//# The DECRYPT_ONLY encryption context MUST NOT have a `version` attribute.
//# The `type` attribute MUST stores the branch key version formatted like `"branch:version:"` + `version`.
function buildDecryptOnlyEncryptionContext(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have been needed for VersionKey... Oh, I see what you did.
OK.

Comment on lines +949 to +950
expect(validate(result.branchKeyIdentifier)).to.be.true
expect(version(result.branchKeyIdentifier)).to.equal(4)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are validate and version from UUID?
Yes.

Comment on lines +978 to +981
// Active key must be retrievable
const material = await keyStore.getActiveBranchKey(customId)
expect(material.branchKey().length).to.equal(32)
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: Assert that the encryption context is department: test.

})

describe('CreateKey + VersionKey lifecycle', () => {
it('Create, retrieve, version, retrieve new, retrieve old', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: do this test with custom EC and assert that EC is preserved by version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants