react-native-quick-crypto
Version:
A fast implementation of Node's `crypto` module written in C/C++ JSI
95 lines • 3.46 kB
TypeScript
import { Buffer } from '@craftzdog/react-native-buffer';
import type { AsymmetricKeyType, EncodingOptions, JWK, KeyDetail, KeyObjectHandle, KeyUsage, SubtleAlgorithm } from '../utils';
import { KFormatType, KeyEncoding } from '../utils';
export declare class CryptoKey {
keyObject: KeyObject;
keyAlgorithm: SubtleAlgorithm;
keyUsages: KeyUsage[];
keyExtractable: boolean;
get [Symbol.toStringTag](): string;
constructor(keyObject: KeyObject, keyAlgorithm: SubtleAlgorithm, keyUsages: KeyUsage[], keyExtractable: boolean);
inspect(_depth: number, _options: unknown): unknown;
get type(): "public" | "secret" | "private";
get extractable(): boolean;
get algorithm(): SubtleAlgorithm;
get usages(): KeyUsage[];
}
export declare class KeyObject {
handle: KeyObjectHandle;
type: 'public' | 'secret' | 'private';
get [Symbol.toStringTag](): string;
export(options: {
format: 'pem';
} & EncodingOptions): string | Buffer;
export(options?: {
format: 'der';
} & EncodingOptions): Buffer;
export(options?: {
format: 'jwk';
} & EncodingOptions): JWK;
export(options?: EncodingOptions): string | Buffer | JWK;
equals(otherKeyObject: KeyObject): boolean;
constructor(type: string, handle: KeyObjectHandle);
constructor(type: string, key: ArrayBuffer);
static from(key: CryptoKey): KeyObject;
toCryptoKey(algorithm: SubtleAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): CryptoKey;
static createKeyObject(type: string, key: ArrayBuffer, format?: KFormatType, encoding?: KeyEncoding, passphrase?: ArrayBuffer): KeyObject;
getAsymmetricKeyType(): undefined;
getAsymmetricKeyDetails(): undefined;
}
export declare class SecretKeyObject extends KeyObject {
constructor(handle: KeyObjectHandle);
get symmetricKeySize(): number;
export(options: {
format: 'pem';
} & EncodingOptions): never;
export(options: {
format: 'der';
} & EncodingOptions): Buffer;
export(options: {
format: 'jwk';
} & EncodingOptions): never;
export(options?: EncodingOptions): Buffer;
}
export declare class AsymmetricKeyObject extends KeyObject {
constructor(type: string, handle: KeyObjectHandle);
private _asymmetricKeyType?;
get asymmetricKeyType(): AsymmetricKeyType;
private _asymmetricKeyDetails?;
get asymmetricKeyDetails(): KeyDetail;
get namedCurve(): string | undefined;
}
export declare class PublicKeyObject extends AsymmetricKeyObject {
constructor(handle: KeyObjectHandle);
export(options: {
format: 'pem';
} & EncodingOptions): string;
export(options: {
format: 'der';
} & EncodingOptions): Buffer;
export(options: {
format: 'jwk';
} & EncodingOptions): JWK;
export(options: {
format: 'raw-public';
} & EncodingOptions): Buffer;
}
export declare class PrivateKeyObject extends AsymmetricKeyObject {
constructor(handle: KeyObjectHandle);
export(options: {
format: 'pem';
} & EncodingOptions): string;
export(options: {
format: 'der';
} & EncodingOptions): Buffer;
export(options: {
format: 'jwk';
} & EncodingOptions): JWK;
export(options: {
format: 'raw-private';
} & EncodingOptions): Buffer;
export(options: {
format: 'raw-seed';
} & EncodingOptions): Buffer;
}
//# sourceMappingURL=classes.d.ts.map