Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/crypto): KeyAlgorithm typings for supported algorithms #11738

Merged
merged 4 commits into from
Aug 24, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions ext/crypto/lib.deno_crypto.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type KeyUsage =
| "wrapKey";

type NamedCurve = string;
type BigInteger = Uint8Array;
littledivy marked this conversation as resolved.
Show resolved Hide resolved

interface HmacKeyGenParams extends Algorithm {
hash: HashAlgorithmIdentifier;
Expand Down Expand Up @@ -59,6 +60,24 @@ interface HmacImportParams extends Algorithm {
length?: number;
}

interface EcKeyAlgorithm extends KeyAlgorithm {
namedCurve: NamedCurve;
}

interface HmacKeyAlgorithm extends KeyAlgorithm {
hash: KeyAlgorithm;
length: number;
}

interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {
hash: KeyAlgorithm;
}

interface RsaKeyAlgorithm extends KeyAlgorithm {
modulusLength: number;
publicExponent: BigInteger;
}

/** The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. */
interface CryptoKey {
readonly algorithm: KeyAlgorithm;
Expand Down