How to use the webcrypto-core.EcdhProvider function in webcrypto-core

To help you get started, we’ve selected a few webcrypto-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PeculiarVentures / webcrypto / src / mechs / ec / ec_dh.ts View on Github external
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);
  }
github PeculiarVentures / webcrypto-liner / src / mechs / ec / ec_dh.ts View on Github external
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();
github PeculiarVentures / node-webcrypto-p11 / src / mechs / ec / ec_dh.ts View on Github external
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;