docs: update keylike interface description

This commit is contained in:
Filip Skokan 2021-03-30 15:21:13 +02:00
parent 5487311ca9
commit 1d49c6b78c

16
src/types.d.ts vendored
View file

@ -80,20 +80,26 @@ export interface GetKeyFunction<T, T2> {
(protectedHeader: T, token: T2): Promise<KeyLike>
}
/* eslint-disable jsdoc/check-indentation */
/**
* KeyLike are platform-specific references to keying material.
*
* - [KeyObject](https://nodejs.org/api/crypto.html#crypto_class_keyobject) instances come from
* node's [crypto module](https://nodejs.org/api/crypto.html) (see crypto.generateKeyPair,
* crypto.createPublicKey, crypto.createPrivateKey, crypto.createSecretKey).
* - [CryptoKey](https://www.w3.org/TR/WebCryptoAPI) instances come from
* [Web Cryptography API](https://www.w3.org/TR/WebCryptoAPI) (see SubtleCrypto.importKey,
* SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.unwrapKey).
* node's [crypto module](https://nodejs.org/api/crypto.html), e.g.:
* - [crypto.generateKeyPair](https://nodejs.org/api/crypto.html#crypto_crypto_generatekeypair_type_options_callback)
* - [crypto.createPublicKey](https://nodejs.org/api/crypto.html#crypto_crypto_createpublickey_key)
* - [crypto.createPrivateKey](https://nodejs.org/api/crypto.html#crypto_crypto_createprivatekey_key)
* - [crypto.createSecretKey](https://nodejs.org/api/crypto.html#crypto_crypto_createsecretkey_key_encoding)
* - [CryptoKey](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey) instances come from
* [Web Cryptography API](https://www.w3.org/TR/WebCryptoAPI), e.g.:
* - [SubtleCrypto.importKey](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey)
* - [SubtleCrypto.generateKey](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey)
* - [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)
* is used exclusively for symmetric secret representations, a CryptoKey or KeyObject is
* preferred, but in Web Crypto API this isn't an option for some algorithms.
*/
export type KeyLike = KeyObject | CryptoKey | Uint8Array
/* eslint-enable */
/**
* Flattened JWS definition for verify function inputs, allows payload as