File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -218,8 +218,12 @@ export class DataProtector {
218218 }
219219
220220 async _getTransparentSession ( encryptionOptions : Omit < EncryptionOptions , 'paddingStep' > ) : Promise < SessionResult > {
221- const shareWithUsers = encryptionOptions . shareWithUsers || [ ] ;
222- const shareWithGroups = encryptionOptions . shareWithGroups || [ ] ;
221+ const shareWithUsers = [
222+ ...encryptionOptions . shareWithUsers || [ ] ,
223+ ] ;
224+ const shareWithGroups = [
225+ ...encryptionOptions . shareWithGroups || [ ] ,
226+ ] ;
223227
224228 if ( encryptionOptions . shareWithSelf ) {
225229 const selfIdentity = _serializeIdentity ( this . _handleShareWithSelf ( [ ] , encryptionOptions . shareWithSelf ) [ 0 ] ! ) ;
Original file line number Diff line number Diff line change @@ -197,6 +197,15 @@ export const generateEncryptionTests = (args: TestArgs) => {
197197 } ) ;
198198
199199 describe ( 'share at encryption time' , ( ) => {
200+ it ( 'does not alter sharing options' , async ( ) => {
201+ const options = {
202+ shareWithUsers : [ alicePublicIdentity ] ,
203+ } ;
204+ await expect ( bobLaptop . encrypt ( clearText , options ) ) . to . be . fulfilled ;
205+
206+ expect ( options . shareWithUsers . length ) . to . equal ( 1 ) ;
207+ } ) ;
208+
200209 it ( 'encrypts and shares with a permanent identity' , async ( ) => {
201210 const encrypted = await bobLaptop . encrypt ( clearText , { shareWithUsers : [ alicePublicIdentity ] } ) ;
202211 await expectDecrypt ( [ aliceLaptop ] , clearText , encrypted ) ;
You can’t perform that action at this time.
0 commit comments