diff --git a/sdks/node-sdk/CHANGELOG.md b/sdks/node-sdk/CHANGELOG.md index f5789835..0dd786d6 100644 --- a/sdks/node-sdk/CHANGELOG.md +++ b/sdks/node-sdk/CHANGELOG.md @@ -1,5 +1,14 @@ # @xmtp/node-sdk +## 0.0.30 + +### Patch Changes + +- 7338e0e: + - Removed authorization instance methods from client + - Added static authorization methods to client + - Upgraded to latest node bindings + ## 0.0.29 ### Patch Changes diff --git a/sdks/node-sdk/package.json b/sdks/node-sdk/package.json index 6471cfaa..f124e806 100644 --- a/sdks/node-sdk/package.json +++ b/sdks/node-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@xmtp/node-sdk", - "version": "0.0.29", + "version": "0.0.30", "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.27", + "@xmtp/node-bindings": "^0.0.28", "@xmtp/proto": "^3.72.3" }, "devDependencies": { diff --git a/sdks/node-sdk/test/Client.test.ts b/sdks/node-sdk/test/Client.test.ts index 59e742f2..33965c46 100644 --- a/sdks/node-sdk/test/Client.test.ts +++ b/sdks/node-sdk/test/Client.test.ts @@ -231,4 +231,40 @@ describe("Client", () => { ); expect(verified4).toBe(false); }); + + it("should check if an address is authorized", async () => { + const user = createUser(); + const client = await createRegisteredClient(user); + const authorized = await Client.isAddressAuthorized( + client.inboxId, + user.account.address.toLowerCase(), + { env: "local" }, + ); + expect(authorized).toBe(true); + + const notAuthorized = await Client.isAddressAuthorized( + client.inboxId, + "0x1234567890123456789012345678901234567890", + { env: "local" }, + ); + expect(notAuthorized).toBe(false); + }); + + it("should check if an installation is authorized", async () => { + const user = createUser(); + const client = await createRegisteredClient(user); + const authorized = await Client.isInstallationAuthorized( + client.inboxId, + client.installationIdBytes, + { env: "local" }, + ); + expect(authorized).toBe(true); + + const notAuthorized = await Client.isInstallationAuthorized( + client.inboxId, + new Uint8Array(32), + { env: "local" }, + ); + expect(notAuthorized).toBe(false); + }); }); diff --git a/yarn.lock b/yarn.lock index cf99b015..0b2aaab4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5086,7 +5086,27 @@ __metadata: languageName: node linkType: hard -"@xmtp/node-sdk@npm:^0.0.29, @xmtp/node-sdk@workspace:sdks/node-sdk": +"@xmtp/node-bindings@npm:^0.0.28": + version: 0.0.28 + resolution: "@xmtp/node-bindings@npm:0.0.28" + checksum: 10/0ceea72582926dcce03c8e3839b7101d7ce4aef56a55b46421c2e46e96f65c90a224b1649ff765c1f3cb1e2e21a730d1891bb369260c94712066b85d358fb6f4 + 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": 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.27" + "@xmtp/node-bindings": "npm:^0.0.28" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "workspace:^" fast-glob: "npm:^3.3.2"