Skip to content

Commit

Permalink
Bring back the loginOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoferlund committed Oct 16, 2024
1 parent 74cf2f5 commit 8dbf53e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
type AuthClientLoginOptions,
} from "@dfinity/auth-client";
import type { State } from "./state.type";
import type { LoginOptions } from "./login-options.type";

/**
* React context for managing the login state and the Internet Identity.
Expand Down Expand Up @@ -55,8 +56,10 @@ export function InternetIdentityProvider({
*/
createOptions?: AuthClientCreateOptions;

/** Options that determine the behaviour of the {@link AuthClient} login call. */
loginOptions?: AuthClientLoginOptions;
/** Options that determine the behaviour of the {@link AuthClient} login call. These options are a subset of
* the {@link AuthClientLoginOptions}.
*/
loginOptions?: LoginOptions;

/** The child components that the InternetIdentityProvider will wrap. This allows any child
* component to access the authentication context provided by the InternetIdentityProvider. */
Expand Down
26 changes: 26 additions & 0 deletions src/login-options.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export type LoginOptions = {
/**
* Expiration of the authentication in nanoseconds
* @default BigInt(8) hours * BigInt(3_600_000_000_000) nanoseconds
*/
maxTimeToLive?: bigint;
/**
* If present, indicates whether or not the Identity Provider should allow the user to authenticate and/or register using a temporary key/PIN identity. Authenticating dapps may want to prevent users from using Temporary keys/PIN identities because Temporary keys/PIN identities are less secure than Passkeys (webauthn credentials) and because Temporary keys/PIN identities generally only live in a browser database (which may get cleared by the browser/OS).
*/
allowPinAuthentication?: boolean;
/**
* Origin for Identity Provider to use while generating the delegated identity. For II, the derivation origin must authorize this origin by setting a record at `<derivation-origin>/.well-known/ii-alternative-origins`.
* @see https://github.com/dfinity/internet-identity/blob/main/docs/internet-identity-spec.adoc
*/
derivationOrigin?: string | URL;
/**
* Auth Window feature config string
* @example "toolbar=0,location=0,menubar=0,width=500,height=500,left=100,top=100"
*/
windowOpenerFeatures?: string;
/**
* Extra values to be passed in the login request during the authorize-ready phase
*/
customValues?: Record<string, unknown>;
}

0 comments on commit 8dbf53e

Please sign in to comment.