Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions KeeperSdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,14 @@ export type {

export {
PamManager,
ActionManager,
pamActionRotate,
rotatePamAction,
rotatePamRecord,
editPamConnection,
ConnectionManager,
editPamRbi,
RbiManager,
GatewayManager,
listGateways,
formatGatewaysTable,
Expand Down Expand Up @@ -998,6 +1006,49 @@ export {
findGatewayByControllerUid,
buildOnlineGatewayUidSet,
resolveGatewayName,
PAM_ACTION_DEFAULT_PASSWORD_COMPLEXITY,
PAM_ACTION_ROTATE,
PAM_ACTION_ROTATE_RECORD_TYPE,
PAM_ACTION_ROTATE_TIMEOUT,
createRotateActionPayload,
encryptRotationPasswordComplexity,
getCachedRotation,
getPamRecord,
getRotationUids,
isGatewayConnected,
isPamUserRecord,
parseRotateResponse,
resolvePamActionFolderUids,
resolvePamActionRecordUids,
requireRotateTarget,
PAM_CONNECTION_CONFIG_TYPES,
PAM_CONNECTION_PROTOCOLS,
PAM_CONNECTION_RESOURCE_TYPES,
PAM_CONNECTION_SEEDED_RECORD_TYPES,
PAM_CONNECTION_SETTING_KEYS,
applyResourceRecordSettings,
convertConnectionSetting,
getCachedConfigurationUid,
getTypedRecordData,
isConnectionConfig,
isConnectionResource,
makeAllowedSettings,
makeConnectionSettingsBytes,
recordUidBytes,
resolveConnectionRecord,
resolvePamUserUid,
validateConnectionInput,
PAM_RBI_RECORD_TYPE,
PAM_RBI_SETTING_VALUES,
PAM_RBI_DEFAULT_SETTINGS,
PAM_RBI_BOOLEAN_FIELDS,
resolveRbiRecord,
validateRbiInput,
convertRbiSetting,
rbiData,
updateRbiSettings,
rbiSettingsBytes,
rbiRecordUidBytes,
} from './pam'
export type {
ListGatewaysOptions,
Expand Down Expand Up @@ -1076,6 +1127,20 @@ export type {
RotationProfile,
PasswordComplexityInput,
ScheduleData,
PamActionRotateControllerResponse,
PamActionRotateInput,
PamActionRotateLiveInfo,
PamActionRotateOptions,
PamActionRotateRecordResult,
PamActionRotateResult,
PamActionRotateStatus,
PamRotateActionPayload,
PamConnectionEditInput,
PamConnectionEditResult,
PamConnectionSetting,
PamRbiEditInput,
PamRbiEditResult,
PamRbiSetting,
} from './pam'

export type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
shareNestedShareRecord,
formatNsfRecordSharePlan,
formatNsfRecordShareResults,
formatNsfFolderShareResults,
} from './nsfShare'
import { listNsfShortcuts, keepNsfShortcut, formatNsfShortcutOutput, formatKeepNsfShortcutPlan } from './nsfShortcut'
import { transferNestedShareRecords, formatTransferNestedShareRecordResults } from './nsfTransferRecord'
Expand Down Expand Up @@ -170,6 +171,10 @@ export class NestedShareFolderManager {
return formatNsfRecordShareResults(results)
}

public formatNsfFolderShareResults(results: ShareNestedShareFolderResult['results']): string {
return formatNsfFolderShareResults(results)
}

public listNsfShortcuts(options: ListNsfShortcutsOptions = {}): NsfShortcutRow[] {
return listNsfShortcuts(this.storage, options)
}
Expand Down
34 changes: 34 additions & 0 deletions KeeperSdk/src/pam/PamManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import type { InMemoryStorage } from '../storage/InMemoryStorage'
import { ConfigManager } from './config/ConfigManager'
import { GatewayManager } from './gateway/GatewayManager'
import { RotationManager } from './rotation/RotationManager'
import { ActionManager } from './action/ActionManager'
import { ConnectionManager } from './connection/ConnectionManager'
import type { PamConnectionEditInput, PamConnectionEditResult } from './connection/connectionTypes'
import { RbiManager } from './rbi/RbiManager'
import type { PamRbiEditInput, PamRbiEditResult } from './rbi/rbiTypes'
import type { PamActionRotateInput, PamActionRotateResult } from './action/rotateActionTypes'
import type {
FormatPamConfigurationsTableOptions,
FormattedPamConfigurationsTable,
Expand Down Expand Up @@ -59,11 +65,17 @@ export class PamManager {
private readonly gatewayManager: GatewayManager
private readonly configManager: ConfigManager
private readonly rotationManager: RotationManager
private readonly actionManager: ActionManager
private readonly connectionManager: ConnectionManager
private readonly rbiManager: RbiManager

constructor(storage: InMemoryStorage, authProvider: AuthProvider) {
this.gatewayManager = new GatewayManager(storage, authProvider)
this.configManager = new ConfigManager(storage, authProvider)
this.rotationManager = new RotationManager(storage, authProvider)
this.actionManager = new ActionManager(storage, authProvider)
this.connectionManager = new ConnectionManager(storage, authProvider)
this.rbiManager = new RbiManager(storage, authProvider)
}

public getGatewayManager(): GatewayManager {
Expand All @@ -78,6 +90,28 @@ export class PamManager {
return this.rotationManager
}

public getActionManager(): ActionManager {
return this.actionManager
}
public getConnectionManager(): ConnectionManager {
return this.connectionManager
}
public getRbiManager(): RbiManager {
return this.rbiManager
}

public async rotatePamAction(input: PamActionRotateInput): Promise<PamActionRotateResult> {
return this.actionManager.rotatePamAction(input)
}

public async editPamConnection(input: PamConnectionEditInput): Promise<PamConnectionEditResult> {
return this.connectionManager.editPamConnection(input)
}

public async editPamRbi(input: PamRbiEditInput): Promise<PamRbiEditResult> {
return this.rbiManager.editPamRbi(input)
}

public async listGateways(options: ListGatewaysOptions = {}): Promise<ListGatewaysResult> {
return this.gatewayManager.listGateways(options)
}
Expand Down
33 changes: 33 additions & 0 deletions KeeperSdk/src/pam/action/ActionManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { Auth } from '@keeper-security/keeperapi'
import type { InMemoryStorage } from '../../storage/InMemoryStorage'
import { KeeperSdkError, ResultCodes } from '../../utils'
import { rotatePamAction } from './rotateAction'
import type { PamActionRotateInput, PamActionRotateResult } from './rotateActionTypes'

export type AuthProvider = () => Auth

export class ActionManager {
private readonly storage: InMemoryStorage
private readonly authProvider: AuthProvider

constructor(storage: InMemoryStorage, authProvider: AuthProvider) {
this.storage = storage
this.authProvider = authProvider
}

private requireAuth(): Auth {
const auth = this.authProvider()
if (!auth?.sessionToken) {
throw new KeeperSdkError('Not logged in. Call login() first.', ResultCodes.NOT_LOGGED_IN)
}
return auth
}

public async rotatePamAction(input: PamActionRotateInput): Promise<PamActionRotateResult> {
return rotatePamAction(this.requireAuth(), this.storage, input)
}

public async rotate(input: PamActionRotateInput): Promise<PamActionRotateResult> {
return this.rotatePamAction(input)
}
}
12 changes: 12 additions & 0 deletions KeeperSdk/src/pam/action/actionConstants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const PAM_ACTION_ROTATE = 'rotate' as const
export const PAM_ACTION_ROTATE_TIMEOUT = 15_000

export const PAM_ACTION_DEFAULT_PASSWORD_COMPLEXITY = {
length: 20,
caps: 1,
lowercase: 1,
digits: 1,
special: 1,
} as const

export const PAM_ACTION_ROTATE_RECORD_TYPE = 'pamUser' as const
Loading
Loading