mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
js-nacl: new method random_bytes (#43142)
* feat(js-nacl): new method random_bytes * docs(js-nacl): up version number in header
This commit is contained in:
parent
76bb329370
commit
c888b9e91a
5
types/js-nacl/index.d.ts
vendored
5
types/js-nacl/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for js-nacl 1.2
|
||||
// Type definitions for js-nacl 1.3
|
||||
// Project: https://github.com/tonyg/js-nacl#readme
|
||||
// Definitions by: Ethan Frey <https://github.com/ethanfrey>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@ -116,6 +116,9 @@ export interface Nacl {
|
||||
crypto_box_seed_keypair: (seed: Uint8Array) => BoxKeyPair;
|
||||
crypto_box_keypair_from_raw_sk: (seed: Uint8Array) => BoxKeyPair;
|
||||
|
||||
// random
|
||||
random_bytes: (length: number) => Uint8Array;
|
||||
|
||||
// TODO: crypto_stream
|
||||
// crypto_stream_random_nonce: () => Nonce;
|
||||
// crypto_stream: (len: number, nonce: Nonce, key: StreamKey) => Stream;
|
||||
|
||||
@ -9,6 +9,7 @@ nacl.instantiate((inst: nacl.Nacl) => {
|
||||
demo_box(inst);
|
||||
demo_secret_box(inst);
|
||||
demo_derived(inst);
|
||||
demo_random(inst);
|
||||
});
|
||||
|
||||
function demo_hex(inst: nacl.Nacl): void {
|
||||
@ -71,3 +72,7 @@ function demo_derived(inst: nacl.Nacl): void {
|
||||
inst.crypto_box_seed_keypair(seed); // $ExpectType BoxKeyPair
|
||||
inst.crypto_box_keypair_from_raw_sk(seed); // $ExpectType BoxKeyPair
|
||||
}
|
||||
|
||||
function demo_random(inst: nacl.Nacl): void {
|
||||
inst.random_bytes(32); // $ExpectType Uint8Array
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user