Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8f799b8
feat!: 💥 remove @polkadot and @azns dependencies
0xKheops Jul 2, 2026
03d4565
feat!: 💥 remove azero id from public api
0xKheops Jul 3, 2026
7b77534
chore: 🏗️ restructure as pnpm monorepo
0xKheops Jul 3, 2026
408e034
chore(demo): 📦 import demo dapp
0xKheops Jul 3, 2026
da94f55
chore(docs): 📦 import docs site
0xKheops Jul 3, 2026
f0dd986
feat(demo): ✨ pure svg polkadot identicons
0xKheops Jul 3, 2026
0feb597
chore: 🔧 fail lint on warnings
0xKheops Jul 3, 2026
208612b
feat(demo): 🚀 migrate to tanstack start on cloudflare workers
0xKheops Jul 3, 2026
97262aa
feat(demo): 📚 serve docs from demo worker at /docs
0xKheops Jul 3, 2026
8da18fd
docs: 📝 rewrite docs for framework-agnostic v2 api
0xKheops Jul 3, 2026
4beaaa1
docs: 📝 recommend substrate js frameworks for wallet connection
0xKheops Jul 3, 2026
7cd01dd
chore: 🔧 add scoped dev/build/preview/deploy scripts
0xKheops Jul 3, 2026
9dee9a8
docs: 📝 slim connect wallet guide to minimal example
0xKheops Jul 3, 2026
7e5f392
docs: ✂️ collapse tutorial into single quickstart page
0xKheops Jul 3, 2026
ac532eb
docs: 📝 explain nonce round-trip in quickstart
0xKheops Jul 3, 2026
5090a1d
docs: ✂️ nonce issuance as prose instead of code
0xKheops Jul 3, 2026
8f4896a
docs: 📝 clarify nonce cookie round-trip
0xKheops Jul 3, 2026
659eeef
docs: ✂️ tech-agnostic nonce handling in quickstart
0xKheops Jul 3, 2026
990f29d
feat!: 💥 remove signing from public api, siws is now primitives only
0xKheops Jul 3, 2026
81538c3
docs: 📝 verify-siws accepts bytes signatures
0xKheops Jul 3, 2026
2bc19e5
ci: ⬆️ node 24
0xKheops Jul 6, 2026
ab5d5e5
test: 🩹 fix flaky asJson issuedAt assertion
0xKheops Jul 6, 2026
d0e0768
chore: 🔧 prep cloudflare workers builds deploy
0xKheops Jul 6, 2026
07b40b8
ci: 🔐 npm publish via oidc trusted publishing
0xKheops Jul 6, 2026
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
10 changes: 0 additions & 10 deletions .eslintrc

This file was deleted.

22 changes: 12 additions & 10 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
name: Dry Run Publish
name: PR Checks

on:
pull_request:
branches:
- main

jobs:
dryRun:
checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
node-version: 24
cache: pnpm
- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm exec biome ci .
- name: Build
run: npm run build
- name: Audit dependencies
run: npm audit signatures
run: pnpm -r build
- name: Tests
run: npm test
run: pnpm --filter @talismn/siws test
- name: Dry Run Publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release --dry-run
run: pnpm exec semantic-release --dry-run
17 changes: 9 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ permissions:
contents: write
issues: write
pull-requests: write
id-token: write

jobs:
release:
Expand All @@ -18,20 +19,20 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
node-version: 24
cache: pnpm
- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile
- name: Build
run: npm run build
- name: Audit dependencies
run: npm audit signatures
run: pnpm --filter @talismn/siws build
- name: Tests
run: npm test
run: pnpm --filter @talismn/siws test
- name: Publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
run: pnpm exec semantic-release
27 changes: 24 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
# Dependency directories
# Dependencies
node_modules

# Output of 'npm run build'
# Build outputs
dist
coverage
.next/
.astro/
*.tsbuildinfo

coverage
# Env
.env
.env.*
!.env.example
.dev.vars

# Cloudflare / TanStack Start
.wrangler/
routeTree.gen.ts
.tanstack/
.nitro/
.output/

# Docs build copied into the demo app (generated by apps/demo build:docs)
apps/demo/public/docs/

# Misc
.DS_Store
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
pnpm exec commitlint --edit "$1"
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm test
pnpm --filter @talismn/siws test
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
13 changes: 0 additions & 13 deletions .prettierrc

This file was deleted.

17 changes: 17 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"branches": ["main"],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"releaseRules": [
{ "scope": "demo", "release": false },
{ "scope": "docs", "release": false }
]
}
],
"@semantic-release/release-notes-generator",
["@semantic-release/npm", { "pkgRoot": "packages/siws" }],
"@semantic-release/github"
]
}
111 changes: 40 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,62 @@
<br/>

<p align="center">
<a href="https://siws.xyz">
<picture>
<div align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/TalismanSociety/siws/blob/main/assets/Logo-dark.svg">
<img alt="siws logo" src="https://github.com/TalismanSociety/siws/blob/main/assets/Logo-light.svg" width="auto" height="60">
</picture>
</a>
</p>
<p align="center">
Sign-In with Substrate
<p>

<br>

![SIWS Example](https://github.com/TalismanSociety/siws/blob/main/assets/siws-example.png?raw=true "SIWS Example")
</picture>
</div>

# Sign-In with Substrate
# SIWS — Sign-In with Substrate

`@talismn/siws` is a package that lets you easily allow users to authenticate themselves with your off chain services by signing in with their Substrate accounts.
Monorepo for SIWS.

## Problem & Motivation
## Packages

When building Signet, an enterprise tool for companies to manage their on-chain organisations in the Substrate ecosystem, we needed a way for users to prove that they own an address before they can request for resources relevant to that address. There was no solution yet that offered good user experience, where users could easily understand what they are signing with their wallet. Inspired by [Sign-in with Ethereum](https://github.com/spruceid/siwe), we decided to build the right tool for the Substrate ecosystem.
| Path | Description |
| --- | --- |
| [`packages/siws`](packages/siws) | The [`@talismn/siws`](https://www.npmjs.com/package/@talismn/siws) library |
| [`apps/demo`](apps/demo) | Next.js demo dapp showcasing the full sign-in flow |
| [`apps/docs`](apps/docs) | Documentation site (Astro + Starlight) |

## Features
## Development

- Construct human readable sign in message
- Construct message in stringified JSON format
- Decode and parse string message of both format into JS object
- Basic validations (e.g. expiration)
- Utility `Address` to help with dealing with address string
- Utility `verifySIWS` to help verify that a signature is valid
- Full Typescript support

## Installation
Requires [pnpm](https://pnpm.io) 11+.

```bash
$ npm install @talismn/siws
```
pnpm install

## Usage
# lib tsc --watch + demo vite dev (http://localhost:5173), in parallel
pnpm dev

### Frontend
# docs dev server with hot reload (http://localhost:4321/docs/)
pnpm dev:docs

```typescript
// 1. import necessary modules
import { web3FromSource } from "@polkadot/extension-dapp"
import { SiwsMessage } from "@talismn/siws"
# lib + demo + docs dev servers, all in parallel
pnpm dev:all

// 2. handle sign in after `account` is selected
const handleSignIn = async () => {
const siws = new SiwsMessage({
domain: "localhost",
uri: "http://localhost:3000/sign-in",
address: account.address,
nonce, // a challenge generated from backend
statement: "Welcome to my dapp!",
})
# build everything (lib first, then apps)
pnpm build

// get the injector so we can sign the message
const injectedExtension = await web3FromSource(account.meta.source)
const signed = await siws.sign(injectedExtension)
# scoped builds
pnpm build:lib # library only
pnpm build:demo # demo app (includes a fresh docs build copied to /docs)
pnpm build:docs # rebuild docs + copy into the demo's public/docs

// api to sign in with backend
await signIn(signed)
}
```

### Backend
# run tests
pnpm test

```typescript
// 1. import siws
import { verifySIWS } from "@talismn/siws"
# format / lint (biome)
pnpm format
pnpm lint

// 2. backend handler to handle sign in request
const handleSignInRequest = ({ signature, message, address }) => {
// verify that signature is valid
const siwsMessage = await verifySIWS(message, signature, address)
# preview the built demo (app + docs) in the workerd runtime
pnpm preview

// ... user has proven ownership of address and hence authenticated!
}
# deploy demo + docs to Cloudflare Workers
# ("run" is required — plain `pnpm deploy` triggers pnpm's built-in deploy command)
pnpm run deploy
```

## Documentation

Check out our [full guide](https://docs.siws.xyz/) on how to implement SIWS into your dapp!

## Support
## Releases

- [Talisman](https://talisman.xyz)
- [Web3 Foundation](https://grants.web3.foundation/)
`@talismn/siws` is published from `packages/siws` via semantic-release on push to `main`.
Conventional commits drive the version bump; scope demo/docs-only changes as `chore(demo):` / `chore(docs):` (or any type with those scopes) so they don't trigger a library release.
36 changes: 36 additions & 0 deletions apps/demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
Loading
Loading