Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement transaction [WPB-11400] [WPB-10917] #732

Open
wants to merge 79 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
5b3a4a4
chore: move global lock into MlsCentral
augustocdias Sep 10, 2024
ef5889d
feat: create a keystore transaction struct to be used in the context
augustocdias Sep 18, 2024
ab35220
Creating the context object in order to provide transactional support…
augustocdias Sep 27, 2024
b646e97
Expose the context through the bindings [WPB-10918] (#698)
augustocdias Oct 2, 2024
0feb30e
refactor: refactor tests to transactional api
SimonThormeyer Oct 2, 2024
2a208c8
chore: rename mlsext trait
SimonThormeyer Oct 23, 2024
33ad8ef
chore: use renamed mlsext trait
SimonThormeyer Oct 23, 2024
a922ccc
chore: implement EntityTransactionExt for ProteusIdentity
SimonThormeyer Oct 7, 2024
0eaa544
chore: implement EntityTransactionExt for ProteusPrekey
SimonThormeyer Oct 7, 2024
3e872cf
chore: implement EntityTransactionExt for ProteusSession
SimonThormeyer Oct 7, 2024
068cbc5
chore: implement find_all() on unique entity
SimonThormeyer Oct 7, 2024
ca6bfcd
chore: implement save() for unique entities
SimonThormeyer Oct 9, 2024
dab52f8
chore: introduce merge key
SimonThormeyer Oct 22, 2024
c997e9a
chore: provide a separate delete function that fails on missing id
SimonThormeyer Oct 23, 2024
9153a65
chore: use the separate delete function that fails on missing id
SimonThormeyer Oct 23, 2024
3a8758f
chore: implement downcast on Entity
SimonThormeyer Oct 14, 2024
e7fc8ee
chore: add itertools to keystore crate
SimonThormeyer Oct 23, 2024
b4b7a31
feat: implement in-memory cache on transaction
SimonThormeyer Oct 23, 2024
a6e21aa
chore: use updated transaction constructor
SimonThormeyer Oct 23, 2024
4d20c9b
chore: fix callsites of new_transaction()
SimonThormeyer Oct 4, 2024
4955e64
refactor: redirect fetch calls to transaction
SimonThormeyer Oct 8, 2024
0b805a5
chore: redirect mutating operations to transaction
SimonThormeyer Oct 7, 2024
27f6d09
chore: provide commit_transaction() on connection
SimonThormeyer Oct 8, 2024
75b5fb8
chore: implement credential deletion on connection
SimonThormeyer Oct 23, 2024
0e1b5ba
chore: implement mls traits on connection
SimonThormeyer Oct 8, 2024
653504d
chore: remove mutating functions from entitybase trait
SimonThormeyer Oct 8, 2024
246b999
chore: refactor context to have transaction handled in keystore
SimonThormeyer Oct 8, 2024
666c19b
chore: resolve compile errors after having transaction handled in key…
SimonThormeyer Oct 23, 2024
bb0635d
chore: fix credential implementation
SimonThormeyer Oct 9, 2024
ebb15aa
chore: fix deadlock in e2ei rotation
SimonThormeyer Oct 9, 2024
3a041a7
chore: move test utils functions to client context
SimonThormeyer Oct 7, 2024
342b505
chore: introduce mutex on client identities
SimonThormeyer Oct 14, 2024
92196b9
chore: fix compile errors after introducing mutex on client identities
SimonThormeyer Oct 14, 2024
ec6b11d
chore: add rollback_transaction() method to connection
SimonThormeyer Oct 15, 2024
9a934fe
chore: fix merge key for MlsPending message
SimonThormeyer Oct 15, 2024
637ef58
refactor: rename id field on MlsPendingMessage
SimonThormeyer Oct 15, 2024
1cda79e
refactor: improve keystore test ergonomics
SimonThormeyer Oct 15, 2024
c6b8f0d
chore: fix compile errors after keystore test refactoring
SimonThormeyer Oct 9, 2024
a35b896
chore: fix wipe and close keystore
SimonThormeyer Oct 15, 2024
3a08d8d
chore: update tests to open and close transactions, fix compile errors
SimonThormeyer Oct 15, 2024
6c18eb8
chore: move transaction creation to core struct
SimonThormeyer Oct 16, 2024
8617715
chore: move context module
SimonThormeyer Oct 16, 2024
9fe6686
chore: move proteus functions to central context
SimonThormeyer Oct 16, 2024
32b81bb
chore: fix compile errors in exposed functions on CoreCrypto
SimonThormeyer Oct 16, 2024
52c990e
chore: restructure modules in crypto-ffi
SimonThormeyer Oct 16, 2024
7fafad1
chore: expose proteus functions via uniffi
SimonThormeyer Oct 16, 2024
a4cd09a
chore: rename MlsContext to CoreCryptoContext
SimonThormeyer Oct 18, 2024
582087f
chore: kotlin wrapper: expose proteus functions on context
SimonThormeyer Oct 18, 2024
6a68978
chore: remove implementation error from keystore
SimonThormeyer Oct 18, 2024
07908cb
chore: implement entity base for enrollment
SimonThormeyer Oct 18, 2024
487450d
chore: export and use proteus_impl macro
SimonThormeyer Oct 23, 2024
89f42b9
chore: expose proteus functions on context for wasm
SimonThormeyer Oct 21, 2024
aed9502
chore: fix wasm compile errors in keystore and crypto crate
SimonThormeyer Oct 23, 2024
0a9a713
chore: expose context api for proteus functions in wasm wrapper
SimonThormeyer Oct 21, 2024
c888ba7
chore: fix interop test
SimonThormeyer Oct 21, 2024
73d6f42
chore: update interop ffi client to 1.0.2 api
SimonThormeyer Oct 23, 2024
43e37e3
chore: use ffi client in interop test
SimonThormeyer Oct 23, 2024
89c1502
style: run cargo fmt
SimonThormeyer Nov 6, 2024
5cd9814
chore: fix compile errors in e2ei_rotate()
SimonThormeyer Oct 24, 2024
b3cde2a
chore: add e2ei_rotate() to context and bindings
SimonThormeyer Oct 24, 2024
f2d2c16
chore: remove transaction lock
SimonThormeyer Oct 24, 2024
3b5f6fb
chore: fix wasm close and wipe
SimonThormeyer Oct 24, 2024
2c4a2b8
chore: fix corrupted transaction state after commit_accepted()
SimonThormeyer Oct 24, 2024
a030fef
chore: fix transaction creation for iOS
SimonThormeyer Oct 25, 2024
9a7e060
chore: decouple dynamic dispatch boiler plate in transaction
SimonThormeyer Oct 25, 2024
069a586
chore: dynamic dispatch module in compliance with cargo features
SimonThormeyer Oct 25, 2024
231129b
chore: compliance with proteus feature in context
SimonThormeyer Oct 25, 2024
cfde9e6
chore: fix independent compilation of cargo features
SimonThormeyer Nov 1, 2024
44ae62a
chore: fix transactions in bindings
SimonThormeyer Oct 25, 2024
9068533
chore: incorporate fix in uniffi bindings
SimonThormeyer Oct 25, 2024
4174af6
chore: use transaction api in deprecated functions in TS wrapper
SimonThormeyer Oct 21, 2024
e69254c
chore: remove deprecated functions from wasm bindings
SimonThormeyer Oct 30, 2024
5b5d3cd
chore: keep proteus error code from context
SimonThormeyer Oct 28, 2024
618ee4e
chore: handle transaction error in typescript wrapper
SimonThormeyer Oct 29, 2024
96ef935
chore: handle transaction error in kotlin wrapper
SimonThormeyer Oct 31, 2024
2b2b306
chore: fix benches
SimonThormeyer Oct 30, 2024
e5e8a12
chore: remove transactional crypto provider
SimonThormeyer Nov 6, 2024
7ce86a2
chore: fix docs
SimonThormeyer Nov 1, 2024
82b335e
chore: test that interaction with invalid context throws error
SimonThormeyer Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions crypto-ffi/bindings/js/CoreCrypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1043,15 +1043,27 @@ export class CoreCrypto {
callback: (ctx: CoreCryptoContext) => Promise<R>
): Promise<R> {
let result!: R;
await CoreCryptoError.asyncMapErr(
this.#cc.transaction({
execute: async (ctx: CoreCryptoFfiTypes.CoreCryptoContext) => {
let error: CoreCryptoError | null = null;
await this.#cc.transaction({
execute: async (ctx: CoreCryptoFfiTypes.CoreCryptoContext) => {
try {
result = await callback(
CoreCryptoContext.fromFfiContext(ctx)
);
},
})
);
} catch (e) {
if (e instanceof CoreCryptoError) {
error = e as CoreCryptoError;
} else {
error = CoreCryptoError.fromStdError(
e as Error
) as CoreCryptoError;
}
}
},
});
if (error !== null) {
throw error;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a test for this?

return result;
}

Expand Down