/** * Copyright 2023 Fluence Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { PeerId } from "@libp2p/interface"; import { KeyPairOptions } from "../clientPeer/types.js"; export declare class KeyPair { private privateKey; private libp2pPeerId; private publicKey; private constructor(); /** * Key pair in libp2p format. Used for backward compatibility with the current FluencePeer implementation */ getLibp2pPeerId(): PeerId; /** * Return public key inferred from private key */ getPublicKey(): Uint8Array; /** * Generates new KeyPair from ed25519 private key represented as a 32 byte array * @param seed - Any sequence of 32 bytes * @returns - Promise with the created KeyPair */ static fromEd25519SK(seed: Uint8Array): Promise; /** * Generates new KeyPair with a random secret key * @returns - Promise with the created KeyPair */ static randomEd25519(): Promise; static verifyWithPublicKey(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean | Promise; getPeerId(): string; /** * @returns 32 byte private key */ toEd25519PrivateKey(): Uint8Array; signBytes(data: Uint8Array): Promise; verify(data: Uint8Array, signature: Uint8Array): Promise; } export declare const fromBase64Sk: (sk: string) => Promise; export declare const fromBase58Sk: (sk: string) => Promise; export declare const fromOpts: (opts: KeyPairOptions) => Promise;