Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as core from "webcrypto-core";
import { CryptoKey } from "../../keys";
import { EcCrypto } from "./crypto";
import { EcPrivateKey } from "./private_key";
import { EcPublicKey } from "./public_key";
export class EcdhProvider extends core.EcdhProvider {
public async onGenerateKey(algorithm: EcKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise {
const key = await EcCrypto.generateKey(
{
...algorithm,
name: this.name,
},
extractable,
keyUsages);
return key;
}
public async onExportKey(format: KeyFormat, key: CryptoKey): Promise {
return EcCrypto.exportKey(format, key);
}
import * as core from "webcrypto-core";
import { EcCrypto } from "./crypto";
import { EcCryptoKey } from "./key";
export class EcdhProvider extends core.EcdhProvider {
public async onGenerateKey(algorithm: EcKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise {
return EcCrypto.generateKey(algorithm, extractable, keyUsages);
}
public async onExportKey(format: KeyFormat, key: EcCryptoKey): Promise {
return EcCrypto.exportKey(format, key);
}
public async onImportKey(format: KeyFormat, keyData: ArrayBuffer | JsonWebKey, algorithm: EcKeyImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise {
return EcCrypto.importKey(format, keyData, algorithm, extractable, keyUsages);
}
public async onDeriveBits(algorithm: EcdhKeyDeriveParams, baseKey: EcCryptoKey, length: number): Promise {
EcCrypto.checkLib();
import * as graphene from "graphene-pk11";
import * as core from "webcrypto-core";
import { Crypto } from "../../crypto";
import { CryptoKey } from "../../key";
import { EcCrypto } from "./crypto";
import { EcCryptoKey } from "./key";
export class EcdhProvider extends core.EcdhProvider {
constructor(private crypto: Crypto) {
super();
}
public async onGenerateKey(algorithm: EcKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise {
const key = await EcCrypto.generateKey(
this.crypto.session,
{
...algorithm,
name: this.name,
},
extractable,
keyUsages);
return key;