@naculus/connect-appkit-vue 0.2.4 → 0.2.6
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 +38 -4
- package/dist/index.cjs +2748 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +955 -4
- package/dist/index.d.ts +955 -4
- package/dist/index.js +2773 -42
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
> **Components have parity with React. Composables do not.** All 28 components
|
|
6
6
|
> are generated from the same Stencil source, so anything visual works the same
|
|
7
|
-
> in both. The logic layer
|
|
8
|
-
>
|
|
9
|
-
>
|
|
10
|
-
>
|
|
7
|
+
> in both. The Vue logic layer currently covers 43 of 51 parity targets. Message
|
|
8
|
+
> signing and EVM/Solana transaction actions are available through caller-owned
|
|
9
|
+
> functions, and SIWX auth/session state is available through caller-owned
|
|
10
|
+
> actions. Session keys and parts of the transaction lifecycle remain
|
|
11
|
+
> React-only today.
|
|
11
12
|
>
|
|
12
13
|
> `useCapabilities` (the EIP-5792 query) and `useSolanaRoles` (which of
|
|
13
14
|
> `identity` / `signer` / `payer` the connected Solana wallet can fill) are not
|
|
@@ -50,6 +51,39 @@ import "@naculus/connect-appkit-vue";
|
|
|
50
51
|
</script>
|
|
51
52
|
```
|
|
52
53
|
|
|
54
|
+
### Restoring SIWX sessions
|
|
55
|
+
|
|
56
|
+
`useSIWxSession` and `useSiwxAuthSession` are reactive shells: they do not read
|
|
57
|
+
storage or validate session dates. Before exposing a persisted session or SIWX
|
|
58
|
+
result to either composable, the caller must apply the shared appkit-core
|
|
59
|
+
policy. This rejects expired sessions, not-yet-valid sessions, and malformed
|
|
60
|
+
date strings instead of restoring them.
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import {
|
|
64
|
+
isSiwxExpired,
|
|
65
|
+
isSiwxNotBeforeValid,
|
|
66
|
+
type SiwxResultLike,
|
|
67
|
+
} from "@naculus/connect-appkit-core";
|
|
68
|
+
import { shallowRef } from "vue";
|
|
69
|
+
|
|
70
|
+
const restoredResult = shallowRef<SiwxResultLike | null>(null);
|
|
71
|
+
const candidate = await loadPersistedSiwxResult();
|
|
72
|
+
const now = new Date();
|
|
73
|
+
|
|
74
|
+
if (
|
|
75
|
+
candidate &&
|
|
76
|
+
!isSiwxExpired(candidate, now) &&
|
|
77
|
+
isSiwxNotBeforeValid(candidate, now)
|
|
78
|
+
) {
|
|
79
|
+
restoredResult.value = candidate;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Pass restoredResult to useSiwxAuthSession. For useSIWxSession, expose the
|
|
83
|
+
// corresponding session only after the same check and provide isExpired from
|
|
84
|
+
// your caller-owned session policy.
|
|
85
|
+
```
|
|
86
|
+
|
|
53
87
|
## License
|
|
54
88
|
|
|
55
89
|
MIT
|