await SafeWorker.request<boolean>({\r
method: 'destroy',\r
store: 'Account',\r
- name: this.publicKey\r
+ names: this.publicKey\r
})\r
} catch (err) {\r
console.error(err)\r
try {\r
const response = await SafeWorker.request<ArrayBuffer>({\r
method: 'fetch',\r
- name: this.publicKey,\r
+ names: this.publicKey,\r
store: 'Account',\r
password: password.buffer\r
})\r
const { result } = await SafeWorker.request<boolean>({
method: 'destroy',
store: 'Rolodex',
- name: address
+ names: address
})
return result
}
for (const address of addresses) {
names.push(address)
}
- data.name = JSON.stringify(names)
+ data.names = names
const { result } = await SafeWorker.request<boolean>(data)
return result
}
try {
const response = await SafeWorker.request<ArrayBuffer>({
method: 'fetch',
- name,
+ names: name,
store: 'Rolodex',
password: utf8.toBuffer('')
})
try {
const response = await SafeWorker.request<ArrayBuffer>({
method: 'export',
- name: '',
store: 'Rolodex',
password: utf8.toBuffer('')
})
try {
const response = await SafeWorker.request<ArrayBuffer>({
method: 'fetch',
- name: address,
+ names: address,
store: 'Rolodex',
password: utf8.toBuffer('')
})
await SafeWorker.request<boolean>({\r
store: 'Wallet',\r
method: 'destroy',\r
- [this.id]: this.id\r
+ name: this.id\r
})\r
} catch (err) {\r
console.error(err)\r
}\r
const response = await SafeWorker.request<ArrayBuffer>({\r
method: 'fetch',\r
- name: this.id,\r
+ names: this.id,\r
store: 'Wallet',\r
password: password.buffer\r
})\r
if (typeof data !== 'object') {
throw new TypeError('Invalid data')
}
- const { method, names, store, password } = data as { [key: string]: unknown }
+ let { method, names, store, password, ...buffers } = data as { [key: string]: unknown }
if (typeof method !== 'string') {
throw new TypeError('Invalid method')
}
+ if (typeof names === 'string') names = [names]
function validateNames (names: unknown): asserts names is string[] {
- if (!Array.isArray(names) || names.some(n => typeof n !== 'string')) {
+ if (names !== undefined && (!Array.isArray(names) || names.some(n => typeof n !== 'string'))) {
throw new TypeError('Invalid name')
}
}
try {
switch (method) {
case 'store': {
- return { result: await this.store(data, store, password) }
+ return { result: await this.store(buffers, store, password) }
}
case 'fetch': {
return await this.fetch(names, store, password)