@guveno/wallet-sdk 1.0.0

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 (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +211 -0
  3. package/dist/api/client.d.ts +48 -0
  4. package/dist/api/client.d.ts.map +1 -0
  5. package/dist/api/client.js +563 -0
  6. package/dist/api/client.js.map +1 -0
  7. package/dist/api/types.d.ts +237 -0
  8. package/dist/api/types.d.ts.map +1 -0
  9. package/dist/api/types.js +9 -0
  10. package/dist/api/types.js.map +1 -0
  11. package/dist/chains.d.ts +25 -0
  12. package/dist/chains.d.ts.map +1 -0
  13. package/dist/chains.js +67 -0
  14. package/dist/chains.js.map +1 -0
  15. package/dist/constants.d.ts +17 -0
  16. package/dist/constants.d.ts.map +1 -0
  17. package/dist/constants.js +19 -0
  18. package/dist/constants.js.map +1 -0
  19. package/dist/crypto/sealed-box.d.ts +8 -0
  20. package/dist/crypto/sealed-box.d.ts.map +1 -0
  21. package/dist/crypto/sealed-box.js +66 -0
  22. package/dist/crypto/sealed-box.js.map +1 -0
  23. package/dist/derivation.d.ts +26 -0
  24. package/dist/derivation.d.ts.map +1 -0
  25. package/dist/derivation.js +121 -0
  26. package/dist/derivation.js.map +1 -0
  27. package/dist/errors.d.ts +81 -0
  28. package/dist/errors.d.ts.map +1 -0
  29. package/dist/errors.js +95 -0
  30. package/dist/errors.js.map +1 -0
  31. package/dist/hot-wallet.d.ts +57 -0
  32. package/dist/hot-wallet.d.ts.map +1 -0
  33. package/dist/hot-wallet.js +139 -0
  34. package/dist/hot-wallet.js.map +1 -0
  35. package/dist/index.d.ts +29 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +21 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/keyprovider/file-provider.d.ts +19 -0
  40. package/dist/keyprovider/file-provider.d.ts.map +1 -0
  41. package/dist/keyprovider/file-provider.js +48 -0
  42. package/dist/keyprovider/file-provider.js.map +1 -0
  43. package/dist/keyprovider/index.d.ts +13 -0
  44. package/dist/keyprovider/index.d.ts.map +1 -0
  45. package/dist/keyprovider/index.js +3 -0
  46. package/dist/keyprovider/index.js.map +1 -0
  47. package/dist/keyprovider/kms-provider.d.ts +26 -0
  48. package/dist/keyprovider/kms-provider.d.ts.map +1 -0
  49. package/dist/keyprovider/kms-provider.js +32 -0
  50. package/dist/keyprovider/kms-provider.js.map +1 -0
  51. package/dist/manager.d.ts +28 -0
  52. package/dist/manager.d.ts.map +1 -0
  53. package/dist/manager.js +499 -0
  54. package/dist/manager.js.map +1 -0
  55. package/dist/mnemonic.d.ts +13 -0
  56. package/dist/mnemonic.d.ts.map +1 -0
  57. package/dist/mnemonic.js +44 -0
  58. package/dist/mnemonic.js.map +1 -0
  59. package/dist/session/file-store.d.ts +10 -0
  60. package/dist/session/file-store.d.ts.map +1 -0
  61. package/dist/session/file-store.js +88 -0
  62. package/dist/session/file-store.js.map +1 -0
  63. package/dist/signing/sign-bitcoin.d.ts +14 -0
  64. package/dist/signing/sign-bitcoin.d.ts.map +1 -0
  65. package/dist/signing/sign-bitcoin.js +133 -0
  66. package/dist/signing/sign-bitcoin.js.map +1 -0
  67. package/dist/signing/sign-ethereum.d.ts +13 -0
  68. package/dist/signing/sign-ethereum.d.ts.map +1 -0
  69. package/dist/signing/sign-ethereum.js +49 -0
  70. package/dist/signing/sign-ethereum.js.map +1 -0
  71. package/dist/signing/sign-polkadot.d.ts +9 -0
  72. package/dist/signing/sign-polkadot.d.ts.map +1 -0
  73. package/dist/signing/sign-polkadot.js +79 -0
  74. package/dist/signing/sign-polkadot.js.map +1 -0
  75. package/dist/signing/sign-withdrawal.d.ts +21 -0
  76. package/dist/signing/sign-withdrawal.d.ts.map +1 -0
  77. package/dist/signing/sign-withdrawal.js +35 -0
  78. package/dist/signing/sign-withdrawal.js.map +1 -0
  79. package/dist/signing/sign-xrp.d.ts +7 -0
  80. package/dist/signing/sign-xrp.d.ts.map +1 -0
  81. package/dist/signing/sign-xrp.js +27 -0
  82. package/dist/signing/sign-xrp.js.map +1 -0
  83. package/dist/signing/types.d.ts +84 -0
  84. package/dist/signing/types.d.ts.map +1 -0
  85. package/dist/signing/types.js +15 -0
  86. package/dist/signing/types.js.map +1 -0
  87. package/dist/storage/crypto.d.ts +7 -0
  88. package/dist/storage/crypto.d.ts.map +1 -0
  89. package/dist/storage/crypto.js +80 -0
  90. package/dist/storage/crypto.js.map +1 -0
  91. package/dist/storage/file-store.d.ts +21 -0
  92. package/dist/storage/file-store.d.ts.map +1 -0
  93. package/dist/storage/file-store.js +219 -0
  94. package/dist/storage/file-store.js.map +1 -0
  95. package/dist/types.d.ts +187 -0
  96. package/dist/types.d.ts.map +1 -0
  97. package/dist/types.js +2 -0
  98. package/dist/types.js.map +1 -0
  99. package/docs/security.md +119 -0
  100. package/package.json +76 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,119 @@
1
+ # Security Considerations
2
+
3
+ ## Storage Model
4
+
5
+ The SDK separates local state into:
6
+
7
+ - `metadata.json`: non-sensitive `keys`, `wallets`, and `addresses`
8
+ - `secrets.json`: encrypted key material only
9
+ - `auth-session.json`: saved CLI bearer token plus API session metadata
10
+
11
+ This separation reduces accidental exposure of secret material, but it is not a substitute for a hardware wallet, HSM, or dedicated secret manager.
12
+
13
+ ## Encryption Model
14
+
15
+ New wallet creation and import flows always encrypt secret material before persistence.
16
+
17
+ Current scheme:
18
+
19
+ - KDF: `scrypt`
20
+ - Cipher: `aes-256-gcm`
21
+ - Protected value: mnemonic only
22
+
23
+ The encryption password is provided in the SDK or CLI by the user. The backend does not encrypt on the user’s behalf.
24
+
25
+ ## Multi-Chain Model
26
+
27
+ Each wallet group is bound to exactly one chain:
28
+
29
+ - `ethereum`
30
+ - `bitcoin`
31
+ - `xrp`
32
+
33
+ The same mnemonic can back multiple wallet groups across different chains, but each group derives addresses only for its own chain-specific path family.
34
+
35
+ Internally, the SDK stores:
36
+
37
+ - one local `key` per mnemonic fingerprint
38
+ - one local `wallet` per chain-specific wallet group
39
+ - one local `address` row per derived account
40
+
41
+ ## Server Persistence Contract
42
+
43
+ When exporting a wallet for backend storage, the SDK sends:
44
+
45
+ - `groupName`
46
+ - `chain`
47
+ - `keyFingerprint`
48
+ - `metadataJson`
49
+ - `secretsJson`
50
+ - `addresses`
51
+
52
+ `metadataJson` contains non-sensitive key, wallet, and address metadata.
53
+
54
+ `secretsJson` is an encrypted blob generated by the SDK. The backend stores it as received and should not require plaintext mnemonic access for routine storage.
55
+
56
+ On the backend, the encrypted blob belongs to a `key` record. The uploaded wallet structure and derived addresses are stored separately so the server can index addresses without decrypting the underlying seed material.
57
+
58
+ ## Persisted vs Not Persisted
59
+
60
+ Persisted:
61
+
62
+ - mnemonic fingerprint
63
+ - encrypted mnemonic payload
64
+ - wallet group metadata
65
+ - chain identifier
66
+ - derived addresses
67
+ - labels
68
+ - timestamps
69
+
70
+ Not persisted:
71
+
72
+ - standalone private keys
73
+ - RPC or network state
74
+ - plaintext mnemonic material on the server
75
+
76
+ Private keys are derived on demand from the mnemonic rather than stored separately.
77
+
78
+ ## CLI Safety Tradeoffs
79
+
80
+ Safer options:
81
+
82
+ - `--mnemonic-file` instead of `--mnemonic`
83
+ - `--password-env` instead of `--password`
84
+ - interactive password prompts instead of inline password flags
85
+ - no mnemonic output unless `--reveal-mnemonic` is explicitly requested
86
+
87
+ Less safe options:
88
+
89
+ - passing mnemonics or passwords directly on the command line
90
+ - storing `auth-session.json` in insecure locations
91
+ - exporting wallet JSON to insecure locations
92
+ - reusing weak encryption passwords
93
+
94
+ ## Duplicate Mnemonic Handling
95
+
96
+ If the same mnemonic is imported again for the same chain, the SDK:
97
+
98
+ - finds the existing wallet group by mnemonic fingerprint and chain
99
+ - reuses that group
100
+ - derives the next account index from the same seed
101
+
102
+ If the same mnemonic is imported for a different chain, the SDK creates a separate wallet group because the derivation path family is different.
103
+
104
+ That second wallet group reuses the same local `key` record and encrypted secret material instead of storing a duplicate encrypted mnemonic blob.
105
+
106
+ When those groups are uploaded to the backend for the same user, the shared mnemonic fingerprint lets the server reuse one `key` row while keeping separate `wallet` and `address` rows per chain.
107
+
108
+ ## Operational Limits
109
+
110
+ This SDK is for local wallet management and encrypted wallet-record transport.
111
+
112
+ It is not intended to replace:
113
+
114
+ - a hardware wallet
115
+ - an HSM
116
+ - an enterprise secret manager
117
+ - multi-party custody controls
118
+
119
+ The file store uses atomic replacement plus a lock file, but large-scale concurrent writers are outside the intended operating model.
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@guveno/wallet-sdk",
3
+ "version": "1.0.0",
4
+ "description": "Add secure crypto custody to your app in minutes — create and manage multi-chain wallets, automate withdrawals, and receive real-time webhooks for Bitcoin, Ethereum, XRP, and Polkadot. Built for exchanges, fintechs, and platforms.",
5
+ "author": "Guveno LLC",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "keywords": [
17
+ "guveno",
18
+ "wallet",
19
+ "sdk",
20
+ "hd-wallet",
21
+ "bip39",
22
+ "ethereum",
23
+ "bitcoin",
24
+ "xrp",
25
+ "polkadot",
26
+ "crypto",
27
+ "custody"
28
+ ],
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/hollaex/guveno-sdk.git"
32
+ },
33
+ "homepage": "https://github.com/hollaex/guveno-sdk#readme",
34
+ "bugs": {
35
+ "url": "https://github.com/hollaex/guveno-sdk/issues"
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "README.md",
40
+ "docs",
41
+ "LICENSE"
42
+ ],
43
+ "engines": {
44
+ "node": ">=20.0.0"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public"
48
+ },
49
+ "scripts": {
50
+ "build": "tsc -p tsconfig.json",
51
+ "clean": "rm -rf dist coverage .vitest-temp",
52
+ "lint": "tsc --noEmit",
53
+ "test": "vitest run",
54
+ "test:watch": "vitest",
55
+ "prepublishOnly": "npm run clean && npm run build"
56
+ },
57
+ "dependencies": {
58
+ "@polkadot/keyring": "^13.5.1",
59
+ "@polkadot/util": "^13.5.1",
60
+ "@polkadot/util-crypto": "^13.5.1",
61
+ "@scure/bip39": "^2.0.1",
62
+ "@substrate/txwrapper-polkadot": "^7.5.3",
63
+ "bip32": "^5.0.0",
64
+ "bitcoinjs-lib": "^7.0.0",
65
+ "ethers": "^6.16.0",
66
+ "tiny-secp256k1": "^2.2.4",
67
+ "xrpl": "^4.6.0",
68
+ "zod": "^4.3.6"
69
+ },
70
+ "devDependencies": {
71
+ "@types/node": "^25.6.0",
72
+ "tsx": "^4.21.0",
73
+ "typescript": "^6.0.2",
74
+ "vitest": "^4.1.4"
75
+ }
76
+ }