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).


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.


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

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support 37Edge Full support 12Firefox Full support 34IE No support NoOpera ? Safari No support NoWebView Android Full support 37Chrome Android Full support 37Edge Mobile Full support YesFirefox Android Full support 34Opera Android ? Safari iOS No support NoSamsung Internet Android Full support Yes


Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

See also

Document Tags and Contributors

Contributors to this page: fscholz, erikadoyle, teoli
Last updated by: fscholz,