@sidhujag/sysweb3-keyring 1.0.624 → 1.0.626

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sidhujag/sysweb3-keyring",
3
- "version": "1.0.624",
3
+ "version": "1.0.626",
4
4
  "description": "Keyring Manager for UTXO and Web3 Wallets",
5
5
  "main": "cjs/index.js",
6
6
  "types": "types/index.d.ts",
package/types/index.d.ts CHANGED
@@ -4,6 +4,8 @@ export * from './storage';
4
4
  export * from './signers';
5
5
  export * from './initial-state';
6
6
  export * from './keyring-manager';
7
+ export { MAX_PRIVATE_RECORD_BYTES, MAX_PRIVATE_RECORD_LABEL_BYTES, } from './private-records';
8
+ export type { IDecryptPrivateRecordParams, IEncryptedPrivateRecord, IEncryptPrivateRecordParams, } from './private-records';
7
9
  export * from './providers';
8
10
  export * from './utils/derivation-paths';
9
11
  export * from './network-utils';
@@ -1,6 +1,7 @@
1
1
  import { INetwork, INetworkType } from '@sidhujag/sysweb3-network';
2
2
  import { HardwareWalletManager } from './hardware-wallet-manager';
3
3
  import { LedgerKeyring } from './ledger';
4
+ import { IDecryptPrivateRecordParams, IEncryptedPrivateRecord, IEncryptPrivateRecordParams } from './private-records';
4
5
  import { SyscoinHDSigner } from './signers';
5
6
  import { TrezorKeyring } from './trezor';
6
7
  import { IKeyringAccountState, ICreateSmartAccountParams, ISyscoinTransactions, KeyringAccountType, IEthereumTransactions, IKeyringManager } from './types';
@@ -39,6 +40,7 @@ export declare class KeyringManager implements IKeyringManager {
39
40
  private accountAddressExists;
40
41
  private sessionPassword;
41
42
  private sessionMnemonic;
43
+ private privateRecordSessionRevision;
42
44
  /**
43
45
  * @param sharedHardwareWalletManager Optional shared HardwareWalletManager instance.
44
46
  * If not provided, the singleton instance will be used.
@@ -79,7 +81,7 @@ export declare class KeyringManager implements IKeyringManager {
79
81
  private isDescriptor;
80
82
  private isXpubLike;
81
83
  private isWatchOnlyAccount;
82
- getEncryptedXprv: (hd: SyscoinHDSigner) => string;
84
+ getEncryptedXprv: (hd: SyscoinHDSigner) => any;
83
85
  getSeed: (pwd: string) => Promise<any>;
84
86
  deriveSLHDSASetupSecretForAccount: ({ accountIndex, }: {
85
87
  accountIndex: number;
@@ -89,6 +91,12 @@ export declare class KeyringManager implements IKeyringManager {
89
91
  }>;
90
92
  encryptSLHDSASessionState: (plainText: string) => string;
91
93
  decryptSLHDSASessionState: (cipherText: string) => string;
94
+ private privateRecordSession;
95
+ /** Stable local profile identifier; never an account address or a key. */
96
+ getPrivateRecordProfileId(): Promise<string>;
97
+ /** Encrypt caller-owned bytes; persistence and encrypted backup belong to the caller. */
98
+ encryptPrivateRecord(params: IEncryptPrivateRecordParams): Promise<IEncryptedPrivateRecord>;
99
+ decryptPrivateRecord(params: IDecryptPrivateRecordParams): Promise<Uint8Array>;
92
100
  setSignerNetwork: (network: INetwork) => Promise<{
93
101
  activeChain?: INetworkType;
94
102
  success: boolean;
@@ -0,0 +1,26 @@
1
+ /** Versioned, public envelope. Application metadata belongs inside the plaintext. */
2
+ export interface IEncryptedPrivateRecord {
3
+ ciphertext: string;
4
+ domain: string;
5
+ nonce: string;
6
+ profileId: string;
7
+ recordId: string;
8
+ version: 1;
9
+ }
10
+ export interface IEncryptPrivateRecordParams {
11
+ domain: string;
12
+ plaintext: Uint8Array;
13
+ recordId: string;
14
+ }
15
+ export interface IDecryptPrivateRecordParams {
16
+ domain: string;
17
+ envelope: IEncryptedPrivateRecord;
18
+ recordId: string;
19
+ }
20
+ export declare const MAX_PRIVATE_RECORD_BYTES: number;
21
+ export declare const MAX_PRIVATE_RECORD_LABEL_BYTES = 128;
22
+ type Guard = () => void;
23
+ export declare function privateRecordProfileId(secret: Uint8Array, guard: Guard): Promise<string>;
24
+ export declare function encryptPrivateRecordBytes(secret: Uint8Array, params: IEncryptPrivateRecordParams, guard: Guard): Promise<IEncryptedPrivateRecord>;
25
+ export declare function decryptPrivateRecordBytes(secret: Uint8Array, params: IDecryptPrivateRecordParams, guard: Guard): Promise<Uint8Array>;
26
+ export {};
@@ -4,7 +4,7 @@ import { BigNumber, TransactionResponse } from '../ethers-v6';
4
4
  import { LedgerKeyring } from '../ledger';
5
5
  import { CustomJsonRpcProvider } from '../providers';
6
6
  import { TrezorKeyring } from '../trezor';
7
- import { IResponseFromSendErcSignedTransaction, ISendSignedErcTransactionProps, IEthereumTransactions, IEvmCancellationOptions, IEvmReplacementOptions, SimpleTransactionRequest, KeyringAccountType, accountType, IGasParams } from '../types';
7
+ import { IResponseFromSendErcSignedTransaction, ISendSignedErcTransactionProps, IEthereumTransactions, IEvmCancellationOptions, IEvmReplacementOptions, IEvmSendOptions, SimpleTransactionRequest, KeyringAccountType, accountType, IGasParams } from '../types';
8
8
  export declare class EthereumTransactions implements IEthereumTransactions {
9
9
  private _web3Provider;
10
10
  private _web3ProviderKey?;
@@ -68,7 +68,7 @@ export declare class EthereumTransactions implements IEthereumTransactions {
68
68
  isCanceled: boolean;
69
69
  transaction?: TransactionResponse;
70
70
  }>;
71
- sendFormattedTransaction: (params: SimpleTransactionRequest, isLegacy?: boolean) => Promise<any>;
71
+ sendFormattedTransaction: (params: SimpleTransactionRequest, isLegacy?: boolean, options?: IEvmSendOptions) => Promise<any>;
72
72
  private sendFormattedTransactionInternal;
73
73
  sendTransactionWithEditedFee: (txHash: string, isLegacy?: boolean, options?: IEvmReplacementOptions) => Promise<{
74
74
  maximumFee?: string;
package/types/types.d.ts CHANGED
@@ -4,6 +4,7 @@ import { ITxid } from '@sidhujag/sysweb3-utils';
4
4
  import { CustomJsonRpcProvider } from 'providers';
5
5
  import { BigNumber, BigNumberish, BytesLike, TransactionResponse } from './ethers-v6';
6
6
  import { LedgerKeyring } from './ledger';
7
+ import { IDecryptPrivateRecordParams, IEncryptedPrivateRecord, IEncryptPrivateRecordParams } from './private-records';
7
8
  import { SyscoinHDSigner } from './signers';
8
9
  import { TrezorKeyring } from './trezor';
9
10
  export type AccessListish = Array<{
@@ -34,6 +35,10 @@ export type EvmLocalAccount = {
34
35
  privateKey: string;
35
36
  publicKey: string;
36
37
  };
38
+ export interface IEvmSendOptions {
39
+ /** Synchronous host admission, rechecked immediately before signing and broadcast. */
40
+ assertCurrent?: () => void;
41
+ }
37
42
  export interface IEvmReplacementOptions {
38
43
  /** Read-only preview; never requests credentials, a device signature or broadcast. */
39
44
  previewOnly?: boolean;
@@ -82,7 +87,7 @@ export interface IEthereumTransactions {
82
87
  signTypedData: (addr: string, typedData: TypedDataV1 | TypedMessage<any>, version: SignTypedDataVersion) => Promise<string>;
83
88
  importAccount: (mnemonicOrPrivKey: string) => EvmLocalAccount;
84
89
  parsePersonalMessage: (hexMsg: string) => string;
85
- sendFormattedTransaction: (params: SimpleTransactionRequest, isLegacy?: boolean) => Promise<TransactionResponse>;
90
+ sendFormattedTransaction: (params: SimpleTransactionRequest, isLegacy?: boolean, options?: IEvmSendOptions) => Promise<TransactionResponse>;
86
91
  sendSignedErc1155Transaction: ({ receiver, tokenAddress, tokenId, isLegacy, gasPrice, gasLimit, maxFeePerGas, maxPriorityFeePerGas, }: ISendSignedErcTransactionProps) => Promise<IResponseFromSendErcSignedTransaction>;
87
92
  verifyPersonalMessage: (msg: string, sign: string) => string;
88
93
  toBigNumber: (aBigNumberish: string | number) => BigNumber;
@@ -164,6 +169,9 @@ export interface IKeyringManager {
164
169
  syscoinTransaction: ISyscoinTransactions;
165
170
  isSeedValid: (seedPhrase: string) => boolean;
166
171
  getSeed: (pwd: string) => Promise<string>;
172
+ getPrivateRecordProfileId: () => Promise<string>;
173
+ encryptPrivateRecord: (params: IEncryptPrivateRecordParams) => Promise<IEncryptedPrivateRecord>;
174
+ decryptPrivateRecord: (params: IDecryptPrivateRecordParams) => Promise<Uint8Array>;
167
175
  deriveSLHDSASetupSecretForAccount: (params: {
168
176
  accountIndex: number;
169
177
  }) => Promise<{