UNPKG

@tiplink/api

Version:

Api for creating and sending TipLinks

20 lines (19 loc) 1.3 kB
import type { Keypair } from "@solana/web3.js"; import nacl from "tweetnacl"; import { decodeUTF8, encodeUTF8 } from "tweetnacl-util"; export declare const DEFAULT_TIPLINK_KEYLENGTH = 12; export declare const generateRandomSalt: () => string; export declare const generateKey: () => Promise<string>; export declare const encrypt: (data: string, key: string, salt: string) => Promise<string>; export declare const decrypt: (data: string, key: string, salt: string) => Promise<string>; export declare const generatePublicPrivateKey: () => Promise<{ publicKey: string; privateKey: string; }>; export declare const encryptPublicKey: (data: string, publicKey: string) => Promise<string>; export declare const decryptPrivateKey: (data: string, privateKey: string) => Promise<string>; export declare const generateNonce: () => Promise<string>; export declare const encryptMessage: (keypair: Keypair, nonce: string, message: string) => Promise<Uint8Array>; export declare const decryptMessage: (keypair: Keypair, nonce: string, encryptedMessage: string) => Promise<string>; export declare const decryptDataUsingDH: (dataToDecrypt: Uint8Array | string, nonce: Uint8Array | string, senderEncryptionPubKey: Uint8Array | string, encryptionKeypair: nacl.BoxKeyPair) => any; export { decodeUTF8, encodeUTF8 };