mnemonic.d.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import type { BytesLike } from "../utils/index.js";
  2. import type { Wordlist } from "../wordlists/index.js";
  3. /**
  4. * A **Mnemonic** wraps all properties required to compute [[link-bip-39]]
  5. * seeds and convert between phrases and entropy.
  6. */
  7. export declare class Mnemonic {
  8. /**
  9. * The mnemonic phrase of 12, 15, 18, 21 or 24 words.
  10. *
  11. * Use the [[wordlist]] ``split`` method to get the individual words.
  12. */
  13. readonly phrase: string;
  14. /**
  15. * The password used for this mnemonic. If no password is used this
  16. * is the empty string (i.e. ``""``) as per the specification.
  17. */
  18. readonly password: string;
  19. /**
  20. * The wordlist for this mnemonic.
  21. */
  22. readonly wordlist: Wordlist;
  23. /**
  24. * The underlying entropy which the mnemonic encodes.
  25. */
  26. readonly entropy: string;
  27. /**
  28. * @private
  29. */
  30. constructor(guard: any, entropy: string, phrase: string, password?: null | string, wordlist?: null | Wordlist);
  31. /**
  32. * Returns the seed for the mnemonic.
  33. */
  34. computeSeed(): string;
  35. /**
  36. * Creates a new Mnemonic for the %%phrase%%.
  37. *
  38. * The default %%password%% is the empty string and the default
  39. * wordlist is the [English wordlists](LangEn).
  40. */
  41. static fromPhrase(phrase: string, password?: null | string, wordlist?: null | Wordlist): Mnemonic;
  42. /**
  43. * Create a new **Mnemonic** from the %%entropy%%.
  44. *
  45. * The default %%password%% is the empty string and the default
  46. * wordlist is the [English wordlists](LangEn).
  47. */
  48. static fromEntropy(_entropy: BytesLike, password?: null | string, wordlist?: null | Wordlist): Mnemonic;
  49. /**
  50. * Returns the phrase for %%mnemonic%%.
  51. */
  52. static entropyToPhrase(_entropy: BytesLike, wordlist?: null | Wordlist): string;
  53. /**
  54. * Returns the entropy for %%phrase%%.
  55. */
  56. static phraseToEntropy(phrase: string, wordlist?: null | Wordlist): string;
  57. /**
  58. * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase.
  59. *
  60. * This checks all the provided words belong to the %%wordlist%%,
  61. * that the length is valid and the checksum is correct.
  62. */
  63. static isValidMnemonic(phrase: string, wordlist?: null | Wordlist): boolean;
  64. }
  65. //# sourceMappingURL=mnemonic.d.ts.map