Skip to content

Commit

Permalink
Project import generated by Copybara.
Browse files Browse the repository at this point in the history
FolderOrigin-RevId: /usr/src/app/bi-sdk-js
  • Loading branch information
bi-ci-bot committed May 22, 2024
1 parent 8f5a1fe commit 8a1dc62
Show file tree
Hide file tree
Showing 59 changed files with 2,102 additions and 2,748 deletions.
1,215 changes: 549 additions & 666 deletions coresdk/dist/bi-core.js

Large diffs are not rendered by default.

25 changes: 6 additions & 19 deletions coresdk/dist/src/core/core.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Configuration } from "../configuration";
import { Credential, CredentialV1, BindCredentialV1Result, PkceCodeChallenge, Pkce, AuthorizationCode, UrlResponse, TokenResponse, BrowserInfo, CredentialDescriptor, AuthenticationContext } from "../types";
import { Credential, PkceCodeChallenge, Pkce, AuthorizationCode, BrowserInfo, CredentialDescriptor, AuthenticationContext, AuthenticateResponse, BindResponse } from "../types";
import { Host, HostEvents, ExportEvent, ImportEvent } from "../host";
import { BiAuthenticateResponse } from "../types/credential";
import { Types } from "../messaging";
/**
* This class encapsulates all the methods required to interact with Core
Expand All @@ -20,22 +19,22 @@ export declare class Core {
/**
* Binds a credential to this device
*/
bindCredential: (url: string) => Promise<BindCredentialV1Result>;
bindCredential: (url: string) => Promise<BindResponse>;
/**
* Deletes a Credential from the local store.
*/
deleteCredentialV1: (id: string) => Promise<void>;
deleteCredential: (id: string) => Promise<void>;
/**
* Returns a list of all the Credentials in the local store.
*/
listCredentials: () => Promise<CredentialV1[]>;
getCredentials: () => Promise<Credential[]>;
/**
* Authenticate using the specified credential.
*
* If the provided credential describes an OTP credential,
* a follow up call to `redeemOtp` is required.
*/
authenticate: (url: string, credDesc: CredentialDescriptor) => Promise<BiAuthenticateResponse>;
authenticate: (url: string, credDesc: CredentialDescriptor) => Promise<AuthenticateResponse>;
/**
* Returns the Authentication Context for the current transaction.
*
Expand All @@ -53,18 +52,10 @@ export declare class Core {
* Create a new Credential. Testing only.
*/
createCredential: (handle: string, name: string, imageUrl: string, loginUri?: string | undefined, enrollUri?: string | undefined) => Promise<Credential>;
/**
* Returns all the Credentials in the local store.
*/
getCredentials: () => Promise<Credential[]>;
/**
* Delete a Credential from the local store.
*/
deleteCredential: (handle: string) => Promise<void>;
/**
* Register a new Credential on this device.
*/
register: (url: string) => Promise<UrlResponse>;
register: (url: string) => Promise<BindResponse>;
/**
* Begins an export of the specified credential.
* @param handle
Expand Down Expand Up @@ -95,10 +86,6 @@ export declare class Core {
* Confidential OIDC authentication.
*/
authenticateConfidential: (authURL: string, clientId: string, redirectURI: string, scope: string, PKCECodeChallenge?: PkceCodeChallenge | undefined, nonce?: string | undefined) => Promise<AuthorizationCode>;
/**
* TODO: We don't support this flow. Can we delete this?
*/
authenticatePublic: (authURL: string, tokenURL: string, clientId: string, redirectURI: string, nonce?: string | undefined) => Promise<TokenResponse>;
/**
* Creates a PKCE code verifier and code challenge.
*/
Expand Down
18 changes: 16 additions & 2 deletions coresdk/dist/src/core/service/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
import { Host } from "../../host";
import { BindResponse, Credential, CredentialDescriptor, AuthenticationContext, AuthenticateResponse } from "../../types";
export { initialize } from "./initialize";
export { getAppInstanceId, getBrowserInfo } from "./util";
export { getAppInstanceId, getBrowserInfo, getServiceUrlType } from "./util";
export * as v0 from "./v0";
export * as v1 from "./v1";
export declare function bindCredential(url: string, host: Host): Promise<BindResponse>;
export declare function deleteCredential(id: string, host: Host): Promise<void>;
export declare function getCredentials(host: Host): Promise<Credential[]>;
export declare function getAuthenticationContext(url: string, host: Host): Promise<AuthenticationContext>;
/**
*
* @param url Authentication URL. For example auth-us.beyondidentity.com.
* @param credDesc A structure describing the credential to authenticate,
* or a credential selection callback
* @param host The Host callbacks.
* @returns
*/
export declare function authenticate(url: string, credDesc: CredentialDescriptor, host: Host): Promise<AuthenticateResponse>;
8 changes: 3 additions & 5 deletions coresdk/dist/src/core/service/util.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { BrowserInfo, Credential, KeyType } from "../../types";
import { BrowserInfo } from "../../types";
import { Types } from "../../messaging";
export declare function getAppInstanceId(): Promise<string>;
export declare function getBrowserInfo(): Promise<BrowserInfo>;
/** Returns the type of key, webauthn or subtle. */
export declare function getKeyType(keyHandle: string): Promise<KeyType>;
/** Updates a V0 credential with key type and integrity errors (if they exist). */
export declare function updateV0CredentialInfo(cred: Credential): Promise<void>;
export declare function getServiceUrlType(url: string): Types.UrlType;
3 changes: 1 addition & 2 deletions coresdk/dist/src/core/service/v0/auth.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { AuthorizationCode, PkceCodeChallenge, TokenResponse } from "../../../types";
import { AuthorizationCode, PkceCodeChallenge } from "../../../types";
import { Host } from "../../../host";
export declare function authenticateConfidential(authURL: string, clientId: string, redirectURI: string, scope: string, challenge: PkceCodeChallenge | undefined, nonce: string | undefined, host: Host): Promise<AuthorizationCode>;
export declare function authenticatePublic(authURL: string, tokenURL: string, clientId: string, redirectURI: string, nonce: string | undefined, host: Host): Promise<TokenResponse>;
4 changes: 0 additions & 4 deletions coresdk/dist/src/core/service/v0/cred.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { Host } from "../../../host";
import { UrlResponse } from "../../../types";
import { Credential } from "../../../types";
export declare function createCredential(handle: string, name: string, imageUrl: string, loginUri: string | undefined, enrollUri: string | undefined, host: Host): Promise<Credential>;
export declare function register(url: string, host: Host): Promise<UrlResponse>;
export declare function getCredentials(host: Host): Promise<Credential[]>;
export declare function deleteCredential(handle: string, host: Host): Promise<void>;
12 changes: 0 additions & 12 deletions coresdk/dist/src/core/service/v1/auth.d.ts

This file was deleted.

16 changes: 0 additions & 16 deletions coresdk/dist/src/core/service/v1/cred.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions coresdk/dist/src/core/service/v1/index.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions coresdk/dist/src/core/service/v1/util.d.ts

This file was deleted.

6 changes: 3 additions & 3 deletions coresdk/dist/src/host/host.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HostEvents, ImportEvent, ExportEvent } from "./hostEvents";
import { Configuration } from "../configuration";
import { FeatureFlagRequest, FeatureFlagResponse, PathType, HostFilePath, PromptDetail, ClientEnvironment, CredentialV1 } from "../types";
import { FeatureFlagRequest, FeatureFlagResponse, PathType, HostFilePath, PromptDetail, ClientEnvironment } from "../types";
import { Log } from "../log";
/**
* The host describes the system calling into KMC.
Expand All @@ -14,7 +14,7 @@ export declare class Host implements HostEvents {
logger?: Log;
onexport?: (this: Host, ev: ExportEvent) => void;
onimport?: (this: Host, ev: ImportEvent) => void;
onSelectCredentialV1?: (credentials: CredentialV1[]) => Promise<string | undefined>;
onSelectCredential?: (credentials: Credential[]) => Promise<string | undefined>;
get events(): HostEvents;
constructor(config: Configuration);
checkFeatureFlags(feature_flags: FeatureFlagRequest[]): FeatureFlagResponse[];
Expand All @@ -31,5 +31,5 @@ export declare class Host implements HostEvents {
ask(profile_handle: string): boolean;
authenticationPrompt(app_name: string, detail_list: PromptDetail[]): boolean;
log(msg: string): void;
selectCredentialV1(credentials: CredentialV1[]): Promise<string | undefined>;
selectCredential(credentials: Credential[]): Promise<string | undefined>;
}
3 changes: 1 addition & 2 deletions coresdk/dist/src/host/hostEvents.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { CredentialV1 } from "../types";
import { Host } from "./host";
export interface ExportEvent {
type: "started" | "timeout" | "requestReceived" | "failed" | "cancelled";
Expand All @@ -16,5 +15,5 @@ export interface ImportEvent {
export interface HostEvents {
onexport?: (this: Host, ev: ExportEvent) => void;
onimport?: (this: Host, ev: ImportEvent) => void;
onSelectCredentialV1?: (credentials: CredentialV1[]) => Promise<string | undefined>;
onSelectCredentialV1?: (credentials: Credential[]) => Promise<string | undefined>;
}
4 changes: 2 additions & 2 deletions coresdk/dist/src/messaging/hostMessage.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PromptDetail, FeatureFlagRequest, PathType, CoreCredentialV1 } from "./types";
import { PromptDetail, FeatureFlagRequest, PathType } from "./types";
/**
* Host Messages
* -------------
Expand Down Expand Up @@ -99,6 +99,6 @@ export declare type LogRequest = {
Log: string;
};
export declare type SelectAuthNCredentialRequest = {
SelectAuthNCredential: CoreCredentialV1[];
SelectAuthNCredential: Credential[];
};
export declare type HostRequest = AskRequest | AuthenticationPromptRequest | CheckFeatureFlagsRequest | ExportRequestReceivedRequest | ExportStartedRequest | ExportTokenTimeoutRequest | GetDeviceGatewayUrlRequest | GetDeviceInfoRequest | GetFilePathRequest | ImportManifestReceivedRequest | ImportReceivedSignedRequest | ImportRequestsToSignRequest | ImportStartedRequest | LogRequest | SelectAuthNCredentialRequest;
110 changes: 7 additions & 103 deletions coresdk/dist/src/messaging/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,73 +6,17 @@
* Some types have the same spelling, so they are re-exports
* of the application types.
*/
import { Credential, CredentialV1, PkceCodeChallenge, UrlResponse, CryptoSource, KeyStorageStrategy, PathType, State, IntegrityFailureError, AuthenticationContext } from "../types";
import { Credential, PkceCodeChallenge, UrlResponse, CryptoSource, KeyStorageStrategy, PathType, AuthenticationContext, AuthenticationMethod } from "../types";
export { PkceCodeChallenge, RegistrationStatus, PromptDetail, FeatureFlagRequest, FeatureFlagResponse, PathType, } from "../types";
/**
* A Profile is identical to a Credential, but
* is named differently for legacy reasons.
*/
export interface Profile {
state: State;
created: string;
handle: string;
key_handle: string;
name: string;
image_url: string;
login_uri?: string;
enroll_uri?: string;
chain: string[];
root_fingerprint: string;
user_id?: Uint8Array;
key_type?: "subtle" | "webauthn";
}
/**
* Ok or Err.
* FIXME: parameterize this over the "Ok" type.
*/
export declare type IntegrityResult = {
Ok: string;
} | {
Err: IntegrityFailureError;
};
/**
* Returned from kmc_all_credentials
*/
export interface CoreCredential {
created: IntegrityResult;
state: State;
handle: IntegrityResult;
key_handle: IntegrityResult;
name: string;
image_url: string;
chain_handles: IntegrityResult[];
enroll_uri: string;
login_uri: string;
desktop_login_url: string;
device_gateway_url: string;
migrate_addr: string;
root_fingerprint: IntegrityResult;
user?: User;
device_credential?: DeviceCredential;
ssids: [{}];
key_type?: "subtle" | "webauthn";
}
interface User {
}
interface DeviceCredential {
}
/** Helper method for constructing Credentials from rust Profile objects. */
export declare function credentialFromProfile(profile: Profile): Credential;
export declare function credentialFromCore(cred: CoreCredential): Credential;
export interface HandleSelfIssueUrlResponse {
operation: string;
profile: Profile;
profile: Credential;
redirect_url: string;
handled_redirect_externally?: boolean;
}
export interface HandleRegisterUrlResponse {
operation: string;
profile: Profile;
profile: Credential;
}
export interface HandleBiAuthenticateUrlResponse {
operation: string;
Expand All @@ -85,7 +29,7 @@ export interface HandleBiContinueResponse {
url: string;
}
export interface HandleBindCredentialUrlResponse {
credential: CoreCredentialV1;
credential: Credential;
post_binding_redirect_uri?: string;
}
export declare type HandleUrlResponse = {
Expand Down Expand Up @@ -138,40 +82,6 @@ export interface ClientEnvironment {
key_storage_strategy: KeyStorageStrategy;
gdc_url: string;
}
export interface CoreCredentialV1 {
id: string;
local_created: string;
local_updated: string;
api_base_url: string;
tenant_id: string;
realm_id: string;
identity_id: string;
key_handle: string;
state: "Active" | "Revoked";
created: string;
updated: string;
tenant: CoreTenantV1;
realm: CoreRealmV1;
identity: CoreIdentityV1;
theme: CoreThemeV1;
}
export interface CoreRealmV1 {
display_name: string;
}
export interface CoreIdentityV1 {
display_name: string;
username: string;
primary_email_address?: string;
}
export interface CoreThemeV1 {
logo_url_light: string;
logo_url_dark: string;
support_url: string;
}
export interface CoreTenantV1 {
display_name: string;
}
export declare function credentialV1FromCredential(coreCred: CoreCredentialV1): CredentialV1;
export declare type UrlType = {
type: "Authenticate";
} | {
Expand All @@ -198,21 +108,15 @@ interface CoreAuthenticatorConfig {
*/
declare type CoreAuthenticatorProfileConfig = {
type: "hosted_web";
authentication_methods: CoreAuthenticationMethod[];
authentication_methods: AuthenticationMethod[];
} | {
type: "hosted_login";
authentication_methods: CoreAuthenticationMethod[];
authentication_methods: AuthenticationMethod[];
} | {
type: "platform";
} | {
type: "embedded";
};
declare type CoreAuthenticationMethod = {
type: "webauthn_passkey";
} | {
type: "software_passkey";
} | {
type: "email_one_time_password";
authentication_methods: AuthenticationMethod[];
};
interface CoreRequestOrigin {
ip?: string;
Expand Down
Loading

0 comments on commit 8a1dc62

Please sign in to comment.