Nyzo techRelease notesNyzo Chrome 7: automatic transaction authorization

Nyzo Chrome 7: automatic transaction authorization

Nyzo Chrome extension version 7 (commit on GitHub) adds a flow for authorization of automatic transactions.

This version adds protections that will allow automatic transactions to be used by a wider user base, and this version will be submitted to the Chrome Web Store. However, we will always recommend using a low-balance account for the Chrome extension.

In the content script, the tipConfiguration and micropayConfiguration have been moved outside the initializeExtension() function. This allows the configurations to be updated after page load. Also, the automaticConfiguration was added to allow the page to request authorization for automatic transactions.

CX_7 image 0

The iteration style for the listener for storage changes was modified, and a condition was added to respond to changes in automatic transaction authorizations.

CX_7 image 1

Authorized automatic amounts are also now sent to the page to allow it to respond appropriately when authorization is inadequate for proper function.

CX_7 image 2

Loading of Micropay configurations from the page has been refactored to the loadConfigurationFromPage() function. This allows the configuration to be loaded both on page load and whenever the nyzo-configuration-changed event is received. The message listener from lines 51 through 71 is not new code. This is in the diff due to the movement of other code.

CX_7 image 3

As noted above, the tipConfiguration and micropayConfiguration are now declared outside the initialization function.

CX_7 image 4

The removed code from lines 72 to 89 has moved to starting at line 51, as indicated above.

The automatic configuration is now read and stored. This configuration allows specification of a receiver, minimum amount, recommended amount, and display name. Configuration of both an amount and receiver makes automatic transactions as safe as conventional transactions. Users only send money to intended recipients, and users send no more than intended amounts.

The display name, not yet used, will allow better communication to users about the purpose of the authorization.

CX_7 image 5

When sending an automatic transaction, the authorization amount for the specified receiver is now checked.

CX_7 image 6

Automatic transaction amounts are deducted from authorizations.

CX_7 image 7

All automatic authorizations amounts are communicated to the page on initialization with the sendAuthorizedAutomaticAmountsToPage() function. They are also sent to the page whenever they change. This includes both increases due to new authorizations and decreases due to sending of automatic transactions.

CX_7 image 8

Support of the the maximum automatic authorization parameter has been added to the extensionUtil script.

CX_7 image 9

The extension's description has been updated to reflect the new functionality offered by automatic transactions.

CX_7 image 10

A field has been added to the options page for maximum automatic authorization.

CX_7 image 11

The options script was modified to support the maximum automatic authorization field.

CX_7 image 12

The validateAndStoreMaximumAutomaticAuthorization() function follows the same pattern as the other validateAndStore...() functions.

CX_7 image 13

In the popup, an inconsequential oversight in the placeholder texts of the Micropay notices was remedied.

CX_7 image 14

Also in the popup, elements were added to support automatic authorizations.

CX_7 image 15

The page notice in the popup was modified to be more inclusive of current extension functionality.

CX_7 image 16

Some variable declarations in the popup script were modified from var to let to improve scoping. The micropayButtonsActive variable was unused, so it was removed.

CX_7 image 17

The automatic authorization section of the popup is configured when authorization information is available.

CX_7 image 18

Hiding of the last divider in the popup was generalized to account for the presence of the automatic authorization section.

When a valid automatic configuration is available, the page notice is hidden. The page notice is only shown when a page does not use Micropay at all.

CX_7 image 19

The new elements were added to the set of elements that are hidden when the extension configuration is not valid.

CX_7 image 20

The configureAutomaticSection() function displays either a button for authorizing an amount or a notice displaying the currently authorized amount. This function calculates the actual amount to be authorized, storing that value on the button for when it is clicked. If the maximum automatic authorization configured in the extension options is less than the page's recommended authorization, the authorization amount is reduced to avoid exceeding this maximum. If the extension's maximum automatic authorization is less than the page's minimum authorization, an error is displayed.

CX_7 image 21

The automaticButtonClicked() function stores the authorization in local extension storage. This triggers the listener that notifies the page that the authorization has changed, and it makes the authorization available for future automatic transactions.

CX_7 image 22

The code for storing and sending Micropay transactions in the sendTransaction() function has been reorganized slightly. Storage has been moved outside the tab query, as it had not reason to be inside the tab query, and the array of tabs is now checked to avoid an error if the array is empty.

CX_7 image 23

In the resendTransaction() function, the array of tabs is also now checked to avoid an error.

CX_7 image 24

The isValidAutomaticConfiguration() function checks the configuration retrieved from the page. The isValidExtensionConfiguration() function now includes a check of the maximum automatic authorization amount.

CX_7 image 25

In the style sheet, the public-identifier class was added for display of Nyzo public identifier strings.

CX_7 image 26