-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add SodiumSumo.runIsolated override (fixes #116)
- Loading branch information
1 parent
d15bbb2
commit 5b04d74
Showing
15 changed files
with
235 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
presets: | ||
unit: | ||
paths: | ||
- test/unit | ||
|
||
integration: | ||
paths: | ||
- test/integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,32 @@ | ||
import 'dart:async'; | ||
|
||
import '../key_pair.dart'; | ||
import '../secure_key.dart'; | ||
import '../sodium.dart'; | ||
import 'crypto_sumo.dart'; | ||
|
||
/// A callback to be executed on a separate isolate. | ||
/// | ||
/// The callback receives a fresh [sodium] sumo instance that only lives on the | ||
/// new isolate, as well as the [secureKeys] and [keyPairs] that have been | ||
/// transferred to it via the [SodiumSumo.runIsolated] method. | ||
typedef SodiumSumoIsolateCallback<T> = FutureOr<T> Function( | ||
SodiumSumo sodium, | ||
List<SecureKey> secureKeys, | ||
List<KeyPair> keyPairs, | ||
); | ||
|
||
/// A meta class that provides access to all toplevel libsodium sumo API groups. | ||
abstract class SodiumSumo implements Sodium { | ||
const SodiumSumo._(); // coverage:ignore-line | ||
|
||
@override | ||
CryptoSumo get crypto; | ||
|
||
@override | ||
Future<T> runIsolated<T>( | ||
SodiumSumoIsolateCallback<T> callback, { | ||
List<SecureKey> secureKeys = const [], | ||
List<KeyPair> keyPairs = const [], | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.