tink-crypto
Version:
A multi-language, cross-platform library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.
32 lines (31 loc) • 1.21 kB
TypeScript
/**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as ellipticCurves from '../../../subtle/elliptic_curves';
import { HpkeKemPrivateKey } from './hpke_kem_private_key';
/**
* Private keys used in Diffie-Hellman-based P256 and P521 HPKE KEM
* variants.
*/
export declare class NistCurvesHpkeKemPrivateKey implements HpkeKemPrivateKey {
readonly privateKey: CryptoKey;
readonly publicKey: CryptoKey;
constructor(privateKey: CryptoKey, publicKey: CryptoKey);
getSerializedPublicKey(): Promise<Uint8Array>;
}
/**
* Converts an uncompressed point encoded `publicKey` and its associated
* `privateKey` into a `NistCurvesHpkeKemPrivateKey`.
*/
export declare function fromBytes({ privateKey, publicKey, curveType }: {
privateKey: Uint8Array;
publicKey: Uint8Array;
curveType: ellipticCurves.CurveType.P256 | ellipticCurves.CurveType.P521;
}): Promise<NistCurvesHpkeKemPrivateKey>;
/**
* Converts a `CryptoKeyPair` into a `NistCurvesHpkeKemPrivateKey`. The
* algorithm on both keys must be ECDH and both keys should be valid.
*/
export declare function fromCryptoKeyPair(keyPair: CryptoKeyPair): Promise<NistCurvesHpkeKemPrivateKey>;