@junobuild/core-standalone 1.2.1-next-2025-09-03.1 → 2.0.0

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.
@@ -1,4 +1,5 @@
1
- import type { AuthClientSignInOptions, InternetIdentityConfig } from '../types/auth-client';
1
+ import type { AuthClientSignInOptions } from '../types/auth-client';
2
+ import type { InternetIdentityConfig } from '../types/internet-identity';
2
3
  import type { Provider } from '../types/provider';
3
4
  import { AuthClientProvider, type AuthProviderSignInOptions } from './_auth-client.providers';
4
5
  /**
@@ -12,7 +13,7 @@ export declare class InternetIdentityProvider extends AuthClientProvider {
12
13
  * Creates an instance of InternetIdentityProvider.
13
14
  * @param {InternetIdentityConfig} config - The configuration for Internet Identity.
14
15
  */
15
- constructor({ domain }?: InternetIdentityConfig);
16
+ constructor({ domain }: InternetIdentityConfig);
16
17
  /**
17
18
  * Gets the identifier of the provider.
18
19
  * @returns {Provider} The identifier of the provider - `internet_identity`.
@@ -1,4 +1,5 @@
1
- import type { AuthClientSignInOptions, NFIDConfig } from '../types/auth-client';
1
+ import type { AuthClientSignInOptions } from '../types/auth-client';
2
+ import type { NFIDConfig } from '../types/nfid';
2
3
  import type { Provider } from '../types/provider';
3
4
  import { AuthClientProvider, type AuthProviderSignInOptions } from './_auth-client.providers';
4
5
  /**
@@ -1,5 +1,5 @@
1
1
  import type { Identity } from '@dfinity/agent';
2
- import type { SignInOptions, SignUpOptions } from '../types/auth';
2
+ import type { SignInOptions, SignOutOptions, SignUpOptions } from '../types/auth';
3
3
  import type { Provider } from '../types/provider';
4
4
  /**
5
5
  * Initialize the authClient and load the existing user.
@@ -17,10 +17,10 @@ export declare const createAuth: ({ provider }: {
17
17
  * Signs in a user with the specified options.
18
18
  *
19
19
  * @default Signs in by default with Internet Identity
20
- * @param {SignInOptions} [options] - The options for signing in.
20
+ * @param {SignInOptions} [options] - The options for signing in including the provider to use for the process.
21
21
  * @returns {Promise<void>} A promise that resolves when the sign-in process is complete and the authenticated user is initialized.
22
22
  */
23
- export declare const signIn: (options?: SignInOptions) => Promise<void>;
23
+ export declare const signIn: (options: SignInOptions) => Promise<void>;
24
24
  /**
25
25
  * Signs up to create a new user with the specified options.
26
26
  *
@@ -32,7 +32,7 @@ export declare const signUp: (options: SignUpOptions) => Promise<void>;
32
32
  * Signs out the current user.
33
33
  * @returns {Promise<void>} A promise that resolves when the sign-out process is complete.
34
34
  */
35
- export declare const signOut: () => Promise<void>;
35
+ export declare const signOut: (options?: SignOutOptions) => Promise<void>;
36
36
  /**
37
37
  * ℹ️ Exposed for testing purpose only. Should not be leaked to consumer or used by the library.
38
38
  */
@@ -41,36 +41,3 @@ export interface AuthClientSignInOptions {
41
41
  */
42
42
  onProgress?: SignProgressFn<AuthClientSignInProgressStep>;
43
43
  }
44
- /**
45
- * Type representing the available Internet Identity domains.
46
- * @typedef {('internetcomputer.org' | 'ic0.app')} InternetIdentityDomain
47
- */
48
- export type InternetIdentityDomain = 'internetcomputer.org' | 'ic0.app';
49
- /**
50
- * Interface representing the configuration for Internet Identity.
51
- * @interface InternetIdentityConfig
52
- */
53
- export interface InternetIdentityConfig {
54
- /**
55
- * The domain for Internet Identity.
56
- * @default internetcomputer.org
57
- * @type {InternetIdentityDomain}
58
- */
59
- domain?: InternetIdentityDomain;
60
- }
61
- /**
62
- * Interface representing the configuration for NFID.
63
- * @interface NFIDConfig
64
- */
65
- export interface NFIDConfig {
66
- /**
67
- * The name of the application.
68
- * @type {string}
69
- */
70
- appName: string;
71
- /**
72
- * The URL of the application's logo.
73
- * @type {string}
74
- */
75
- logoUrl: string;
76
- }
@@ -1,4 +1,5 @@
1
- import type { AuthClientSignInOptions, InternetIdentityConfig, NFIDConfig } from './auth-client';
1
+ import type { InternetIdentitySignInOptions } from './internet-identity';
2
+ import type { NFIDSignInOptions } from './nfid';
2
3
  import type { WebAuthnSignInOptions, WebAuthnSignUpOptions } from './webauthn';
3
4
  /**
4
5
  * Options for the context of the sign-in flow.
@@ -17,20 +18,18 @@ export interface SignInContext {
17
18
  /**
18
19
  * The options for sign-in.
19
20
  *
20
- * - `internetIdentity`: Internet Identity config + options
21
- * - `nfid`: NFID config (required) + popup options
21
+ * - `internetIdentity`: Internet Identity options
22
+ * - `nfid`: NFID options
22
23
  * - `webauthn`: WebAuthn/Passkey options
23
24
  */
24
25
  export type SignInOptions = {
25
26
  internet_identity: {
26
- config?: InternetIdentityConfig;
27
- options?: AuthClientSignInOptions;
27
+ options?: InternetIdentitySignInOptions;
28
28
  context?: SignInContext;
29
29
  };
30
30
  } | {
31
31
  nfid: {
32
- config: NFIDConfig;
33
- options?: AuthClientSignInOptions;
32
+ options: NFIDSignInOptions;
34
33
  context?: SignInContext;
35
34
  };
36
35
  } | {
@@ -50,3 +49,15 @@ export interface SignUpOptions {
50
49
  context?: SignInContext;
51
50
  };
52
51
  }
52
+ /**
53
+ * The options for sign-out.
54
+ */
55
+ export interface SignOutOptions {
56
+ /**
57
+ * Opt out of reloading the window after state and authentication
58
+ * have been successfully cleared.
59
+ *
60
+ * @default true
61
+ */
62
+ windowReload?: boolean;
63
+ }
@@ -4,6 +4,8 @@ export declare class SignInInitError extends Error {
4
4
  }
5
5
  export declare class SignInUserInterruptError extends Error {
6
6
  }
7
+ export declare class SignInProviderNotSupportedError extends Error {
8
+ }
7
9
  export declare class WebAuthnSignInRetrievePublicKeyError extends Error {
8
10
  }
9
11
  export declare class SignUpProviderNotSupportedError extends Error {
@@ -0,0 +1,23 @@
1
+ import type { AuthClientSignInOptions } from './auth-client';
2
+ /**
3
+ * Type representing the available Internet Identity domains.
4
+ * @typedef {('internetcomputer.org' | 'ic0.app')} InternetIdentityDomain
5
+ */
6
+ export type InternetIdentityDomain = 'internetcomputer.org' | 'ic0.app';
7
+ /**
8
+ * Interface representing the specific configuration for Internet Identity.
9
+ * @interface InternetIdentityConfig
10
+ */
11
+ export interface InternetIdentityConfig {
12
+ /**
13
+ * The domain for Internet Identity.
14
+ * @default internetcomputer.org
15
+ * @type {InternetIdentityDomain}
16
+ */
17
+ domain?: InternetIdentityDomain;
18
+ }
19
+ /**
20
+ * Interface representing sign-in options when using the Internet Identity provider.
21
+ * @interface InternetIdentitySignInOptions
22
+ */
23
+ export type InternetIdentitySignInOptions = InternetIdentityConfig & AuthClientSignInOptions;
@@ -0,0 +1,22 @@
1
+ import type { AuthClientSignInOptions } from './auth-client';
2
+ /**
3
+ * Interface representing the specific configuration for NFID.
4
+ * @interface NFIDConfig
5
+ */
6
+ export interface NFIDConfig {
7
+ /**
8
+ * The name of the application.
9
+ * @type {string}
10
+ */
11
+ appName: string;
12
+ /**
13
+ * The URL of the application's logo.
14
+ * @type {string}
15
+ */
16
+ logoUrl: string;
17
+ }
18
+ /**
19
+ * Interface representing sign-in options when using the NFID provider.
20
+ * @interface NFIDSignInOptions
21
+ */
22
+ export type NFIDSignInOptions = NFIDConfig & AuthClientSignInOptions;
@@ -46,3 +46,5 @@ export declare const onAuthStateChange: (callback: (authUser: User | null) => vo
46
46
  * @deprecated Use {@link onAuthStateChange} instead.
47
47
  */
48
48
  export declare const authSubscribe: (callback: (authUser: User | null) => void) => Unsubscribe;
49
+ export { InternetIdentityConfig, InternetIdentityDomain } from './auth/types/internet-identity';
50
+ export { NFIDConfig } from './auth/types/nfid';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/core-standalone",
3
- "version": "1.2.1-next-2025-09-03.1",
3
+ "version": "2.0.0",
4
4
  "description": "JavaScript core client for Juno with all dependencies bundled — no peer dependencies",
5
5
  "author": "David Dal Busco (https://daviddalbusco.com)",
6
6
  "license": "MIT",
@@ -59,8 +59,8 @@
59
59
  "@dfinity/principal": "^2.3.0",
60
60
  "@dfinity/utils": "^2",
61
61
  "@junobuild/errors": "*",
62
- "@junobuild/ic-client": "^2",
63
- "@junobuild/storage": "^1.2.0",
62
+ "@junobuild/ic-client": "^3",
63
+ "@junobuild/storage": "^1.2.1",
64
64
  "@junobuild/utils": "*"
65
65
  }
66
- }
66
+ }