@libp2p/crypto
Version:
Crypto primitives for libp2p
48 lines • 1.67 kB
TypeScript
import type { Codec, DecodeOptions } from 'protons-runtime';
import type { Uint8ArrayList } from 'uint8arraylist';
export declare enum KeyType {
RSA = "RSA",
Ed25519 = "Ed25519",
secp256k1 = "secp256k1",
ECDSA = "ECDSA"
}
export declare namespace KeyType {
const codec: () => Codec<KeyType>;
}
export interface PublicKey {
Type?: KeyType;
Data?: Uint8Array;
}
export declare namespace PublicKey {
const codec: () => Codec<PublicKey>;
interface PublicKeyTypeFieldEvent {
field: '$.Type';
value: KeyType;
}
interface PublicKeyDataFieldEvent {
field: '$.Data';
value: Uint8Array;
}
function encode(obj: Partial<PublicKey>): Uint8Array;
function decode(buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<PublicKey>): PublicKey;
function stream(buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<PublicKey>): Generator<PublicKeyTypeFieldEvent | PublicKeyDataFieldEvent>;
}
export interface PrivateKey {
Type?: KeyType;
Data?: Uint8Array;
}
export declare namespace PrivateKey {
const codec: () => Codec<PrivateKey>;
interface PrivateKeyTypeFieldEvent {
field: '$.Type';
value: KeyType;
}
interface PrivateKeyDataFieldEvent {
field: '$.Data';
value: Uint8Array;
}
function encode(obj: Partial<PrivateKey>): Uint8Array;
function decode(buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<PrivateKey>): PrivateKey;
function stream(buf: Uint8Array | Uint8ArrayList, opts?: DecodeOptions<PrivateKey>): Generator<PrivateKeyTypeFieldEvent | PrivateKeyDataFieldEvent>;
}
//# sourceMappingURL=keys.d.ts.map