1 | /** Is `bignum` a negative number? */
|
2 | export declare const isNegative: (bignum: Uint8Array) => boolean;
|
3 | /** Negate `bignum` */
|
4 | export declare const negate: (bignum: Uint8Array) => void;
|
5 | /**
|
6 | * Convert an unsigned decimal number in `s` to a bignum
|
7 | *
|
8 | * @param size bignum size (bytes)
|
9 | */
|
10 | export declare const decimalToBinary: (size: number, s: string) => Uint8Array;
|
11 | /**
|
12 | * Convert a signed decimal number in `s` to a bignum
|
13 | *
|
14 | * @param size bignum size (bytes)
|
15 | */
|
16 | export declare const signedDecimalToBinary: (size: number, s: string) => Uint8Array;
|
17 | /**
|
18 | * Convert `bignum` to an unsigned decimal number
|
19 | *
|
20 | * @param minDigits 0-pad result to this many digits
|
21 | */
|
22 | export declare const binaryToDecimal: (bignum: Uint8Array, minDigits?: number) => string;
|
23 | /**
|
24 | * Convert `bignum` to a signed decimal number
|
25 | *
|
26 | * @param minDigits 0-pad result to this many digits
|
27 | */
|
28 | export declare const signedBinaryToDecimal: (bignum: Uint8Array, minDigits?: number) => string;
|
29 | /**
|
30 | * Convert an unsigned base-58 number in `s` to a bignum
|
31 | *
|
32 | * @param size bignum size (bytes)
|
33 | */
|
34 | export declare const base58ToBinary: (size: number, s: string) => Uint8Array;
|
35 | /**
|
36 | * Convert `bignum` to a base-58 number
|
37 | *
|
38 | * @param minDigits 0-pad result to this many digits
|
39 | */
|
40 | export declare const binaryToBase58: (bignum: Uint8Array, minDigits?: number) => string;
|
41 | /** Convert an unsigned base-64 number in `s` to a bignum */
|
42 | export declare const base64ToBinary: (s: string) => Uint8Array;
|
43 | /** Key types this library supports */
|
44 | export declare enum KeyType {
|
45 | k1 = 0,
|
46 | r1 = 1,
|
47 | wa = 2
|
48 | }
|
49 | /** Public key data size, excluding type field */
|
50 | export declare const publicKeyDataSize = 33;
|
51 | /** Private key data size, excluding type field */
|
52 | export declare const privateKeyDataSize = 32;
|
53 | /** Signature data size, excluding type field */
|
54 | export declare const signatureDataSize = 65;
|
55 | /** Public key, private key, or signature in binary form */
|
56 | export interface Key {
|
57 | type: KeyType;
|
58 | data: Uint8Array;
|
59 | }
|
60 | /** Convert key in `s` to binary form */
|
61 | export declare const stringToPublicKey: (s: string) => Key;
|
62 | /** Convert public `key` to legacy string (base-58) form */
|
63 | export declare const publicKeyToLegacyString: (key: Key) => string;
|
64 | /** Convert `key` to string (base-58) form */
|
65 | export declare const publicKeyToString: (key: Key) => string;
|
66 | /** If a key is in the legacy format (`EOS` prefix), then convert it to the new format (`PUB_K1_`).
|
67 | * Leaves other formats untouched
|
68 | */
|
69 | export declare const convertLegacyPublicKey: (s: string) => string;
|
70 | /** If a key is in the legacy format (`EOS` prefix), then convert it to the new format (`PUB_K1_`).
|
71 | * Leaves other formats untouched
|
72 | */
|
73 | export declare const convertLegacyPublicKeys: (keys: string[]) => string[];
|
74 | /** Convert key in `s` to binary form */
|
75 | export declare const stringToPrivateKey: (s: string) => Key;
|
76 | /** Convert private `key` to legacy string (base-58) form */
|
77 | export declare const privateKeyToLegacyString: (key: Key) => string;
|
78 | /** Convert `key` to string (base-58) form */
|
79 | export declare const privateKeyToString: (key: Key) => string;
|
80 | /** Convert key in `s` to binary form */
|
81 | export declare const stringToSignature: (s: string) => Key;
|
82 | /** Convert `signature` to string (base-58) form */
|
83 | export declare const signatureToString: (signature: Key) => string;
|