diff --git a/package.json b/package.json index e0f48b7..38a0fc7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@wharfkit/wallet-plugin-web-authenticator", "description": "A Web Authenticator wallet plugin for use with @wharfkit/session.", - "version": "0.3.1", + "version": "0.4.0", "homepage": "https://github.com/wharfkit/wallet-plugin-web-authenticator", "license": "BSD-3-Clause", "main": "lib/wallet-plugin-web-authenticator.js", diff --git a/src/index.ts b/src/index.ts index 61d0998..f942505 100644 --- a/src/index.ts +++ b/src/index.ts @@ -228,8 +228,8 @@ export class WalletPluginWebAuthenticator extends AbstractWalletPlugin implement context.ui ) - this.data.privateKey = String(privateKey) - this.data.publicKey = payload.link_key + this.data.encryptionKey = String(privateKey) + this.data.messageKey = payload.link_key if (!payload.cid) { throw new Error('Login failed: No chain ID returned') @@ -274,7 +274,7 @@ export class WalletPluginWebAuthenticator extends AbstractWalletPlugin implement ): Promise { try { // Ensure we have a request key from login - if (!this.data.privateKey || !this.data.publicKey) { + if (!this.data.encryptionKey || !this.data.messageKey) { throw new Error('No request keys available - please login first') } @@ -299,8 +299,8 @@ export class WalletPluginWebAuthenticator extends AbstractWalletPlugin implement const sealedRequest = await sealMessage( modifiedRequest.encode(), - PrivateKey.from(this.data.privateKey), - PublicKey.from(this.data.publicKey), + PrivateKey.from(this.data.encryptionKey), + PublicKey.from(this.data.messageKey), nonce ) @@ -310,7 +310,7 @@ export class WalletPluginWebAuthenticator extends AbstractWalletPlugin implement context.accountName }&permissionName=${context.permissionName}&appName=${ context.appName - }&requestKey=${String(PrivateKey.from(this.data.privateKey).toPublic())}` + }&requestKey=${String(PrivateKey.from(this.data.encryptionKey).toPublic())}` const response = await this.openPopup(signUrl, callback, context.ui) diff --git a/test/tests/common.ts b/test/tests/common.ts index ee896ee..80ffa1a 100644 --- a/test/tests/common.ts +++ b/test/tests/common.ts @@ -1,5 +1,5 @@ import {Chains, SessionKit} from '@wharfkit/session' -import {PermissionLevel, Signature, APIClient, PrivateKey} from '@wharfkit/antelope' +import {APIClient, PermissionLevel, PrivateKey, Signature} from '@wharfkit/antelope' import { mockChainDefinition, mockPermissionLevel, @@ -9,21 +9,21 @@ import { } from '@wharfkit/mock-data' import {assert} from 'chai' import { - LoginContext, - ResolvedSigningRequest, - TransactContext, - ChainDefinition, ABICacheInterface, - WalletPluginSignResponse, - UserInterface, Cancelable, + ChainDefinition, + CreateAccountContext, + LoginContext, + LoginHooks, PromptArgs, PromptResponse, + ResolvedSigningRequest, + TransactContext, TransactHooks, - LoginHooks, - UserInterfaceLoginResponse, + UserInterface, UserInterfaceAccountCreationResponse, - CreateAccountContext, + UserInterfaceLoginResponse, + WalletPluginSignResponse, } from '@wharfkit/session' import {WalletPluginWebAuthenticator} from '$lib' @@ -235,8 +235,8 @@ suite('wallet plugin', function () { // Use different keys for the sign test to avoid channel ID conflicts const signPrivateKey = PrivateKey.generate('K1') const signPublicKey = signPrivateKey.toPublic() - plugin.data.privateKey = signPrivateKey - plugin.data.publicKey = signPublicKey + plugin.data.encryptionKey = signPrivateKey + plugin.data.messageKey = signPublicKey const mockResolvedSigningRequest = await makeMockResolvedSigningRequest()