Skip to content

Commit 7b2a135

Browse files
committed
feat: implement beacon styles (#441)
* feat: implement beacon styles
1 parent c31de50 commit 7b2a135

File tree

23 files changed

+1419
-88
lines changed

23 files changed

+1419
-88
lines changed

DynamoDbEncryption/dafny/DynamoDbEncryption/Model/AwsCryptographyDbEncryptionSdkDynamoDbTypes.dfy

+19-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy"
2222

2323
// Begin Generated Types
2424

25+
datatype AsSet = | AsSet (
26+
27+
)
2528
type AttributeActions = map<ComAmazonawsDynamodbTypes.AttributeName, AwsCryptographyDbEncryptionSdkStructuredEncryptionTypes.CryptoAction>
2629
type BeaconBitLength = x: int32 | IsValid_BeaconBitLength(x) witness *
2730
predicate method IsValid_BeaconBitLength(x: int32) {
@@ -30,6 +33,11 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy"
3033
datatype BeaconKeySource =
3134
| single(single: SingleKeyStore)
3235
| multi(multi: MultiKeyStore)
36+
datatype BeaconStyle =
37+
| partOnly(partOnly: PartOnly)
38+
| twinned(twinned: Twinned)
39+
| asSet(asSet: AsSet)
40+
| twinnedSet(twinnedSet: TwinnedSet)
3341
datatype BeaconVersion = | BeaconVersion (
3442
nameonly version: VersionNumber ,
3543
nameonly keyStore: AwsCryptographyKeyStoreTypes.IKeyStoreClient ,
@@ -310,6 +318,9 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy"
310318
nameonly keyFieldName: string ,
311319
nameonly cacheTTL: int32 ,
312320
nameonly cache: Option<AwsCryptographyMaterialProvidersTypes.CacheType>
321+
)
322+
datatype PartOnly = | PartOnly (
323+
313324
)
314325
datatype PlaintextOverride =
315326
| FORCE_PLAINTEXT_WRITE_ALLOW_PLAINTEXT_READ
@@ -339,7 +350,8 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy"
339350
datatype StandardBeacon = | StandardBeacon (
340351
nameonly name: string ,
341352
nameonly length: BeaconBitLength ,
342-
nameonly loc: Option<TerminalLocation>
353+
nameonly loc: Option<TerminalLocation> ,
354+
nameonly style: Option<BeaconStyle>
343355
)
344356
type StandardBeaconList = x: seq<StandardBeacon> | IsValid_StandardBeaconList(x) witness *
345357
predicate method IsValid_StandardBeaconList(x: seq<StandardBeacon>) {
@@ -349,6 +361,12 @@ include "../../../../submodules/MaterialProviders/StandardLibrary/src/Index.dfy"
349361
predicate method IsValid_TerminalLocation(x: string) {
350362
( 1 <= |x| )
351363
}
364+
datatype Twinned = | Twinned (
365+
nameonly other: string
366+
)
367+
datatype TwinnedSet = | TwinnedSet (
368+
nameonly other: string
369+
)
352370
datatype Upper = | Upper (
353371

354372
)

DynamoDbEncryption/dafny/DynamoDbEncryption/Model/DynamoDbEncryption.smithy

+57-1
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,60 @@ union VirtualTransform {
465465
segments : GetSegments
466466
}
467467

468+
//= specification/searchable-encryption/beacons.md#partonly-initialization
469+
//= type=implication
470+
//# On initialization of a PartOnly, the caller MUST NOT provide any
471+
//# additional parameters to the PartOnly.
472+
@javadoc("Attribute must be used as part of a Compound Beacon, never alone.")
473+
structure PartOnly {}
474+
475+
//= specification/searchable-encryption/beacons.md#asset-initialization
476+
//= type=implication
477+
//# On initialization of as AsSet, the caller MUST NOT provide any
478+
//# additional parameters to the AsSet.
479+
@javadoc("Attribute must be a Set. Beacon value will also be a Set.")
480+
structure AsSet {}
481+
482+
//= specification/searchable-encryption/beacons.md#twinned-initialization
483+
//= type=implication
484+
//# On initialization of a Twinned, the caller MUST provide:
485+
//#
486+
//# * other : a beacon name
487+
@javadoc("This beacon should calculate values like another beacon, so they can be compared.")
488+
structure Twinned {
489+
@required
490+
@javadoc("Calculate beacon values as for this beacon.")
491+
other : String,
492+
}
493+
494+
//= specification/searchable-encryption/beacons.md#twinnedset-initialization
495+
//= type=implication
496+
//# On initialization of a TwinnedSet, the caller MUST provide:
497+
//#
498+
//# * other : a beacon name
499+
@javadoc("Both Twinned and AsSet.")
500+
structure TwinnedSet {
501+
@required
502+
@javadoc("Calculate beacon values as for this beacon.")
503+
other : String,
504+
}
505+
506+
//= specification/searchable-encryption/beacons.md#beacon-style-initialization
507+
//= type=implication
508+
//# On initialization of a Beacon Style, the caller MUST provide exactly one of
509+
//#
510+
//# * a [PartOnly](#partonly-initialization)
511+
//# * a [Twinned](#twinned-initialization)
512+
//# * an [AsSet](#asset-initialization)
513+
//# * a [TwinnedSet](#twinnedset-initialization)
514+
515+
union BeaconStyle {
516+
partOnly: PartOnly,
517+
twinned: Twinned,
518+
asSet: AsSet,
519+
twinnedSet: TwinnedSet,
520+
}
521+
468522
//= specification/searchable-encryption/beacons.md#encrypted-part-initialization
469523
//= type=implication
470524
//# On initialization of a [encrypted part](#encrypted-part-initialization), the caller MUST provide:
@@ -552,7 +606,9 @@ structure StandardBeacon {
552606
@javadoc("The length of the calculated beacon.")
553607
length : BeaconBitLength,
554608
@javadoc("The DynamoDB document path to the value this beacon will calculate over. If not specified, the beacon will calculate values for the attribute with the name specified in 'name'.")
555-
loc : TerminalLocation
609+
loc : TerminalLocation,
610+
@javadoc("Optional augmented behavior.")
611+
style : BeaconStyle,
556612
}
557613

558614
//= specification/searchable-encryption/beacons.md#compound-beacon-initialization

0 commit comments

Comments
 (0)