@@ -980,12 +980,9 @@ describe('Test Branch keystore', () => {
980980 expect ( material . branchKey ( ) . length ) . to . equal ( 32 )
981981
982982 // Custom encryption context must be preserved.
983- // NOTE: Unlike the Dafny implementation, the JS SDK currently returns
984- // keys with the `aws-crypto-ec:` prefix.
985- expect ( material . encryptionContext ) . to . have . property (
986- 'aws-crypto-ec:department' ,
987- 'test'
988- )
983+ // Custom encryption context is returned with the prefix stripped,
984+ // matching the Dafny implementation behavior.
985+ expect ( material . encryptionContext ) . to . have . property ( 'department' , 'test' )
989986 } )
990987 } )
991988
@@ -1008,19 +1005,13 @@ describe('Test Branch keystore', () => {
10081005 } )
10091006
10101007 // 2. Retrieve the active key and verify EC
1011- // NOTE: Unlike the Dafny implementation, the JS SDK currently returns
1012- // keys with the `aws-crypto-ec:` prefix .
1008+ // Custom encryption context is returned with the prefix stripped,
1009+ // matching the Dafny implementation behavior .
10131010 const v1 = await keyStore . getActiveBranchKey ( branchKeyIdentifier )
10141011 const v1Version = v1 . branchKeyVersion . toString ( 'utf8' )
10151012 expect ( v1 . branchKey ( ) . length ) . to . equal ( 32 )
1016- expect ( v1 . encryptionContext ) . to . have . property (
1017- 'aws-crypto-ec:department' ,
1018- 'engineering'
1019- )
1020- expect ( v1 . encryptionContext ) . to . have . property (
1021- 'aws-crypto-ec:project' ,
1022- 'lifecycle'
1023- )
1013+ expect ( v1 . encryptionContext ) . to . have . property ( 'department' , 'engineering' )
1014+ expect ( v1 . encryptionContext ) . to . have . property ( 'project' , 'lifecycle' )
10241015
10251016 // 3. Version the key
10261017 await keyStore . versionKey ( { branchKeyIdentifier } )
@@ -1030,16 +1021,10 @@ describe('Test Branch keystore', () => {
10301021 const v2Version = v2 . branchKeyVersion . toString ( 'utf8' )
10311022 expect ( v2 . branchKey ( ) . length ) . to . equal ( 32 )
10321023 expect ( v2Version ) . to . not . equal ( v1Version )
1033- // NOTE: Unlike the Dafny implementation, the JS SDK currently returns
1034- // keys with the `aws-crypto-ec:` prefix.
1035- expect ( v2 . encryptionContext ) . to . have . property (
1036- 'aws-crypto-ec:department' ,
1037- 'engineering'
1038- )
1039- expect ( v2 . encryptionContext ) . to . have . property (
1040- 'aws-crypto-ec:project' ,
1041- 'lifecycle'
1042- )
1024+ // Custom encryption context is returned with the prefix stripped,
1025+ // matching the Dafny implementation behavior.
1026+ expect ( v2 . encryptionContext ) . to . have . property ( 'department' , 'engineering' )
1027+ expect ( v2 . encryptionContext ) . to . have . property ( 'project' , 'lifecycle' )
10431028
10441029 // 5. Old version is still retrievable with EC preserved
10451030 const oldMaterial = await keyStore . getBranchKeyVersion (
@@ -1048,14 +1033,14 @@ describe('Test Branch keystore', () => {
10481033 )
10491034 expect ( oldMaterial . branchKey ( ) . length ) . to . equal ( 32 )
10501035 expect ( oldMaterial . branchKeyIdentifier ) . to . equal ( branchKeyIdentifier )
1051- // NOTE: Unlike the Dafny implementation, the JS SDK currently returns
1052- // keys with the `aws-crypto-ec:` prefix .
1036+ // Custom encryption context is returned with the prefix stripped,
1037+ // matching the Dafny implementation behavior .
10531038 expect ( oldMaterial . encryptionContext ) . to . have . property (
1054- 'aws-crypto-ec: department' ,
1039+ 'department' ,
10551040 'engineering'
10561041 )
10571042 expect ( oldMaterial . encryptionContext ) . to . have . property (
1058- 'aws-crypto-ec: project' ,
1043+ 'project' ,
10591044 'lifecycle'
10601045 )
10611046 } )
0 commit comments