@reown/appkit-siwe 0.0.3

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.
Files changed (34) hide show
  1. package/LICENSE +190 -0
  2. package/dist/esm/core/controller/SIWEController.js +92 -0
  3. package/dist/esm/core/controller/SIWEController.js.map +1 -0
  4. package/dist/esm/core/helpers/index.js +17 -0
  5. package/dist/esm/core/helpers/index.js.map +1 -0
  6. package/dist/esm/core/utils/ConstantsUtil.js +4 -0
  7. package/dist/esm/core/utils/ConstantsUtil.js.map +1 -0
  8. package/dist/esm/core/utils/TypeUtils.js +2 -0
  9. package/dist/esm/core/utils/TypeUtils.js.map +1 -0
  10. package/dist/esm/exports/index.js +11 -0
  11. package/dist/esm/exports/index.js.map +1 -0
  12. package/dist/esm/scaffold/partials/w3m-connecting-siwe/index.js +49 -0
  13. package/dist/esm/scaffold/partials/w3m-connecting-siwe/index.js.map +1 -0
  14. package/dist/esm/scaffold/partials/w3m-connecting-siwe/styles.js +13 -0
  15. package/dist/esm/scaffold/partials/w3m-connecting-siwe/styles.js.map +1 -0
  16. package/dist/esm/scaffold/views/w3m-connecting-siwe-view/index.js +151 -0
  17. package/dist/esm/scaffold/views/w3m-connecting-siwe-view/index.js.map +1 -0
  18. package/dist/esm/src/client.js +111 -0
  19. package/dist/esm/src/client.js.map +1 -0
  20. package/dist/esm/tests/controllers/SIWEController.test.js +57 -0
  21. package/dist/esm/tests/controllers/SIWEController.test.js.map +1 -0
  22. package/dist/esm/tsconfig.tsbuildinfo +1 -0
  23. package/dist/types/core/controller/SIWEController.d.ts +39 -0
  24. package/dist/types/core/helpers/index.d.ts +9 -0
  25. package/dist/types/core/utils/ConstantsUtil.d.ts +3 -0
  26. package/dist/types/core/utils/TypeUtils.d.ts +74 -0
  27. package/dist/types/exports/index.d.ts +10 -0
  28. package/dist/types/scaffold/partials/w3m-connecting-siwe/index.d.ts +14 -0
  29. package/dist/types/scaffold/partials/w3m-connecting-siwe/styles.d.ts +2 -0
  30. package/dist/types/scaffold/views/w3m-connecting-siwe-view/index.d.ts +14 -0
  31. package/dist/types/src/client.d.ts +14 -0
  32. package/dist/types/tests/controllers/SIWEController.test.d.ts +1 -0
  33. package/package.json +48 -0
  34. package/readme.md +11 -0
@@ -0,0 +1,74 @@
1
+ export interface SIWESession {
2
+ address: string;
3
+ chainId: number;
4
+ }
5
+ interface CacaoHeader {
6
+ t: 'caip122';
7
+ }
8
+ export interface SIWECreateMessageArgs {
9
+ chainId: number;
10
+ domain: string;
11
+ nonce: string;
12
+ uri: string;
13
+ address: string;
14
+ version: '1';
15
+ type?: CacaoHeader['t'];
16
+ nbf?: string;
17
+ exp?: string;
18
+ statement?: string;
19
+ requestId?: string;
20
+ resources?: string[];
21
+ expiry?: number;
22
+ iat?: string;
23
+ }
24
+ export type SIWEMessageArgs = {
25
+ chains: number[];
26
+ methods?: string[];
27
+ } & Omit<SIWECreateMessageArgs, 'address' | 'chainId' | 'nonce' | 'version'>;
28
+ interface CacaoPayload {
29
+ domain: string;
30
+ aud: string;
31
+ nonce: string;
32
+ iss: string;
33
+ version?: string;
34
+ iat?: string;
35
+ nbf?: string;
36
+ exp?: string;
37
+ statement?: string;
38
+ requestId?: string;
39
+ resources?: string[];
40
+ type?: string;
41
+ }
42
+ interface Cacao {
43
+ h: CacaoHeader;
44
+ p: CacaoPayload;
45
+ s: {
46
+ t: 'eip191' | 'eip1271';
47
+ s: string;
48
+ m?: string;
49
+ };
50
+ }
51
+ export interface SIWEVerifyMessageArgs {
52
+ message: string;
53
+ signature: string;
54
+ cacao?: Cacao;
55
+ }
56
+ export interface SIWEClientMethods {
57
+ getNonce: (address?: string) => Promise<string>;
58
+ getMessageParams?: () => Promise<SIWEMessageArgs>;
59
+ createMessage: (args: SIWECreateMessageArgs) => string;
60
+ verifyMessage: (args: SIWEVerifyMessageArgs) => Promise<boolean>;
61
+ getSession: () => Promise<SIWESession | null>;
62
+ signOut: () => Promise<boolean>;
63
+ onSignIn?: (session?: SIWESession) => void;
64
+ onSignOut?: () => void;
65
+ }
66
+ export interface SIWEConfig extends SIWEClientMethods {
67
+ enabled?: boolean;
68
+ nonceRefetchIntervalMs?: number;
69
+ sessionRefetchIntervalMs?: number;
70
+ signOutOnDisconnect?: boolean;
71
+ signOutOnAccountChange?: boolean;
72
+ signOutOnNetworkChange?: boolean;
73
+ }
74
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { SIWEConfig } from '../core/utils/TypeUtils.js';
2
+ import { Web3ModalSIWEClient } from '../src/client.js';
3
+ export { getAddressFromMessage, getChainIdFromMessage, verifySignature } from '../core/helpers/index.js';
4
+ export { formatMessage, getDidChainId, getDidAddress } from '@walletconnect/utils';
5
+ export { SIWEController, type SIWEControllerClient } from '../core/controller/SIWEController.js';
6
+ export * from '../core/utils/TypeUtils.js';
7
+ export type { Web3ModalSIWEClient };
8
+ export declare function createSIWEConfig(siweConfig: SIWEConfig): Web3ModalSIWEClient;
9
+ export * from '../scaffold/partials/w3m-connecting-siwe/index.js';
10
+ export * from '../scaffold/views/w3m-connecting-siwe-view/index.js';
@@ -0,0 +1,14 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class W3mConnectingSiwe extends LitElement {
3
+ static styles: import("lit").CSSResult;
4
+ private readonly dappImageUrl;
5
+ private readonly walletImageUrl;
6
+ firstUpdated(): void;
7
+ render(): import("lit").TemplateResult<1>;
8
+ private createAnimation;
9
+ }
10
+ declare global {
11
+ interface HTMLElementTagNameMap {
12
+ 'w3m-connecting-siwe': W3mConnectingSiwe;
13
+ }
14
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class W3mConnectingSiweView extends LitElement {
3
+ private readonly dappName;
4
+ private isSigning;
5
+ private isCancelling;
6
+ render(): import("lit").TemplateResult<1>;
7
+ private onSign;
8
+ private onCancel;
9
+ }
10
+ declare global {
11
+ interface HTMLElementTagNameMap {
12
+ 'w3m-connecting-siwe-view': W3mConnectingSiweView;
13
+ }
14
+ }
@@ -0,0 +1,14 @@
1
+ import { type SIWEControllerClient } from '../core/controller/SIWEController.js';
2
+ import type { SIWEClientMethods, SIWEConfig, SIWECreateMessageArgs, SIWEMessageArgs, SIWESession, SIWEVerifyMessageArgs } from '../core/utils/TypeUtils.js';
3
+ export declare class Web3ModalSIWEClient {
4
+ options: SIWEControllerClient['options'];
5
+ methods: SIWEClientMethods;
6
+ constructor(siweConfig: SIWEConfig);
7
+ getNonce(address?: string): Promise<string>;
8
+ getMessageParams?(): Promise<SIWEMessageArgs>;
9
+ createMessage(args: SIWECreateMessageArgs): string;
10
+ verifyMessage(args: SIWEVerifyMessageArgs): Promise<boolean>;
11
+ getSession(): Promise<SIWESession>;
12
+ signIn(): Promise<SIWESession>;
13
+ signOut(): Promise<boolean>;
14
+ }
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@reown/appkit-siwe",
3
+ "version": "0.0.3",
4
+ "type": "module",
5
+ "main": "./dist/esm/exports/index.js",
6
+ "types": "./dist/types/exports/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "!tsconfig.tsbuildinfo"
10
+ ],
11
+ "dependencies": {
12
+ "@walletconnect/utils": "2.16.1",
13
+ "valtio": "1.11.2",
14
+ "lit": "3.1.0",
15
+ "@reown/appkit-core": "0.0.3",
16
+ "@reown/appkit-ui": "0.0.3",
17
+ "@reown/appkit-wallet": "0.0.3",
18
+ "@reown/appkit-common": "0.0.3",
19
+ "@reown/appkit-utils": "0.0.3"
20
+ },
21
+ "keywords": [
22
+ "web3",
23
+ "crypto",
24
+ "ethereum",
25
+ "appkit",
26
+ "reown",
27
+ "lit",
28
+ "webcomponents",
29
+ "siwe"
30
+ ],
31
+ "author": "reown <reown.com>",
32
+ "license": "Apache-2.0",
33
+ "homepage": "https://github.com/web3modal/web3modal",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/WalletConnect/shadow-appkit.git"
37
+ },
38
+ "bugs": {
39
+ "url": "https://github.com/web3modal/web3modal/issues"
40
+ },
41
+ "scripts": {
42
+ "build:clean": "rm -rf dist",
43
+ "build": "tsc --build",
44
+ "watch": "tsc --watch",
45
+ "typecheck": "tsc --noEmit",
46
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
47
+ }
48
+ }
package/readme.md ADDED
@@ -0,0 +1,11 @@
1
+ #### 📚 [Documentation](https://docs.walletconnect.com/2.0/web3modal/about)
2
+
3
+ #### 🔗 [Website](https://web3modal.com)
4
+
5
+ # Web3Modal SIWE
6
+
7
+ Your on-ramp to web3 multichain. Web3Modal is a versatile library that makes it super easy to connect users with your Dapp and start interacting with the blockchain.
8
+
9
+ <p align="center">
10
+ <img src="./.github/assets/header.png" alt="" border="0">
11
+ </p>