generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
Background:
Part of #211
Key Package Generation API
When creating a key package there are several options that can be set:
- LeafNode extensions
- KeyPackage extensions
- NotBefore time
- NotAfter time
These options should be configured via a new KeyPackageBuilder instead of the current combination of client configuration + properties passed directly to the generate_key_package_message function
Before (0.x)
Creating Key Packages
// Make a key package store that conforms to the KeyPackageStorage trait
let key_package_store = MyKeyPackageStore::new();
let client = Client::builder()
.key_package_repo(key_package_store) // Transfer the ownership of the key package repo to a client via the ClientBuilder
.key_package_lifetime(1000) // All generated key packages are valid for 1000 seconds
....
.build();
// Generate the key package and provide extensions as Default
let key_package = client.generate_key_package_message(Default::default(), Default::default()).unwrap();After (1.x)
Creating Key Packages
// MyKeyPackageStore no longer needs to conform to KeyPackageStorage (trait no longer exists)
let key_package_store = MyKeyPackageStore::new();
let client = Client::builder()
.... // No key package specific configuration
.build();
// Generate a key package and private data
let (kp_message, private_kp_data) = client.key_package_builder()
.valid_for_sec(1000) // Key package is valid for 1000 seconds
.with_package_extension(ext1) // Add first extension
.with_package_extension(ext2) // Add second extension
.with_leaf_extension(some_leaf_extension) // Add leaf node extension
.build()
.unwrap();
// Independently store the generated secret keys in MyKeyPackageStore
key_package_store.write(private_kp_data).unwrap();Metadata
Metadata
Assignees
Labels
No labels