Skip to content

Commit

Permalink
docs: update keylike interface description
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Mar 30, 2021
1 parent 5487311 commit 1d49c6b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1d49c6b

Please sign in to comment.