char/avril

(wip) why'd you have to go and make things so complicaaaaated?

git clone https://git.t4t.associates/char/avril

Charlotte Somport webcrypto extension to typescriptdbb5c40

main
3.7 KiB125 linesraw
1declare module "ext:core/ops" {
2  type CryptoUsage = import("./types.js").CryptoKeyUsage;
3  type CryptoOperation = import("./types.js").CryptoOperation;
4  type CryptoFormat = import("./types.js").CryptoKeyFormat;
5  type CryptoMeta = import("./types.js").CryptoKeyMetadata;
6  type CryptoBuffer = import("./types.js").CryptoBuffer;
7  type CryptoView = import("./types.js").CryptoView;
8
9  export function op_crypto_random(bytes: CryptoView): null;
10  export function op_crypto_uuid(input: null): string;
11  export function op_crypto_key_dispose(id: number): null;
12  export function op_crypto_key_clone(id: number): number;
13  export function op_crypto_key_serialize(id: number): number;
14  export function op_crypto_key_deserialize(id: number): number;
15  export function op_crypto_key_pair_generate(
16    args: [
17      algorithm: string,
18      hash: string,
19      length: number,
20      exponent: CryptoBuffer,
21      curve: string,
22      usages: CryptoUsage[],
23      extractable: boolean,
24    ],
25  ): Promise<[publicId: number, privateId: number, length: number, exponent: CryptoBuffer | null]>;
26  export function op_crypto_key_generate(
27    args: [algorithm: string, length: number, hash: string, usages: CryptoUsage[], extractable: boolean],
28  ): Promise<number>;
29  export function op_crypto_key_import(
30    args: [
31      algorithm: string,
32      bytes: CryptoBuffer,
33      length: number,
34      hash: string,
35      usages: CryptoUsage[],
36      extractable: boolean,
37    ],
38  ): Promise<number>;
39  export function op_crypto_key_import_asymmetric(
40    args: [
41      format: CryptoFormat,
42      data: CryptoBuffer,
43      algorithm: string,
44      hash: string,
45      curve: string,
46      usages: CryptoUsage[],
47      extractable: boolean,
48    ],
49  ): Promise<CryptoMeta>;
50  export function op_crypto_key_import_jwk(
51    args: [
52      jwk: Record<string, unknown>,
53      algorithm: string,
54      hash: string,
55      curve: string,
56      usages: CryptoUsage[],
57      extractable: boolean,
58      length: number,
59    ],
60  ): Promise<CryptoMeta>;
61  export function op_crypto_key_export(args: [id: number, format: CryptoFormat]): Promise<CryptoBuffer>;
62  export function op_crypto_key_export_jwk(id: number): Promise<Record<string, unknown>>;
63  export function op_crypto_derive_key(
64    args: [
65      id: number,
66      hash: string,
67      salt: CryptoBuffer,
68      iterations: number,
69      info: CryptoBuffer,
70      length: number,
71      algorithm: string,
72      keyHash: string,
73      usages: CryptoUsage[],
74      extractable: boolean,
75      peerId: number,
76    ],
77  ): Promise<number>;
78  export function op_crypto_wrap_key(
79    args: [
80      wrappingId: number,
81      targetId: number,
82      format: CryptoFormat,
83      algorithm: string,
84      hash: string,
85      iv: CryptoBuffer,
86      counter: CryptoBuffer,
87      additional: CryptoBuffer,
88      tagLength: number,
89    ],
90  ): Promise<CryptoBuffer>;
91  export function op_crypto_unwrap_key(
92    args: [
93      wrappingId: number,
94      format: CryptoFormat,
95      wrapped: CryptoBuffer,
96      algorithm: string,
97      hash: string,
98      curve: string,
99      usages: CryptoUsage[],
100      extractable: boolean,
101      iv: CryptoBuffer,
102      counter: CryptoBuffer,
103      additional: CryptoBuffer,
104      tagLength: number,
105      length: number,
106    ],
107  ): Promise<CryptoMeta>;
108  export function op_crypto_run(
109    args: [
110      operation: CryptoOperation,
111      id: number,
112      hash: string,
113      iv: CryptoBuffer,
114      counter: CryptoBuffer,
115      additional: CryptoBuffer,
116      tagLength: number,
117      iterations: number,
118      salt: CryptoBuffer,
119      info: CryptoBuffer,
120      input: CryptoBuffer,
121      peerId: number,
122    ],
123  ): Promise<CryptoBuffer>;
124  export function op_crypto_digest(args: [name: string, input: CryptoBuffer]): Promise<CryptoBuffer>;
125}