1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- use libwebrtc:: native:: frame_cryptor as fc;
15+ use libwebrtc:: native:: frame_cryptor:: { self as fc, KeyDerivationAlgorithm } ;
1616use std:: sync:: {
1717 atomic:: { AtomicI32 , Ordering } ,
1818 Arc ,
@@ -31,6 +31,7 @@ pub struct KeyProviderOptions {
3131 pub ratchet_salt : Vec < u8 > ,
3232 pub failure_tolerance : i32 ,
3333 pub key_ring_size : i32 ,
34+ pub key_derivation_algorithm : KeyDerivationAlgorithm ,
3435}
3536
3637impl Default for KeyProviderOptions {
@@ -40,6 +41,7 @@ impl Default for KeyProviderOptions {
4041 ratchet_salt : DEFAULT_RATCHET_SALT . to_owned ( ) . into_bytes ( ) ,
4142 failure_tolerance : DEFAULT_FAILURE_TOLERANCE ,
4243 key_ring_size : DEFAULT_KEY_RING_SIZE ,
44+ key_derivation_algorithm : KeyDerivationAlgorithm :: PBKDF2 ,
4345 }
4446 }
4547}
@@ -60,6 +62,7 @@ impl KeyProvider {
6062 ratchet_salt : options. ratchet_salt ,
6163 failure_tolerance : options. failure_tolerance ,
6264 key_ring_size : options. key_ring_size ,
65+ key_derivation_algorithm : options. key_derivation_algorithm ,
6366 } ) ,
6467 latest_key_index : Arc :: new ( AtomicI32 :: new ( 0 ) ) ,
6568 }
@@ -72,6 +75,7 @@ impl KeyProvider {
7275 ratchet_salt : options. ratchet_salt ,
7376 failure_tolerance : options. failure_tolerance ,
7477 key_ring_size : options. key_ring_size ,
78+ key_derivation_algorithm : options. key_derivation_algorithm ,
7579 } ) ;
7680 handle. set_shared_key ( 0 , shared_key) ;
7781 Self { handle, latest_key_index : Arc :: new ( AtomicI32 :: new ( 0 ) ) }
0 commit comments