@junobuild/core 5.0.0 → 5.1.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.
@@ -0,0 +1,41 @@
1
+ import type { DelegationChain, ECDSAKeyIdentity } from '@icp-sdk/core/identity';
2
+ import type { DevIdentitySignInOptions } from '../types/dev-identity';
3
+ import type { ProviderWithoutData } from '../types/provider';
4
+ /**
5
+ * Development identity authentication provider for local testing.
6
+ *
7
+ * ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
8
+ * ⚠️ UNSAFE - FOR LOCAL DEVELOPMENT ONLY ⚠️
9
+ * ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
10
+ *
11
+ * This provider generates deterministic identities for local development
12
+ * without requiring external authentication services. Only works on localhost.
13
+ *
14
+ * @class DevIdentityProvider
15
+ */
16
+ export declare class DevIdentityProvider {
17
+ /**
18
+ * Signs in a user with a development identity.
19
+ *
20
+ * @param {Object} params - The sign-in parameters.
21
+ * @param {DevIdentitySignInOptions} [params.options] - Optional configuration for the dev identity (identifier, TTL).
22
+ * @param {Function} params.initAuth - Callback to initialize or load the user after identity generation.
23
+ * @param {Function} params.setStorage - Callback to store the session key and delegation chain for AuthClient.
24
+ *
25
+ * @returns {Promise<void>} Resolves when sign-in is complete.
26
+ *
27
+ * @throws {UnsafeDevIdentityNotBrowserError} If called outside browser environment.
28
+ * @throws {UnsafeDevIdentityNotLocalhostError} If called outside localhost.
29
+ * @throws {UnsafeDevIdentityInvalidIdentifierError} If identifier exceeds 32 characters.
30
+ */
31
+ signIn({ options, initAuth, setStorage }: {
32
+ options?: DevIdentitySignInOptions;
33
+ initAuth: (params: {
34
+ provider: ProviderWithoutData;
35
+ }) => Promise<void>;
36
+ setStorage: (params: {
37
+ delegationChain: DelegationChain;
38
+ sessionKey: ECDSAKeyIdentity;
39
+ }) => Promise<void>;
40
+ }): Promise<void>;
41
+ }
@@ -1,3 +1,4 @@
1
+ import type { DevIdentitySignInOptions } from './dev-identity';
1
2
  import type { GitHubHandleRedirectCallbackOptions, GitHubSignInRedirectOptions } from './github';
2
3
  import type { GoogleSignInRedirectOptions } from './google';
3
4
  import type { InternetIdentitySignInOptions } from './internet-identity';
@@ -23,6 +24,7 @@ export interface SignInContext {
23
24
  * - `github` — GitHub sign-in
24
25
  * - `internet_identity` — Internet Identity
25
26
  * - `webauthn` — WebAuthn/Passkeys
27
+ * - `dev` — Local development (only)
26
28
  */
27
29
  export type SignInOptions = {
28
30
  google: {
@@ -42,6 +44,10 @@ export type SignInOptions = {
42
44
  options?: WebAuthnSignInOptions;
43
45
  context?: SignInContext;
44
46
  };
47
+ } | {
48
+ dev: {
49
+ options?: DevIdentitySignInOptions;
50
+ };
45
51
  };
46
52
  /**
47
53
  * Defines which provider to use for signing up and its associated options.
@@ -0,0 +1,6 @@
1
+ import type { GenerateUnsafeIdentityParams } from '@junobuild/ic-client/dev';
2
+ /**
3
+ * Interface representing sign-in options for local development.
4
+ * @interface DevIdentitySignInOptions
5
+ */
6
+ export type DevIdentitySignInOptions = GenerateUnsafeIdentityParams;
@@ -11,6 +11,7 @@ export { signOut } from './auth/services/sign-out.services';
11
11
  export { signUp } from './auth/services/sign-up.services';
12
12
  export type * from './auth/types/auth';
13
13
  export * from './auth/types/auth-client';
14
+ export type * from './auth/types/dev-identity';
14
15
  export * from './auth/types/errors';
15
16
  export type * from './auth/types/github';
16
17
  export type * from './auth/types/google';
@@ -18,7 +19,7 @@ export type * from './auth/types/internet-identity';
18
19
  export type * from './auth/types/progress';
19
20
  export type * from './auth/types/provider';
20
21
  export type * from './auth/types/user';
21
- export type * from './auth/types/webauthn';
22
+ export * from './auth/types/webauthn';
22
23
  export * from './auth/utils/user.utils';
23
24
  export type * from './core/types/env';
24
25
  export { ListOrder, ListPaginate, ListParams, ListResults } from './core/types/list';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/core",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "JavaScript core client for Juno",
5
5
  "author": "David Dal Busco (https://daviddalbusco.com)",
6
6
  "license": "MIT",
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "@junobuild/auth": "^3",
56
56
  "@junobuild/errors": "*",
57
- "@junobuild/ic-client": "^7.1",
57
+ "@junobuild/ic-client": "^7.2",
58
58
  "@junobuild/storage": "^2.2",
59
59
  "@junobuild/utils": "*"
60
60
  },