@anywalletkit/wallet-near 0.2.0 → 0.3.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.cjs CHANGED
@@ -1228,13 +1228,20 @@ var WalletAccountNear = class _WalletAccountNear extends WalletAccountReadOnlyNe
1228
1228
  needsNetwork = true;
1229
1229
  /** Derivation path, or `external` for an external signer. */
1230
1230
  path;
1231
- /** The signer that holds the key. */
1232
- signer;
1231
+ /**
1232
+ * The signer that holds the key, in a private field: not a property of the account, so no code
1233
+ * the account is handed to (a protocol module, a logger) can reach it and sign around the
1234
+ * account's checks (audit 2026-10-29 A1).
1235
+ */
1236
+ #signer;
1237
+ /** What holds the key: `seed`, `key` (one imported key) or `external`. */
1238
+ signerKind;
1233
1239
  _disposed = false;
1234
1240
  _readOnly;
1235
1241
  constructor(signer, publicKey, path, config = {}, accountId) {
1236
1242
  super(accountId ?? implicitAccountId(publicKey), config, ed25519Key(publicKey));
1237
- this.signer = (0, import_core4.requireCurve)(signer, "ed25519");
1243
+ this.#signer = (0, import_core4.requireCurve)(signer, "ed25519");
1244
+ this.signerKind = this.#signer.kind;
1238
1245
  this.path = path;
1239
1246
  }
1240
1247
  /** Wrap a raw derived key (takes ownership; zeroized on dispose). */
@@ -1248,14 +1255,14 @@ var WalletAccountNear = class _WalletAccountNear extends WalletAccountReadOnlyNe
1248
1255
  }
1249
1256
  /** The same key bound to a named account (`alice.near`) that lists it as a full-access key. */
1250
1257
  withAccountId(accountId) {
1251
- return new _WalletAccountNear(this.signer, this.publicKey.data, this.path, this._config, accountId);
1258
+ return new _WalletAccountNear(this.#signer, this.publicKey.data, this.path, this._config, accountId);
1252
1259
  }
1253
1260
  key() {
1254
1261
  if (this._disposed) throw new import_core4.SignerError("This account has been disposed.");
1255
1262
  }
1256
1263
  async #signBytes(bytes, context) {
1257
1264
  this.key();
1258
- return this.signer.sign(bytes, { scheme: "ed25519", context });
1265
+ return this.#signer.sign(bytes, { scheme: "ed25519", context });
1259
1266
  }
1260
1267
  /**
1261
1268
  * Raw ed25519 signature over the message bytes, as NEAR tooling prints it: "ed25519:<base58>".
@@ -1342,7 +1349,7 @@ var WalletAccountNear = class _WalletAccountNear extends WalletAccountReadOnlyNe
1342
1349
  /** Dispose the signer (zeroizes a local key). Idempotent. */
1343
1350
  dispose() {
1344
1351
  this._disposed = true;
1345
- this.signer.dispose();
1352
+ this.#signer.dispose();
1346
1353
  }
1347
1354
  };
1348
1355
  function decodeSigned(b64) {