Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge consent-proof-signature and frames-client from web repo #684

Merged
merged 170 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
b147ae5
Add frames client
neekolas Jan 30, 2024
a870205
Add signed frame action payloads
neekolas Jan 30, 2024
224bd35
Merge branch 'main' into nm/signed-frame-action-payload
neekolas Jan 30, 2024
7f16c45
Lint
neekolas Jan 30, 2024
e68f367
Merge pull request #168 from xmtp/nm/signed-frame-action-payload
neekolas Jan 30, 2024
1389a0b
release: version packages
github-actions[bot] Jan 30, 2024
c995316
Merge pull request #167 from xmtp/changeset-release/main
neekolas Jan 30, 2024
54e90b8
Scaffold tests
neekolas Jan 30, 2024
e026299
Merge branch 'main' into nm/add-frames-tests
neekolas Jan 30, 2024
a40553a
Add some more tests
neekolas Jan 30, 2024
f195c59
Add README and tests
neekolas Jan 30, 2024
675ce1f
Ability to POST to the frame
neekolas Jan 30, 2024
805e155
Lint
neekolas Jan 30, 2024
d21e17d
Merge pull request #169 from xmtp/nm/add-frames-tests
neekolas Jan 30, 2024
c951403
release: version packages
github-actions[bot] Jan 30, 2024
b846faa
Merge pull request #170 from xmtp/changeset-release/main
neekolas Jan 30, 2024
4cfb55a
Add vitest setup
neekolas Jan 30, 2024
3f125e8
Merge pull request #171 from xmtp/nm/fix-crypto-import
neekolas Jan 30, 2024
1ecbcc9
release: version packages
github-actions[bot] Jan 30, 2024
28bdf2b
Merge pull request #172 from xmtp/changeset-release/main
neekolas Jan 30, 2024
171e017
Dynamic import of crypto
neekolas Jan 30, 2024
259598a
Add caching
neekolas Jan 30, 2024
885356b
Merge branch 'main' into nm/dynamic-crypto-import
neekolas Jan 30, 2024
957330d
Merge pull request #173 from xmtp/nm/dynamic-crypto-import
neekolas Jan 30, 2024
2da9b29
release: version packages
github-actions[bot] Jan 30, 2024
f15228e
Merge pull request #174 from xmtp/changeset-release/main
neekolas Jan 30, 2024
3d0697b
Update crypto imports, build, and exports
rygine Jan 30, 2024
6d7db12
Merge pull request #175 from xmtp/rygine/crypto
rygine Jan 30, 2024
766ad2b
release: version packages
github-actions[bot] Jan 30, 2024
6f17d3d
Merge pull request #176 from xmtp/changeset-release/main
rygine Jan 30, 2024
b96f343
Add prettier plugin, format `package.json` files
rygine Jan 30, 2024
ef27f18
Merge pull request #177 from xmtp/rygine/fix-deps
rygine Jan 30, 2024
b999c26
Update to latest protos
neekolas Feb 2, 2024
db66c87
Merge branch 'main' into nm/update-to-latest-proto
neekolas Feb 2, 2024
89a322b
Lowercase everything when computing the digest
neekolas Feb 2, 2024
5cd6e6a
Test for lowercasing
neekolas Feb 2, 2024
7c54603
Format
neekolas Feb 2, 2024
861dfcf
Merge pull request #179 from xmtp/nm/update-to-latest-proto
neekolas Feb 5, 2024
5435c4c
release: version packages
github-actions[bot] Feb 5, 2024
1c774b5
Merge pull request #180 from xmtp/changeset-release/main
neekolas Feb 5, 2024
5097ac6
update readme for new spec
Feb 6, 2024
fe6895f
format fix
Feb 6, 2024
a9ed389
release: version packages
github-actions[bot] Feb 6, 2024
b1c0147
Merge pull request #183 from xmtp/changeset-release/main
daria-github Feb 6, 2024
00671e2
Make Open Frames compatible payloads
neekolas Feb 10, 2024
e686fbf
Merge pull request #186 from xmtp/nm/make-openframes-compatible
neekolas Feb 10, 2024
8b0c043
release: version packages
github-actions[bot] Feb 10, 2024
9ca5462
Merge pull request #187 from xmtp/changeset-release/main
neekolas Feb 10, 2024
3327b55
Add provenance
rygine Feb 14, 2024
09d9b7a
Add new frames proxy
neekolas Feb 15, 2024
292b8b3
Update README
neekolas Feb 15, 2024
8d72d77
Rename back
neekolas Feb 15, 2024
f810a05
Longer timeout
neekolas Feb 15, 2024
83d9b33
Add RN support
neekolas Feb 15, 2024
9b480ad
Ensure no keystore
neekolas Feb 15, 2024
4e3a0db
Flip around order
neekolas Feb 15, 2024
eceea3e
Merge pull request #190 from xmtp/nm/react-native-support
neekolas Feb 15, 2024
07ff119
Merge pull request #189 from xmtp/nm/new-frames-api-client
neekolas Feb 15, 2024
ad38807
release: version packages
github-actions[bot] Feb 15, 2024
9e9e0ba
Merge pull request #191 from xmtp/changeset-release/main
neekolas Feb 15, 2024
3271f0d
Check both the walletEcdsaCompact and the ecdsaCompact
neekolas Feb 15, 2024
6456ef3
Merge pull request #192 from xmtp/nm/fix-identity-key-translation
neekolas Feb 15, 2024
a359725
release: version packages
github-actions[bot] Feb 15, 2024
ec53086
Merge pull request #193 from xmtp/changeset-release/main
neekolas Feb 15, 2024
710bf49
Change up exports
neekolas Feb 15, 2024
bad288c
Merge pull request #194 from xmtp/nm/export-proxy
neekolas Feb 15, 2024
2dd05e2
release: version packages
github-actions[bot] Feb 15, 2024
1be42c1
Merge pull request #195 from xmtp/changeset-release/main
neekolas Feb 15, 2024
3e06530
Update README.md
humanagent Feb 16, 2024
0b760e5
Upgrade to JS SDK `11.3.12`
rygine Feb 16, 2024
284efbb
Merge pull request #188 from xmtp/rygine/updates
rygine Feb 16, 2024
434a21b
Use new OpenFrames proxy service
neekolas Feb 21, 2024
e1e2db5
Add better test
neekolas Feb 21, 2024
14319dc
Use latest proxy client
neekolas Feb 21, 2024
ddbe2ce
Add open frames proxy dev
neekolas Feb 21, 2024
175508d
Merge pull request #198 from xmtp/nm/use-new-frames-proxy
neekolas Feb 21, 2024
c138312
release: version packages
github-actions[bot] Feb 21, 2024
c8ea046
Merge pull request #199 from xmtp/changeset-release/main
neekolas Feb 21, 2024
10c0e8a
Use 0.2.0 of proxy-client
neekolas Feb 23, 2024
c5943b5
Merge pull request #200 from xmtp/nm/use-new-frames-proxy
neekolas Feb 23, 2024
bc86f67
release: version packages
github-actions[bot] Feb 23, 2024
f3701fc
Merge pull request #201 from xmtp/changeset-release/main
neekolas Feb 23, 2024
e09a764
Add support for inputText
neekolas Feb 23, 2024
9b98aa2
Support data URIs
neekolas Feb 23, 2024
ce407f9
Merge pull request #202 from xmtp/nm/add-text-input-support
neekolas Feb 23, 2024
711d1c4
release: version packages
github-actions[bot] Feb 23, 2024
93258d4
Merge pull request #203 from xmtp/changeset-release/main
neekolas Feb 23, 2024
b6613b7
Upgrade dependencies
rygine Feb 27, 2024
6257c65
Format tsconfig.json files
rygine Feb 27, 2024
ad8d3d5
Include source files when publishing packages
rygine Feb 28, 2024
e06d0c7
Upgrade JS SDK
rygine Feb 28, 2024
872c283
Merge pull request #204 from xmtp/rygine/upgrade-sdk
rygine Feb 28, 2024
3371ae4
Add State field to be in line with OF spec
neekolas Feb 29, 2024
1c94987
Add State field to be in line with OF spec
neekolas Feb 29, 2024
3fa8260
Merge branch '02-28-Add_State_field_to_be_in_line_with_OF_spec' of gi…
neekolas Feb 29, 2024
55c1144
Add State field to be in line with OF spec (#207)
neekolas Mar 1, 2024
df7812c
release: version packages
github-actions[bot] Mar 1, 2024
59fe1b2
release: version packages (#209)
neekolas Mar 1, 2024
a30b9d6
Upgrade dev deps
rygine Mar 7, 2024
4a551ef
Merge pull request #210 from xmtp/rygine/updates
rygine Mar 7, 2024
fa9c2a9
format
humanagent Mar 11, 2024
d343b2f
Merge pull request #196 from xmtp/fabriguespe-patch-2
rygine Mar 11, 2024
46c01b1
Upgrade dev deps
rygine Mar 13, 2024
50f0bb7
Merge pull request #211 from xmtp/rygine/updates
rygine Mar 13, 2024
685acca
Frames Client State
Mar 28, 2024
d3ec377
Merge pull request #220 from xmtp/ar/frames-state
alexrisch Mar 28, 2024
369051e
add postTransaction support
Apr 19, 2024
4281918
bumped packages
Apr 19, 2024
f033104
fix tests
Apr 19, 2024
ff39eda
Merge pull request #223 from xmtp/dj/tx-frames
daria-github Apr 19, 2024
16ae852
release: version packages
github-actions[bot] Apr 19, 2024
e6e3c44
Merge pull request #224 from xmtp/changeset-release/main
daria-github Apr 19, 2024
8e7de2a
Update README.md
humanagent Apr 30, 2024
b5ddeb3
“update”
humanagent Apr 30, 2024
3adbc5c
pass postUrl through in frameInfo
May 2, 2024
f6ca64b
Merge pull request #229 from xmtp/dj/post-url
daria-github May 2, 2024
169e000
release: version packages
github-actions[bot] May 2, 2024
d4af671
Merge pull request #230 from xmtp/changeset-release/main
daria-github May 2, 2024
1f9e950
Add consent proof message package
May 3, 2024
63df893
Fix test
May 3, 2024
59e745c
added dependencies
May 3, 2024
44b1025
updated signature
May 4, 2024
bf95250
Merge pull request #231 from xmtp/ar/consent-proof-signature-package
alexrisch May 6, 2024
8003ad8
release: version packages
github-actions[bot] May 6, 2024
7a86034
Merge pull request #232 from xmtp/changeset-release/main
alexrisch May 6, 2024
3dcb88c
Add CommonJS export to consent-proof-signature
rygine May 16, 2024
1726911
Merge pull request #234 from xmtp/rygine/consent-exports
rygine May 16, 2024
9cadba6
release: version packages
github-actions[bot] May 16, 2024
e43d8d9
Merge pull request #235 from xmtp/changeset-release/main
rygine May 16, 2024
5f218e6
Manually bump version for consent-proof-signature
rygine May 16, 2024
a0cc81f
Merge pull request #236 from xmtp/rygine/manual-version-bump
rygine May 16, 2024
1688b43
add transactionId
May 24, 2024
8ccba41
Merge pull request #239 from xmtp/dj/tx-id
humanagent May 25, 2024
f974070
release: version packages
github-actions[bot] May 25, 2024
a3d1a02
Merge pull request #240 from xmtp/changeset-release/main
daria-github May 28, 2024
2859308
return txId
May 29, 2024
9ee2b09
Merge pull request #241 from xmtp/dj/tx-id
daria-github May 29, 2024
92228d2
release: version packages
github-actions[bot] May 29, 2024
818a2d2
Merge pull request #242 from xmtp/changeset-release/main
daria-github May 29, 2024
6086293
Upgrade @xmtp dependencies
rygine Jul 2, 2024
d76e12a
Merge pull request #245 from xmtp/rygine/up-deps
rygine Jul 2, 2024
252f1e9
Upgrade yarn
rygine Jul 2, 2024
3c881db
Merge pull request #246 from xmtp/changeset-release/main
rygine Jul 2, 2024
5d401d7
Upgrade prettier
rygine Jul 3, 2024
5e3dd74
Upgrade rollup, fix config
rygine Jul 3, 2024
48b3c94
Upgrade vite deps
rygine Jul 3, 2024
61da5ae
Upgrade typescript
rygine Jul 3, 2024
828512a
Upgrade ethers
rygine Jul 3, 2024
79b4421
Upgrade typedoc
rygine Jul 3, 2024
cbc1145
Merge pull request #247 from xmtp/rygine/up-dev-deps
rygine Jul 3, 2024
98f4792
Upgrade frames client deps
rygine Jul 8, 2024
7eb108f
Upgrade testing deps
rygine Jul 8, 2024
514f7f3
Upgrade dev deps
rygine Jul 8, 2024
88c4671
Merge pull request #248 from xmtp/rygine/fix-deps
rygine Jul 8, 2024
ebefdc5
release: version packages
github-actions[bot] Jul 8, 2024
965e13d
Update CHANGELOG.md
rygine Jul 8, 2024
59add0f
Merge pull request #249 from xmtp/changeset-release/main
rygine Jul 8, 2024
16dfda3
Upgrade dev dependencies
rygine Jul 15, 2024
5376e25
Merge pull request #283 from xmtp/rygine/upgrade-de-v-deps
rygine Jul 15, 2024
6c93206
Merge pull request #228 from xmtp/fabriguespe-patch-2
rygine Jul 26, 2024
7a594b9
Add web packages
rygine Oct 17, 2024
afa95ee
Add tsconfigs
rygine Oct 17, 2024
e05c1d1
Refactor package.json file, run prettier
rygine Oct 17, 2024
631c70b
Fix lint issues in frames-client
rygine Oct 17, 2024
8545387
Update READMEs
rygine Oct 17, 2024
ffa4220
Change output dir to /dist
rygine Oct 17, 2024
135c7ac
Add GitHub workflow for packages
rygine Oct 17, 2024
ccbbd79
Fix yarn.lock
rygine Oct 17, 2024
cb0d836
Upgrade dev deps
rygine Oct 17, 2024
92bc000
Update turbo.json for certain tests
rygine Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Packages

on:
push:
branches:
- main

pull_request:
paths:
- "packages/**"
- ".github/workflows/packages.yml"
- "dev/**"
- ".node-version"
- ".nvmrc"
- ".yarnrc.yml"
- "turbo.json"
- "yarn.lock"

jobs:
typecheck:
name: Typecheck
runs-on: warp-ubuntu-latest-x64-8x
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "yarn"
env:
SKIP_YARN_COREPACK_CHECK: "1"
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: yarn
- name: Typecheck
run: yarn turbo run typecheck --filter='./packages/*'

test:
name: Test
runs-on: warp-ubuntu-latest-x64-8x
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "yarn"
env:
SKIP_YARN_COREPACK_CHECK: "1"
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: yarn
- name: Start dev environment
run: ./dev/up
- name: Sleep for 5 seconds
run: sleep 5s
- name: Run tests
run: yarn turbo run test --filter='./packages/*'

build:
name: Build
runs-on: warp-ubuntu-latest-x64-8x
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "yarn"
env:
SKIP_YARN_COREPACK_CHECK: "1"
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: yarn
- name: Build
run: yarn turbo run build --filter='./packages/*'
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ To learn more about the contents of this repository, see this README and the REA
- [`content-type-text`](content-types/content-type-text): Content type for plain text messages
- [`content-type-transaction-reference`](content-types/content-type-transaction-reference): Content type for on-chain transaction references

### Packages

- [`frames-client`](https://github.com/xmtp/xmtp-js/blob/main/packages/frames-client): XMTP Open Frames client
- [`consent-proof-signature`](https://github.com/xmtp/xmtp-js/blob/main/packages/consent-proof-signature): Lightweight package for creating consent proofs

## Contributing

See our [contribution guide](./CONTRIBUTING.md) to learn more about contributing to this project.
2 changes: 1 addition & 1 deletion content-types/content-type-primitives/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^20.16.11",
"happy-dom": "^15.7.4",
"rimraf": "^6.0.1",
Expand Down
2 changes: 1 addition & 1 deletion content-types/content-type-reaction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^20.16.11",
"@xmtp/xmtp-js": "^11.6.3",
"buffer": "^6.0.3",
Expand Down
2 changes: 1 addition & 1 deletion content-types/content-type-read-receipt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^20.16.11",
"@xmtp/xmtp-js": "^11.6.3",
"buffer": "^6.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^20.16.11",
"@xmtp/rollup-plugin-resolve-extensions": "^1.0.1",
"@xmtp/xmtp-js": "^11.6.3",
Expand Down
2 changes: 1 addition & 1 deletion content-types/content-type-reply/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^20.16.11",
"@xmtp/content-type-remote-attachment": "workspace:*",
"@xmtp/xmtp-js": "^11.6.3",
Expand Down
2 changes: 1 addition & 1 deletion content-types/content-type-text/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^20.16.11",
"@xmtp/xmtp-js": "^11.6.3",
"buffer": "^6.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^20.16.11",
"@xmtp/xmtp-js": "^11.6.3",
"buffer": "^6.0.3",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"rimraf": "^6.0.1",
"turbo": "^2.1.3",
"typescript": "^5.6.3",
"typescript-eslint": "^8.9.0"
"typescript-eslint": "^8.10.0"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
13 changes: 13 additions & 0 deletions packages/consent-proof-signature/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# @xmtp/consent-proof-signature

## 0.1.3

### Patch Changes

- 8adc23f: Add CommonJS export to `consent-proof-signature` package

## 0.1.1

### Patch Changes

- 6fbe931: Created package
24 changes: 24 additions & 0 deletions packages/consent-proof-signature/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Consent Proof Signature

## Usage

```ts
// Sign the message for example with Viem
import { createWalletClient, custom } from "viem";

const timestamp = Date.now();
const message = createConsentMessage(broadcastAddress, timestamp);

const walletClient = createWalletClient({
chain: mainnet,
transport: custom((window as any).ethereum!),
});
const [account] = await walletClient.getAddresses();
const signature = await walletClient.signMessage({
account,
message,
});
const consentProofBytes = createConsentProofPayload(signature, timestamp);
```

Now the `consentProofBytes` can be encoded and sent to a service to decode and add in a new conversation invitation
88 changes: 88 additions & 0 deletions packages/consent-proof-signature/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"name": "@xmtp/consent-proof-signature",
"version": "0.1.3",
"keywords": [
"xmtp",
"messaging",
"web3",
"sdk",
"js",
"ts",
"javascript",
"typescript"
],
"homepage": "https://github.com/xmtp/xmtp-js",
"bugs": {
"url": "https://github.com/xmtp/xmtp-js/issues"
},
"repository": {
"type": "git",
"url": "[email protected]:xmtp/xmtp-js.git",
"directory": "packages/consent-proof-signature"
},
"license": "MIT",
"author": "XMTP Labs <[email protected]>",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.js"
}
},
"main": "dist/index.cjs",
"module": "dist/index.js",
"browser": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist",
"src",
"!src/**/*.test.*",
"tsconfig.json"
],
"scripts": {
"build": "yarn clean:dist && yarn rollup -c",
"clean": "rm -rf .turbo && rm -rf node_modules && yarn clean:dist",
"clean:dist": "rm -rf dist",
"dev": "yarn clean:dist && yarn rollup -c --watch",
"test": "vitest run --passWithNoTests",
"typecheck": "tsc",
"typedoc": "typedoc"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 3 chrome versions",
"last 3 firefox versions",
"last 3 safari versions"
]
},
"dependencies": {
"@xmtp/proto": "3.62.1",
"long": "^5.2.3"
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.1",
"ethers": "^6.13.1",
"rollup": "^4.24.0",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-filesize": "^10.0.0",
"tsconfig": "workspace:*",
"typedoc": "^0.26.4",
"typescript": "^5.6.3",
"vite": "^5.4.9",
"vitest": "^2.1.3"
},
"packageManager": "[email protected]",
"publishConfig": {
"access": "public",
"provenance": true,
"registry": "https://registry.npmjs.org/"
}
}
58 changes: 58 additions & 0 deletions packages/consent-proof-signature/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import terser from "@rollup/plugin-terser";
import typescript from "@rollup/plugin-typescript";
import { defineConfig } from "rollup";
import { dts } from "rollup-plugin-dts";
import filesize from "rollup-plugin-filesize";

const plugins = [
typescript({
declaration: false,
declarationMap: false,
}),
filesize({
showMinifiedSize: false,
}),
];

const external = ["@xmtp/proto", "node:crypto", "long"];

export default defineConfig([
{
input: "src/index.ts",
output: {
file: "dist/index.js",
format: "es",
sourcemap: true,
},
external,
plugins,
},
{
input: "src/index.ts",
output: {
file: "dist/index.cjs",
format: "cjs",
sourcemap: true,
},
external,
plugins,
},
{
input: "src/index.ts",
output: {
file: "dist/browser/index.js",
format: "es",
sourcemap: true,
},
external,
plugins: [terser(), ...plugins],
},
{
input: "src/index.ts",
output: {
file: "dist/index.d.ts",
format: "es",
},
plugins: [dts()],
},
]);
30 changes: 30 additions & 0 deletions packages/consent-proof-signature/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { describe, expect, it } from "vitest";
import { createConsentMessage, createConsentProofPayload } from ".";

describe("createConsentMessage", () => {
it("should return a signature", () => {
const timestampMs = 1581663600000;
const exampleAddress = "0x1234567890abcdef";
const signatureMessage = createConsentMessage(exampleAddress, timestampMs);
expect(signatureMessage).toEqual(
"XMTP : Grant inbox consent to sender\n\nCurrent Time: Fri, 14 Feb 2020 07:00:00 GMT\nFrom Address: 0x1234567890abcdef\n\nFor more info: https://xmtp.org/signatures/",
);
});
});

describe("createConsentProofPayload", () => {
it("should return data of consent proof", () => {
const timestampMs = 1581663600000;
const exampleSignature = "0x1234567890abcdef";
const signatureMessage = createConsentProofPayload(
exampleSignature,
timestampMs,
);
expect(signatureMessage).toEqual(
Buffer.from([
10, 18, 48, 120, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 97, 98, 99,
100, 101, 102, 16, 128, 251, 252, 147, 132, 46, 24, 1,
]),
);
});
});
Loading
Loading