@tuwaio/siwx-server 1.0.0-fix-initialize-alpha.11.03ee15d → 1.0.0-fix-initialize-alpha.12.626c94c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -123,6 +123,26 @@ const nonce = generateServerNonce();
|
|
|
123
123
|
await redis.set(`nonce:${nonce}`, '1', 'EX', 300); // expires in 5 min
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
+
### `toSession(parsed: ParsedSiwxMessage): SiwxSession`
|
|
127
|
+
|
|
128
|
+
Converts a `ParsedSiwxMessage` into a lean `SiwxSession` object.
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
import { toSession } from '@tuwaio/siwx-server';
|
|
132
|
+
|
|
133
|
+
const session = toSession(parsedMessage);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### `isSessionMatchingTarget(session, targetAddress, targetChainId?)`
|
|
137
|
+
|
|
138
|
+
Re-exported from `@tuwaio/siwx-core` for server-side authorization checks. Validates if a session matches a target account address and optional chainId.
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
import { isSessionMatchingTarget } from '@tuwaio/siwx-server';
|
|
142
|
+
|
|
143
|
+
const isValid = isSessionMatchingTarget(session, userAddress, chainId);
|
|
144
|
+
```
|
|
145
|
+
|
|
126
146
|
---
|
|
127
147
|
|
|
128
148
|
## Nonce Replay Protection
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SiwxVerifyPayload } from '@tuwaio/siwx-core';
|
|
2
|
-
export { generateNonce as generateServerNonce } from '@tuwaio/siwx-core';
|
|
2
|
+
export { SiwxSessionLike, generateNonce as generateServerNonce, isSessionMatchingTarget } from '@tuwaio/siwx-core';
|
|
3
3
|
import { S as SiwxSession, C as CookieOptions, a as SerializedCookieSession, b as ServerVerifyOptions, c as ServerVerifyResult } from './types-CvnkVdoo.mjs';
|
|
4
4
|
export { t as toSession } from './types-CvnkVdoo.mjs';
|
|
5
5
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SiwxVerifyPayload } from '@tuwaio/siwx-core';
|
|
2
|
-
export { generateNonce as generateServerNonce } from '@tuwaio/siwx-core';
|
|
2
|
+
export { SiwxSessionLike, generateNonce as generateServerNonce, isSessionMatchingTarget } from '@tuwaio/siwx-core';
|
|
3
3
|
import { S as SiwxSession, C as CookieOptions, a as SerializedCookieSession, b as ServerVerifyOptions, c as ServerVerifyResult } from './types-CvnkVdoo.js';
|
|
4
4
|
export { t as toSession } from './types-CvnkVdoo.js';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var chunk47HTX7ZQ_js=require('./chunk-47HTX7ZQ.js');Object.defineProperty(exports,"deserializeCookieSession",{enumerable:true,get:function(){return chunk47HTX7ZQ_js.e}});Object.defineProperty(exports,"generateServerNonce",{enumerable:true,get:function(){return chunk47HTX7ZQ_js.b}});Object.defineProperty(exports,"serializeCookieSession",{enumerable:true,get:function(){return chunk47HTX7ZQ_js.d}});Object.defineProperty(exports,"toSession",{enumerable:true,get:function(){return chunk47HTX7ZQ_js.a}});Object.defineProperty(exports,"verifySiwxPayload",{enumerable:true,get:function(){return chunk47HTX7ZQ_js.c}});
|
|
1
|
+
'use strict';var chunk47HTX7ZQ_js=require('./chunk-47HTX7ZQ.js'),siwxCore=require('@tuwaio/siwx-core');Object.defineProperty(exports,"deserializeCookieSession",{enumerable:true,get:function(){return chunk47HTX7ZQ_js.e}});Object.defineProperty(exports,"generateServerNonce",{enumerable:true,get:function(){return chunk47HTX7ZQ_js.b}});Object.defineProperty(exports,"serializeCookieSession",{enumerable:true,get:function(){return chunk47HTX7ZQ_js.d}});Object.defineProperty(exports,"toSession",{enumerable:true,get:function(){return chunk47HTX7ZQ_js.a}});Object.defineProperty(exports,"verifySiwxPayload",{enumerable:true,get:function(){return chunk47HTX7ZQ_js.c}});Object.defineProperty(exports,"isSessionMatchingTarget",{enumerable:true,get:function(){return siwxCore.isSessionMatchingTarget}});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{e as deserializeCookieSession,b as generateServerNonce,d as serializeCookieSession,a as toSession,c as verifySiwxPayload}from'./chunk-JVIBIICZ.mjs';
|
|
1
|
+
export{e as deserializeCookieSession,b as generateServerNonce,d as serializeCookieSession,a as toSession,c as verifySiwxPayload}from'./chunk-JVIBIICZ.mjs';export{isSessionMatchingTarget}from'@tuwaio/siwx-core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuwaio/siwx-server",
|
|
3
|
-
"version": "1.0.0-fix-initialize-alpha.
|
|
3
|
+
"version": "1.0.0-fix-initialize-alpha.12.626c94c",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Oleksandr Tkach",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -68,15 +68,15 @@
|
|
|
68
68
|
}
|
|
69
69
|
],
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@tuwaio/siwx-core": "1.0.0-fix-initialize-alpha.
|
|
71
|
+
"@tuwaio/siwx-core": "1.0.0-fix-initialize-alpha.12.626c94c"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"tsup": "^8.5.1",
|
|
75
75
|
"typescript": "^6.0.3",
|
|
76
76
|
"viem": "^2.55.11",
|
|
77
|
-
"@tuwaio/siwx-core": "1.0.0-fix-initialize-alpha.
|
|
78
|
-
"@tuwaio/siwx-evm": "1.0.0-fix-initialize-alpha.
|
|
79
|
-
"@tuwaio/siwx-solana": "1.0.0-fix-initialize-alpha.
|
|
77
|
+
"@tuwaio/siwx-core": "1.0.0-fix-initialize-alpha.12.626c94c",
|
|
78
|
+
"@tuwaio/siwx-evm": "1.0.0-fix-initialize-alpha.12.626c94c",
|
|
79
|
+
"@tuwaio/siwx-solana": "1.0.0-fix-initialize-alpha.12.626c94c"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|
|
82
82
|
"start": "tsup src/index.ts --watch",
|