mirrored from https://www.bouncycastle.org/repositories/pc-dart
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove old js package and use js_interop instead
- Loading branch information
1 parent
ab53265
commit 3d25587
Showing
2 changed files
with
11 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
/// Wrapper for needed NodeJS Crypto library function and require. | ||
@JS() | ||
library nodecryto; | ||
|
||
import 'package:js/js.dart'; | ||
import 'dart:js_interop'; | ||
import 'dart:js_interop_unsafe'; | ||
|
||
external dynamic require(String id); | ||
@JS() | ||
external JSObject require(String id); | ||
|
||
@JS() | ||
@staticInterop | ||
class NodeCrypto { | ||
external randomFillSync(buf); | ||
static JSAny randomFillSync(JSAny buf) { | ||
final crypto = require('crypto'); | ||
return crypto.callMethod('randomFillSync'.toJS, [buf].toJS); | ||
} | ||
} |
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