@anywalletkit/wallet-ton 0.4.0 → 0.5.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/dist/index.d.cts CHANGED
@@ -749,8 +749,8 @@ declare class WalletAccountTon extends WalletAccountReadOnlyTon implements IWall
749
749
  readonly needsNetwork = true;
750
750
  /** Derivation path, `ton-mnemonic`, or `external`. */
751
751
  readonly path: string;
752
- /** The signer that holds the key. */
753
- readonly signer: Signer;
752
+ /** What holds the key: `seed`, `key` (one imported key) or `external`. */
753
+ readonly signerKind: Signer['kind'];
754
754
  private _readOnly;
755
755
  /** `publicKey` is the signer's 32-byte ed25519 key; the V5R1 address derives from it synchronously. */
756
756
  constructor(signer: Signer, publicKey: Uint8Array, path: string, config?: TonConfig);
package/dist/index.d.ts CHANGED
@@ -749,8 +749,8 @@ declare class WalletAccountTon extends WalletAccountReadOnlyTon implements IWall
749
749
  readonly needsNetwork = true;
750
750
  /** Derivation path, `ton-mnemonic`, or `external`. */
751
751
  readonly path: string;
752
- /** The signer that holds the key. */
753
- readonly signer: Signer;
752
+ /** What holds the key: `seed`, `key` (one imported key) or `external`. */
753
+ readonly signerKind: Signer['kind'];
754
754
  private _readOnly;
755
755
  /** `publicKey` is the signer's 32-byte ed25519 key; the V5R1 address derives from it synchronously. */
756
756
  constructor(signer: Signer, publicKey: Uint8Array, path: string, config?: TonConfig);
package/dist/index.js CHANGED
@@ -1125,13 +1125,20 @@ var WalletAccountTon = class _WalletAccountTon extends WalletAccountReadOnlyTon
1125
1125
  needsNetwork = true;
1126
1126
  /** Derivation path, `ton-mnemonic`, or `external`. */
1127
1127
  path;
1128
- /** The signer that holds the key. */
1129
- signer;
1128
+ /**
1129
+ * The signer that holds the key, in a private field: not a property of the account, so no code
1130
+ * the account is handed to (a protocol module, a logger) can reach it and sign around the
1131
+ * account's checks (audit 2026-10-29 A1).
1132
+ */
1133
+ #signer;
1134
+ /** What holds the key: `seed`, `key` (one imported key) or `external`. */
1135
+ signerKind;
1130
1136
  _readOnly;
1131
1137
  /** `publicKey` is the signer's 32-byte ed25519 key; the V5R1 address derives from it synchronously. */
1132
1138
  constructor(signer, publicKey, path, config = {}) {
1133
1139
  super(publicKey, config);
1134
- this.signer = requireCurve(signer, "ed25519");
1140
+ this.#signer = requireCurve(signer, "ed25519");
1141
+ this.signerKind = this.#signer.kind;
1135
1142
  this.path = path;
1136
1143
  }
1137
1144
  /** Back-compat: wrap a raw derived key in a {@link LocalSigner} (the account takes ownership; it cannot derive). */
@@ -1154,7 +1161,7 @@ var WalletAccountTon = class _WalletAccountTon extends WalletAccountReadOnlyTon
1154
1161
  async sign(message) {
1155
1162
  const bytes = typeof message === "string" ? new TextEncoder().encode(message) : message;
1156
1163
  if (bytes.length === 32 || carriesKey(bytes, this.publicKey)) throw new MessageIsTransactionError();
1157
- return toHex(await this.signer.sign(bytes, { scheme: "ed25519", context: "ton-message" }));
1164
+ return toHex(await this.#signer.sign(bytes, { scheme: "ed25519", context: "ton-message" }));
1158
1165
  }
1159
1166
  /**
1160
1167
  * TON Connect `ton_proof` for this wallet's address: the `proof` object of the connect reply. The
@@ -1163,7 +1170,7 @@ var WalletAccountTon = class _WalletAccountTon extends WalletAccountReadOnlyTon
1163
1170
  */
1164
1171
  async signTonProof(request) {
1165
1172
  const digest = tonProofDigest(this._address, request);
1166
- const signature = await this.signer.sign(digest, { scheme: "ed25519", context: "ton-proof" });
1173
+ const signature = await this.#signer.sign(digest, { scheme: "ed25519", context: "ton-proof" });
1167
1174
  return {
1168
1175
  timestamp: request.timestamp,
1169
1176
  domain: { lengthBytes: new TextEncoder().encode(request.domain).length, value: request.domain },
@@ -1174,7 +1181,7 @@ var WalletAccountTon = class _WalletAccountTon extends WalletAccountReadOnlyTon
1174
1181
  /** TON Connect `signData` (text / binary) for this wallet's address: the reply the dApp gets. */
1175
1182
  async signTonConnectData(request) {
1176
1183
  const digest = tonSignDataDigest(this._address, request);
1177
- const signature = await this.signer.sign(digest, { scheme: "ed25519", context: "ton-sign-data" });
1184
+ const signature = await this.#signer.sign(digest, { scheme: "ed25519", context: "ton-sign-data" });
1178
1185
  return {
1179
1186
  signature: Buffer6.from(signature).toString("base64"),
1180
1187
  address: this._address.toRawString(),
@@ -1213,7 +1220,7 @@ var WalletAccountTon = class _WalletAccountTon extends WalletAccountReadOnlyTon
1213
1220
  }
1214
1221
  const { signing } = await this.signingCell(messages);
1215
1222
  const fee = await this.preflight(v5r1PackUnsigned(signing), limit, op, want);
1216
- const signature = await this.signer.sign(new Uint8Array(signing.hash()), { scheme: "ed25519", context: "ton-external" });
1223
+ const signature = await this.#signer.sign(new Uint8Array(signing.hash()), { scheme: "ed25519", context: "ton-external" });
1217
1224
  return { body: v5r1PackSigned(signing, signature), fee };
1218
1225
  }
1219
1226
  async preflight(body, limit, op, expectedTonOut) {
@@ -1277,7 +1284,7 @@ var WalletAccountTon = class _WalletAccountTon extends WalletAccountReadOnlyTon
1277
1284
  }
1278
1285
  /** Disposes the signer: a local key is zeroized, an external one is released. */
1279
1286
  dispose() {
1280
- this.signer.dispose();
1287
+ this.#signer.dispose();
1281
1288
  }
1282
1289
  };
1283
1290