method webcrypto.SubtleCrypto.importKey
Jump to headingSubtleCrypto.importKey(): Promise<CryptoKey>
The subtle.importKey()
method attempts to interpret the provided keyData
as the given format
to create a <CryptoKey>
instance using the provided algorithm
, extractable
, and keyUsages
arguments.
If the import is successful, the returned promise will be resolved with the created <CryptoKey>
.
If importing a 'PBKDF2'
key, extractable
must be false
.
Parameters Jump to heading
Jump to headingformat: "jwk"
Must be one of 'raw'
, 'pkcs8'
, 'spki'
, or 'jwk'
.
Jump to headingkeyData: JsonWebKey
Jump to headingextractable: boolean
Jump to headingkeyUsages: readonly KeyUsage[]
See Key usages.
Return Type Jump to heading
Promise<CryptoKey>
Jump to headingSubtleCrypto.importKey(format: Exclude<KeyFormat, "jwk">,keyData: BufferSource,algorithm: ,extractable: boolean,keyUsages: KeyUsage[],): Promise<CryptoKey>
Parameters Jump to heading
Jump to headingformat: Exclude<KeyFormat, "jwk">
Jump to headingkeyData: BufferSource
Jump to headingextractable: boolean
Jump to headingkeyUsages: KeyUsage[]
Return Type Jump to heading
Promise<CryptoKey>