if (typeof address !== 'string') {
throw new Error('Address must be a string for rolodex entries')
}
- name = name
- .replaceAll('/', '\\u002f')
- .replaceAll('<', '\\u003c')
- .replaceAll('>', '\\u003e')
- .replaceAll('\\', '\\u005c')
const account = new Account(address)
try {
/**
* Gets all names stored in the rolodex.
*
+ * Be sure to sanitize names before displaying in HTML to prevent XSS.
+ *
* @returns {Promise<string[]>} Promise for a list of all names stored in the rolodex
*/
static async getAllNames (): Promise<string[]> {
/**
* Gets the name associated with a specific Nano address from the rolodex.
*
+ * Be sure to sanitize names before displaying in HTML to prevent XSS.
+ *
* @param {string} address - Nano account address
* @returns {Promise<string|null>} Promise for the name associated with the address, or null if not found
*/
*
* @param {string} name - Alias to look up
* @param {string} signature - Signature to use for verification
- * @param {string} data - Signed data to verify
+ * @param {string} data - UTF-8 string of signed data to verify
* @returns {Promise<boolean>} True if the signature was used to sign the data, else false
*/
static async verify (name: string, signature: string, data: string): Promise<boolean> {
data ??= {}
data.action = action.toLowerCase()
const body = JSON.stringify(data)
- .replaceAll('/', '\\u002f')
- .replaceAll('<', '\\u003c')
- .replaceAll('>', '\\u003e')
- .replaceAll('\\', '\\u005c')
const aborter = new AbortController()
const req = new Request(this.#u, {