/**
 * @license
 * Copyright 2020 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import * as KeyManager from './key_manager';
import * as PrimitiveSet from './primitive_set';
import { PrimitiveWrapper } from './primitive_wrapper';
import { PbKeyData, PbKeyTemplate, PbMessage } from './proto';
import { Constructor } from './util';
/**
 * Register the given manager for the given key type. Manager must be
 * non-nullptr. New keys are allowed if not specified.
 */
export declare function registerKeyManager(manager: KeyManager.KeyManager<unknown>, opt_newKeyAllowed?: boolean): void;
/**
 * Returns a key manager for the given key type or throws an exception if no
 * such manager found.
 *
 * @param typeUrl -- key type
 *
 */
export declare function getKeyManager(typeUrl: string): KeyManager.KeyManager<unknown>;
/**
 * It finds KeyManager according to key type (which is either given by
 * PbKeyData or given by opt_typeUrl), than calls the corresponding
 * manager's getPrimitive method.
 *
 * Either key is of type PbKeyData or opt_typeUrl must be provided.
 *
 * @param key -- key is either a proto of some key
 *     or key data.
 * @param opt_typeUrl -- key type
 * @this {typeof Registry}
 *
 */
export declare function getPrimitive<P>(primitiveType: Constructor<P>, key: PbKeyData | PbMessage, opt_typeUrl?: string | null): Promise<P>;
/**
 * Generates a new PbKeyData for the specified keyTemplate. It finds a
 * KeyManager given by keyTemplate.typeUrl and calls the newKeyData method of
 * that manager.
 *
 *
 *
 */
export declare function newKeyData(keyTemplate: PbKeyTemplate): Promise<PbKeyData>;
/**
 * Generates a new key for the specified keyTemplate using the
 * KeyManager determined by typeUrl field of the keyTemplate.
 *
 *
 *
 * @return returns a key proto
 */
export declare function newKey(keyTemplate: PbKeyTemplate): Promise<PbMessage>;
/**
 * Convenience method for extracting the public key data from the private key
 * given by serializedPrivateKey.
 * It looks up a KeyManager identified by typeUrl, which must hold
 * PrivateKeyFactory, and calls getPublicKeyData method of that factory.
 *
 */
export declare function getPublicKeyData(typeUrl: string, serializedPrivateKey: Uint8Array): PbKeyData;
/**
 * Resets the registry.
 * After reset the registry is empty, i.e. it contains no key managers.
 *
 * This method is only for testing.
 */
export declare function reset(): void;
/**
 * Tries to register a primitive wrapper.
 */
export declare function registerPrimitiveWrapper<P>(wrapper: PrimitiveWrapper<P>): void;
/**
 * Wraps a PrimitiveSet and returns a single instance.
 */
export declare function wrap<P>(primitiveSet: PrimitiveSet.PrimitiveSet<P>): P;
