@@ -26,6 +26,7 @@ module SearchableEncryptionInfo {
2626 import MP = AwsCryptographyMaterialProvidersTypes
2727 import KeyStoreTypes = AwsCryptographyKeyStoreTypes
2828 import SE = AwsCryptographyDbEncryptionSdkStructuredEncryptionTypes
29+ import CacheConstants
2930
3031 // = specification/searchable-encryption/search-config.md#version-number
3132 // = type=implication
@@ -137,7 +138,8 @@ module SearchableEncryptionInfo {
137138 store : ValidStore ,
138139 keyLoc : KeyLocation ,
139140 cache : MP .ICryptographicMaterialsCache,
140- cacheTTL : uint32
141+ cacheTTL : uint32 ,
142+ partitionIdBytes : seq <uint8 >
141143 ) {
142144 function Modifies () : set < object > {
143145 client. Modifies + store. Modifies
@@ -153,7 +155,7 @@ module SearchableEncryptionInfo {
153155 {
154156 if keyLoc. SingleLoc? {
155157 :- Need (keyId.DontUseKeyId?, E("KeyID should not be supplied with a SingleKeyStore"));
156- var theMap :- getKeysCache (stdNames, keyLoc.keyId);
158+ var theMap :- getKeysCache (stdNames, keyLoc.keyId, partitionIdBytes );
157159 return Success (Keys(theMap));
158160 } else if keyLoc. LiteralLoc? {
159161 :- Need (keyId.DontUseKeyId?, E("KeyID should not be supplied with a LiteralKeyStore"));
@@ -163,7 +165,7 @@ module SearchableEncryptionInfo {
163165 match keyId {
164166 case DontUseKeyId => return Failure (E("KeyID must not be supplied with a MultiKeyStore"));
165167 case ShouldHaveKeyId => return Success (ShouldHaveKeys);
166- case KeyId (id) => var theMap :- getKeysCache (stdNames, id); return Success (Keys(theMap));
168+ case KeyId (id) => var theMap :- getKeysCache (stdNames, id, partitionIdBytes ); return Success (Keys(theMap));
167169 }
168170 }
169171 }
@@ -182,7 +184,8 @@ module SearchableEncryptionInfo {
182184
183185 method getKeysCache (
184186 stdNames : seq <string >,
185- keyId : string
187+ keyId : string ,
188+ partitionIdBytes : seq <uint8 >
186189 )
187190 returns (output : Result< HmacKeyMap, Error> )
188191 requires Seq. HasNoDuplicates (stdNames)
@@ -241,6 +244,11 @@ module SearchableEncryptionInfo {
241244
242245 )
243246 {
247+
248+ // Resource ID: Searchable Encryption [0x02]
249+ // var resourceId : seq<uint8> := RESOURCE_ID_HIERARCHICAL_KEYRING;
250+
251+
244252 var keyIdBytesR := UTF8. Encode (keyId);
245253 var keyIdBytes :- keyIdBytesR. MapFailure (e => E(e));
246254 var getCacheInput := MP. GetCacheEntryInput (identifier := keyIdBytes, bytesUsed := None);
@@ -253,6 +261,7 @@ module SearchableEncryptionInfo {
253261 return Failure (AwsCryptographyMaterialProviders(AwsCryptographyMaterialProviders:=getCacheOutput.error));
254262 }
255263
264+ // TODO: Add cacheEntryWithinLimits
256265 if getCacheOutput. Failure? {
257266 // = specification/searchable-encryption/search-config.md#beacon-keys
258267 // # Beacon keys MUST be obtained from the configured [Beacon Key Source](#beacon-key-source).
0 commit comments