Skip to content

Commit

Permalink
renamed to handshake (#1479)
Browse files Browse the repository at this point in the history
  • Loading branch information
fan-zhang-sv authored Jan 16, 2025
1 parent 3cd583e commit 59a6feb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/wallet-sdk/src/CoinbaseWalletProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('Ephemeral methods', () => {
const args = { method: 'wallet_sign', params: ['0xdeadbeef'] };
expect(provider['signer']).toBeNull();
await provider.request(args);
expect(mockHandshake).toHaveBeenCalledWith({ method: 'coinbase_handshake' });
expect(mockHandshake).toHaveBeenCalledWith({ method: 'handshake' });
expect(mockRequest).toHaveBeenCalledWith(args);
expect(mockCleanup).toHaveBeenCalled();
expect(provider['signer']).toBeNull();
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet-sdk/src/CoinbaseWalletProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class CoinbaseWalletProvider extends ProviderEventEmitter implements Prov
case 'wallet_sendCalls':
case 'wallet_sign': {
const ephemeralSigner = this.initSigner('scw');
await ephemeralSigner.handshake({ method: 'coinbase_handshake' }); // exchange session keys
await ephemeralSigner.handshake({ method: 'handshake' }); // exchange session keys
const result = await ephemeralSigner.request(args); // send diffie-hellman encrypted request
await ephemeralSigner.cleanup(); // clean up (rotate) the ephemeral session keys
return result as T;
Expand Down
10 changes: 5 additions & 5 deletions packages/wallet-sdk/src/sign/scw/SCWSigner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,22 @@ describe('SCWSigner', () => {
expect(mockCallback).toHaveBeenCalledWith('connect', { chainId: '0x1' });
});

it('should perform a successful handshake for coinbase_handshake', async () => {
it('should perform a successful handshake for handshake', async () => {
(decryptContent as Mock).mockResolvedValueOnce({
result: {
value: null,
},
});

await signer.handshake({ method: 'coinbase_handshake' });
await signer.handshake({ method: 'handshake' });

expect(importKeyFromHexString).toHaveBeenCalledWith('public', '0xPublicKey');
expect(mockCommunicator.postRequestAndWaitForResponse).toHaveBeenCalledWith(
expect.objectContaining({
sender: '0xPublicKey',
content: {
handshake: expect.objectContaining({
method: 'coinbase_handshake',
method: 'handshake',
}),
},
})
Expand Down Expand Up @@ -168,7 +168,7 @@ describe('SCWSigner', () => {

describe('request - using ephemeral SCWSigner', () => {
it.each(['wallet_sign', 'wallet_sendCalls'])(
'should perform a successful request after coinbase_handshake',
'should perform a successful request after handshake',
async (method) => {
const mockRequest: RequestArguments = { method };

Expand All @@ -177,7 +177,7 @@ describe('SCWSigner', () => {
value: null,
},
});
await signer.handshake({ method: 'coinbase_handshake' });
await signer.handshake({ method: 'handshake' });
expect(signer['accounts']).toEqual([]);

(decryptContent as Mock).mockResolvedValueOnce({
Expand Down

0 comments on commit 59a6feb

Please sign in to comment.