if (name == null || name === '') {
throw new Error('Name is required for rolodex entries')
}
+ if (typeof name !== 'string') {
+ throw new Error('Name must be a string for rolodex entries')
+ }
if (address == null || address === '') {
- throw new Error('address is required for rolodex entries')
+ throw new Error('Address is required for rolodex entries')
+ }
+ if (typeof address !== 'string') {
+ throw new Error('Address must be a string for rolodex entries')
}
+ name = name
+ .replaceAll('/', '\\u002f')
+ .replaceAll('<', '\\u003c')
+ .replaceAll('>', '\\u003d')
+ .replaceAll('\\', '\\u005c')
const account = new Account(address)
const nameResult = this.#entries.find(e => e.name === name)
const accountResult = this.#entries.find(e => e.account.address === address)
}
/**
- * Gets all Nano addresses associated with a name from the rolodex.
+ * Gets all names associated with a name from the rolodex.
*
* @param {string} name - Alias to look up
* @returns {string[]} List of Nano addresses associated with the name
return entries.map(a => a.account.address)
}
+ /**
+ * Gets all names stored in the rolodex.
+ *
+ * @returns {string[]} List of names stored in the rolodex
+ */
+ getAllNames (): string[] {
+ return this.#entries.map(e => e.name)
+ }
+
/**
* Verifies whether the public key of any Nano address saved under a specific
* name in the rolodex was used to sign a specific set of data.