Skip to content

Commit

Permalink
authorize with lib
Browse files Browse the repository at this point in the history
  • Loading branch information
codabrink committed Nov 26, 2024
1 parent 4e393d2 commit 35ea1f6
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/frames-validator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions packages/frames-validator/src/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

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.27",
"version": "0.0.28",
"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.22",
"@xmtp/node-bindings": "^0.0.23",
"@xmtp/proto": "^3.72.3"
},
"devDependencies": {
Expand Down
7 changes: 7 additions & 0 deletions sdks/node-sdk/src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ export class Client {
return this.#innerClient.isRegistered();
}

async isAddressAuthorized(
inboxId: string,
address: string,
): Promise<boolean> {
return this.#innerClient.isAddressAuthorized(inboxId, address);
}

async #createInboxSignatureText() {
try {
const signatureText = await this.#innerClient.createInboxSignatureText();
Expand Down
26 changes: 23 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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:
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.22"
"@xmtp/node-bindings": "npm:^0.0.23"
"@xmtp/proto": "npm:^3.72.3"
"@xmtp/xmtp-js": "workspace:^"
fast-glob: "npm:^3.3.2"
Expand Down

0 comments on commit 35ea1f6

Please sign in to comment.