Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: verify v2 #5236

Merged
merged 28 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
951f993
wip: verify v2 - submit attestation
ganchoradkov Jul 30, 2024
0596131
chore: sents `attestation` with publish payload
ganchoradkov Jul 31, 2024
d1966d4
feat: verify v2
ganchoradkov Aug 1, 2024
f755ef6
refactor: uses getDocument()
ganchoradkov Aug 6, 2024
07823a5
Merge branch 'v2.0' into feat/verify-v2
ganchoradkov Aug 9, 2024
2c79c58
Merge branch 'feat/verify-v2' of github.com:WalletConnect/walletconne…
ganchoradkov Aug 9, 2024
318a0e2
refactor: makes verify v2 public key being fetched only when attempte…
ganchoradkov Aug 9, 2024
d11901e
chore: canary relay api
ganchoradkov Aug 9, 2024
18d5f6b
chore: prettier
ganchoradkov Aug 9, 2024
6b5a70a
fix: adds new `attestation` field to publisher tests
ganchoradkov Aug 9, 2024
e0d979e
fix: relayer test with new `attestation` param
ganchoradkov Aug 9, 2024
730bca3
chore: updates relay-api to stable
ganchoradkov Aug 9, 2024
5210e5a
feat: adds test
ganchoradkov Aug 9, 2024
3ddbfc7
chore: clean up logs
ganchoradkov Aug 9, 2024
372a42e
chore: bump node to 20
ganchoradkov Aug 9, 2024
9659018
fix: logging & rm event listener
ganchoradkov Aug 9, 2024
faeed6d
fix: subtle crypto in node
ganchoradkov Aug 9, 2024
0141609
Merge branch 'v2.0' into feat/verify-v2
ganchoradkov Aug 12, 2024
82e5cd4
refactor: log rejections & unsubscribe on abortController
ganchoradkov Aug 12, 2024
9535ca9
Merge branch 'feat/verify-v2' of github.com:WalletConnect/walletconne…
ganchoradkov Aug 12, 2024
0ef5ee2
chore: handle invalid keys
ganchoradkov Aug 12, 2024
92d77a9
Merge branch 'v2.0' into feat/verify-v2
ganchoradkov Aug 12, 2024
24614bd
chore: fixes typo
ganchoradkov Aug 12, 2024
9e9bf2e
Merge branch 'feat/verify-v2' of github.com:WalletConnect/walletconne…
ganchoradkov Aug 12, 2024
fb3dceb
feat: implements `ecdsa` signature validation without relying on `nod…
ganchoradkov Aug 14, 2024
0c4df5c
chore: cleanup
ganchoradkov Aug 15, 2024
29f8df8
feat: adds unhappy path tests
ganchoradkov Aug 15, 2024
1c229bd
chore: uses const
ganchoradkov Aug 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: setup-node
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: install
Expand Down
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@walletconnect/jsonrpc-ws-connection": "1.0.14",
"@walletconnect/keyvaluestorage": "1.1.1",
"@walletconnect/logger": "2.1.2",
"@walletconnect/relay-api": "1.0.10",
"@walletconnect/relay-api": "1.0.11",
"@walletconnect/relay-auth": "1.0.4",
"@walletconnect/safe-json": "1.0.2",
"@walletconnect/time": "1.0.2",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/constants/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ export const VERIFY_CONTEXT = "verify-api";
const VERIFY_SERVER_COM = "https://verify.walletconnect.com";
const VERIFY_SERVER_ORG = "https://verify.walletconnect.org";
export const VERIFY_SERVER = VERIFY_SERVER_ORG;
export const VERIFY_SERVER_V2 = "https://verify.walletconnect.org/v2";
ganchoradkov marked this conversation as resolved.
Show resolved Hide resolved

export const TRUSTED_VERIFY_URLS = [VERIFY_SERVER_COM, VERIFY_SERVER_ORG];
19 changes: 16 additions & 3 deletions packages/core/src/controllers/publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,18 @@ export class Publisher extends IPublisher {
const prompt = opts?.prompt || false;
const tag = opts?.tag || 0;
const id = opts?.id || (getBigIntRpcId().toString() as any);
const params = { topic, message, opts: { ttl, relay, prompt, tag, id } };
const params = {
topic,
message,
opts: {
ttl,
relay,
prompt,
tag,
id,
attestation: opts?.attestation,
},
};
const failedPublishMessage = `Failed to publish payload, please try again. id:${id} tag:${tag}`;
const startPublish = Date.now();
let result;
Expand All @@ -63,8 +74,8 @@ export class Publisher extends IPublisher {

this.logger.trace({ id, attempts }, `publisher.publish - attempt ${attempts}`);
const publish = await createExpiringPromise(
this.rpcPublish(topic, message, ttl, relay, prompt, tag, id).catch((e) =>
this.logger.warn(e),
this.rpcPublish(topic, message, ttl, relay, prompt, tag, id, opts?.attestation).catch(
(e) => this.logger.warn(e),
),
this.publishTimeout,
failedPublishMessage,
Expand Down Expand Up @@ -121,6 +132,7 @@ export class Publisher extends IPublisher {
prompt?: boolean,
tag?: number,
id?: number,
attestation?: string,
) {
const api = getRelayProtocolApi(relay.protocol);
const request: RequestArguments<RelayJsonRpc.PublishParams> = {
Expand All @@ -131,6 +143,7 @@ export class Publisher extends IPublisher {
ttl,
prompt,
tag,
attestation,
},
id,
};
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/controllers/relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@ export class Relayer extends IRelayer {
if (isJsonRpcRequest(payload)) {
if (!payload.method.endsWith(RELAYER_SUBSCRIBER_SUFFIX)) return;
const event = (payload as JsonRpcRequest<RelayJsonRpc.SubscriptionParams>).params;
const { topic, message, publishedAt } = event.data;
const messageEvent: RelayerTypes.MessageEvent = { topic, message, publishedAt };
const { topic, message, publishedAt, attestation } = event.data;
const messageEvent: RelayerTypes.MessageEvent = { topic, message, publishedAt, attestation };
this.logger.debug(`Emitting Relayer Payload`);
this.logger.trace({ type: "event", event: event.id, ...messageEvent });
this.events.emit(event.id, messageEvent);
Expand Down
Loading