summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/iso/isoCrypto/importKey.ts
blob: d475ac143398683f0627399cecac7df41c346ac9 (plain)
1
2
3
4
5
6
7
8
9
10
import { WebCrypto } from '../../../deps.ts';

export function importKey(opts: {
  keyData: JsonWebKey;
  algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams;
}): Promise<CryptoKey> {
  const { keyData, algorithm } = opts;

  return WebCrypto.subtle.importKey('jwk', keyData, algorithm, false, ['verify']);
}