Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/push-protocol/frames-validator
https://github.com/push-protocol/frames-validator
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/push-protocol/frames-validator
- Owner: push-protocol
- Created: 2024-04-04T18:29:33.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-08T13:23:07.000Z (9 months ago)
- Last Synced: 2024-11-19T20:51:45.186Z (about 1 month ago)
- Language: TypeScript
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# frames-validator
This package can be used by a frame server to validate incoming requests from a Push Chat Client and get the trustedData from it.
### Installation
```bash
npm i @pushprotocol/frames-validator
```### Usage
```javascript
import verifyFrameMessage from "@pushprotocol/frames-validator";const {isValid, trustedData} = await verifyFrameMessage(trustedData);
```### Sample Response
- Returns `isValid` as `true` if the user originally made this frame interaction, otherwise return `isValid` as `false`.
```javascript
{
isValid: true,
trustedData: {
url: 'frame_url',
unixTimestamp: timestamp,
buttonIndex: 3,
inputText: '',
state: '',
transactionId: 'undefined',
address: 'user_address',
messageId: 'previous:v2:11bce1cdfdd3ce9c05b6aeb564be993e2176f2e823c9f16aa361aa67d8fb7883',
chatId: 'chatid:c3ea478558ffcea3dc0d08f4d52629af1125b1577490d2c95c9f56d771c8186a',
clientProtocol: 'push',
env: 'staging'
}
}
```