Skip to content

Commit

Permalink
Merge branch 'main' into coda/frames-check
Browse files Browse the repository at this point in the history
  • Loading branch information
rygine committed Dec 2, 2024
2 parents 9db45bf + a7f2b52 commit 6ab5830
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 4 deletions.
9 changes: 9 additions & 0 deletions sdks/node-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions sdks/node-sdk/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
36 changes: 36 additions & 0 deletions sdks/node-sdk/test/Client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
24 changes: 22 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
Expand Down

0 comments on commit 6ab5830

Please sign in to comment.