zeldwallet 0.1.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.
- package/README.md +305 -0
- package/dist/index.d.ts +6 -0
- package/dist/src/ZeldWallet.d.ts +254 -0
- package/dist/src/ZeldWallet.d.ts.map +1 -0
- package/dist/src/component/ZeldWalletUI.d.ts +56 -0
- package/dist/src/component/ZeldWalletUI.d.ts.map +1 -0
- package/dist/src/component/balance.d.ts +41 -0
- package/dist/src/component/balance.d.ts.map +1 -0
- package/dist/src/component/bindings.d.ts +76 -0
- package/dist/src/component/bindings.d.ts.map +1 -0
- package/dist/src/component/constants.d.ts +15 -0
- package/dist/src/component/constants.d.ts.map +1 -0
- package/dist/src/component/controller.d.ts +224 -0
- package/dist/src/component/controller.d.ts.map +1 -0
- package/dist/src/component/errors.d.ts +5 -0
- package/dist/src/component/errors.d.ts.map +1 -0
- package/dist/src/component/i18n.d.ts +156 -0
- package/dist/src/component/i18n.d.ts.map +1 -0
- package/dist/src/component/messages/ar.d.ts +3 -0
- package/dist/src/component/messages/ar.d.ts.map +1 -0
- package/dist/src/component/messages/bn.d.ts +3 -0
- package/dist/src/component/messages/bn.d.ts.map +1 -0
- package/dist/src/component/messages/cs.d.ts +3 -0
- package/dist/src/component/messages/cs.d.ts.map +1 -0
- package/dist/src/component/messages/de.d.ts +3 -0
- package/dist/src/component/messages/de.d.ts.map +1 -0
- package/dist/src/component/messages/el.d.ts +3 -0
- package/dist/src/component/messages/el.d.ts.map +1 -0
- package/dist/src/component/messages/en.d.ts +3 -0
- package/dist/src/component/messages/en.d.ts.map +1 -0
- package/dist/src/component/messages/es.d.ts +3 -0
- package/dist/src/component/messages/es.d.ts.map +1 -0
- package/dist/src/component/messages/fa.d.ts +3 -0
- package/dist/src/component/messages/fa.d.ts.map +1 -0
- package/dist/src/component/messages/fr.d.ts +3 -0
- package/dist/src/component/messages/fr.d.ts.map +1 -0
- package/dist/src/component/messages/he.d.ts +3 -0
- package/dist/src/component/messages/he.d.ts.map +1 -0
- package/dist/src/component/messages/hi.d.ts +3 -0
- package/dist/src/component/messages/hi.d.ts.map +1 -0
- package/dist/src/component/messages/id.d.ts +3 -0
- package/dist/src/component/messages/id.d.ts.map +1 -0
- package/dist/src/component/messages/index.d.ts +31 -0
- package/dist/src/component/messages/index.d.ts.map +1 -0
- package/dist/src/component/messages/it.d.ts +3 -0
- package/dist/src/component/messages/it.d.ts.map +1 -0
- package/dist/src/component/messages/ja.d.ts +3 -0
- package/dist/src/component/messages/ja.d.ts.map +1 -0
- package/dist/src/component/messages/ko.d.ts +3 -0
- package/dist/src/component/messages/ko.d.ts.map +1 -0
- package/dist/src/component/messages/ms.d.ts +3 -0
- package/dist/src/component/messages/ms.d.ts.map +1 -0
- package/dist/src/component/messages/nl.d.ts +3 -0
- package/dist/src/component/messages/nl.d.ts.map +1 -0
- package/dist/src/component/messages/pl.d.ts +3 -0
- package/dist/src/component/messages/pl.d.ts.map +1 -0
- package/dist/src/component/messages/pt.d.ts +3 -0
- package/dist/src/component/messages/pt.d.ts.map +1 -0
- package/dist/src/component/messages/ro.d.ts +3 -0
- package/dist/src/component/messages/ro.d.ts.map +1 -0
- package/dist/src/component/messages/ru.d.ts +3 -0
- package/dist/src/component/messages/ru.d.ts.map +1 -0
- package/dist/src/component/messages/sw.d.ts +3 -0
- package/dist/src/component/messages/sw.d.ts.map +1 -0
- package/dist/src/component/messages/th.d.ts +3 -0
- package/dist/src/component/messages/th.d.ts.map +1 -0
- package/dist/src/component/messages/tl.d.ts +3 -0
- package/dist/src/component/messages/tl.d.ts.map +1 -0
- package/dist/src/component/messages/tr.d.ts +3 -0
- package/dist/src/component/messages/tr.d.ts.map +1 -0
- package/dist/src/component/messages/uk.d.ts +3 -0
- package/dist/src/component/messages/uk.d.ts.map +1 -0
- package/dist/src/component/messages/ur.d.ts +3 -0
- package/dist/src/component/messages/ur.d.ts.map +1 -0
- package/dist/src/component/messages/vi.d.ts +3 -0
- package/dist/src/component/messages/vi.d.ts.map +1 -0
- package/dist/src/component/messages/zh-CN.d.ts +3 -0
- package/dist/src/component/messages/zh-CN.d.ts.map +1 -0
- package/dist/src/component/messages/zh-TW.d.ts +3 -0
- package/dist/src/component/messages/zh-TW.d.ts.map +1 -0
- package/dist/src/component/miner.d.ts +108 -0
- package/dist/src/component/miner.d.ts.map +1 -0
- package/dist/src/component/render.d.ts +11 -0
- package/dist/src/component/render.d.ts.map +1 -0
- package/dist/src/component/state.d.ts +142 -0
- package/dist/src/component/state.d.ts.map +1 -0
- package/dist/src/component/styles.d.ts +2 -0
- package/dist/src/component/styles.d.ts.map +1 -0
- package/dist/src/component/viewModel.d.ts +281 -0
- package/dist/src/component/viewModel.d.ts.map +1 -0
- package/dist/src/component/wallets.d.ts +40 -0
- package/dist/src/component/wallets.d.ts.map +1 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/keys/KeyManager.d.ts +132 -0
- package/dist/src/keys/KeyManager.d.ts.map +1 -0
- package/dist/src/keys/derivation.d.ts +58 -0
- package/dist/src/keys/derivation.d.ts.map +1 -0
- package/dist/src/keys/signing.d.ts +44 -0
- package/dist/src/keys/signing.d.ts.map +1 -0
- package/dist/src/provider/WBIPProvider.d.ts +74 -0
- package/dist/src/provider/WBIPProvider.d.ts.map +1 -0
- package/dist/src/react/ZeldWalletCard.d.ts +29 -0
- package/dist/src/react/ZeldWalletCard.d.ts.map +1 -0
- package/dist/src/react/index.d.ts +3 -0
- package/dist/src/react/index.d.ts.map +1 -0
- package/dist/src/react/useZeldWalletController.d.ts +28 -0
- package/dist/src/react/useZeldWalletController.d.ts.map +1 -0
- package/dist/src/storage/SecureStorage.d.ts +183 -0
- package/dist/src/storage/SecureStorage.d.ts.map +1 -0
- package/dist/src/storage/constants.d.ts +59 -0
- package/dist/src/storage/constants.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +245 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/ui/Modal.d.ts +19 -0
- package/dist/src/ui/Modal.d.ts.map +1 -0
- package/dist/src/unifiedWallet.d.ts +29 -0
- package/dist/src/unifiedWallet.d.ts.map +1 -0
- package/dist/src/utils/crypto.d.ts +36 -0
- package/dist/src/utils/crypto.d.ts.map +1 -0
- package/dist/src/utils/encoding.d.ts +46 -0
- package/dist/src/utils/encoding.d.ts.map +1 -0
- package/dist/src/utils/validation.d.ts +42 -0
- package/dist/src/utils/validation.d.ts.map +1 -0
- package/dist/wasm/package.json +31 -0
- package/dist/wasm/zeldhash_miner_wasm.d.ts +82 -0
- package/dist/wasm/zeldhash_miner_wasm.js +1404 -0
- package/dist/wasm/zeldhash_miner_wasm_bg.wasm +0 -0
- package/dist/wasm/zeldhash_miner_wasm_bg.wasm.d.ts +27 -0
- package/dist/worker.js +338 -0
- package/dist/zeldwallet.es.js +36558 -0
- package/dist/zeldwallet.es.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { AddressType, AddressPurpose, NetworkType } from '../types';
|
|
2
|
+
/** Derivation path templates for different address types */
|
|
3
|
+
export declare const DERIVATION_PATHS: {
|
|
4
|
+
/** BIP44 - Legacy P2PKH (m/44'/0'/account'/change/index) */
|
|
5
|
+
readonly legacy: "m/44'/0'/0'";
|
|
6
|
+
/** BIP49 - Nested SegWit P2SH-P2WPKH (m/49'/0'/account'/change/index) */
|
|
7
|
+
readonly nestedSegwit: "m/49'/0'/0'";
|
|
8
|
+
/** BIP84 - Native SegWit P2WPKH (m/84'/0'/account'/change/index) */
|
|
9
|
+
readonly nativeSegwit: "m/84'/0'/0'";
|
|
10
|
+
/** BIP86 - Taproot P2TR (m/86'/0'/account'/change/index) */
|
|
11
|
+
readonly taproot: "m/86'/0'/0'";
|
|
12
|
+
};
|
|
13
|
+
/** Testnet derivation paths (coin type 1) */
|
|
14
|
+
export declare const TESTNET_DERIVATION_PATHS: {
|
|
15
|
+
readonly legacy: "m/44'/1'/0'";
|
|
16
|
+
readonly nestedSegwit: "m/49'/1'/0'";
|
|
17
|
+
readonly nativeSegwit: "m/84'/1'/0'";
|
|
18
|
+
readonly taproot: "m/86'/1'/0'";
|
|
19
|
+
};
|
|
20
|
+
export type DerivationPathType = keyof typeof DERIVATION_PATHS;
|
|
21
|
+
/** Type for derivation path maps */
|
|
22
|
+
export type DerivationPathMap = {
|
|
23
|
+
readonly legacy: string;
|
|
24
|
+
readonly nestedSegwit: string;
|
|
25
|
+
readonly nativeSegwit: string;
|
|
26
|
+
readonly taproot: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Get derivation paths for the specified network
|
|
30
|
+
*/
|
|
31
|
+
export declare function getDerivationPaths(network: NetworkType): DerivationPathMap;
|
|
32
|
+
/**
|
|
33
|
+
* Map address type to derivation path type
|
|
34
|
+
*/
|
|
35
|
+
export declare function addressTypeToPathType(addressType: AddressType): DerivationPathType;
|
|
36
|
+
/**
|
|
37
|
+
* Map derivation path type to address type
|
|
38
|
+
*/
|
|
39
|
+
export declare function pathTypeToAddressType(pathType: DerivationPathType): AddressType;
|
|
40
|
+
/**
|
|
41
|
+
* Get the address type to use for a given purpose
|
|
42
|
+
*/
|
|
43
|
+
export declare function purposeToAddressType(purpose: AddressPurpose): AddressType;
|
|
44
|
+
/**
|
|
45
|
+
* Build a full derivation path
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildDerivationPath(pathType: DerivationPathType, network: NetworkType, account?: number, change?: 0 | 1, index?: number): string;
|
|
48
|
+
/**
|
|
49
|
+
* Parse a derivation path string
|
|
50
|
+
*/
|
|
51
|
+
export declare function parseDerivationPath(path: string): {
|
|
52
|
+
purpose: number;
|
|
53
|
+
coinType: number;
|
|
54
|
+
account: number;
|
|
55
|
+
change: number;
|
|
56
|
+
index: number;
|
|
57
|
+
} | null;
|
|
58
|
+
//# sourceMappingURL=derivation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivation.d.ts","sourceRoot":"","s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AAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,IAAI,CAaP"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signing Utilities
|
|
3
|
+
*
|
|
4
|
+
* Message and transaction signing functions.
|
|
5
|
+
*/
|
|
6
|
+
import * as bitcoin from 'bitcoinjs-lib';
|
|
7
|
+
type SchnorrLike = {
|
|
8
|
+
sign: (msg: Uint8Array, priv: Uint8Array) => Promise<Uint8Array> | Uint8Array;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Create the message hash for Bitcoin message signing
|
|
12
|
+
*/
|
|
13
|
+
export declare function createMessageHash(message: string): Uint8Array;
|
|
14
|
+
/**
|
|
15
|
+
* Sign a message with ECDSA and return a recoverable signature
|
|
16
|
+
* @param messageHash - The hash of the message to sign
|
|
17
|
+
* @param privateKey - The private key to sign with
|
|
18
|
+
* @returns Base64-encoded signature
|
|
19
|
+
*/
|
|
20
|
+
export declare function signMessageEcdsa(messageHash: Uint8Array, privateKey: Uint8Array): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Verify an ECDSA signature
|
|
23
|
+
*/
|
|
24
|
+
export declare function verifyMessageEcdsa(messageHash: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Sign a message using a BIP-322-style hash (simple mode)
|
|
27
|
+
* Uses Schnorr for Taproot-friendly signatures (still a simplified flow).
|
|
28
|
+
*/
|
|
29
|
+
export declare function signMessageBip322Simple(message: string, address: string, network: bitcoin.Network, privateKey: Uint8Array, xOnlyPublicKey: Uint8Array, schnorrImpl?: SchnorrLike): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Tweak a private key for Taproot (BIP340)
|
|
32
|
+
* Used for Taproot key path spending
|
|
33
|
+
*/
|
|
34
|
+
export declare function tweakPrivateKey(privateKey: Uint8Array, merkleRoot?: Uint8Array): Uint8Array;
|
|
35
|
+
/**
|
|
36
|
+
* Get the public key for a private key
|
|
37
|
+
*/
|
|
38
|
+
export declare function getPublicKey(privateKey: Uint8Array, compressed?: boolean): Uint8Array;
|
|
39
|
+
/**
|
|
40
|
+
* Get the x-only public key (for Taproot)
|
|
41
|
+
*/
|
|
42
|
+
export declare function getXOnlyPublicKey(privateKey: Uint8Array): Uint8Array;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=signing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../../src/keys/signing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AAGzC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;CAC/E,CAAC;AAKF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAa7D;AA0BD;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,UAAU,EACvB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,MAAM,CAAC,CAajB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,UAAU,EACvB,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,UAAU,GACpB,OAAO,CAAC,OAAO,CAAC,CAIlB;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,CAAC,OAAO,EACxB,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,UAAU,EAC1B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,MAAM,CAAC,CAyDjB;AAcD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,UAAU,CAiB3F;AAoCD;;GAEG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,GAAE,OAAc,GAAG,UAAU,CAE3F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAIpE"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { AddressInfo, AddressPurpose, EventHandler, NetworkType, SignInputOptions, WBIPProviderOptions, WalletEvent, ConfirmationType } from '../types';
|
|
2
|
+
export type ConfirmationHandler = (type: ConfirmationType, payload?: unknown) => Promise<boolean>;
|
|
3
|
+
/**
|
|
4
|
+
* Minimal interface the provider needs from the wallet to avoid circular deps.
|
|
5
|
+
*/
|
|
6
|
+
interface WalletAdapter {
|
|
7
|
+
isUnlocked(): boolean;
|
|
8
|
+
getAddresses(purposes: AddressPurpose[]): AddressInfo[];
|
|
9
|
+
getNetwork(): NetworkType;
|
|
10
|
+
signMessage(message: string, address: string, protocol?: 'ecdsa' | 'bip322-simple'): Promise<string>;
|
|
11
|
+
signPsbt(psbtBase64: string, inputsToSign: SignInputOptions[]): Promise<string>;
|
|
12
|
+
on(event: WalletEvent, handler: EventHandler): void;
|
|
13
|
+
off(event: WalletEvent, handler: EventHandler): void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* WBIP Provider implementation (Phase 2)
|
|
17
|
+
*/
|
|
18
|
+
export declare class WBIPProvider {
|
|
19
|
+
private wallet;
|
|
20
|
+
private confirm?;
|
|
21
|
+
private lastProviderId;
|
|
22
|
+
private accessGrants;
|
|
23
|
+
private currentOptions?;
|
|
24
|
+
constructor(wallet: WalletAdapter, confirm?: ConfirmationHandler | undefined);
|
|
25
|
+
/**
|
|
26
|
+
* Update the confirmation handler used for sensitive requests.
|
|
27
|
+
*/
|
|
28
|
+
setConfirmationHandler(confirm?: ConfirmationHandler): void;
|
|
29
|
+
/**
|
|
30
|
+
* Register the provider on the global window object so dApps can discover it.
|
|
31
|
+
*/
|
|
32
|
+
register(options: WBIPProviderOptions): void;
|
|
33
|
+
/**
|
|
34
|
+
* Unregister the provider and clean up globals.
|
|
35
|
+
*/
|
|
36
|
+
unregister(id?: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Handle WBIP request entry point.
|
|
39
|
+
*/
|
|
40
|
+
request(method: string, params?: unknown): Promise<unknown>;
|
|
41
|
+
private handleGetAddresses;
|
|
42
|
+
private handleSignMessage;
|
|
43
|
+
private handleSignPsbt;
|
|
44
|
+
private handleGetInfo;
|
|
45
|
+
private buildNetworkPayload;
|
|
46
|
+
private ensureUnlocked;
|
|
47
|
+
private getOrigin;
|
|
48
|
+
private showConfirmation;
|
|
49
|
+
private buildConfirmationSummary;
|
|
50
|
+
/**
|
|
51
|
+
* Provide a concise PSBT summary for the confirm dialog.
|
|
52
|
+
* Avoids deep decoding to keep execution fast and safe.
|
|
53
|
+
*/
|
|
54
|
+
private summarizeSignPsbt;
|
|
55
|
+
/**
|
|
56
|
+
* Normalize unexpected errors into WBIP-compatible internal errors.
|
|
57
|
+
*/
|
|
58
|
+
private formatInternalError;
|
|
59
|
+
private isWBIPError;
|
|
60
|
+
/**
|
|
61
|
+
* Lightweight taproot detector: bech32m v1 with 32-byte data.
|
|
62
|
+
*/
|
|
63
|
+
private isTaprootAddress;
|
|
64
|
+
/**
|
|
65
|
+
* Map common user-driven errors to INVALID_PARAMS for clearer feedback.
|
|
66
|
+
*/
|
|
67
|
+
private mapUserError;
|
|
68
|
+
/**
|
|
69
|
+
* Reset transient access grants (used when wallet locks or unregisters).
|
|
70
|
+
*/
|
|
71
|
+
resetAccess(): void;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=WBIPProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WB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OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI;IA2C5C;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAuB7B;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;YA0CnD,kBAAkB;YA6DlB,iBAAiB;YAuCjB,cAAc;IAkF5B,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,SAAS;YAOH,gBAAgB;IAoB9B,OAAO,CAAC,wBAAwB;IAuBhC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAsCzB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,WAAW;IAWnB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IASxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAsBpB;;OAEG;IACH,WAAW,IAAI,IAAI;CAGpB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
2
|
+
import { UseZeldWalletControllerArgs } from './useZeldWalletController';
|
|
3
|
+
declare global {
|
|
4
|
+
namespace JSX {
|
|
5
|
+
interface IntrinsicElements {
|
|
6
|
+
'zeld-wallet-ui': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export type ZeldWalletCardProps = UseZeldWalletControllerArgs & {
|
|
11
|
+
className?: string;
|
|
12
|
+
variant?: 'light' | 'dark';
|
|
13
|
+
/**
|
|
14
|
+
* Optionally override the tag name when defining the custom element.
|
|
15
|
+
*/
|
|
16
|
+
tagName?: string;
|
|
17
|
+
};
|
|
18
|
+
export type ZeldWalletCardRef = {
|
|
19
|
+
connect: (password?: string) => Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
export declare const ZeldWalletCard: import('react').ForwardRefExoticComponent<UseZeldWalletControllerArgs & {
|
|
22
|
+
className?: string;
|
|
23
|
+
variant?: "light" | "dark";
|
|
24
|
+
/**
|
|
25
|
+
* Optionally override the tag name when defining the custom element.
|
|
26
|
+
*/
|
|
27
|
+
tagName?: string;
|
|
28
|
+
} & import('react').RefAttributes<ZeldWalletCardRef>>;
|
|
29
|
+
//# sourceMappingURL=ZeldWalletCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZeldWalletCard.d.ts","sourceRoot":"","sources":["../../../src/react/ZeldWalletCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAEpB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAE7E,OAAO,CAAC,MAAM,CAAC;IAGb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,gBAAgB,EAAE,iBAAiB,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,CAAC;SAC/E;KACF;CACF;AAED,MAAM,MAAM,mBAAmB,GAAG,2BAA2B,GAAG;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C,CAAC;AAEF,eAAO,MAAM,cAAc;gBAZb,MAAM;cACR,OAAO,GAAG,MAAM;IAC1B;;OAEG;cACO,MAAM;qDAwDhB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { ZeldWalletCard, type ZeldWalletCardRef, type ZeldWalletCardProps } from './ZeldWalletCard';
|
|
2
|
+
export { useZeldWalletController, type UseZeldWalletControllerArgs, type UseZeldWalletControllerResult, } from './useZeldWalletController';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,EACL,uBAAuB,EACvB,KAAK,2BAA2B,EAChC,KAAK,6BAA6B,GACnC,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { NetworkType } from '../types';
|
|
2
|
+
import { LocaleKey, LocaleStrings } from '../component/i18n';
|
|
3
|
+
import { ComponentState } from '../component/state';
|
|
4
|
+
export type UseZeldWalletControllerArgs = {
|
|
5
|
+
lang?: string;
|
|
6
|
+
network?: NetworkType;
|
|
7
|
+
autoconnect?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type UseZeldWalletControllerResult = {
|
|
10
|
+
state: ComponentState;
|
|
11
|
+
locale: LocaleKey;
|
|
12
|
+
strings: LocaleStrings;
|
|
13
|
+
network: NetworkType;
|
|
14
|
+
showPasswordWarning: boolean;
|
|
15
|
+
showBackupWarning: boolean;
|
|
16
|
+
readyWithSecurity: boolean;
|
|
17
|
+
connect: (password?: string) => Promise<void>;
|
|
18
|
+
setLocale: (lang?: string) => void;
|
|
19
|
+
showSetPasswordForm: () => void;
|
|
20
|
+
hideSetPasswordForm: () => void;
|
|
21
|
+
showBackupForm: () => void;
|
|
22
|
+
hideBackupForm: () => void;
|
|
23
|
+
clearBackupResult: () => void;
|
|
24
|
+
handleSetPassword: (password: string, confirmPassword: string) => Promise<void>;
|
|
25
|
+
handleExportBackup: (walletPassword: string) => Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
export declare function useZeldWalletController({ lang, network, autoconnect, }: UseZeldWalletControllerArgs): UseZeldWalletControllerResult;
|
|
28
|
+
//# sourceMappingURL=useZeldWalletController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useZeldWalletController.d.ts","sourceRoot":"","sources":["../../../src/react/useZeldWalletController.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,aAAa,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChF,kBAAkB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EACtC,IAAW,EACX,OAAmB,EACnB,WAAkB,GACnB,EAAE,2BAA2B,GAAG,6BAA6B,CAsD7D"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SecureStorage
|
|
3
|
+
*
|
|
4
|
+
* Handles encrypted storage of sensitive data using IndexedDB and Web Crypto API.
|
|
5
|
+
* Supports both password-protected mode and passwordless mode.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* SecureStorage class for encrypted data persistence
|
|
9
|
+
*/
|
|
10
|
+
export declare class SecureStorage {
|
|
11
|
+
private db;
|
|
12
|
+
private encryptionKey;
|
|
13
|
+
private isPasswordProtected;
|
|
14
|
+
private pbkdf2Iterations?;
|
|
15
|
+
constructor(options?: {
|
|
16
|
+
pbkdf2Iterations?: number;
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Resolve a PBKDF2 iteration override from environment variables.
|
|
20
|
+
* Useful to speed up CI/tests without weakening the default shipped cost.
|
|
21
|
+
*/
|
|
22
|
+
private getEnvIterationOverride;
|
|
23
|
+
/**
|
|
24
|
+
* Resolve the PBKDF2 iteration count in priority order:
|
|
25
|
+
* 1) explicit override passed to constructor (per-session opt-in)
|
|
26
|
+
* 2) persisted metadata from prior setup
|
|
27
|
+
* 3) environment override (e.g., test)
|
|
28
|
+
* 4) default from PBKDF2_CONFIG
|
|
29
|
+
*/
|
|
30
|
+
private resolveIterations;
|
|
31
|
+
/**
|
|
32
|
+
* When issuing a new password-derived key, enforce a sensible floor if metadata already exists.
|
|
33
|
+
* This avoids permanently low KDF costs that were set in test/dev environments.
|
|
34
|
+
*/
|
|
35
|
+
private normalizeIterationsForNewKey;
|
|
36
|
+
/**
|
|
37
|
+
* Initialize the secure storage
|
|
38
|
+
* @param password - Optional password for encryption. If not provided, uses stored key.
|
|
39
|
+
*/
|
|
40
|
+
init(password?: string, options?: {
|
|
41
|
+
readOnly?: boolean;
|
|
42
|
+
}): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Open the IndexedDB database
|
|
45
|
+
*/
|
|
46
|
+
private openDatabase;
|
|
47
|
+
/**
|
|
48
|
+
* Check if storage exists (has been initialized before)
|
|
49
|
+
*/
|
|
50
|
+
exists(): Promise<boolean>;
|
|
51
|
+
/**
|
|
52
|
+
* Determine if a wallet payload exists (mnemonic present in data store).
|
|
53
|
+
* Metadata alone should not mark the wallet as existing.
|
|
54
|
+
*/
|
|
55
|
+
private hasWalletPayload;
|
|
56
|
+
/**
|
|
57
|
+
* Get storage metadata
|
|
58
|
+
*/
|
|
59
|
+
private getMetadata;
|
|
60
|
+
/**
|
|
61
|
+
* Update storage metadata
|
|
62
|
+
*/
|
|
63
|
+
private updateMetadata;
|
|
64
|
+
/**
|
|
65
|
+
* Get or create salt for PBKDF2 key derivation
|
|
66
|
+
*/
|
|
67
|
+
private getOrCreateSalt;
|
|
68
|
+
/**
|
|
69
|
+
* Require an existing salt when storage is already password-protected.
|
|
70
|
+
*/
|
|
71
|
+
private requireSalt;
|
|
72
|
+
/**
|
|
73
|
+
* Derive encryption key from password using PBKDF2
|
|
74
|
+
*/
|
|
75
|
+
private deriveKeyFromPassword;
|
|
76
|
+
/**
|
|
77
|
+
* Get or create a stored encryption key (passwordless mode)
|
|
78
|
+
*/
|
|
79
|
+
private getOrCreateStoredKey;
|
|
80
|
+
/**
|
|
81
|
+
* Convert stored key material (CryptoKey or legacy envelope/raw) into a CryptoKey.
|
|
82
|
+
* Migrates legacy formats to a stored CryptoKey when possible.
|
|
83
|
+
*/
|
|
84
|
+
private materializeStoredKey;
|
|
85
|
+
/**
|
|
86
|
+
* Import a stored envelope into a non-extractable CryptoKey
|
|
87
|
+
*/
|
|
88
|
+
private importStoredKeyEnvelope;
|
|
89
|
+
/**
|
|
90
|
+
* Normalize legacy raw key bytes into a versioned envelope.
|
|
91
|
+
*/
|
|
92
|
+
private normalizeStoredKeyEnvelope;
|
|
93
|
+
/**
|
|
94
|
+
* Encrypt data using AES-GCM
|
|
95
|
+
*/
|
|
96
|
+
private encrypt;
|
|
97
|
+
/**
|
|
98
|
+
* Decrypt data using AES-GCM
|
|
99
|
+
*/
|
|
100
|
+
private decrypt;
|
|
101
|
+
/**
|
|
102
|
+
* Normalize legacy encrypted payloads and validate structure.
|
|
103
|
+
*/
|
|
104
|
+
private normalizeEncryptedData;
|
|
105
|
+
/**
|
|
106
|
+
* Detect production builds without relying solely on process.env.
|
|
107
|
+
* Browser bundles may tree-shake process, so we also look for Vite/import.meta flags.
|
|
108
|
+
*/
|
|
109
|
+
private isProductionLike;
|
|
110
|
+
/**
|
|
111
|
+
* Store encrypted data
|
|
112
|
+
*/
|
|
113
|
+
set(key: string, value: Uint8Array): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Retrieve and decrypt data
|
|
116
|
+
*/
|
|
117
|
+
get(key: string): Promise<Uint8Array | null>;
|
|
118
|
+
/**
|
|
119
|
+
* Delete a key from storage
|
|
120
|
+
*/
|
|
121
|
+
delete(key: string): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Check if storage has password protection
|
|
124
|
+
*/
|
|
125
|
+
hasPassword(): Promise<boolean>;
|
|
126
|
+
/**
|
|
127
|
+
* Check if a backup was created at least once.
|
|
128
|
+
*/
|
|
129
|
+
hasBackup(): Promise<boolean>;
|
|
130
|
+
/**
|
|
131
|
+
* Mark backup metadata as completed with the provided timestamp.
|
|
132
|
+
*/
|
|
133
|
+
markBackupCompleted(timestamp?: number): Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Expose the PBKDF2 iteration count used for the current storage.
|
|
136
|
+
* Useful for backup metadata so restores reuse the same KDF cost.
|
|
137
|
+
*/
|
|
138
|
+
getPbkdf2Iterations(): Promise<number | undefined>;
|
|
139
|
+
/**
|
|
140
|
+
* Add password protection to passwordless storage
|
|
141
|
+
* Re-encrypts all data with the new password-derived key
|
|
142
|
+
*/
|
|
143
|
+
setPassword(password: string): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Change the password
|
|
146
|
+
*/
|
|
147
|
+
changePassword(oldPassword: string, newPassword: string, options?: {
|
|
148
|
+
iterations?: number;
|
|
149
|
+
}): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Remove password protection (revert to passwordless mode)
|
|
152
|
+
*/
|
|
153
|
+
removePassword(currentPassword: string): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Export all data in decrypted form
|
|
156
|
+
*/
|
|
157
|
+
private exportAllDecrypted;
|
|
158
|
+
/**
|
|
159
|
+
* Import and encrypt all data
|
|
160
|
+
*/
|
|
161
|
+
private importAllEncrypted;
|
|
162
|
+
/**
|
|
163
|
+
* Best-effort zeroization of decrypted data held during migrations.
|
|
164
|
+
*/
|
|
165
|
+
private wipeDecryptedData;
|
|
166
|
+
/**
|
|
167
|
+
* Clear all data and reset storage
|
|
168
|
+
*/
|
|
169
|
+
clear(): Promise<void>;
|
|
170
|
+
/**
|
|
171
|
+
* Request persistent storage from the browser
|
|
172
|
+
*/
|
|
173
|
+
requestPersistence(): Promise<boolean>;
|
|
174
|
+
/**
|
|
175
|
+
* Check if storage is persistent
|
|
176
|
+
*/
|
|
177
|
+
isPersistent(): Promise<boolean>;
|
|
178
|
+
/**
|
|
179
|
+
* Close the database connection
|
|
180
|
+
*/
|
|
181
|
+
close(): void;
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=SecureStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SecureStorage.d.ts","sourceRoot":"","sources":["../../../src/storage/SecureStorage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAuCH;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,EAAE,CAA2C;IACrD,O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C;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAKrC;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAKnC;;OAEG;IACG,mBAAmB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO5D;;;OAGG;IACG,mBAAmB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAKxD;;;OAGG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgElD;;OAEG;IACG,cAAc,CAClB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAChC,OAAO,CAAC,IAAI,CAAC;IA+EhB;;OAEG;IACG,cAAc,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuF5D;;OAEG;YACW,kBAAkB;IAiBhC;;OAEG;YACW,kBAAkB;IAsBhC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAOzB;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA4C5B;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAO5C;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;IAOtC;;OAEG;IACH,KAAK,IAAI,IAAI;CAQd"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SecureStorage Constants
|
|
3
|
+
*/
|
|
4
|
+
/** Database name for IndexedDB */
|
|
5
|
+
export declare const DB_NAME = "zeldwallet";
|
|
6
|
+
/** Database version */
|
|
7
|
+
export declare const DB_VERSION = 1;
|
|
8
|
+
/** Object store names */
|
|
9
|
+
export declare const STORES: {
|
|
10
|
+
/** Store for encrypted wallet data */
|
|
11
|
+
readonly DATA: "data";
|
|
12
|
+
/** Store for metadata (salt, encryption key, etc.) */
|
|
13
|
+
readonly META: "meta";
|
|
14
|
+
};
|
|
15
|
+
/** Metadata keys */
|
|
16
|
+
export declare const META_KEYS: {
|
|
17
|
+
/** Salt for PBKDF2 key derivation */
|
|
18
|
+
readonly SALT: "salt";
|
|
19
|
+
/** Stored encryption key (passwordless mode) */
|
|
20
|
+
readonly ENCRYPTION_KEY: "encryption-key";
|
|
21
|
+
/** Storage metadata */
|
|
22
|
+
readonly METADATA: "metadata";
|
|
23
|
+
};
|
|
24
|
+
/** Data keys */
|
|
25
|
+
export declare const DATA_KEYS: {
|
|
26
|
+
/** Encrypted mnemonic */
|
|
27
|
+
readonly MNEMONIC: "mnemonic";
|
|
28
|
+
/** Optional BIP39 passphrase (encrypted alongside mnemonic) */
|
|
29
|
+
readonly PASSPHRASE: "passphrase";
|
|
30
|
+
/** Wallet configuration */
|
|
31
|
+
readonly CONFIG: "config";
|
|
32
|
+
};
|
|
33
|
+
/** PBKDF2 parameters */
|
|
34
|
+
export declare const PBKDF2_CONFIG: {
|
|
35
|
+
/** Number of iterations (600k for strong security) */
|
|
36
|
+
readonly ITERATIONS: 600000;
|
|
37
|
+
/** Hash algorithm */
|
|
38
|
+
readonly HASH: "SHA-256";
|
|
39
|
+
/** Salt length in bytes */
|
|
40
|
+
readonly SALT_LENGTH: 16;
|
|
41
|
+
/** Key derivation algorithm name */
|
|
42
|
+
readonly NAME: "PBKDF2";
|
|
43
|
+
};
|
|
44
|
+
/** AES-GCM parameters */
|
|
45
|
+
export declare const AES_CONFIG: {
|
|
46
|
+
/** Algorithm name */
|
|
47
|
+
readonly NAME: "AES-GCM";
|
|
48
|
+
/** Key length in bits */
|
|
49
|
+
readonly LENGTH: 256;
|
|
50
|
+
/** IV length in bytes */
|
|
51
|
+
readonly IV_LENGTH: 12;
|
|
52
|
+
};
|
|
53
|
+
/** Storage format version */
|
|
54
|
+
export declare const STORAGE_VERSION = 1;
|
|
55
|
+
/** Stored key envelope version (for passwordless master key persistence) */
|
|
56
|
+
export declare const KEY_ENVELOPE_VERSION = 1;
|
|
57
|
+
/** Encrypted record version (per-record versioning for migration readiness) */
|
|
58
|
+
export declare const ENCRYPTED_RECORD_VERSION = 1;
|
|
59
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/storage/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,kCAAkC;AAClC,eAAO,MAAM,OAAO,eAAe,CAAC;AAEpC,uBAAuB;AACvB,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B,yBAAyB;AACzB,eAAO,MAAM,MAAM;IACjB,sCAAsC;;IAEtC,sDAAsD;;CAE9C,CAAC;AAEX,oBAAoB;AACpB,eAAO,MAAM,SAAS;IACpB,qCAAqC;;IAErC,gDAAgD;;IAEhD,uBAAuB;;CAEf,CAAC;AAEX,gBAAgB;AAChB,eAAO,MAAM,SAAS;IACpB,yBAAyB;;IAEzB,+DAA+D;;IAE/D,2BAA2B;;CAEnB,CAAC;AAEX,wBAAwB;AACxB,eAAO,MAAM,aAAa;IACxB,sDAAsD;;IAEtD,qBAAqB;;IAErB,2BAA2B;;IAE3B,oCAAoC;;CAE5B,CAAC;AAEX,yBAAyB;AACzB,eAAO,MAAM,UAAU;IACrB,qBAAqB;;IAErB,yBAAyB;;IAEzB,yBAAyB;;CAEjB,CAAC;AAEX,6BAA6B;AAC7B,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,IAAI,CAAC"}
|