wallaby-cash 1.7.10 → 1.7.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/eth-crypto-utils/createIdentity.d.ts +16 -0
  2. package/dist/eth-crypto-utils/decryptWithPrivateKey.d.ts +2 -0
  3. package/dist/eth-crypto-utils/encryptWithPublicKey.d.ts +2 -0
  4. package/dist/eth-crypto-utils/encryption-utils.d.ts +18 -0
  5. package/dist/eth-crypto-utils/hash.d.ts +1 -0
  6. package/dist/eth-crypto-utils/index.d.ts +27 -0
  7. package/dist/eth-crypto-utils/publicKeyByPrivateKey.d.ts +7 -0
  8. package/dist/eth-crypto-utils/recoverPublicKey.d.ts +7 -0
  9. package/dist/eth-crypto-utils/sign.d.ts +8 -0
  10. package/dist/eth-crypto-utils/util.d.ts +37 -0
  11. package/dist/index.cjs.js +3751 -52
  12. package/dist/index.cjs.js.map +1 -1
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.esm.js +3723 -32
  15. package/dist/index.esm.js.map +1 -1
  16. package/dist/index.js +3723 -32
  17. package/dist/index.js.map +1 -1
  18. package/dist/lib/utils/index.d.ts +2 -7
  19. package/dist/types/common.d.ts +4 -0
  20. package/dist/types/wallet.d.ts +1 -1
  21. package/package.json +14 -8
  22. package/dist/documentation/auth.doc.d.ts +0 -58
  23. package/dist/documentation/merchants.doc.d.ts +0 -59
  24. package/dist/documentation/system.doc.d.ts +0 -77
  25. package/dist/documentation/transactions.doc.d.ts +0 -80
  26. package/dist/documentation/wallet.doc.d.ts +0 -173
  27. package/dist/tests/__mocks__/localStorageMock.d.ts +0 -10
  28. package/dist/tests/auth.spec.d.ts +0 -1
  29. package/dist/tests/create-identity.spec.d.ts +0 -1
  30. package/dist/tests/data/auth.d.ts +0 -11
  31. package/dist/tests/data/config.d.ts +0 -2
  32. package/dist/tests/data/constants.d.ts +0 -5
  33. package/dist/tests/data/index.d.ts +0 -5
  34. package/dist/tests/data/merchants.d.ts +0 -8
  35. package/dist/tests/data/system.d.ts +0 -47
  36. package/dist/tests/data/user.d.ts +0 -22
  37. package/dist/tests/encryption.spec.d.ts +0 -1
  38. package/dist/tests/hash.spec.d.ts +0 -1
  39. package/dist/tests/helpers.spec.d.ts +0 -1
  40. package/dist/tests/is-jwt-expired.spec.d.ts +0 -1
  41. package/dist/tests/merchants.spec.d.ts +0 -1
  42. package/dist/tests/object-to-params.spec.d.ts +0 -1
  43. package/dist/tests/public-key-by-private-key.spec.d.ts +0 -1
  44. package/dist/tests/recovery.spec.d.ts +0 -1
  45. package/dist/tests/sanitize-sui-object-id.spec.d.ts +0 -1
  46. package/dist/tests/sign.spec.d.ts +0 -1
  47. package/dist/tests/system.spec.d.ts +0 -1
  48. package/dist/tests/utils.spec.d.ts +0 -1
  49. package/dist/tests/wallet.spec.d.ts +0 -1
@@ -0,0 +1,16 @@
1
+ export declare const DEFAULT_ENTROPY_BYTES = 32;
2
+ /**
3
+ * creates a new private key
4
+ * @param { Uint8Array } entropy - optional entropy to create the private key
5
+ * @returns a new private key
6
+ */
7
+ export declare const createPrivateKey: (entropy?: Uint8Array) => string;
8
+ /**
9
+ * creates a new identity
10
+ * @param { Uint8Array } entropy - optional entropy to create the private key
11
+ * @returns a new pair of private and public key
12
+ */
13
+ export declare const createIdentity: (entropy?: Uint8Array) => {
14
+ privateKey: string;
15
+ publicKey: string;
16
+ };
@@ -0,0 +1,2 @@
1
+ import { Encrypted } from '../types';
2
+ export declare const decryptWithPrivateKey: (privateKey: string, encrypted: Encrypted) => string;
@@ -0,0 +1,2 @@
1
+ import { EncryptionOptions } from '../types';
2
+ export declare const encryptWithPublicKey: (publicKey: string, message: string, options?: EncryptionOptions) => import("../types").Encrypted;
@@ -0,0 +1,18 @@
1
+ import { Encrypted, EncryptionOptions } from '../types';
2
+ /**
3
+ * See https://github.com/bitchan/eccrypto for the original implementation that eth-crypto used, it's ancient and not maintained.
4
+ */
5
+ /**
6
+ * Encrypts a message using the recipient's public key.
7
+ * @param {string} publicKeyTo - The recipient's public key.
8
+ * @param {string} msg - The message to encrypt.
9
+ * @returns {Encrypted} The encrypted message.
10
+ */
11
+ export declare const encrypt: (publicKeyTo: string, msg: string, options?: EncryptionOptions) => Encrypted;
12
+ /**
13
+ * Decrypts an encrypted message using the recipient's private key.
14
+ * @param {string} privateKey - The recipient's private key.
15
+ * @param {Encrypted} opts - The encrypted message.
16
+ * @returns {string} The decrypted message.
17
+ */
18
+ export declare const decrypt: (privateKey: string, opts: Encrypted) => string;
@@ -0,0 +1 @@
1
+ export declare const keccak256: (params: string) => string;
@@ -0,0 +1,27 @@
1
+ import { createIdentity } from './createIdentity';
2
+ import { sign } from './sign';
3
+ import { encryptWithPublicKey } from './encryptWithPublicKey';
4
+ import { decryptWithPrivateKey } from './decryptWithPrivateKey';
5
+ import { keccak256 } from './hash';
6
+ import { publicKeyByPrivateKey } from './publicKeyByPrivateKey';
7
+ import { recoverPublicKey } from './recoverPublicKey';
8
+ declare const hash: {
9
+ keccak256: (params: string) => string;
10
+ };
11
+ export { createIdentity, decryptWithPrivateKey, encryptWithPublicKey, hash, keccak256, publicKeyByPrivateKey, recoverPublicKey, sign, };
12
+ declare const _default: {
13
+ createIdentity: (entropy?: Uint8Array) => {
14
+ privateKey: string;
15
+ publicKey: string;
16
+ };
17
+ decryptWithPrivateKey: (privateKey: string, encrypted: import("..").Encrypted) => string;
18
+ encryptWithPublicKey: (publicKey: string, message: string, options?: import("..").EncryptionOptions) => import("..").Encrypted;
19
+ hash: {
20
+ keccak256: (params: string) => string;
21
+ };
22
+ keccak256: (params: string) => string;
23
+ publicKeyByPrivateKey: (privateKey: string) => string;
24
+ recoverPublicKey: (signature: string, hash: string) => string;
25
+ sign: (privateKey: string, hash: string) => string;
26
+ };
27
+ export default _default;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Generate publicKey from the privateKey.
3
+ * This creates the uncompressed publicKey,
4
+ * where 04 has stripped from left
5
+ * @returns {string}
6
+ */
7
+ export declare const publicKeyByPrivateKey: (privateKey: string) => string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * returns the publicKey for the privateKey with which the messageHash was signed
3
+ * @param {string} signature
4
+ * @param {string} hash
5
+ * @return {string} publicKey
6
+ */
7
+ export declare const recoverPublicKey: (signature: string, hash: string) => string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * signs the given message
3
+ * @param {string} privateKey
4
+ * @param {string} hash
5
+ * @return {string} hexString
6
+ */
7
+ export declare const sign: (privateKey: string, hash: string) => string;
8
+ export declare const hmacSha256Sign: (key: Uint8Array, msg: Uint8Array) => Uint8Array;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Returns a `Boolean` on whether or not the a `String` starts with '0x'
3
+ * @param str the string input value
4
+ * @return a boolean if it is or is not hex prefixed
5
+ * @throws if the str input is not a string
6
+ */
7
+ export declare const isHexPrefixed: (str: string) => boolean;
8
+ /**
9
+ * Removes '0x' from a given `String` if present
10
+ * @param str the string value
11
+ * @returns the string without 0x prefix
12
+ */
13
+ export declare const stripHexPrefix: (str: string) => string;
14
+ /**
15
+ * Is the string a hex string.
16
+ *
17
+ * @param value
18
+ * @param length
19
+ * @returns output the string is a hex string
20
+ */
21
+ export declare const isHexString: (value: string, length?: number) => boolean;
22
+ /**
23
+ * Adds '0x' to a given `String` if not present
24
+ * @param str the string input value
25
+ * @return the string with a 0x prefix
26
+ */
27
+ export declare const addLeading0x: (str: string) => string;
28
+ export declare const decompress: (startsWith02Or03: string) => string;
29
+ /** Helper function to concat UInt8Arrays mimicking the behaviour of the
30
+ * Buffer.concat function in Node.js
31
+ */
32
+ export declare const concatUint8Arrays: (uint8arrays: Uint8Array[]) => Uint8Array;
33
+ /**
34
+ * Converts a UTF-8 string to a Uint8Array without using TextEncoder, which is not available in mobile
35
+ * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
36
+ */
37
+ export declare const utf8ToBytes: (str: string) => Uint8Array;