better-near-auth 0.1.3 → 0.1.5

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 (3) hide show
  1. package/package.json +11 -8
  2. package/src/client.ts +5 -12
  3. package/index.ts +0 -22
package/package.json CHANGED
@@ -1,14 +1,18 @@
1
1
  {
2
2
  "name": "better-near-auth",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Sign in with NEAR (SIWN) plugin for Better Auth",
5
- "main": "index.ts",
6
- "module": "index.ts",
5
+ "main": "src/index.ts",
6
+ "module": "src/index.ts",
7
7
  "type": "module",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./index.ts",
11
- "types": "./index.ts"
10
+ "import": "./src/index.ts",
11
+ "types": "./src/index.ts"
12
+ },
13
+ "./client": {
14
+ "import": "./src/client.ts",
15
+ "types": "./src/client.ts"
12
16
  }
13
17
  },
14
18
  "scripts": {
@@ -16,7 +20,7 @@
16
20
  "test": "vitest",
17
21
  "test:watch": "vitest --watch",
18
22
  "lint": "tsc --noEmit",
19
- "dev": "bun run index.ts"
23
+ "dev": "bun run src/index.ts"
20
24
  },
21
25
  "keywords": [
22
26
  "better-auth",
@@ -45,7 +49,7 @@
45
49
  "dependencies": {
46
50
  "@better-auth/utils": "^0.2.6",
47
51
  "@fastnear/utils": "^0.9.7",
48
- "fastintear": "link:fastintear",
52
+ "fastintear": "^0.2.4",
49
53
  "nanostores": "^1.0.1",
50
54
  "near-sign-verify": "^0.4.3",
51
55
  "zod": "^4.0.17"
@@ -59,7 +63,6 @@
59
63
  },
60
64
  "files": [
61
65
  "src/",
62
- "index.ts",
63
66
  "README.md",
64
67
  "LICENSE"
65
68
  ]
package/src/client.ts CHANGED
@@ -1,18 +1,11 @@
1
1
  import { base64ToBytes } from "@fastnear/utils";
2
2
  import type { BetterAuthClientPlugin, BetterFetch, BetterFetchOption, BetterFetchResponse } from "better-auth/client";
3
- // TODO: tree shaking, browser vs node
4
- import * as fastintear from "fastintear";
3
+ import { createNearClient } from "fastintear";
5
4
  import { atom } from "nanostores";
6
- import { sign, type WalletInterface } from "near-sign-verify";
7
- import { siwn } from ".";
5
+ import { sign } from "near-sign-verify";
6
+ import type { siwn } from ".";
8
7
  import { type AccountId, type NonceRequestT, type NonceResponseT, type ProfileResponseT, type VerifyRequestT, type VerifyResponseT } from "./types";
9
8
 
10
- export interface Signer {
11
- accountId(): string | null;
12
- signMessage: WalletInterface["signMessage"];
13
- requestSignIn: typeof fastintear.requestSignIn
14
- }
15
-
16
9
  export interface AuthCallbacks {
17
10
  onSuccess?: () => void;
18
11
  onError?: (error: Error & { status?: number; code?: string }) => void;
@@ -37,7 +30,7 @@ export interface SIWNClientActions {
37
30
  nonce: (params: NonceRequestT) => Promise<BetterFetchResponse<NonceResponseT>>;
38
31
  verify: (params: VerifyRequestT) => Promise<BetterFetchResponse<VerifyResponseT>>;
39
32
  getProfile: (accountId?: AccountId) => Promise<BetterFetchResponse<ProfileResponseT>>;
40
- getNearClient: () => ReturnType<typeof fastintear.createNearClient>;
33
+ getNearClient: () => ReturnType<typeof createNearClient>;
41
34
  getAccountId: () => string | null;
42
35
  disconnect: () => Promise<void>;
43
36
  };
@@ -57,7 +50,7 @@ export interface SIWNClientPlugin extends BetterAuthClientPlugin {
57
50
 
58
51
  export const siwnClient = (config: SIWNClientConfig): SIWNClientPlugin => {
59
52
  // Create embedded NEAR client
60
- const nearClient = fastintear.createNearClient({
53
+ const nearClient = createNearClient({
61
54
  networkId: config.networkId || "mainnet"
62
55
  });
63
56
 
package/index.ts DELETED
@@ -1,22 +0,0 @@
1
- export { siwn } from "./src/index";
2
- export { siwnClient } from "./src/client";
3
- export type {
4
- AccountId,
5
- NearAccount,
6
- SocialImage,
7
- Profile,
8
- NonceRequestT,
9
- NonceResponseT,
10
- VerifyRequestT,
11
- VerifyResponseT,
12
- ProfileRequestT,
13
- ProfileResponseT,
14
- } from "./src/types";
15
- export { accountIdSchema } from "./src/types";
16
- export type { SIWNPluginOptions } from "./src/index";
17
- export type {
18
- AuthCallbacks,
19
- SIWNClientConfig,
20
- SIWNClientActions,
21
- SIWNClientPlugin,
22
- } from "./src/client";