@safetech/inheriti-client-sdk 1.17.26 → 1.17.28

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.
@@ -1973,7 +1973,18 @@ interface ValidatedOperatorToken {
1973
1973
  scopes: readonly string[];
1974
1974
  nonce?: string;
1975
1975
  }
1976
- interface OperatorSession {
1976
+ interface BusinessOperatorSession {
1977
+ kind: 'business';
1978
+ familyId: string;
1979
+ accessToken: string;
1980
+ refreshToken: string;
1981
+ tokenType: 'Bearer';
1982
+ expiresAt: number;
1983
+ sessionExpiresAt: number;
1984
+ principal: ValidatedOperatorToken;
1985
+ }
1986
+ interface ProviderOperatorSession {
1987
+ kind?: 'provider';
1977
1988
  accessToken: string;
1978
1989
  refreshToken?: string;
1979
1990
  idToken?: string;
@@ -1983,6 +1994,26 @@ interface OperatorSession {
1983
1994
  offlineAccessGranted?: boolean;
1984
1995
  principal: ValidatedOperatorToken;
1985
1996
  }
1997
+ interface SafeIdOidcBusinessSession extends Omit<ProviderOperatorSession, 'kind'> {
1998
+ kind: 'safeid-oidc-business';
1999
+ businessApiUrl: string;
2000
+ audience: string;
2001
+ clientId: string;
2002
+ issuer: string;
2003
+ environment: ElementsEnvironment;
2004
+ }
2005
+ type OperatorSession = BusinessOperatorSession | ProviderOperatorSession | SafeIdOidcBusinessSession;
2006
+ interface BusinessSessionResponse {
2007
+ accessToken: string;
2008
+ refreshToken: string;
2009
+ accessExpiresAt: string;
2010
+ sessionExpiresAt: string;
2011
+ familyId: string;
2012
+ environment: ElementsEnvironment;
2013
+ clientId: string;
2014
+ providerIssuer: string;
2015
+ providerSubject: string;
2016
+ }
1986
2017
  interface AuthorizationTransaction {
1987
2018
  kind: 'authorization-code';
1988
2019
  state: string;
@@ -2039,6 +2070,25 @@ interface OperatorAuthTransport {
2039
2070
  clientId: string;
2040
2071
  refreshToken: string;
2041
2072
  }): Promise<OAuthTokenResponse>;
2073
+ revoke?(input: {
2074
+ endpoint: string;
2075
+ clientId: string;
2076
+ refreshToken: string;
2077
+ signal?: AbortSignal;
2078
+ }): Promise<void>;
2079
+ exchangeBusinessSession(input: {
2080
+ apiUrl: string;
2081
+ providerAccessToken: string;
2082
+ }): Promise<BusinessSessionResponse>;
2083
+ refreshBusinessSession(input: {
2084
+ apiUrl: string;
2085
+ refreshToken: string;
2086
+ }): Promise<BusinessSessionResponse>;
2087
+ revokeBusinessSession(input: {
2088
+ apiUrl: string;
2089
+ refreshToken: string;
2090
+ signal?: AbortSignal;
2091
+ }): Promise<void>;
2042
2092
  }
2043
2093
  interface OperatorTokenValidator {
2044
2094
  validateAccessToken(accessToken: string): Promise<ValidatedOperatorToken>;
@@ -2099,12 +2149,25 @@ declare class HttpOperatorAuthTransport implements OperatorAuthTransport {
2099
2149
  startDeviceAuthorization(input: Parameters<OperatorAuthTransport['startDeviceAuthorization']>[0]): Promise<DeviceAuthorization>;
2100
2150
  pollDeviceToken(input: Parameters<OperatorAuthTransport['pollDeviceToken']>[0]): Promise<OAuthTokenResponse>;
2101
2151
  refresh(input: Parameters<OperatorAuthTransport['refresh']>[0]): Promise<OAuthTokenResponse>;
2152
+ revoke(input: {
2153
+ endpoint: string;
2154
+ clientId: string;
2155
+ refreshToken: string;
2156
+ signal?: AbortSignal;
2157
+ }): Promise<void>;
2158
+ exchangeBusinessSession(input: Parameters<OperatorAuthTransport['exchangeBusinessSession']>[0]): Promise<BusinessSessionResponse>;
2159
+ refreshBusinessSession(input: Parameters<OperatorAuthTransport['refreshBusinessSession']>[0]): Promise<BusinessSessionResponse>;
2160
+ revokeBusinessSession(input: Parameters<OperatorAuthTransport['revokeBusinessSession']>[0]): Promise<void>;
2161
+ private businessSession;
2162
+ private businessRequest;
2102
2163
  private token;
2103
2164
  private form;
2104
2165
  private json;
2105
2166
  }
2106
2167
 
2107
2168
  interface OperatorAuthClientOptions {
2169
+ businessApiUrl?: string;
2170
+ businessAuthority?: 'business' | 'safeid-oidc';
2108
2171
  configuration: OperatorAuthConfiguration;
2109
2172
  transport: OperatorAuthTransport;
2110
2173
  tokenValidator: OperatorTokenValidator;
@@ -2131,12 +2194,24 @@ declare class OperatorAuthClient {
2131
2194
  pollDeviceAuthorization(signal?: AbortSignal): Promise<OperatorSession>;
2132
2195
  getAccessToken(): Promise<string | undefined>;
2133
2196
  refresh(): Promise<OperatorSession>;
2197
+ private refreshExpired;
2134
2198
  clear(): Promise<void>;
2135
2199
  private performRefresh;
2200
+ private sameCredential;
2201
+ private clearIfUnchanged;
2202
+ private clearIfCurrent;
2203
+ private performProviderRefresh;
2204
+ private refreshProviderUnderLock;
2136
2205
  private getDiscovery;
2137
2206
  private transactionKey;
2138
2207
  private acceptTokens;
2208
+ private validateProviderTokens;
2209
+ private acceptProviderTokens;
2139
2210
  private isOfflineSession;
2211
+ private isSafeIdBusinessMode;
2212
+ private isValidSafeIdBusinessSession;
2213
+ private businessSession;
2214
+ private isValidBusinessSession;
2140
2215
  private assertPrincipal;
2141
2216
  private assertIdentity;
2142
2217
  }
@@ -2151,4 +2226,4 @@ declare class OperatorSessionController {
2151
2226
  }
2152
2227
 
2153
2228
  export { BusinessOrganizationSelectionError, CANONICAL_PLAN_ASSET_TYPES, CANONICAL_STRUCTURED_ASSET_FIELDS, CorePlanMaterialBuilder, ElementsApiPortRequired, ElementsApiRequestFailed, ElementsClient, GuidedCreateRecoveryError, GuidedPlanCreator, HostProcessRuntimeEnvironment, HttpAutomationRevealApiPort, HttpElementsApiPort, HttpOperatorAuthTransport, InheritiClientProvider, InvalidPlanDeclaration, InvalidPlanMaterial, LocalProcessReconciliationOwnership, MasterKeyRelayCancellationFailed, MasterKeyRelayExpired, MasterKeyRelayTimedOut, MasterKeyRequired, MemoryGuidedCreateCheckpointStore, MemoryKeyVault, MemoryStatePort, OAuthProtocolError, OperatorAuthClient, OperatorAuthError, OperatorReauthenticationRequired, OperatorSessionController, PLAN_CREATION_SERVER_STAGES, PlanMaterialReconstructionFailed, PlanMaterialReconstructorRequired, PollingSharedPlanEventListener, RelayMasterKeySource, RevealActionsNotOpen, RevealFieldAccessError, RevealHandleClosed, StaticMasterKeyResolver, SystemOAuthClock, WebOAuthCrypto, createAutomationRevealClient, createElementsClient, createMasterKeyResolver, exportProtectedRevealAsset, getAvailableEnvs, masterKeyRefFor, masterKeyRefKey, oauthErrorCode, parseAssetFieldSelector, revealPhaseOf, selectBusinessOrganization, unwrapDekWithMasterKey, useClient, validatePlanCreationInput, validatePlanCreationMaterial };
2154
- export type { AssetFieldSelector, AuthorizationTransaction, AuthorizeRevealActionInput, AutomationRevealOptions, BusinessOrganization, CanonicalPlanAssetType, CollectedPlanMaterial, CompatibleValue, ConsumedRevealField, CorePlanSecrets, CreateInboxConversationInput, CreateInboxFileAccessInput, CreateRevealFileAccessInput, CustodianShareResult, DeclaredMasterKeySource, DecodedPlanAsset, DeviceAuthorization, DeviceTransaction, ElementsApiPort, ElementsClientOptions, ElementsEnvironment, EncryptedPlanMaterial, EncryptedPlanShard, ExportPlanBridgeInput, ExportProtectedRevealAssetInput, FileAccessOpening, FileAccessOpeningState, FileAccessStatus, GovernedRevealSession, GovernedRevealState, GovernedShare, GovernedSharesMaterial, GovernedValidatorMaterial, GuidedCreateCheckpoint, GuidedCreateCheckpointStore, GuidedCreateLocalStage, GuidedCreateOptions, InboxConversation, InboxConversationPage, InboxDevice, InboxMember, InboxMemberPage, InboxMessageMetadata, InboxMessagePage, InboxParentMetadata, InboxParentPage, InboxParticipant, InboxParticipantPage, InboxSendPreparation, InboxShareLayer, InheritiClientProviderProps, IntegrationPlanAssetDeclaration, KeyVault, ListInboxConversationsInput, ListInboxMessagesInput, ListInboxParticipantsInput, ListMemberLogsInput, ListPlanLogsInput, ListPlansInput, MasterKeyAcquisition, MasterKeyAcquisitionOptions, MasterKeyRef, MasterKeyRelayContext, MasterKeyRelayPort, MasterKeyRelaySessionOpened, MasterKeyRelaySessionState, MasterKeyResolver, MemberLog, MemberLogPage, NativePlanParticipant, NormalInboxMessageMetadata, NormalInboxMessagePage, NormalInboxSendPreparation, OAuthClock, OAuthCrypto, OAuthHttpTransport, OAuthTokenResponse, OAuthTransaction, OAuthTransactionStore, OidcDiscoveryDocument, OpenRevealOptions, OpenedInboxParent, OpenedNormalInboxMessage, OperatorAuthClientOptions, OperatorAuthConfiguration, OperatorAuthTransport, OperatorSession, OperatorSessionControlPort, OperatorSessionStore, OperatorSessionSummary, OperatorTokenValidator, PlanAssetContainerDecoder, PlanAssetSummary, PlanBridgeEnvelope, PlanCreationOutcome, PlanCreationProgress, PlanCreationServerStage, PlanDetail, PlanGovernanceMode, PlanGovernancePolicy, PlanLog, PlanLogPage, PlanMaterialBuilder, PlanMaterialReconstructor, PlanPage, PlanParticipantRelationship, PlanRevealProfile, PlanStatus, PlanSummary, ProCustodianShare, PublishInboxMessageInput, PublishInboxParentInput, PublishNormalInboxMessageInput, PublishedInboxMessage, PublishedNormalInboxMessage, RegisterInboxDeviceInput, RelayMasterKeySourceOptions, ReplaceInboxDeviceInput, ReportRevealActionOutcomeInput, RevealAction, RevealActionDestination, RevealActionOutcome, RevealActionType, RevealCloseReason, RevealFieldConsumption, RevealFieldDestination, RevealFieldOptions, RevealHandle, RevealMode, RevealPhase, RevealProgress, RevealReconstructionInput, RevealSession, RevealStage, RevokeInboxDeviceInput, StartPlanCreationInput, StartRevealInput, StatePort, StepUpReadContext, ValidatedOperatorToken };
2229
+ export type { AssetFieldSelector, AuthorizationTransaction, AuthorizeRevealActionInput, AutomationRevealOptions, BusinessOperatorSession, BusinessOrganization, BusinessSessionResponse, CanonicalPlanAssetType, CollectedPlanMaterial, CompatibleValue, ConsumedRevealField, CorePlanSecrets, CreateInboxConversationInput, CreateInboxFileAccessInput, CreateRevealFileAccessInput, CustodianShareResult, DeclaredMasterKeySource, DecodedPlanAsset, DeviceAuthorization, DeviceTransaction, ElementsApiPort, ElementsClientOptions, ElementsEnvironment, EncryptedPlanMaterial, EncryptedPlanShard, ExportPlanBridgeInput, ExportProtectedRevealAssetInput, FileAccessOpening, FileAccessOpeningState, FileAccessStatus, GovernedRevealSession, GovernedRevealState, GovernedShare, GovernedSharesMaterial, GovernedValidatorMaterial, GuidedCreateCheckpoint, GuidedCreateCheckpointStore, GuidedCreateLocalStage, GuidedCreateOptions, InboxConversation, InboxConversationPage, InboxDevice, InboxMember, InboxMemberPage, InboxMessageMetadata, InboxMessagePage, InboxParentMetadata, InboxParentPage, InboxParticipant, InboxParticipantPage, InboxSendPreparation, InboxShareLayer, InheritiClientProviderProps, IntegrationPlanAssetDeclaration, KeyVault, ListInboxConversationsInput, ListInboxMessagesInput, ListInboxParticipantsInput, ListMemberLogsInput, ListPlanLogsInput, ListPlansInput, MasterKeyAcquisition, MasterKeyAcquisitionOptions, MasterKeyRef, MasterKeyRelayContext, MasterKeyRelayPort, MasterKeyRelaySessionOpened, MasterKeyRelaySessionState, MasterKeyResolver, MemberLog, MemberLogPage, NativePlanParticipant, NormalInboxMessageMetadata, NormalInboxMessagePage, NormalInboxSendPreparation, OAuthClock, OAuthCrypto, OAuthHttpTransport, OAuthTokenResponse, OAuthTransaction, OAuthTransactionStore, OidcDiscoveryDocument, OpenRevealOptions, OpenedInboxParent, OpenedNormalInboxMessage, OperatorAuthClientOptions, OperatorAuthConfiguration, OperatorAuthTransport, OperatorSession, OperatorSessionControlPort, OperatorSessionStore, OperatorSessionSummary, OperatorTokenValidator, PlanAssetContainerDecoder, PlanAssetSummary, PlanBridgeEnvelope, PlanCreationOutcome, PlanCreationProgress, PlanCreationServerStage, PlanDetail, PlanGovernanceMode, PlanGovernancePolicy, PlanLog, PlanLogPage, PlanMaterialBuilder, PlanMaterialReconstructor, PlanPage, PlanParticipantRelationship, PlanRevealProfile, PlanStatus, PlanSummary, ProCustodianShare, ProviderOperatorSession, PublishInboxMessageInput, PublishInboxParentInput, PublishNormalInboxMessageInput, PublishedInboxMessage, PublishedNormalInboxMessage, RegisterInboxDeviceInput, RelayMasterKeySourceOptions, ReplaceInboxDeviceInput, ReportRevealActionOutcomeInput, RevealAction, RevealActionDestination, RevealActionOutcome, RevealActionType, RevealCloseReason, RevealFieldConsumption, RevealFieldDestination, RevealFieldOptions, RevealHandle, RevealMode, RevealPhase, RevealProgress, RevealReconstructionInput, RevealSession, RevealStage, RevokeInboxDeviceInput, SafeIdOidcBusinessSession, StartPlanCreationInput, StartRevealInput, StatePort, StepUpReadContext, ValidatedOperatorToken };
@@ -1,5 +1,5 @@
1
1
  import type { OperatorAuthTransport } from './ports';
2
- import type { DeviceAuthorization, OAuthTokenResponse, OidcDiscoveryDocument } from './types';
2
+ import type { BusinessSessionResponse, DeviceAuthorization, OAuthTokenResponse, OidcDiscoveryDocument } from './types';
3
3
  export type OAuthHttpTransport = (input: URL | RequestInfo, init?: RequestInit) => Promise<Response>;
4
4
  /** Standard public-client OAuth/OIDC transport. Confidential BFFs should inject their own transport. */
5
5
  export declare class HttpOperatorAuthTransport implements OperatorAuthTransport {
@@ -10,6 +10,17 @@ export declare class HttpOperatorAuthTransport implements OperatorAuthTransport
10
10
  startDeviceAuthorization(input: Parameters<OperatorAuthTransport['startDeviceAuthorization']>[0]): Promise<DeviceAuthorization>;
11
11
  pollDeviceToken(input: Parameters<OperatorAuthTransport['pollDeviceToken']>[0]): Promise<OAuthTokenResponse>;
12
12
  refresh(input: Parameters<OperatorAuthTransport['refresh']>[0]): Promise<OAuthTokenResponse>;
13
+ revoke(input: {
14
+ endpoint: string;
15
+ clientId: string;
16
+ refreshToken: string;
17
+ signal?: AbortSignal;
18
+ }): Promise<void>;
19
+ exchangeBusinessSession(input: Parameters<OperatorAuthTransport['exchangeBusinessSession']>[0]): Promise<BusinessSessionResponse>;
20
+ refreshBusinessSession(input: Parameters<OperatorAuthTransport['refreshBusinessSession']>[0]): Promise<BusinessSessionResponse>;
21
+ revokeBusinessSession(input: Parameters<OperatorAuthTransport['revokeBusinessSession']>[0]): Promise<void>;
22
+ private businessSession;
23
+ private businessRequest;
13
24
  private token;
14
25
  private form;
15
26
  private json;
@@ -1,6 +1,8 @@
1
1
  import type { OAuthClock, OAuthCrypto, OAuthTransactionStore, OperatorAuthTransport, OperatorSessionStore, OperatorTokenValidator } from './ports';
2
2
  import type { DeviceTransaction, OperatorAuthConfiguration, OperatorSession } from './types';
3
3
  export interface OperatorAuthClientOptions {
4
+ businessApiUrl?: string;
5
+ businessAuthority?: 'business' | 'safeid-oidc';
4
6
  configuration: OperatorAuthConfiguration;
5
7
  transport: OperatorAuthTransport;
6
8
  tokenValidator: OperatorTokenValidator;
@@ -27,12 +29,24 @@ export declare class OperatorAuthClient {
27
29
  pollDeviceAuthorization(signal?: AbortSignal): Promise<OperatorSession>;
28
30
  getAccessToken(): Promise<string | undefined>;
29
31
  refresh(): Promise<OperatorSession>;
32
+ private refreshExpired;
30
33
  clear(): Promise<void>;
31
34
  private performRefresh;
35
+ private sameCredential;
36
+ private clearIfUnchanged;
37
+ private clearIfCurrent;
38
+ private performProviderRefresh;
39
+ private refreshProviderUnderLock;
32
40
  private getDiscovery;
33
41
  private transactionKey;
34
42
  private acceptTokens;
43
+ private validateProviderTokens;
44
+ private acceptProviderTokens;
35
45
  private isOfflineSession;
46
+ private isSafeIdBusinessMode;
47
+ private isValidSafeIdBusinessSession;
48
+ private businessSession;
49
+ private isValidBusinessSession;
36
50
  private assertPrincipal;
37
51
  private assertIdentity;
38
52
  }
@@ -1,4 +1,4 @@
1
- import type { DeviceAuthorization, OAuthTokenResponse, OAuthTransaction, OidcDiscoveryDocument, OperatorSession, OperatorSessionSummary, ValidatedOperatorToken } from './types';
1
+ import type { DeviceAuthorization, BusinessSessionResponse, OAuthTokenResponse, OAuthTransaction, OidcDiscoveryDocument, OperatorSession, OperatorSessionSummary, ValidatedOperatorToken } from './types';
2
2
  export interface OperatorAuthTransport {
3
3
  discover(issuer: string): Promise<OidcDiscoveryDocument>;
4
4
  exchangeAuthorizationCode(input: {
@@ -23,6 +23,25 @@ export interface OperatorAuthTransport {
23
23
  clientId: string;
24
24
  refreshToken: string;
25
25
  }): Promise<OAuthTokenResponse>;
26
+ revoke?(input: {
27
+ endpoint: string;
28
+ clientId: string;
29
+ refreshToken: string;
30
+ signal?: AbortSignal;
31
+ }): Promise<void>;
32
+ exchangeBusinessSession(input: {
33
+ apiUrl: string;
34
+ providerAccessToken: string;
35
+ }): Promise<BusinessSessionResponse>;
36
+ refreshBusinessSession(input: {
37
+ apiUrl: string;
38
+ refreshToken: string;
39
+ }): Promise<BusinessSessionResponse>;
40
+ revokeBusinessSession(input: {
41
+ apiUrl: string;
42
+ refreshToken: string;
43
+ signal?: AbortSignal;
44
+ }): Promise<void>;
26
45
  }
27
46
  export interface OperatorTokenValidator {
28
47
  validateAccessToken(accessToken: string): Promise<ValidatedOperatorToken>;
@@ -35,7 +35,18 @@ export interface ValidatedOperatorToken {
35
35
  scopes: readonly string[];
36
36
  nonce?: string;
37
37
  }
38
- export interface OperatorSession {
38
+ export interface BusinessOperatorSession {
39
+ kind: 'business';
40
+ familyId: string;
41
+ accessToken: string;
42
+ refreshToken: string;
43
+ tokenType: 'Bearer';
44
+ expiresAt: number;
45
+ sessionExpiresAt: number;
46
+ principal: ValidatedOperatorToken;
47
+ }
48
+ export interface ProviderOperatorSession {
49
+ kind?: 'provider';
39
50
  accessToken: string;
40
51
  refreshToken?: string;
41
52
  idToken?: string;
@@ -45,6 +56,26 @@ export interface OperatorSession {
45
56
  offlineAccessGranted?: boolean;
46
57
  principal: ValidatedOperatorToken;
47
58
  }
59
+ export interface SafeIdOidcBusinessSession extends Omit<ProviderOperatorSession, 'kind'> {
60
+ kind: 'safeid-oidc-business';
61
+ businessApiUrl: string;
62
+ audience: string;
63
+ clientId: string;
64
+ issuer: string;
65
+ environment: ElementsEnvironment;
66
+ }
67
+ export type OperatorSession = BusinessOperatorSession | ProviderOperatorSession | SafeIdOidcBusinessSession;
68
+ export interface BusinessSessionResponse {
69
+ accessToken: string;
70
+ refreshToken: string;
71
+ accessExpiresAt: string;
72
+ sessionExpiresAt: string;
73
+ familyId: string;
74
+ environment: ElementsEnvironment;
75
+ clientId: string;
76
+ providerIssuer: string;
77
+ providerSubject: string;
78
+ }
48
79
  export interface AuthorizationTransaction {
49
80
  kind: 'authorization-code';
50
81
  state: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@safetech/inheriti-client-sdk",
3
- "version": "1.17.26",
3
+ "version": "1.17.28",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -67,7 +67,7 @@
67
67
  "license": "MIT",
68
68
  "dependencies": {
69
69
  "@safetech/safekey-sdk": "1.0.1",
70
- "@safetech/inheriti-core-sdk": "4.0.37",
70
+ "@safetech/inheriti-core-sdk": "4.0.39",
71
71
  "sonner": "2.0.8"
72
72
  },
73
73
  "devDependencies": {