(credentials)
| 412 | } |
| 413 | |
| 414 | fromObj(credentials) { |
| 415 | $.checkArgument(credentials && typeof credentials === 'object' && !Array.isArray(credentials), 'Argument should be an object'); |
| 416 | |
| 417 | try { |
| 418 | credentials = Credentials.fromObj(credentials); |
| 419 | this.credentials = credentials; |
| 420 | } catch (ex) { |
| 421 | log.warn(`Error importing wallet: ${ex}`); |
| 422 | if (ex.toString().match(/Obsolete/)) { |
| 423 | throw new Errors.OBSOLETE_BACKUP(); |
| 424 | } else { |
| 425 | throw new Errors.INVALID_BACKUP(); |
| 426 | } |
| 427 | } |
| 428 | this.request.setCredentials(this.credentials); |
| 429 | return this; |
| 430 | } |
| 431 | |
| 432 | /** |
| 433 | * Import credentials from a string |
no test coverage detected