summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/iso/isoCrypto/importKey.ts
blob: 4d2ef2bffea7660787b6aa11c81c9fa75bada20c (plain)
1
2
3
4
5
6
7
8
9
10
import WebCrypto from '@simplewebauthn/iso-webcrypto';

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

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