From 35ea1f6c29c92c3e70df8e4bf30428306e8c14be Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Tue, 26 Nov 2024 10:08:45 -0500 Subject: [PATCH 01/27] authorize with lib --- packages/frames-validator/package.json | 2 +- packages/frames-validator/src/validation.ts | 4 ++-- sdks/node-sdk/package.json | 4 ++-- sdks/node-sdk/src/Client.ts | 7 ++++++ yarn.lock | 26 ++++++++++++++++++--- 5 files changed, 35 insertions(+), 8 deletions(-) diff --git a/packages/frames-validator/package.json b/packages/frames-validator/package.json index 68f61891..a8c47397 100644 --- a/packages/frames-validator/package.json +++ b/packages/frames-validator/package.json @@ -40,7 +40,7 @@ "dependencies": { "@noble/curves": "^1.3.0", "@noble/hashes": "^1.4.0", - "@xmtp/node-sdk": "^0.0.27", + "@xmtp/node-sdk": "workspace:^", "@xmtp/proto": "^3.72.3", "uint8array-extras": "^1.4.0", "viem": "^2.16.5" diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index d9713e7f..3aff65a6 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -48,8 +48,8 @@ export async function validateFramesPost( } } else { // make sure inbox IDs match - const addressInboxId = await getInboxIdForAddress(walletAddress, env); - if (inboxId !== addressInboxId) { + const authorized = Client.isAddressAuthorized(inboxId, walletAddress); + if (!authorized) { throw new Error("Invalid inbox ID"); } diff --git a/sdks/node-sdk/package.json b/sdks/node-sdk/package.json index aaea946d..35ad41fc 100644 --- a/sdks/node-sdk/package.json +++ b/sdks/node-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/node-sdk", - "version": "0.0.27", + "version": "0.0.28", "description": "XMTP Node client SDK for interacting with XMTP networks", "keywords": [ "xmtp", @@ -53,7 +53,7 @@ "@xmtp/content-type-group-updated": "^1.0.1", "@xmtp/content-type-primitives": "^1.0.3", "@xmtp/content-type-text": "^1.0.1", - "@xmtp/node-bindings": "^0.0.22", + "@xmtp/node-bindings": "^0.0.23", "@xmtp/proto": "^3.72.3" }, "devDependencies": { diff --git a/sdks/node-sdk/src/Client.ts b/sdks/node-sdk/src/Client.ts index 2bd7eff0..eaea9149 100644 --- a/sdks/node-sdk/src/Client.ts +++ b/sdks/node-sdk/src/Client.ts @@ -172,6 +172,13 @@ export class Client { return this.#innerClient.isRegistered(); } + async isAddressAuthorized( + inboxId: string, + address: string, + ): Promise { + return this.#innerClient.isAddressAuthorized(inboxId, address); + } + async #createInboxSignatureText() { try { const signatureText = await this.#innerClient.createInboxSignatureText(); diff --git a/yarn.lock b/yarn.lock index 011b1f85..af9672c0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5065,7 +5065,7 @@ __metadata: "@rollup/plugin-typescript": "npm:^12.1.1" "@types/bl": "npm:^5.1.4" "@xmtp/frames-client": "npm:^1.0.0" - "@xmtp/node-sdk": "npm:^0.0.27" + "@xmtp/node-sdk": "workspace:^" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "npm:^12.1.0" ethers: "npm:^6.10.0" @@ -5086,7 +5086,27 @@ __metadata: languageName: node linkType: hard -"@xmtp/node-sdk@npm:^0.0.27, @xmtp/node-sdk@workspace:sdks/node-sdk": +"@xmtp/node-bindings@npm:^0.0.23": + version: 0.0.23 + resolution: "@xmtp/node-bindings@npm:0.0.23" + checksum: 10/c7327d874c0ec05027bb40b9d51bcc436662aabb9a8d342fbf8ef96f03fe103a596785b312e760b76df68f8176fe8baf348019328f89ff63e4faed17219fbe61 + languageName: node + linkType: hard + +"@xmtp/node-sdk@npm:^0.0.27": + version: 0.0.27 + resolution: "@xmtp/node-sdk@npm:0.0.27" + dependencies: + "@xmtp/content-type-group-updated": "npm:^1.0.1" + "@xmtp/content-type-primitives": "npm:^1.0.3" + "@xmtp/content-type-text": "npm:^1.0.1" + "@xmtp/node-bindings": "npm:^0.0.22" + "@xmtp/proto": "npm:^3.72.3" + checksum: 10/9937c77d4bd3f3ed8df2f9938e940e2c21a7c8e8f06506d227bb97939f8294e0ae6ec6bc1498f528274257d61f9142e38639aa123c3ddf086a98d9cd041c0161 + languageName: node + linkType: hard + +"@xmtp/node-sdk@workspace:^, @xmtp/node-sdk@workspace:sdks/node-sdk": version: 0.0.0-use.local resolution: "@xmtp/node-sdk@workspace:sdks/node-sdk" dependencies: @@ -5097,7 +5117,7 @@ __metadata: "@xmtp/content-type-group-updated": "npm:^1.0.1" "@xmtp/content-type-primitives": "npm:^1.0.3" "@xmtp/content-type-text": "npm:^1.0.1" - "@xmtp/node-bindings": "npm:^0.0.22" + "@xmtp/node-bindings": "npm:^0.0.23" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "workspace:^" fast-glob: "npm:^3.3.2" From c2123dce7f6904dd6bc1344e896f7f262b18b0c9 Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Tue, 26 Nov 2024 10:11:35 -0500 Subject: [PATCH 02/27] wip --- packages/frames-validator/src/validation.ts | 4 ++-- sdks/node-sdk/src/Client.ts | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index 3aff65a6..d54f8924 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -28,7 +28,7 @@ export async function validateFramesPost( actionBodyBytes, signature, signedPublicKeyBundle, - installationId, // not necessary + installationId, installationSignature, inboxId, } = deserializeProtoMessage(messageBytes); @@ -48,7 +48,7 @@ export async function validateFramesPost( } } else { // make sure inbox IDs match - const authorized = Client.isAddressAuthorized(inboxId, walletAddress); + const authorized = Client.isInstallationAuthorized(inboxId, installationId); if (!authorized) { throw new Error("Invalid inbox ID"); } diff --git a/sdks/node-sdk/src/Client.ts b/sdks/node-sdk/src/Client.ts index eaea9149..66416229 100644 --- a/sdks/node-sdk/src/Client.ts +++ b/sdks/node-sdk/src/Client.ts @@ -179,6 +179,13 @@ export class Client { return this.#innerClient.isAddressAuthorized(inboxId, address); } + async isInstallationAuthorized( + inboxId: string, + installationId: Uint8Array, + ): Promise { + return this.#innerClient.isInstallationAuthorized(inboxId, installationId); + } + async #createInboxSignatureText() { try { const signatureText = await this.#innerClient.createInboxSignatureText(); From 13aac7f7744f513c18336fda0c63a8738acaf4f6 Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Tue, 26 Nov 2024 10:34:39 -0500 Subject: [PATCH 03/27] bump node bindings --- sdks/node-sdk/package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdks/node-sdk/package.json b/sdks/node-sdk/package.json index 35ad41fc..27d511c5 100644 --- a/sdks/node-sdk/package.json +++ b/sdks/node-sdk/package.json @@ -53,7 +53,7 @@ "@xmtp/content-type-group-updated": "^1.0.1", "@xmtp/content-type-primitives": "^1.0.3", "@xmtp/content-type-text": "^1.0.1", - "@xmtp/node-bindings": "^0.0.23", + "@xmtp/node-bindings": "^0.0.24", "@xmtp/proto": "^3.72.3" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index af9672c0..ef392b05 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5086,10 +5086,10 @@ __metadata: languageName: node linkType: hard -"@xmtp/node-bindings@npm:^0.0.23": - version: 0.0.23 - resolution: "@xmtp/node-bindings@npm:0.0.23" - checksum: 10/c7327d874c0ec05027bb40b9d51bcc436662aabb9a8d342fbf8ef96f03fe103a596785b312e760b76df68f8176fe8baf348019328f89ff63e4faed17219fbe61 +"@xmtp/node-bindings@npm:^0.0.24": + version: 0.0.24 + resolution: "@xmtp/node-bindings@npm:0.0.24" + checksum: 10/3cd8cda6a0183c06e5ce8c5645ebc05cc714d191bb1be0ba359c6c084c91af88b0dfe0ce93c3299fe71bb691097de79af068bea069c673449fa69b188aa6895d languageName: node linkType: hard @@ -5117,7 +5117,7 @@ __metadata: "@xmtp/content-type-group-updated": "npm:^1.0.1" "@xmtp/content-type-primitives": "npm:^1.0.3" "@xmtp/content-type-text": "npm:^1.0.1" - "@xmtp/node-bindings": "npm:^0.0.23" + "@xmtp/node-bindings": "npm:^0.0.24" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "workspace:^" fast-glob: "npm:^3.3.2" From 9badaec2364d7b4adf5f0f55b18df9a4fbda0e2d Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Tue, 26 Nov 2024 10:35:34 -0500 Subject: [PATCH 04/27] await --- packages/frames-validator/src/validation.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index d54f8924..5e775e01 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -48,7 +48,10 @@ export async function validateFramesPost( } } else { // make sure inbox IDs match - const authorized = Client.isInstallationAuthorized(inboxId, installationId); + const authorized = await Client.isInstallationAuthorized( + inboxId, + installationId, + ); if (!authorized) { throw new Error("Invalid inbox ID"); } From d60ddf4d0271c67880dc1252c1ebd0b1abedd83a Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Tue, 26 Nov 2024 10:39:04 -0500 Subject: [PATCH 05/27] messaging --- packages/frames-validator/src/validation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index 5e775e01..a58a4737 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -53,7 +53,7 @@ export async function validateFramesPost( installationId, ); if (!authorized) { - throw new Error("Invalid inbox ID"); + throw new Error("Installation not a member of association state"); } const digest = sha256(actionBodyBytes); From cda619baec9c3755e72728883b27c41c25b5d563 Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Tue, 26 Nov 2024 12:53:43 -0500 Subject: [PATCH 06/27] check the wallet --- packages/frames-validator/src/validation.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index a58a4737..b16af474 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -56,6 +56,11 @@ export async function validateFramesPost( throw new Error("Installation not a member of association state"); } + const isMember = await Client.isAddressAuthorized(inboxId, walletAddress); + if (!isMember) { + throw new Error("Unable to associate wallet address with inbox"); + } + const digest = sha256(actionBodyBytes); // make sure installation signature is valid From 8ada32ba4c356d28a4ac7f1a6bb79980f6607113 Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Tue, 26 Nov 2024 12:54:31 -0500 Subject: [PATCH 07/27] bump --- packages/frames-validator/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frames-validator/package.json b/packages/frames-validator/package.json index a8c47397..9f998f00 100644 --- a/packages/frames-validator/package.json +++ b/packages/frames-validator/package.json @@ -40,7 +40,7 @@ "dependencies": { "@noble/curves": "^1.3.0", "@noble/hashes": "^1.4.0", - "@xmtp/node-sdk": "workspace:^", + "@xmtp/node-sdk": "^0.0.28", "@xmtp/proto": "^3.72.3", "uint8array-extras": "^1.4.0", "viem": "^2.16.5" From 8d2e9a65646cd6bd65fee6333b4347b22e9c6de5 Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Tue, 26 Nov 2024 12:55:47 -0500 Subject: [PATCH 08/27] yarn install --- yarn.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yarn.lock b/yarn.lock index ef392b05..d4cd8f03 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5065,7 +5065,7 @@ __metadata: "@rollup/plugin-typescript": "npm:^12.1.1" "@types/bl": "npm:^5.1.4" "@xmtp/frames-client": "npm:^1.0.0" - "@xmtp/node-sdk": "workspace:^" + "@xmtp/node-sdk": "npm:^0.0.28" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "npm:^12.1.0" ethers: "npm:^6.10.0" @@ -5106,7 +5106,7 @@ __metadata: languageName: node linkType: hard -"@xmtp/node-sdk@workspace:^, @xmtp/node-sdk@workspace:sdks/node-sdk": +"@xmtp/node-sdk@npm:^0.0.28, @xmtp/node-sdk@workspace:sdks/node-sdk": version: 0.0.0-use.local resolution: "@xmtp/node-sdk@workspace:sdks/node-sdk" dependencies: From e530d1b63c6066f57c855344c8d76c3e73f38dec Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Tue, 26 Nov 2024 12:58:50 -0500 Subject: [PATCH 09/27] bump node bindings --- sdks/node-sdk/package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdks/node-sdk/package.json b/sdks/node-sdk/package.json index 27d511c5..85669228 100644 --- a/sdks/node-sdk/package.json +++ b/sdks/node-sdk/package.json @@ -53,7 +53,7 @@ "@xmtp/content-type-group-updated": "^1.0.1", "@xmtp/content-type-primitives": "^1.0.3", "@xmtp/content-type-text": "^1.0.1", - "@xmtp/node-bindings": "^0.0.24", + "@xmtp/node-bindings": "^0.0.25", "@xmtp/proto": "^3.72.3" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index d4cd8f03..ed8d7d8e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5086,10 +5086,10 @@ __metadata: languageName: node linkType: hard -"@xmtp/node-bindings@npm:^0.0.24": - version: 0.0.24 - resolution: "@xmtp/node-bindings@npm:0.0.24" - checksum: 10/3cd8cda6a0183c06e5ce8c5645ebc05cc714d191bb1be0ba359c6c084c91af88b0dfe0ce93c3299fe71bb691097de79af068bea069c673449fa69b188aa6895d +"@xmtp/node-bindings@npm:^0.0.25": + version: 0.0.25 + resolution: "@xmtp/node-bindings@npm:0.0.25" + checksum: 10/336f9b2a4a8b2781f6c53a7dd444428893f5e04a927350c82fcb79e37e0cc69abcb86406ffedeaa28115f1b57801890309546a10c9e806e3ed81b18b9d8f1431 languageName: node linkType: hard @@ -5117,7 +5117,7 @@ __metadata: "@xmtp/content-type-group-updated": "npm:^1.0.1" "@xmtp/content-type-primitives": "npm:^1.0.3" "@xmtp/content-type-text": "npm:^1.0.1" - "@xmtp/node-bindings": "npm:^0.0.24" + "@xmtp/node-bindings": "npm:^0.0.25" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "workspace:^" fast-glob: "npm:^3.3.2" From c33fa9e952e991a2e2d373134158a63df1607c59 Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Tue, 26 Nov 2024 14:40:17 -0500 Subject: [PATCH 10/27] bump node sdk version --- packages/frames-client/package.json | 2 +- packages/frames-validator/src/validation.ts | 8 +++--- sdks/node-sdk/src/Client.ts | 28 ++++++++++----------- yarn.lock | 22 +--------------- 4 files changed, 21 insertions(+), 39 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index c36b9ba5..7091c3ec 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -70,7 +70,7 @@ "@open-frames/types": "^0.1.1", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^12.1.1", - "@xmtp/node-sdk": "^0.0.27", + "@xmtp/node-sdk": "^0.0.28", "@xmtp/xmtp-js": "^12.0.0", "ethers": "^6.13.1", "fast-glob": "^3.3.2", diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index b16af474..fe002b00 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -14,6 +14,7 @@ export type * from "./types.js"; const { b64Decode } = fetcher; export async function validateFramesPost( + client: Client, data: XmtpOpenFramesRequest, env?: XmtpEnv, ): Promise { @@ -48,7 +49,7 @@ export async function validateFramesPost( } } else { // make sure inbox IDs match - const authorized = await Client.isInstallationAuthorized( + const authorized = await client.isInstallationAuthorized( inboxId, installationId, ); @@ -56,7 +57,8 @@ export async function validateFramesPost( throw new Error("Installation not a member of association state"); } - const isMember = await Client.isAddressAuthorized(inboxId, walletAddress); + const isMember = await client.isAddressAuthorized(inboxId, walletAddress); + if (!isMember) { throw new Error("Unable to associate wallet address with inbox"); } @@ -64,7 +66,7 @@ export async function validateFramesPost( const digest = sha256(actionBodyBytes); // make sure installation signature is valid - const valid = Client.verifySignedWithPublicKey( + const valid = client.verifySignedWithPublicKey( uint8ArrayToHex(digest), installationSignature, installationId, diff --git a/sdks/node-sdk/src/Client.ts b/sdks/node-sdk/src/Client.ts index 66416229..c8f7e8ab 100644 --- a/sdks/node-sdk/src/Client.ts +++ b/sdks/node-sdk/src/Client.ts @@ -172,20 +172,6 @@ export class Client { return this.#innerClient.isRegistered(); } - async isAddressAuthorized( - inboxId: string, - address: string, - ): Promise { - return this.#innerClient.isAddressAuthorized(inboxId, address); - } - - async isInstallationAuthorized( - inboxId: string, - installationId: Uint8Array, - ): Promise { - return this.#innerClient.isInstallationAuthorized(inboxId, installationId); - } - async #createInboxSignatureText() { try { const signatureText = await this.#innerClient.createInboxSignatureText(); @@ -283,6 +269,20 @@ export class Client { await this.#applySignatures(); } + async isAddressAuthorized( + inboxId: string, + address: string, + ): Promise { + return this.#innerClient.isAddressAuthorized(inboxId, address); + } + + async isInstallationAuthorized( + inboxId: string, + installationId: Uint8Array, + ): Promise { + return this.#innerClient.isInstallationAuthorized(inboxId, installationId); + } + async removeAccount(accountAddress: string) { const signatureText = await this.#removeAccountSignatureText(accountAddress); diff --git a/yarn.lock b/yarn.lock index ed8d7d8e..986bb607 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5033,7 +5033,7 @@ __metadata: "@open-frames/types": "npm:^0.1.1" "@rollup/plugin-terser": "npm:^0.4.4" "@rollup/plugin-typescript": "npm:^12.1.1" - "@xmtp/node-sdk": "npm:^0.0.27" + "@xmtp/node-sdk": "npm:^0.0.28" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "npm:^12.0.0" ethers: "npm:^6.13.1" @@ -5079,13 +5079,6 @@ __metadata: languageName: unknown linkType: soft -"@xmtp/node-bindings@npm:^0.0.22": - version: 0.0.22 - resolution: "@xmtp/node-bindings@npm:0.0.22" - checksum: 10/e8668b2fd30041dff8671625c13d49245d421ac31c0669b9be5365b5f22bf3c28f4d0cc12015a2710b90136423828bcdb1a99a10b37d4d5ac51e3ac47228b960 - languageName: node - linkType: hard - "@xmtp/node-bindings@npm:^0.0.25": version: 0.0.25 resolution: "@xmtp/node-bindings@npm:0.0.25" @@ -5093,19 +5086,6 @@ __metadata: languageName: node linkType: hard -"@xmtp/node-sdk@npm:^0.0.27": - version: 0.0.27 - resolution: "@xmtp/node-sdk@npm:0.0.27" - dependencies: - "@xmtp/content-type-group-updated": "npm:^1.0.1" - "@xmtp/content-type-primitives": "npm:^1.0.3" - "@xmtp/content-type-text": "npm:^1.0.1" - "@xmtp/node-bindings": "npm:^0.0.22" - "@xmtp/proto": "npm:^3.72.3" - checksum: 10/9937c77d4bd3f3ed8df2f9938e940e2c21a7c8e8f06506d227bb97939f8294e0ae6ec6bc1498f528274257d61f9142e38639aa123c3ddf086a98d9cd041c0161 - languageName: node - linkType: hard - "@xmtp/node-sdk@npm:^0.0.28, @xmtp/node-sdk@workspace:sdks/node-sdk": version: 0.0.0-use.local resolution: "@xmtp/node-sdk@workspace:sdks/node-sdk" From 3d4fa7ec9b1364d1d6e9dba69a305d9b85a7855a Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Wed, 27 Nov 2024 10:21:22 -0500 Subject: [PATCH 11/27] fix --- packages/frames-validator/src/validation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index fe002b00..382782d1 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -66,7 +66,7 @@ export async function validateFramesPost( const digest = sha256(actionBodyBytes); // make sure installation signature is valid - const valid = client.verifySignedWithPublicKey( + const valid = Client.verifySignedWithPublicKey( uint8ArrayToHex(digest), installationSignature, installationId, From 2cf9051d730ac8289d622f4ffd01ecc99fc8934b Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Wed, 27 Nov 2024 11:03:46 -0500 Subject: [PATCH 12/27] random client --- packages/frames-validator/src/validation.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index 382782d1..0185cd16 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -1,6 +1,8 @@ +import { getRandomValues } from "crypto"; import { sha256 } from "@noble/hashes/sha256"; -import { Client, getInboxIdForAddress, type XmtpEnv } from "@xmtp/node-sdk"; +import { Client, type XmtpEnv } from "@xmtp/node-sdk"; import { fetcher, frames, type publicKey, type signature } from "@xmtp/proto"; +import { getBytes, Wallet } from "ethers"; import { uint8ArrayToHex } from "uint8array-extras"; import type { UntrustedData, @@ -14,7 +16,6 @@ export type * from "./types.js"; const { b64Decode } = fetcher; export async function validateFramesPost( - client: Client, data: XmtpOpenFramesRequest, env?: XmtpEnv, ): Promise { @@ -48,6 +49,17 @@ export async function validateFramesPost( throw new Error("Invalid wallet address"); } } else { + let randomWallet = Wallet.createRandom(); + const encryptionKey = getRandomValues(new Uint8Array(32)); + const client = await Client.create( + { + getAddress: () => randomWallet.address, + signMessage: async (message: string) => + getBytes(await randomWallet.signMessage(message)), + }, + encryptionKey, + ); + // make sure inbox IDs match const authorized = await client.isInstallationAuthorized( inboxId, From 0eae3f6a6a114d87ee2c44a6f1ff4909f9752735 Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Wed, 27 Nov 2024 20:27:18 -0500 Subject: [PATCH 13/27] new bindings --- packages/frames-validator/src/validation.ts | 8 +++++--- sdks/node-sdk/package.json | 2 +- sdks/node-sdk/src/Client.ts | 20 ++++++++++++++++++++ yarn.lock | 10 +++++----- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index 0185cd16..12e9bdde 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -1,8 +1,8 @@ -import { getRandomValues } from "crypto"; +import { getRandomValues, randomBytes } from "crypto"; import { sha256 } from "@noble/hashes/sha256"; import { Client, type XmtpEnv } from "@xmtp/node-sdk"; import { fetcher, frames, type publicKey, type signature } from "@xmtp/proto"; -import { getBytes, Wallet } from "ethers"; +import { getBytes, LangEn, Mnemonic, Wallet } from "ethers"; import { uint8ArrayToHex } from "uint8array-extras"; import type { UntrustedData, @@ -13,6 +13,8 @@ import { verifyIdentityKeySignature, verifyWalletSignature } from "./utils.js"; export type * from "./types.js"; +// let seed = Mnemonic.fromEntropy(randomBytes(16), "", LangEn.wordlist()).computeSeed(); + const { b64Decode } = fetcher; export async function validateFramesPost( @@ -49,7 +51,7 @@ export async function validateFramesPost( throw new Error("Invalid wallet address"); } } else { - let randomWallet = Wallet.createRandom(); + const randomWallet = Wallet.createRandom(); const encryptionKey = getRandomValues(new Uint8Array(32)); const client = await Client.create( { diff --git a/sdks/node-sdk/package.json b/sdks/node-sdk/package.json index 85669228..326e55bb 100644 --- a/sdks/node-sdk/package.json +++ b/sdks/node-sdk/package.json @@ -53,7 +53,7 @@ "@xmtp/content-type-group-updated": "^1.0.1", "@xmtp/content-type-primitives": "^1.0.3", "@xmtp/content-type-text": "^1.0.1", - "@xmtp/node-bindings": "^0.0.25", + "@xmtp/node-bindings": "^0.0.26", "@xmtp/proto": "^3.72.3" }, "devDependencies": { diff --git a/sdks/node-sdk/src/Client.ts b/sdks/node-sdk/src/Client.ts index c8f7e8ab..45845af2 100644 --- a/sdks/node-sdk/src/Client.ts +++ b/sdks/node-sdk/src/Client.ts @@ -15,6 +15,8 @@ import { generateInboxId, getInboxIdForAddress, GroupMessageKind, + isAddressAuthorized as isAddressAuthorizedBinding, + isInstallationAuthorized as isInstallationAuthorizedBinding, LogLevel, SignatureRequestType, verifySignedWithPublicKey as verifySignedWithPublicKeyBinding, @@ -452,4 +454,22 @@ export class Client { return false; } } + + static async isAddressAuthorized( + networkOptions: NetworkOptions, + inboxId: string, + address: string, + ): Promise { + const host = networkOptions.apiUrl || ApiUrls[networkOptions.env || "dev"]; + return await isAddressAuthorizedBinding(host, inboxId, address); + } + + static async isInstallationAuthori( + networkOptions: NetworkOptions, + inboxId: string, + installation: Uint8Array, + ): Promise { + const host = networkOptions.apiUrl || ApiUrls[networkOptions.env || "dev"]; + return await isInstallationAuthorizedBinding(host, inboxId, installation); + } } diff --git a/yarn.lock b/yarn.lock index 986bb607..0a4dd4eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5079,10 +5079,10 @@ __metadata: languageName: unknown linkType: soft -"@xmtp/node-bindings@npm:^0.0.25": - version: 0.0.25 - resolution: "@xmtp/node-bindings@npm:0.0.25" - checksum: 10/336f9b2a4a8b2781f6c53a7dd444428893f5e04a927350c82fcb79e37e0cc69abcb86406ffedeaa28115f1b57801890309546a10c9e806e3ed81b18b9d8f1431 +"@xmtp/node-bindings@npm:^0.0.26": + version: 0.0.26 + resolution: "@xmtp/node-bindings@npm:0.0.26" + checksum: 10/a5b97f6619f84aa8d9d27e695598a39769659039e6d1ee4637baae63ceefb796e9a1c05af1f681228c644ea701e64bdb590aec3dda2b59a768bae6734c2f9503 languageName: node linkType: hard @@ -5097,7 +5097,7 @@ __metadata: "@xmtp/content-type-group-updated": "npm:^1.0.1" "@xmtp/content-type-primitives": "npm:^1.0.3" "@xmtp/content-type-text": "npm:^1.0.1" - "@xmtp/node-bindings": "npm:^0.0.25" + "@xmtp/node-bindings": "npm:^0.0.26" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "workspace:^" fast-glob: "npm:^3.3.2" From 844e31250fc7d0ebadbcb40d0e6a13abed224a7d Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Wed, 27 Nov 2024 20:41:03 -0500 Subject: [PATCH 14/27] update the validator --- packages/frames-validator/src/validation.ts | 20 +++++++------------- sdks/node-sdk/src/Client.ts | 2 +- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index 12e9bdde..91ea75c9 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -51,19 +51,9 @@ export async function validateFramesPost( throw new Error("Invalid wallet address"); } } else { - const randomWallet = Wallet.createRandom(); - const encryptionKey = getRandomValues(new Uint8Array(32)); - const client = await Client.create( - { - getAddress: () => randomWallet.address, - signMessage: async (message: string) => - getBytes(await randomWallet.signMessage(message)), - }, - encryptionKey, - ); - // make sure inbox IDs match - const authorized = await client.isInstallationAuthorized( + const authorized = await Client.isInstallationAuthorized( + { env }, inboxId, installationId, ); @@ -71,7 +61,11 @@ export async function validateFramesPost( throw new Error("Installation not a member of association state"); } - const isMember = await client.isAddressAuthorized(inboxId, walletAddress); + const isMember = await Client.isAddressAuthorized( + { env }, + inboxId, + walletAddress, + ); if (!isMember) { throw new Error("Unable to associate wallet address with inbox"); diff --git a/sdks/node-sdk/src/Client.ts b/sdks/node-sdk/src/Client.ts index 45845af2..16455c34 100644 --- a/sdks/node-sdk/src/Client.ts +++ b/sdks/node-sdk/src/Client.ts @@ -464,7 +464,7 @@ export class Client { return await isAddressAuthorizedBinding(host, inboxId, address); } - static async isInstallationAuthori( + static async isInstallationAuthorized( networkOptions: NetworkOptions, inboxId: string, installation: Uint8Array, From 23414fe108a290f0ae736d056df33da2a18ac24c Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Wed, 27 Nov 2024 20:42:29 -0500 Subject: [PATCH 15/27] bump node-sdk --- packages/frames-client/package.json | 2 +- packages/frames-validator/package.json | 2 +- sdks/node-sdk/package.json | 2 +- yarn.lock | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 7091c3ec..9f54070f 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -70,7 +70,7 @@ "@open-frames/types": "^0.1.1", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^12.1.1", - "@xmtp/node-sdk": "^0.0.28", + "@xmtp/node-sdk": "^0.0.29", "@xmtp/xmtp-js": "^12.0.0", "ethers": "^6.13.1", "fast-glob": "^3.3.2", diff --git a/packages/frames-validator/package.json b/packages/frames-validator/package.json index 9f998f00..5c4aec10 100644 --- a/packages/frames-validator/package.json +++ b/packages/frames-validator/package.json @@ -40,7 +40,7 @@ "dependencies": { "@noble/curves": "^1.3.0", "@noble/hashes": "^1.4.0", - "@xmtp/node-sdk": "^0.0.28", + "@xmtp/node-sdk": "workspace:*", "@xmtp/proto": "^3.72.3", "uint8array-extras": "^1.4.0", "viem": "^2.16.5" diff --git a/sdks/node-sdk/package.json b/sdks/node-sdk/package.json index 326e55bb..2be97b2d 100644 --- a/sdks/node-sdk/package.json +++ b/sdks/node-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/node-sdk", - "version": "0.0.28", + "version": "0.0.29", "description": "XMTP Node client SDK for interacting with XMTP networks", "keywords": [ "xmtp", diff --git a/yarn.lock b/yarn.lock index 0a4dd4eb..e2d5224a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5033,7 +5033,7 @@ __metadata: "@open-frames/types": "npm:^0.1.1" "@rollup/plugin-terser": "npm:^0.4.4" "@rollup/plugin-typescript": "npm:^12.1.1" - "@xmtp/node-sdk": "npm:^0.0.28" + "@xmtp/node-sdk": "npm:^0.0.29" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "npm:^12.0.0" ethers: "npm:^6.13.1" @@ -5065,7 +5065,7 @@ __metadata: "@rollup/plugin-typescript": "npm:^12.1.1" "@types/bl": "npm:^5.1.4" "@xmtp/frames-client": "npm:^1.0.0" - "@xmtp/node-sdk": "npm:^0.0.28" + "@xmtp/node-sdk": "workspace:*" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "npm:^12.1.0" ethers: "npm:^6.10.0" @@ -5086,7 +5086,7 @@ __metadata: languageName: node linkType: hard -"@xmtp/node-sdk@npm:^0.0.28, @xmtp/node-sdk@workspace:sdks/node-sdk": +"@xmtp/node-sdk@npm:^0.0.29, @xmtp/node-sdk@workspace:*, @xmtp/node-sdk@workspace:sdks/node-sdk": version: 0.0.0-use.local resolution: "@xmtp/node-sdk@workspace:sdks/node-sdk" dependencies: From 1123a401ca6cefeef5c206d5b078d92eb771fb55 Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Wed, 27 Nov 2024 20:43:06 -0500 Subject: [PATCH 16/27] fix version --- packages/frames-validator/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frames-validator/package.json b/packages/frames-validator/package.json index 5c4aec10..9cace063 100644 --- a/packages/frames-validator/package.json +++ b/packages/frames-validator/package.json @@ -40,7 +40,7 @@ "dependencies": { "@noble/curves": "^1.3.0", "@noble/hashes": "^1.4.0", - "@xmtp/node-sdk": "workspace:*", + "@xmtp/node-sdk": "^0.0.29", "@xmtp/proto": "^3.72.3", "uint8array-extras": "^1.4.0", "viem": "^2.16.5" From 4367eb13b61efa3b82016cd6a7887e5dfa5dc650 Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Wed, 27 Nov 2024 20:43:31 -0500 Subject: [PATCH 17/27] cleanup --- packages/frames-validator/src/validation.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index 91ea75c9..3f864342 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -13,8 +13,6 @@ import { verifyIdentityKeySignature, verifyWalletSignature } from "./utils.js"; export type * from "./types.js"; -// let seed = Mnemonic.fromEntropy(randomBytes(16), "", LangEn.wordlist()).computeSeed(); - const { b64Decode } = fetcher; export async function validateFramesPost( From 571460557f64ab72b51501e60a31de9a04fe43b0 Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Wed, 27 Nov 2024 20:43:55 -0500 Subject: [PATCH 18/27] cleanup --- yarn.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yarn.lock b/yarn.lock index e2d5224a..46d6218c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5065,7 +5065,7 @@ __metadata: "@rollup/plugin-typescript": "npm:^12.1.1" "@types/bl": "npm:^5.1.4" "@xmtp/frames-client": "npm:^1.0.0" - "@xmtp/node-sdk": "workspace:*" + "@xmtp/node-sdk": "npm:^0.0.29" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "npm:^12.1.0" ethers: "npm:^6.10.0" @@ -5086,7 +5086,7 @@ __metadata: languageName: node linkType: hard -"@xmtp/node-sdk@npm:^0.0.29, @xmtp/node-sdk@workspace:*, @xmtp/node-sdk@workspace:sdks/node-sdk": +"@xmtp/node-sdk@npm:^0.0.29, @xmtp/node-sdk@workspace:sdks/node-sdk": version: 0.0.0-use.local resolution: "@xmtp/node-sdk@workspace:sdks/node-sdk" dependencies: From 7fbb4d1982bfb81e41c2608e8d6b7cf8d21beeb8 Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Wed, 27 Nov 2024 20:48:53 -0500 Subject: [PATCH 19/27] lint --- packages/frames-validator/src/validation.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index 3f864342..aaafb90b 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -1,8 +1,6 @@ -import { getRandomValues, randomBytes } from "crypto"; import { sha256 } from "@noble/hashes/sha256"; import { Client, type XmtpEnv } from "@xmtp/node-sdk"; import { fetcher, frames, type publicKey, type signature } from "@xmtp/proto"; -import { getBytes, LangEn, Mnemonic, Wallet } from "ethers"; import { uint8ArrayToHex } from "uint8array-extras"; import type { UntrustedData, From de13a4bc8bf94b6c55f0bed3658809cff0383e13 Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Wed, 27 Nov 2024 20:57:34 -0500 Subject: [PATCH 20/27] bump version --- packages/frames-validator/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frames-validator/package.json b/packages/frames-validator/package.json index 9cace063..029b150d 100644 --- a/packages/frames-validator/package.json +++ b/packages/frames-validator/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-validator", - "version": "1.0.0", + "version": "1.0.1", "description": "A validator for XMTP frames requests", "homepage": "https://github.com/xmtp/xmtp-js", "bugs": { From c8e15684a65761f8c35d4b853f83d47bb0ebcbb3 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Wed, 27 Nov 2024 18:35:10 -0800 Subject: [PATCH 21/27] update the frame url --- packages/frames-client/src/client.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/frames-client/src/client.test.ts b/packages/frames-client/src/client.test.ts index 6c921375..2157a8d7 100644 --- a/packages/frames-client/src/client.test.ts +++ b/packages/frames-client/src/client.test.ts @@ -133,7 +133,7 @@ const shouldSignFrameActionWithValidSignature = // Will add E2E tests back once we have Frames deployed with the new schema const worksE2E = (framesClient: FramesClient) => async () => { const frameUrl = - "https://fc-polls-five.vercel.app/polls/01032f47-e976-42ee-9e3d-3aac1324f4b8"; + "https://fc-polls-aikbbaraw-ephemerahq.vercel.app/polls/95de04bf-3f35-4042-895a-094e50062b1e; const metadata = await framesClient.proxy.readMetadata(frameUrl); expect(metadata).toBeDefined(); expect(metadata.frameInfo).toMatchObject({ @@ -150,10 +150,10 @@ const worksE2E = (framesClient: FramesClient) => async () => { }, image: { content: - "https://fc-polls-five.vercel.app/api/image?id=01032f47-e976-42ee-9e3d-3aac1324f4b8", + "https://fc-polls-aikbbaraw-ephemerahq.vercel.app/api/image?id=01032f47-e976-42ee-9e3d-3aac1324f4b8", }, postUrl: - "https://fc-polls-five.vercel.app/api/vote?id=01032f47-e976-42ee-9e3d-3aac1324f4b8", + "https://fc-polls-aikbbaraw-ephemerahq.vercel.app/api/vote?id=01032f47-e976-42ee-9e3d-3aac1324f4b8", }); const signedPayload = await framesClient.signFrameAction({ frameUrl, From 579854d01596cc398ba014e0a29e5261233b0d48 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Wed, 27 Nov 2024 18:40:17 -0800 Subject: [PATCH 22/27] missing quote --- packages/frames-client/src/client.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frames-client/src/client.test.ts b/packages/frames-client/src/client.test.ts index 2157a8d7..170a907f 100644 --- a/packages/frames-client/src/client.test.ts +++ b/packages/frames-client/src/client.test.ts @@ -133,7 +133,7 @@ const shouldSignFrameActionWithValidSignature = // Will add E2E tests back once we have Frames deployed with the new schema const worksE2E = (framesClient: FramesClient) => async () => { const frameUrl = - "https://fc-polls-aikbbaraw-ephemerahq.vercel.app/polls/95de04bf-3f35-4042-895a-094e50062b1e; + "https://fc-polls-aikbbaraw-ephemerahq.vercel.app/polls/95de04bf-3f35-4042-895a-094e50062b1e"; const metadata = await framesClient.proxy.readMetadata(frameUrl); expect(metadata).toBeDefined(); expect(metadata.frameInfo).toMatchObject({ From a3dbb24737a8acb98f34ea0393e9744e37dffaa2 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Wed, 27 Nov 2024 19:15:39 -0800 Subject: [PATCH 23/27] one more bump to the urls --- packages/frames-client/src/client.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/frames-client/src/client.test.ts b/packages/frames-client/src/client.test.ts index 170a907f..9521e159 100644 --- a/packages/frames-client/src/client.test.ts +++ b/packages/frames-client/src/client.test.ts @@ -133,7 +133,7 @@ const shouldSignFrameActionWithValidSignature = // Will add E2E tests back once we have Frames deployed with the new schema const worksE2E = (framesClient: FramesClient) => async () => { const frameUrl = - "https://fc-polls-aikbbaraw-ephemerahq.vercel.app/polls/95de04bf-3f35-4042-895a-094e50062b1e"; + "https://fc-polls-five.vercel.app/polls/03710836-bc1d-4921-9e24-89d82015c53b"; const metadata = await framesClient.proxy.readMetadata(frameUrl); expect(metadata).toBeDefined(); expect(metadata.frameInfo).toMatchObject({ @@ -150,10 +150,10 @@ const worksE2E = (framesClient: FramesClient) => async () => { }, image: { content: - "https://fc-polls-aikbbaraw-ephemerahq.vercel.app/api/image?id=01032f47-e976-42ee-9e3d-3aac1324f4b8", + "https://fc-polls-five.vercel.app/api/image?id=03710836-bc1d-4921-9e24-89d82015c53b", }, postUrl: - "https://fc-polls-aikbbaraw-ephemerahq.vercel.app/api/vote?id=01032f47-e976-42ee-9e3d-3aac1324f4b8", + "https://fc-polls-five.vercel.app/api/vote?id=03710836-bc1d-4921-9e24-89d82015c53b", }); const signedPayload = await framesClient.signFrameAction({ frameUrl, From 7968cea2887a0cc033cb0fc138d6542314ea1665 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 2 Dec 2024 13:10:40 -0600 Subject: [PATCH 24/27] Undo frame-validator version bump --- packages/frames-validator/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frames-validator/package.json b/packages/frames-validator/package.json index 029b150d..9cace063 100644 --- a/packages/frames-validator/package.json +++ b/packages/frames-validator/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/frames-validator", - "version": "1.0.1", + "version": "1.0.0", "description": "A validator for XMTP frames requests", "homepage": "https://github.com/xmtp/xmtp-js", "bugs": { From 9db45bfaed1ca51249c0add1333aa186a0e8d301 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 2 Dec 2024 13:20:30 -0600 Subject: [PATCH 25/27] Refactor node client API --- packages/frames-validator/src/validation.ts | 10 ++++------ sdks/node-sdk/src/Client.ts | 22 ++++----------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/packages/frames-validator/src/validation.ts b/packages/frames-validator/src/validation.ts index aaafb90b..f69c1f93 100644 --- a/packages/frames-validator/src/validation.ts +++ b/packages/frames-validator/src/validation.ts @@ -49,19 +49,17 @@ export async function validateFramesPost( } else { // make sure inbox IDs match const authorized = await Client.isInstallationAuthorized( - { env }, inboxId, installationId, + { env }, ); if (!authorized) { throw new Error("Installation not a member of association state"); } - const isMember = await Client.isAddressAuthorized( - { env }, - inboxId, - walletAddress, - ); + const isMember = await Client.isAddressAuthorized(inboxId, walletAddress, { + env, + }); if (!isMember) { throw new Error("Unable to associate wallet address with inbox"); diff --git a/sdks/node-sdk/src/Client.ts b/sdks/node-sdk/src/Client.ts index 16455c34..674b4c15 100644 --- a/sdks/node-sdk/src/Client.ts +++ b/sdks/node-sdk/src/Client.ts @@ -271,20 +271,6 @@ export class Client { await this.#applySignatures(); } - async isAddressAuthorized( - inboxId: string, - address: string, - ): Promise { - return this.#innerClient.isAddressAuthorized(inboxId, address); - } - - async isInstallationAuthorized( - inboxId: string, - installationId: Uint8Array, - ): Promise { - return this.#innerClient.isInstallationAuthorized(inboxId, installationId); - } - async removeAccount(accountAddress: string) { const signatureText = await this.#removeAccountSignatureText(accountAddress); @@ -456,20 +442,20 @@ export class Client { } static async isAddressAuthorized( - networkOptions: NetworkOptions, inboxId: string, address: string, + options?: NetworkOptions, ): Promise { - const host = networkOptions.apiUrl || ApiUrls[networkOptions.env || "dev"]; + const host = options?.apiUrl || ApiUrls[options?.env || "dev"]; return await isAddressAuthorizedBinding(host, inboxId, address); } static async isInstallationAuthorized( - networkOptions: NetworkOptions, inboxId: string, installation: Uint8Array, + options?: NetworkOptions, ): Promise { - const host = networkOptions.apiUrl || ApiUrls[networkOptions.env || "dev"]; + const host = options?.apiUrl || ApiUrls[options?.env || "dev"]; return await isInstallationAuthorizedBinding(host, inboxId, installation); } } From ae0a28c7760f1d2807f924ad906b492f2bc0e226 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 2 Dec 2024 17:15:16 -0600 Subject: [PATCH 26/27] Upgrade Node SDK --- packages/frames-client/package.json | 2 +- packages/frames-validator/package.json | 2 +- yarn.lock | 26 +++----------------------- 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 9f54070f..3ab23263 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -70,7 +70,7 @@ "@open-frames/types": "^0.1.1", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^12.1.1", - "@xmtp/node-sdk": "^0.0.29", + "@xmtp/node-sdk": "^0.0.30", "@xmtp/xmtp-js": "^12.0.0", "ethers": "^6.13.1", "fast-glob": "^3.3.2", diff --git a/packages/frames-validator/package.json b/packages/frames-validator/package.json index 9cace063..09171838 100644 --- a/packages/frames-validator/package.json +++ b/packages/frames-validator/package.json @@ -40,7 +40,7 @@ "dependencies": { "@noble/curves": "^1.3.0", "@noble/hashes": "^1.4.0", - "@xmtp/node-sdk": "^0.0.29", + "@xmtp/node-sdk": "^0.0.30", "@xmtp/proto": "^3.72.3", "uint8array-extras": "^1.4.0", "viem": "^2.16.5" diff --git a/yarn.lock b/yarn.lock index 0b2aaab4..591f6a75 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5033,7 +5033,7 @@ __metadata: "@open-frames/types": "npm:^0.1.1" "@rollup/plugin-terser": "npm:^0.4.4" "@rollup/plugin-typescript": "npm:^12.1.1" - "@xmtp/node-sdk": "npm:^0.0.29" + "@xmtp/node-sdk": "npm:^0.0.30" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "npm:^12.0.0" ethers: "npm:^6.13.1" @@ -5065,7 +5065,7 @@ __metadata: "@rollup/plugin-typescript": "npm:^12.1.1" "@types/bl": "npm:^5.1.4" "@xmtp/frames-client": "npm:^1.0.0" - "@xmtp/node-sdk": "npm:^0.0.29" + "@xmtp/node-sdk": "npm:^0.0.30" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "npm:^12.1.0" ethers: "npm:^6.10.0" @@ -5079,13 +5079,6 @@ __metadata: languageName: unknown linkType: soft -"@xmtp/node-bindings@npm:^0.0.27": - version: 0.0.27 - resolution: "@xmtp/node-bindings@npm:0.0.27" - checksum: 10/e5c737f41169caa58b55241e7f8e544076e8f7d7e3ba9703703885bda73d352c26984a8a4a4d1277a30d3837da9a0023a94dfadf40b5c8f8f3b6366260f3d20e - languageName: node - linkType: hard - "@xmtp/node-bindings@npm:^0.0.28": version: 0.0.28 resolution: "@xmtp/node-bindings@npm:0.0.28" @@ -5093,20 +5086,7 @@ __metadata: languageName: node linkType: hard -"@xmtp/node-sdk@npm:^0.0.29": - version: 0.0.29 - resolution: "@xmtp/node-sdk@npm:0.0.29" - dependencies: - "@xmtp/content-type-group-updated": "npm:^1.0.1" - "@xmtp/content-type-primitives": "npm:^1.0.3" - "@xmtp/content-type-text": "npm:^1.0.1" - "@xmtp/node-bindings": "npm:^0.0.27" - "@xmtp/proto": "npm:^3.72.3" - checksum: 10/d4d02916eb70b14bb34151ac513572aaad3d5341cc1edb251f75e9cd29e92c50e5d01714643e1db02ff23d22f5b9d6640c8e3a8fc63b1e503ced5dc9aca849d8 - languageName: node - linkType: hard - -"@xmtp/node-sdk@workspace:sdks/node-sdk": +"@xmtp/node-sdk@npm:^0.0.30, @xmtp/node-sdk@workspace:sdks/node-sdk": version: 0.0.0-use.local resolution: "@xmtp/node-sdk@workspace:sdks/node-sdk" dependencies: From 1d2dab8d58beb9fa8ba1a2dbb7c104c2f5b01ecb Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 2 Dec 2024 17:18:01 -0600 Subject: [PATCH 27/27] Create lemon-rockets-do.md --- .changeset/lemon-rockets-do.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lemon-rockets-do.md diff --git a/.changeset/lemon-rockets-do.md b/.changeset/lemon-rockets-do.md new file mode 100644 index 00000000..6835c341 --- /dev/null +++ b/.changeset/lemon-rockets-do.md @@ -0,0 +1,5 @@ +--- +"@xmtp/frames-validator": patch +--- + +Fix V3 frames validation