Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
be318c6
initial implementation of vault cli
sgaddala-ks Jun 16, 2026
a9c6dfb
NSF command implementation (list, get, ln and rm) (#169)
ukumar-ks Jun 16, 2026
51510ea
Extra space remove
ukumar-ks Jun 16, 2026
b5f34af
nsf record initial commit
ukumar-ks Jun 17, 2026
0e76ce5
Align NSF permission checks with KeeperDrive MRD (canRemove/canDelete)
ukumar-ks Jun 17, 2026
3817392
Merge branch 'main' into feature-kd-part1
ukumar-ks Jun 17, 2026
86dcd13
Merge branch 'feature-kd-part1' of https://github.com/Keeper-Security…
ukumar-ks Jun 18, 2026
291651a
nsf record and folder implementation
ukumar-ks Jun 18, 2026
490e654
fixed formatting for command outputs
sgaddala-ks Jun 18, 2026
ba6a94b
Code format and optimisation
ukumar-ks Jun 18, 2026
fb7732e
nsf commands initial commit
ukumar-ks Jun 23, 2026
384b530
removed cli package and migrated to different repo
sgaddala-ks Jun 24, 2026
24eaad1
Use logger in socket connection, add socket connection to the router.…
saldoukhov Jun 16, 2026
0f4af07
added fixes for browser compatibilty
sgaddala-ks Jun 29, 2026
a11459f
added additional commands p1
sgaddala-ks Jul 1, 2026
61b1656
Bump the npm_and_yarn group across 4 directories with 3 updates (#174)
dependabot[bot] Jun 17, 2026
7276104
Supply-chain security: use npm ci in CI workflows and add min-release…
tylerccarson Jun 17, 2026
c859f53
BE-7699 Removed leading slashes from rest messages (#179)
hleekeeper Jun 18, 2026
6e79fa4
Use preserveModules for browser dist to enable proto.js tree-shaking …
tylerccarson Jun 23, 2026
8138e53
NSF command implementation (list, get, ln and rm) (#175)
ukumar-ks Jun 24, 2026
1624afc
initial implementation of vault cli
sgaddala-ks Jun 16, 2026
38c3a86
migrated functions and files from sdk to cli repository
sgaddala-ks Jul 1, 2026
2bb236b
Merge remote-tracking branch 'origin/main' into feature-shell-sdk-sup…
sgaddala-ks Jul 1, 2026
237cce2
formatting changes after running formatting.
sgaddala-ks Jul 10, 2026
f1c391f
added team key parsing while sharing record.
sgaddala-ks Jul 13, 2026
1c09853
added formatting changes
sgaddala-ks Jul 13, 2026
dc5a17b
Add get_configuration_controller and workflow API messages (#195)
tylerccarson Jul 1, 2026
626dfe3
BE-7755: preserve platform-connect side-effects in sideEffects allowlist
svelichkin-keeper Jul 1, 2026
c3a2608
BE-7755: bump keeperapi to 18.0.4
svelichkin-keeper Jul 1, 2026
c07911f
Reporting command implementation(Audit, Action and Password). (#194)
ukumar-ks Jul 2, 2026
3dda497
Regenerate protobuf files (#199)
github-actions[bot] Jul 6, 2026
ee34d76
Added the Modifying the generation script in the Protobuf Regeneratio…
hleekeeper Jul 6, 2026
bfd4a8c
Rest message update for nsf commands (#201)
ukumar-ks Jul 6, 2026
77c5578
NSF record (add, update and details) and folder (add and remove) func…
ukumar-ks Jul 10, 2026
20e3d19
NSF sdk examples implemented (#205)
ukumar-ks Jul 10, 2026
5c78473
initial implementation of vault cli
sgaddala-ks Jun 16, 2026
c65322e
Use logger in socket connection, add socket connection to the router.…
saldoukhov Jun 16, 2026
b0371b6
Bump the npm_and_yarn group across 4 directories with 3 updates (#174)
dependabot[bot] Jun 17, 2026
feddec1
BE-7699 Removed leading slashes from rest messages (#179)
hleekeeper Jun 18, 2026
6c909cc
NSF command implementation (list, get, ln and rm) (#175)
ukumar-ks Jun 24, 2026
65d48da
migrated functions and files from sdk to cli repository
sgaddala-ks Jul 1, 2026
2440ab4
formatting changes after running formatting.
sgaddala-ks Jul 10, 2026
24d582d
added parsing option for restore session.
sgaddala-ks Jul 14, 2026
2240ee8
Merge remote-tracking branch 'origin/feature-kd-share-permission-int'…
sgaddala-ks Jul 14, 2026
bfef44f
updated keeper api version
sgaddala-ks Jul 15, 2026
52d0869
updated version of keeperapi
sgaddala-ks Jul 15, 2026
558b793
Merge remote-tracking branch 'origin/feature-shell-support-sdk-rel' i…
sgaddala-ks Jul 15, 2026
45f6255
updated restore-sesion json parsing
sgaddala-ks Jul 15, 2026
798b459
added support of nsf to list command
sgaddala-ks Jul 16, 2026
02615d1
added support for enterprise role functionality
sgaddala-ks Jul 17, 2026
3b1b4c7
Merge remote-tracking branch 'origin/main' into feature-shell-sdk-sup…
sgaddala-ks Jul 17, 2026
ae7164a
Merge remote-tracking branch 'origin/main' into feature-shell-sdk-sup…
sgaddala-ks Jul 17, 2026
6b9d4cd
removed custom nsf parser codec
sgaddala-ks Jul 17, 2026
72e60e9
applied fixes for enterprise role privileges and managed nodes
sgaddala-ks Jul 20, 2026
e94b3aa
added support for ER
sgaddala-ks Jul 20, 2026
0faf028
Merge remote-tracking branch 'origin/main' into feature-shell-sdk-sup…
sgaddala-ks Jul 20, 2026
7b8ad3b
reverted few enhancements code to reduce PR size.
sgaddala-ks Jul 20, 2026
647b983
removed caching of decrypted keys
sgaddala-ks Jul 20, 2026
bf11e79
added support disable2fa for enterprise user
sgaddala-ks Jul 20, 2026
db0a5a7
added support for enterprise nodes
sgaddala-ks Jul 20, 2026
aa885a3
formatting changes
sgaddala-ks Jul 20, 2026
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
9 changes: 5 additions & 4 deletions KeeperSdk/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions KeeperSdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
"directory": "KeeperSdk"
},
"license": "ISC",
"main": "src/index.ts",
"main": "dist/index.js",
"browser": "dist/browser.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"clean": "rm -rf dist",
"clean": "rm -rf dist node_modules",
"rebuild": "npm run clean && npm install && npm run link-local && npm run build",
"link-local": "npm link ../keeperapi",
"format": "prettier --write .",
"format:check": "prettier --check .",
Expand All @@ -21,8 +24,9 @@
"prepublishOnly": "npm run build"
},
"dependencies": {
"@keeper-security/keeperapi": "^18.0.4",
"@keeper-security/keeperapi": "18.0.6",
"ts-node": "^10.7.0",
"asmcrypto.js": "^2.3.2",
"typescript": "^4.6.3"
},
"devDependencies": {
Expand Down
112 changes: 112 additions & 0 deletions KeeperSdk/src/account/whoamiInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import type { AccountSummary } from '@keeper-security/keeperapi'
import type { VaultSummary } from '../vault/KeeperVault'
import { KEEPER_PUBLIC_HOSTS } from '../utils/constants'

export type WhoamiInfo = {
user: string
server: string
dataCenter: string
admin: boolean
accountType: string
renewalDate: string
storageCapacity: string
storageUsage: string
storageRenewalDate: string
breachWatch: boolean
reportingAndAlerts: boolean
recordsCount?: number
sharedFoldersCount?: number
teamsCount?: number
}

export type BuildWhoamiInfoInput = {
username: string
host: string
accountSummary: AccountSummary.IAccountSummaryElements
vaultSummary?: VaultSummary
}

export function normalizeServerHost(host: string): string {
return host
.toLowerCase()
.trim()
.replace(/^(qa|dev|dev2|local)\./, '')
}

export function resolveDataCenter(host: string): string {
const normalized = normalizeServerHost(host)
for (const [dataCenter, publicHost] of Object.entries(KEEPER_PUBLIC_HOSTS)) {
if (normalized === publicHost || normalized.endsWith(`.${publicHost}`)) {
return dataCenter
}
}
return 'US'
}

export function buildWhoamiInfo(input: BuildWhoamiInfoInput): WhoamiInfo {
const license = input.accountSummary.license ?? input.accountSummary.personalLicense ?? {}
const server = normalizeServerHost(input.host)

const info: WhoamiInfo = {
user: input.username,
server,
dataCenter: resolveDataCenter(input.host),
admin: !!input.accountSummary.isEnterpriseAdmin,
accountType: formatAccountType(license),
renewalDate: formatRenewalDate(license),
storageCapacity: formatStorageCapacity(license.bytesTotal),
storageUsage: formatStorageUsage(license.bytesUsed, license.bytesTotal),
storageRenewalDate: formatRenewalDateField(license.storageExpirationDate, license.storageExpiration),
breachWatch: isBreachWatchEnabled(license),
reportingAndAlerts: !!license.auditAndReportingEnabled,
}

if (input.vaultSummary) {
info.recordsCount = input.vaultSummary.recordCount
info.sharedFoldersCount = input.vaultSummary.sharedFolderCount
info.teamsCount = input.vaultSummary.teamCount
}

return info
}

function formatAccountType(license: AccountSummary.ILicense): string {
const name = (license.productTypeName ?? '').trim()
if (name) return name
if (license.accountType != null) return String(license.accountType)
return 'Unknown'
}

function formatRenewalDate(license: AccountSummary.ILicense): string {
return formatRenewalDateField(license.expirationDate, license.expiration)
}

function formatRenewalDateField(dateString?: string | null, timestamp?: number | null): string {
const trimmed = (dateString ?? '').trim()
if (trimmed) return trimmed
if (timestamp && timestamp > 0) {
return new Date(timestamp).toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric',
})
}
return ''
}

function formatStorageCapacity(bytes?: number | null): string {
if (!bytes || bytes <= 0) return '0GB'
const gb = Math.round(bytes / 1024 ** 3)
return `${gb}GB`
}

function formatStorageUsage(bytesUsed?: number | null, bytesTotal?: number | null): string {
if (!bytesTotal || bytesTotal <= 0) return '0%'
const pct = Math.round(((bytesUsed ?? 0) / bytesTotal) * 100)
return `${pct}%`
}

function isBreachWatchEnabled(license: AccountSummary.ILicense): boolean {
if (license.breachWatchFeatureDisable) return false
return !!license.breachWatchEnabled
}
Loading
Loading