File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -328,6 +328,24 @@ interface Credentials {
328328 removePassword ( service : string , user : User ) : null ;
329329}
330330
331+ /// https://docs.nova.app/api-reference/crypto/
332+
333+ type IntegerTypedArray =
334+ | Int8Array
335+ | Uint8Array
336+ | Uint8ClampedArray
337+ | Int16Array
338+ | Uint16Array
339+ | Int32Array
340+ | Uint32Array
341+ | BigInt64Array
342+ | BigUint64Array ;
343+
344+ interface Crypto {
345+ getRandomValues < T extends IntegerTypedArray > ( typedArray : T ) : T ;
346+ randomUUID ( ) : string ;
347+ }
348+
331349/// https://docs.nova.app/api-reference/disposable/
332350
333351declare class Disposable {
@@ -359,6 +377,7 @@ interface Environment {
359377 readonly clipboard : Clipboard ;
360378 readonly config : Configuration ;
361379 readonly credentials : Credentials ;
380+ readonly crypto : Crypto ;
362381 readonly extension : Extension ;
363382 readonly environment : { [ key : string ] : string } ;
364383 readonly path : Path ;
Original file line number Diff line number Diff line change @@ -102,6 +102,23 @@ const charset2 = charset1.intersect(Charset.letters);
102102// $ExpectType Promise<string>
103103nova . clipboard . readText ( ) ;
104104
105+ /// https://docs.nova.app/api-reference/crypto/
106+
107+ const uint8Array = new Uint8Array ( 16 ) ;
108+ // $ExpectType Uint8Array || Uint8Array<ArrayBuffer>
109+ nova . crypto . getRandomValues ( uint8Array ) ;
110+
111+ const int32Array = new Int32Array ( 10 ) ;
112+ // $ExpectType Int32Array || Int32Array<ArrayBuffer>
113+ nova . crypto . getRandomValues ( int32Array ) ;
114+
115+ const bigUint64Array = new BigUint64Array ( 4 ) ;
116+ // $ExpectType BigUint64Array || BigUint64Array<ArrayBuffer>
117+ nova . crypto . getRandomValues ( bigUint64Array ) ;
118+
119+ // $ExpectType string
120+ nova . crypto . randomUUID ( ) ;
121+
105122/// https://novadocs.panic.com/api-reference/completion-item/
106123
107124const completionItem = new CompletionItem ( "label" , CompletionItemKind . Struct ) ;
You can’t perform that action at this time.
0 commit comments