Skip to content

Commit

Permalink
fix: making popup smaller
Browse files Browse the repository at this point in the history
cleanup: code cleanup
  • Loading branch information
dafuga committed Dec 24, 2024
1 parent 8cbd7d8 commit f36e92b
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class WalletPluginWebAuthenticator extends AbstractWalletPlugin implement
*/
private async openPopup(url: string): Promise<any> {
return new Promise((resolve, reject) => {
const popup = window.open(url, 'Web Authenticator', 'width=800,height=600')
const popup = window.open(url, 'Web Authenticator', 'width=400,height=600')

if (!popup) {
reject(new Error('Popup blocked - please enable popups for this site'))
Expand Down Expand Up @@ -143,28 +143,17 @@ export class WalletPluginWebAuthenticator extends AbstractWalletPlugin implement
}`
const response = await this.openPopup(signUrl)

console.log('response', response)

const wasSuccessful =
isCallback(response.payload) &&
extractSignaturesFromCallback(response.payload).length > 0

console.log('wasSuccessful', wasSuccessful)
console.log('isCallback', isCallback(response.payload))
console.log(
'extractSignaturesFromCallback',
extractSignaturesFromCallback(response.payload)
)

if (wasSuccessful) {
// If the callback was resolved, create a new request from the response
const resolvedRequest = await ResolvedSigningRequest.fromPayload(
response.payload,
context.esrOptions
)

console.log('resolvedRequest', resolvedRequest)

// Return the new request and the signatures from the wallet
return {
signatures: extractSignaturesFromCallback(response.payload),
Expand All @@ -173,10 +162,6 @@ export class WalletPluginWebAuthenticator extends AbstractWalletPlugin implement
} else {
throw new Error('Signing failed: No signatures returned')
}

return {
signatures: response.signatures.map((sig: string) => Signature.from(sig)),
}
} catch (error: unknown) {
if (error instanceof Error) {
throw new Error(`Signing failed: ${error.message}`)
Expand Down

0 comments on commit f36e92b

Please sign in to comment.