@unicitylabs/sphere-sdk 0.5.7 → 0.6.0-dev.1

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.
@@ -93,7 +93,7 @@ interface CreateGroupOptions {
93
93
  * }
94
94
  * ```
95
95
  */
96
- type SphereErrorCode = 'NOT_INITIALIZED' | 'ALREADY_INITIALIZED' | 'INVALID_CONFIG' | 'INVALID_IDENTITY' | 'INSUFFICIENT_BALANCE' | 'INVALID_RECIPIENT' | 'TRANSFER_FAILED' | 'STORAGE_ERROR' | 'TRANSPORT_ERROR' | 'AGGREGATOR_ERROR' | 'VALIDATION_ERROR' | 'NETWORK_ERROR' | 'TIMEOUT' | 'DECRYPTION_ERROR' | 'MODULE_NOT_AVAILABLE';
96
+ type SphereErrorCode = 'NOT_INITIALIZED' | 'ALREADY_INITIALIZED' | 'INVALID_CONFIG' | 'INVALID_IDENTITY' | 'INSUFFICIENT_BALANCE' | 'INVALID_RECIPIENT' | 'TRANSFER_FAILED' | 'STORAGE_ERROR' | 'TRANSPORT_ERROR' | 'AGGREGATOR_ERROR' | 'VALIDATION_ERROR' | 'NETWORK_ERROR' | 'TIMEOUT' | 'DECRYPTION_ERROR' | 'MODULE_NOT_AVAILABLE' | 'SIGNING_ERROR';
97
97
  declare class SphereError extends Error {
98
98
  readonly code: SphereErrorCode;
99
99
  readonly cause?: unknown;
@@ -261,6 +261,34 @@ declare function deriveAddressInfo(masterKey: MasterKey, basePath: string, index
261
261
  * (L1 SDK compatibility)
262
262
  */
263
263
  declare function generateAddressInfo(privateKey: string, index: number, path: string, prefix?: string): AddressInfo;
264
+ /** Prefix prepended to all signed messages (Bitcoin-like signed message format) */
265
+ declare const SIGN_MESSAGE_PREFIX = "Sphere Signed Message:\n";
266
+ /**
267
+ * Hash a message for signing using the Bitcoin-like double-SHA256 scheme:
268
+ * SHA256(SHA256(varint(prefix.length) + prefix + varint(msg.length) + msg))
269
+ *
270
+ * @returns 64-char lowercase hex hash
271
+ */
272
+ declare function hashSignMessage(message: string): string;
273
+ /**
274
+ * Sign a message with a secp256k1 private key.
275
+ *
276
+ * Returns a 130-character hex string: v (2 chars) + r (64 chars) + s (64 chars).
277
+ * The recovery byte `v` is `31 + recoveryParam` (0-3).
278
+ *
279
+ * @param privateKeyHex - 64-char hex private key
280
+ * @param message - plaintext message to sign
281
+ */
282
+ declare function signMessage(privateKeyHex: string, message: string): string;
283
+ /**
284
+ * Verify a signed message against a compressed secp256k1 public key.
285
+ *
286
+ * @param message - The original plaintext message
287
+ * @param signature - 130-char hex signature (v + r + s)
288
+ * @param expectedPubkey - 66-char compressed public key hex
289
+ * @returns `true` if the signature is valid and matches the expected public key
290
+ */
291
+ declare function verifySignedMessage(message: string, signature: string, expectedPubkey: string): boolean;
264
292
 
265
293
  /**
266
294
  * TXF (Token eXchange Format) Type Definitions
@@ -1247,16 +1275,6 @@ interface TransportProvider extends BaseProvider {
1247
1275
  * @returns true if successful, false if nametag is taken by another pubkey
1248
1276
  */
1249
1277
  publishIdentityBinding?(chainPubkey: string, l1Address: string, directAddress: string, nametag?: string): Promise<boolean>;
1250
- /**
1251
- * @deprecated Use publishIdentityBinding instead
1252
- * Register a nametag for this identity
1253
- */
1254
- registerNametag?(nametag: string, chainPubkey: string, directAddress: string): Promise<boolean>;
1255
- /**
1256
- * @deprecated Use publishIdentityBinding instead
1257
- * Publish nametag binding
1258
- */
1259
- publishNametag?(nametag: string, address: string): Promise<void>;
1260
1278
  /**
1261
1279
  * Subscribe to broadcast messages (global/channel)
1262
1280
  */
@@ -3696,6 +3714,15 @@ declare class Sphere {
3696
3714
  get identity(): Identity | null;
3697
3715
  /** Is ready */
3698
3716
  get isReady(): boolean;
3717
+ /**
3718
+ * Sign a plaintext message with the wallet's secp256k1 private key.
3719
+ *
3720
+ * Returns a 130-character hex string: v (2) + r (64) + s (64).
3721
+ * The private key never leaves the SDK boundary.
3722
+ *
3723
+ * @throws SphereError if the wallet is not initialized or identity is missing
3724
+ */
3725
+ signMessage(message: string): string;
3699
3726
  getStorage(): StorageProvider;
3700
3727
  /**
3701
3728
  * Get first token storage provider (for backward compatibility)
@@ -4687,4 +4714,4 @@ interface CheckNetworkHealthOptions {
4687
4714
  */
4688
4715
  declare function checkNetworkHealth(network?: NetworkType, options?: CheckNetworkHealthOptions): Promise<NetworkHealthResult>;
4689
4716
 
4690
- export { type AddressInfo, CHARSET, type CheckNetworkHealthOptions, CurrencyUtils, DEFAULT_DERIVATION_PATH, DEFAULT_TOKEN_DECIMALS, type DerivedKey, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, type EncryptionOptions, type InitProgress, type InitProgressCallback, type InitProgressStep, type KeyPair, type L1Config, type LogHandler, type LogLevel, type LoggerConfig, type MasterKey, type ScanAddressProgress, type ScanAddressesOptions, type ScanAddressesResult, type ScannedAddressResult, Sphere, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, base58Decode, base58Encode, bytesToHex, checkNetworkHealth, computeHash160, convertBits, createAddress, createBech32, createKeyPair, createSphere, decodeBech32, decrypt, decryptJson, decryptMnemonic, decryptSimple, decryptWithSalt, deriveAddressInfo, deriveChildKey, deriveKeyAtPath, deserializeEncrypted, discoverAddressesImpl, doubleSha256, ec, encodeBech32, encrypt, encryptMnemonic, encryptSimple, entropyToMnemonic, extractFromText, findPattern, formatAmount, generateAddressInfo, generateMasterKey, generateMnemonic, generateRandomKey, getAddressHrp, getPublicKey, getSphere, hash160, hash160ToBytes, hexToBytes, identityFromMnemonic, identityFromMnemonicSync, importSphere, initSphere, isEncryptedData, isSphereError, isValidBech32, isValidNametag, isValidPrivateKey, loadSphere, logger, mnemonicToEntropy, mnemonicToSeed, mnemonicToSeedSync, privateKeyToAddressInfo, publicKeyToAddress, randomBytes, randomHex, randomUUID, ripemd160, scanAddressesImpl, serializeEncrypted, sha256, sleep, sphereExists, toHumanReadable, toSmallestUnit, validateMnemonic };
4717
+ export { type AddressInfo, CHARSET, type CheckNetworkHealthOptions, CurrencyUtils, DEFAULT_DERIVATION_PATH, DEFAULT_TOKEN_DECIMALS, type DerivedKey, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, type EncryptionOptions, type InitProgress, type InitProgressCallback, type InitProgressStep, type KeyPair, type L1Config, type LogHandler, type LogLevel, type LoggerConfig, type MasterKey, SIGN_MESSAGE_PREFIX, type ScanAddressProgress, type ScanAddressesOptions, type ScanAddressesResult, type ScannedAddressResult, Sphere, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, base58Decode, base58Encode, bytesToHex, checkNetworkHealth, computeHash160, convertBits, createAddress, createBech32, createKeyPair, createSphere, decodeBech32, decrypt, decryptJson, decryptMnemonic, decryptSimple, decryptWithSalt, deriveAddressInfo, deriveChildKey, deriveKeyAtPath, deserializeEncrypted, discoverAddressesImpl, doubleSha256, ec, encodeBech32, encrypt, encryptMnemonic, encryptSimple, entropyToMnemonic, extractFromText, findPattern, formatAmount, generateAddressInfo, generateMasterKey, generateMnemonic, generateRandomKey, getAddressHrp, getPublicKey, getSphere, hash160, hash160ToBytes, hashSignMessage, hexToBytes, identityFromMnemonic, identityFromMnemonicSync, importSphere, initSphere, isEncryptedData, isSphereError, isValidBech32, isValidNametag, isValidPrivateKey, loadSphere, logger, mnemonicToEntropy, mnemonicToSeed, mnemonicToSeedSync, privateKeyToAddressInfo, publicKeyToAddress, randomBytes, randomHex, randomUUID, ripemd160, scanAddressesImpl, serializeEncrypted, sha256, signMessage, sleep, sphereExists, toHumanReadable, toSmallestUnit, validateMnemonic, verifySignedMessage };
@@ -93,7 +93,7 @@ interface CreateGroupOptions {
93
93
  * }
94
94
  * ```
95
95
  */
96
- type SphereErrorCode = 'NOT_INITIALIZED' | 'ALREADY_INITIALIZED' | 'INVALID_CONFIG' | 'INVALID_IDENTITY' | 'INSUFFICIENT_BALANCE' | 'INVALID_RECIPIENT' | 'TRANSFER_FAILED' | 'STORAGE_ERROR' | 'TRANSPORT_ERROR' | 'AGGREGATOR_ERROR' | 'VALIDATION_ERROR' | 'NETWORK_ERROR' | 'TIMEOUT' | 'DECRYPTION_ERROR' | 'MODULE_NOT_AVAILABLE';
96
+ type SphereErrorCode = 'NOT_INITIALIZED' | 'ALREADY_INITIALIZED' | 'INVALID_CONFIG' | 'INVALID_IDENTITY' | 'INSUFFICIENT_BALANCE' | 'INVALID_RECIPIENT' | 'TRANSFER_FAILED' | 'STORAGE_ERROR' | 'TRANSPORT_ERROR' | 'AGGREGATOR_ERROR' | 'VALIDATION_ERROR' | 'NETWORK_ERROR' | 'TIMEOUT' | 'DECRYPTION_ERROR' | 'MODULE_NOT_AVAILABLE' | 'SIGNING_ERROR';
97
97
  declare class SphereError extends Error {
98
98
  readonly code: SphereErrorCode;
99
99
  readonly cause?: unknown;
@@ -261,6 +261,34 @@ declare function deriveAddressInfo(masterKey: MasterKey, basePath: string, index
261
261
  * (L1 SDK compatibility)
262
262
  */
263
263
  declare function generateAddressInfo(privateKey: string, index: number, path: string, prefix?: string): AddressInfo;
264
+ /** Prefix prepended to all signed messages (Bitcoin-like signed message format) */
265
+ declare const SIGN_MESSAGE_PREFIX = "Sphere Signed Message:\n";
266
+ /**
267
+ * Hash a message for signing using the Bitcoin-like double-SHA256 scheme:
268
+ * SHA256(SHA256(varint(prefix.length) + prefix + varint(msg.length) + msg))
269
+ *
270
+ * @returns 64-char lowercase hex hash
271
+ */
272
+ declare function hashSignMessage(message: string): string;
273
+ /**
274
+ * Sign a message with a secp256k1 private key.
275
+ *
276
+ * Returns a 130-character hex string: v (2 chars) + r (64 chars) + s (64 chars).
277
+ * The recovery byte `v` is `31 + recoveryParam` (0-3).
278
+ *
279
+ * @param privateKeyHex - 64-char hex private key
280
+ * @param message - plaintext message to sign
281
+ */
282
+ declare function signMessage(privateKeyHex: string, message: string): string;
283
+ /**
284
+ * Verify a signed message against a compressed secp256k1 public key.
285
+ *
286
+ * @param message - The original plaintext message
287
+ * @param signature - 130-char hex signature (v + r + s)
288
+ * @param expectedPubkey - 66-char compressed public key hex
289
+ * @returns `true` if the signature is valid and matches the expected public key
290
+ */
291
+ declare function verifySignedMessage(message: string, signature: string, expectedPubkey: string): boolean;
264
292
 
265
293
  /**
266
294
  * TXF (Token eXchange Format) Type Definitions
@@ -1247,16 +1275,6 @@ interface TransportProvider extends BaseProvider {
1247
1275
  * @returns true if successful, false if nametag is taken by another pubkey
1248
1276
  */
1249
1277
  publishIdentityBinding?(chainPubkey: string, l1Address: string, directAddress: string, nametag?: string): Promise<boolean>;
1250
- /**
1251
- * @deprecated Use publishIdentityBinding instead
1252
- * Register a nametag for this identity
1253
- */
1254
- registerNametag?(nametag: string, chainPubkey: string, directAddress: string): Promise<boolean>;
1255
- /**
1256
- * @deprecated Use publishIdentityBinding instead
1257
- * Publish nametag binding
1258
- */
1259
- publishNametag?(nametag: string, address: string): Promise<void>;
1260
1278
  /**
1261
1279
  * Subscribe to broadcast messages (global/channel)
1262
1280
  */
@@ -3696,6 +3714,15 @@ declare class Sphere {
3696
3714
  get identity(): Identity | null;
3697
3715
  /** Is ready */
3698
3716
  get isReady(): boolean;
3717
+ /**
3718
+ * Sign a plaintext message with the wallet's secp256k1 private key.
3719
+ *
3720
+ * Returns a 130-character hex string: v (2) + r (64) + s (64).
3721
+ * The private key never leaves the SDK boundary.
3722
+ *
3723
+ * @throws SphereError if the wallet is not initialized or identity is missing
3724
+ */
3725
+ signMessage(message: string): string;
3699
3726
  getStorage(): StorageProvider;
3700
3727
  /**
3701
3728
  * Get first token storage provider (for backward compatibility)
@@ -4687,4 +4714,4 @@ interface CheckNetworkHealthOptions {
4687
4714
  */
4688
4715
  declare function checkNetworkHealth(network?: NetworkType, options?: CheckNetworkHealthOptions): Promise<NetworkHealthResult>;
4689
4716
 
4690
- export { type AddressInfo, CHARSET, type CheckNetworkHealthOptions, CurrencyUtils, DEFAULT_DERIVATION_PATH, DEFAULT_TOKEN_DECIMALS, type DerivedKey, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, type EncryptionOptions, type InitProgress, type InitProgressCallback, type InitProgressStep, type KeyPair, type L1Config, type LogHandler, type LogLevel, type LoggerConfig, type MasterKey, type ScanAddressProgress, type ScanAddressesOptions, type ScanAddressesResult, type ScannedAddressResult, Sphere, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, base58Decode, base58Encode, bytesToHex, checkNetworkHealth, computeHash160, convertBits, createAddress, createBech32, createKeyPair, createSphere, decodeBech32, decrypt, decryptJson, decryptMnemonic, decryptSimple, decryptWithSalt, deriveAddressInfo, deriveChildKey, deriveKeyAtPath, deserializeEncrypted, discoverAddressesImpl, doubleSha256, ec, encodeBech32, encrypt, encryptMnemonic, encryptSimple, entropyToMnemonic, extractFromText, findPattern, formatAmount, generateAddressInfo, generateMasterKey, generateMnemonic, generateRandomKey, getAddressHrp, getPublicKey, getSphere, hash160, hash160ToBytes, hexToBytes, identityFromMnemonic, identityFromMnemonicSync, importSphere, initSphere, isEncryptedData, isSphereError, isValidBech32, isValidNametag, isValidPrivateKey, loadSphere, logger, mnemonicToEntropy, mnemonicToSeed, mnemonicToSeedSync, privateKeyToAddressInfo, publicKeyToAddress, randomBytes, randomHex, randomUUID, ripemd160, scanAddressesImpl, serializeEncrypted, sha256, sleep, sphereExists, toHumanReadable, toSmallestUnit, validateMnemonic };
4717
+ export { type AddressInfo, CHARSET, type CheckNetworkHealthOptions, CurrencyUtils, DEFAULT_DERIVATION_PATH, DEFAULT_TOKEN_DECIMALS, type DerivedKey, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, type EncryptionOptions, type InitProgress, type InitProgressCallback, type InitProgressStep, type KeyPair, type L1Config, type LogHandler, type LogLevel, type LoggerConfig, type MasterKey, SIGN_MESSAGE_PREFIX, type ScanAddressProgress, type ScanAddressesOptions, type ScanAddressesResult, type ScannedAddressResult, Sphere, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, base58Decode, base58Encode, bytesToHex, checkNetworkHealth, computeHash160, convertBits, createAddress, createBech32, createKeyPair, createSphere, decodeBech32, decrypt, decryptJson, decryptMnemonic, decryptSimple, decryptWithSalt, deriveAddressInfo, deriveChildKey, deriveKeyAtPath, deserializeEncrypted, discoverAddressesImpl, doubleSha256, ec, encodeBech32, encrypt, encryptMnemonic, encryptSimple, entropyToMnemonic, extractFromText, findPattern, formatAmount, generateAddressInfo, generateMasterKey, generateMnemonic, generateRandomKey, getAddressHrp, getPublicKey, getSphere, hash160, hash160ToBytes, hashSignMessage, hexToBytes, identityFromMnemonic, identityFromMnemonicSync, importSphere, initSphere, isEncryptedData, isSphereError, isValidBech32, isValidNametag, isValidPrivateKey, loadSphere, logger, mnemonicToEntropy, mnemonicToSeed, mnemonicToSeedSync, privateKeyToAddressInfo, publicKeyToAddress, randomBytes, randomHex, randomUUID, ripemd160, scanAddressesImpl, serializeEncrypted, sha256, signMessage, sleep, sphereExists, toHumanReadable, toSmallestUnit, validateMnemonic, verifySignedMessage };
@@ -955,6 +955,73 @@ function generateAddressInfo(privateKey, index, path, prefix = "alpha") {
955
955
  index
956
956
  };
957
957
  }
958
+ var SIGN_MESSAGE_PREFIX = "Sphere Signed Message:\n";
959
+ function varint(n) {
960
+ if (n < 253) return new Uint8Array([n]);
961
+ const buf = new Uint8Array(3);
962
+ buf[0] = 253;
963
+ buf[1] = n & 255;
964
+ buf[2] = n >> 8 & 255;
965
+ return buf;
966
+ }
967
+ function hashSignMessage(message) {
968
+ const prefix = new TextEncoder().encode(SIGN_MESSAGE_PREFIX);
969
+ const msg = new TextEncoder().encode(message);
970
+ const prefixLen = varint(prefix.length);
971
+ const msgLen = varint(msg.length);
972
+ const full = new Uint8Array(prefixLen.length + prefix.length + msgLen.length + msg.length);
973
+ let off = 0;
974
+ full.set(prefixLen, off);
975
+ off += prefixLen.length;
976
+ full.set(prefix, off);
977
+ off += prefix.length;
978
+ full.set(msgLen, off);
979
+ off += msgLen.length;
980
+ full.set(msg, off);
981
+ const hex = Array.from(full).map((b) => b.toString(16).padStart(2, "0")).join("");
982
+ const h1 = CryptoJS2.SHA256(CryptoJS2.enc.Hex.parse(hex)).toString();
983
+ return CryptoJS2.SHA256(CryptoJS2.enc.Hex.parse(h1)).toString();
984
+ }
985
+ function signMessage(privateKeyHex, message) {
986
+ const keyPair = ec.keyFromPrivate(privateKeyHex, "hex");
987
+ const hashHex = hashSignMessage(message);
988
+ const hashBytes = Buffer.from(hashHex, "hex");
989
+ const sig = keyPair.sign(hashBytes, { canonical: true });
990
+ const pub = keyPair.getPublic();
991
+ let recoveryParam = -1;
992
+ for (let i = 0; i < 4; i++) {
993
+ try {
994
+ if (ec.recoverPubKey(hashBytes, sig, i).eq(pub)) {
995
+ recoveryParam = i;
996
+ break;
997
+ }
998
+ } catch {
999
+ }
1000
+ }
1001
+ if (recoveryParam === -1) {
1002
+ throw new SphereError("Could not find recovery parameter", "SIGNING_ERROR");
1003
+ }
1004
+ const v = (31 + recoveryParam).toString(16).padStart(2, "0");
1005
+ const r = sig.r.toString("hex").padStart(64, "0");
1006
+ const s = sig.s.toString("hex").padStart(64, "0");
1007
+ return v + r + s;
1008
+ }
1009
+ function verifySignedMessage(message, signature, expectedPubkey) {
1010
+ if (signature.length !== 130) return false;
1011
+ const v = parseInt(signature.slice(0, 2), 16) - 31;
1012
+ const r = signature.slice(2, 66);
1013
+ const s = signature.slice(66, 130);
1014
+ if (v < 0 || v > 3) return false;
1015
+ const hashHex = hashSignMessage(message);
1016
+ const hashBytes = Buffer.from(hashHex, "hex");
1017
+ try {
1018
+ const recovered = ec.recoverPubKey(hashBytes, { r, s }, v);
1019
+ const recoveredHex = recovered.encode("hex", true);
1020
+ return recoveredHex === expectedPubkey;
1021
+ } catch {
1022
+ return false;
1023
+ }
1024
+ }
958
1025
 
959
1026
  // l1/crypto.ts
960
1027
  import CryptoJS3 from "crypto-js";
@@ -14084,6 +14151,23 @@ var Sphere = class _Sphere {
14084
14151
  return this._initialized;
14085
14152
  }
14086
14153
  // ===========================================================================
14154
+ // Public Methods - Signing
14155
+ // ===========================================================================
14156
+ /**
14157
+ * Sign a plaintext message with the wallet's secp256k1 private key.
14158
+ *
14159
+ * Returns a 130-character hex string: v (2) + r (64) + s (64).
14160
+ * The private key never leaves the SDK boundary.
14161
+ *
14162
+ * @throws SphereError if the wallet is not initialized or identity is missing
14163
+ */
14164
+ signMessage(message) {
14165
+ if (!this._identity?.privateKey) {
14166
+ throw new SphereError("Wallet not initialized \u2014 cannot sign", "NOT_INITIALIZED");
14167
+ }
14168
+ return signMessage(this._identity.privateKey, message);
14169
+ }
14170
+ // ===========================================================================
14087
14171
  // Public Methods - Providers Access
14088
14172
  // ===========================================================================
14089
14173
  getStorage() {
@@ -15469,6 +15553,17 @@ var Sphere = class _Sphere {
15469
15553
  if (this._identity?.nametag) {
15470
15554
  throw new SphereError(`Unicity ID already registered for address ${this._currentAddressIndex}: @${this._identity.nametag}`, "ALREADY_INITIALIZED");
15471
15555
  }
15556
+ if (!this._payments.hasNametag()) {
15557
+ logger.debug("Sphere", `Minting nametag token for @${cleanNametag}...`);
15558
+ const result = await this.mintNametag(cleanNametag);
15559
+ if (!result.success) {
15560
+ throw new SphereError(
15561
+ `Failed to mint nametag token: ${result.error}`,
15562
+ "AGGREGATOR_ERROR"
15563
+ );
15564
+ }
15565
+ logger.debug("Sphere", `Nametag token minted successfully`);
15566
+ }
15472
15567
  if (this._transport.publishIdentityBinding) {
15473
15568
  const success = await this._transport.publishIdentityBinding(
15474
15569
  this._identity.chainPubkey,
@@ -15492,15 +15587,6 @@ var Sphere = class _Sphere {
15492
15587
  nametags.set(0, cleanNametag);
15493
15588
  }
15494
15589
  await this.persistAddressNametags();
15495
- if (!this._payments.hasNametag()) {
15496
- logger.debug("Sphere", `Minting nametag token for @${cleanNametag}...`);
15497
- const result = await this.mintNametag(cleanNametag);
15498
- if (!result.success) {
15499
- logger.warn("Sphere", `Failed to mint nametag token: ${result.error}`);
15500
- } else {
15501
- logger.debug("Sphere", `Nametag token minted successfully`);
15502
- }
15503
- }
15504
15590
  this.emitEvent("nametag:registered", {
15505
15591
  nametag: cleanNametag,
15506
15592
  addressIndex: this._currentAddressIndex
@@ -16447,6 +16533,7 @@ export {
16447
16533
  CurrencyUtils,
16448
16534
  DEFAULT_DERIVATION_PATH2 as DEFAULT_DERIVATION_PATH,
16449
16535
  DEFAULT_TOKEN_DECIMALS,
16536
+ SIGN_MESSAGE_PREFIX,
16450
16537
  Sphere,
16451
16538
  SphereError,
16452
16539
  base58Decode,
@@ -16489,6 +16576,7 @@ export {
16489
16576
  getSphere,
16490
16577
  hash160,
16491
16578
  hash160ToBytes,
16579
+ hashSignMessage,
16492
16580
  hexToBytes,
16493
16581
  identityFromMnemonic,
16494
16582
  identityFromMnemonicSync,
@@ -16513,11 +16601,13 @@ export {
16513
16601
  scanAddressesImpl,
16514
16602
  serializeEncrypted,
16515
16603
  sha256,
16604
+ signMessage,
16516
16605
  sleep,
16517
16606
  sphereExists,
16518
16607
  toHumanReadable,
16519
16608
  toSmallestUnit,
16520
- validateMnemonic2 as validateMnemonic
16609
+ validateMnemonic2 as validateMnemonic,
16610
+ verifySignedMessage
16521
16611
  };
16522
16612
  /*! Bundled license information:
16523
16613