W3cubDocs

/DOM

CryptoKey.type

The CryptoKey.type read-only property that indicates the type of the key: if it is the key for a symmetric algorithm ("secret") or for an asymmetric algorithm ("public" or "private", depending of its purpose).

Syntax

result = key.type

Return value

  • result is an enumerated value that can be:
    • "secret" represents the unique key used for encrypting or decrypting a message using a symmetric algorithm.
    • "public" represents a publicly shareable key used in an asymmetric algorithm.
    • "private" represents a key used in an asymmetric algorithm that must be kept private.

Specifications

Specification Status Comment
Web Cryptography API
The definition of 'CryptoKey.type' in that specification.
Recommendation Initial definition.

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 37 12 34 No ? No
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support 37 37 Yes 34 ? No Yes

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey/type