@privateaim/kit 0.8.20 → 0.8.22

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.
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/crypto/asymmetric/constants.ts","../src/crypto/asymmetric/helpers.ts","../src/crypto/asymmetric/module.ts","../src/domains/permission/constants.ts","../src/utils/boolean.ts","../src/utils/has-own-property.ts","../src/utils/error.ts","../src/utils/hex-checker.ts","../src/utils/hostname.ts","../src/utils/is-object.ts","../src/utils/nanoid.ts","../src/utils/nanoseconds.ts","../src/utils/object-properties.ts","../src/utils/proxy-connection-string.ts","../src/utils/regex-patterns.ts","../src/utils/wait.ts","../src/domains/realm/helper.ts","../src/domains/constants.ts","../src/domains/helpers.ts","../src/domain-event/helpers.ts","../src/constants.ts"],"sourcesContent":["/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum AsymmetricCryptoAlgorithmName {\n RSA_OAEP = 'RSA-OAEP',\n\n ECDH = 'ECDH',\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nfunction arrayBufferToBase64(arrayBuffer: ArrayBuffer): string {\n return btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)));\n}\n\nexport async function exportAsymmetricPublicKey(key: CryptoKey): Promise<string> {\n const exported = await crypto.subtle.exportKey(\n 'spki',\n key,\n );\n\n return `-----BEGIN PUBLIC KEY-----\\n${arrayBufferToBase64(exported)}\\n-----END PUBLIC KEY-----`;\n}\n\nexport async function exportAsymmetricPrivateKey(key: CryptoKey): Promise<string> {\n const exported = await crypto.subtle.exportKey(\n 'pkcs8',\n key,\n );\n\n return `-----BEGIN PRIVATE KEY-----\\n${arrayBufferToBase64(exported)}\\n-----END PRIVATE KEY-----`;\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { AsymmetricCryptoAlgorithmName } from './constants';\nimport type { AsymmetricAlgorithmParams } from './types';\n\nexport class CryptoAsymmetricAlgorithm {\n public readonly algorithm: AsymmetricAlgorithmParams;\n\n protected keyPair : CryptoKeyPair | undefined;\n\n constructor(algorithm: AsymmetricAlgorithmParams) {\n if (algorithm.name === AsymmetricCryptoAlgorithmName.RSA_OAEP) {\n algorithm = {\n ...algorithm,\n publicExponent: new Uint8Array([1, 0, 1]),\n };\n }\n\n this.algorithm = algorithm;\n }\n\n async generateKeyPair() : Promise<CryptoKeyPair> {\n if (this.algorithm.name === AsymmetricCryptoAlgorithmName.RSA_OAEP) {\n this.keyPair = await crypto.subtle.generateKey(\n this.algorithm,\n true,\n ['encrypt', 'decrypt'],\n );\n\n return this.keyPair;\n }\n\n if (this.algorithm.name === AsymmetricCryptoAlgorithmName.ECDH) {\n this.keyPair = await crypto.subtle.generateKey(\n this.algorithm,\n true,\n ['deriveKey'],\n );\n\n return this.keyPair;\n }\n\n throw new Error('The algorithm is not supported for key generation.');\n }\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum PermissionName {\n EVENT_CREATE = 'event_create',\n EVENT_READ = 'event_read',\n EVENT_DELETE = 'event_delete',\n\n BUCKET_CREATE = 'bucket_create',\n BUCKET_UPDATE = 'bucket_update',\n BUCKET_DELETE = 'bucket_delete',\n\n LOG_CREATE = 'log_create',\n LOG_DELETE = 'log_delete',\n LOG_READ = 'log_read',\n\n PROJECT_CREATE = 'project_create',\n PROJECT_DELETE = 'project_delete',\n PROJECT_UPDATE = 'project_update',\n PROJECT_APPROVE = 'project_approve',\n\n REGISTRY_MANAGE = 'registry_manage',\n REGISTRY_PROJECT_MANAGE = 'registry_project_manage',\n\n NODE_CREATE = 'node_create',\n NODE_DELETE = 'node_delete',\n NODE_UPDATE = 'node_update',\n\n ANALYSIS_APPROVE = 'analysis_approve',\n ANALYSIS_UPDATE = 'analysis_update',\n ANALYSIS_CREATE = 'analysis_create',\n ANALYSIS_EXECUTION_START = 'analysis_execution_start',\n ANALYSIS_EXECUTION_STOP = 'analysis_execution_stop',\n ANALYSIS_DELETE = 'analysis_delete',\n ANALYSIS_RESULT_READ = 'analysis_result_read', // todo: this is maybe not required anymore\n\n ANALYSIS_SELF_MESSAGE_BROKER_USE = 'analysis_self_message_broker_use',\n ANALYSIS_SELF_STORAGE_USE = 'analysis_self_storage_use',\n\n MASTER_IMAGE_MANAGE = 'master_image_manage',\n MASTER_IMAGE_GROUP_MANAGE = 'master_image_group_manage',\n\n SERVICE_MANAGE = 'service_manage',\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function isBoolTrue<T = any>(input: T | boolean) : input is true {\n return typeof input === 'boolean' && !!input;\n}\n\nexport function isBoolFalse<T = any>(input: T | boolean) : input is false {\n return typeof input === 'boolean' && !input;\n}\n\nexport function isBool<T = any>(input: T | boolean) : input is boolean {\n return typeof input === 'boolean';\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function hasOwnProperty<X extends {}, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown> {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport function isPropertySet<X extends Record<string, any>, K extends keyof X>(\n obj: X,\n prop: K,\n) : boolean {\n return hasOwnProperty(obj, prop);\n}\n","/*\n * Copyright (c) 2023-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { hasOwnProperty } from './has-own-property';\n\nexport function isError(e: unknown) {\n return typeof e === 'object' && e && hasOwnProperty(e, 'message');\n}\n\nexport function extractErrorMessage(e: Error) {\n return e.message;\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function isHex(value: string) : boolean {\n return /^[A-Fa-f0-9]+$/i.test(value);\n}\n\nexport function hexToUTF8(value: string) {\n try {\n return decodeURIComponent(`%${value.match(/.{1,2}/g).join('%')}`);\n } catch (e) {\n if (e instanceof URIError) {\n return value;\n }\n\n throw e;\n }\n}\n","/*\n * Copyright (c) 2022-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function getHostNameFromString(value: string) : string {\n if (\n value.startsWith('http://') ||\n value.startsWith('https://')\n ) {\n const url = new URL(value);\n value = url.hostname;\n }\n\n return value;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function isObject(item: unknown) : item is Record<string, any> {\n return (\n !!item &&\n typeof item === 'object' &&\n !Array.isArray(item)\n );\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { customAlphabet } from 'nanoid';\n\nexport function createNanoID(alphabet?: string) : string;\nexport function createNanoID(len?: number) : string;\nexport function createNanoID(alphabet?: string, len?: number) : string;\nexport function createNanoID(alphabetOrLen?: string | number, len?: number) : string {\n if (typeof alphabetOrLen === 'string') {\n return customAlphabet(alphabetOrLen, len || 21)();\n }\n\n if (typeof alphabetOrLen === 'number') {\n return customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', alphabetOrLen)();\n }\n\n return customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', len || 21)();\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function nanoSeconds() : bigint {\n return BigInt(\n Math.floor(performance.timeOrigin),\n ) * 1_000_000n + BigInt(\n Math.floor(performance.now() * 1_000_000),\n );\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function nullifyEmptyObjectProperties<T extends Record<string, any>>(data: T) : T {\n const keys : (keyof T)[] = Object.keys(data);\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (data[key] === '') {\n data[key] = null as T[keyof T];\n }\n }\n\n return data as T;\n}\n\nexport function deleteUndefinedObjectProperties<T extends Record<string, any>>(data: T) : T {\n const keys : string[] = Object.keys(data);\n\n for (let i = 0; i < keys.length; i++) {\n if (typeof data[keys[i]] === 'undefined') {\n delete data[keys[i]];\n }\n }\n\n return data;\n}\n","/*\n * Copyright (c) 2021-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport type ProxyConnectionConfig = {\n protocol: 'http' | 'https',\n host: string,\n port: number,\n auth: {\n username: string,\n password: string,\n }\n};\n\nexport function parseProxyConnectionString(connectionStr: string) : ProxyConnectionConfig | undefined {\n const match = connectionStr\n .match(/(?:(https|http):\\/\\/)(?:(\\w+)(?::(\\w+))?@)?(?:([^:]+))(?::(\\d{1,5}))?$/);\n\n if (!match) {\n return undefined;\n }\n\n return {\n protocol: match[1] as 'http' | 'https',\n host: match[4],\n port: parseInt(match[5], 10),\n auth: {\n username: match[2],\n password: match[3],\n },\n };\n}\n\nexport function detectProxyConnectionConfig() : ProxyConnectionConfig | undefined {\n const envKeys = [\n 'https_proxy',\n 'HTTPS_PROXY',\n 'http_proxy',\n 'HTTP_PROXY',\n ];\n\n let result : string | undefined;\n\n for (let i = 0; i < envKeys.length; i++) {\n const envKey = envKeys[i];\n const envVal = process.env[envKey];\n\n if (\n envVal !== undefined &&\n envVal !== null\n ) {\n result = result || envVal;\n }\n }\n\n if (!result) {\n return undefined;\n }\n\n return parseProxyConnectionString(result);\n}\n","/*\n * Copyright (c) 2023-2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const alphaNumHyphenUnderscoreRegex = /^[a-z0-9-_]*$/;\nexport const registryRobotSecretRegex = /^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d).{8,}$/;\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport async function wait(ms: number): Promise<void> {\n return new Promise<void>((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Realm } from '@authup/core-kit';\nimport { REALM_MASTER_NAME } from '@authup/core-kit';\nimport { isPropertySet } from '../../utils';\n\n/**\n * Check if a realm resource is writable.\n *\n * @param realm\n * @param resourceRealmId\n */\nexport function isRealmResourceWritable(realm: Partial<Realm>, resourceRealmId: string | string[]) {\n if (Array.isArray(resourceRealmId)) {\n for (let i = 0; i < resourceRealmId.length; i++) {\n if (isRealmResourceWritable(realm, resourceRealmId[i])) {\n return true;\n }\n }\n return false;\n }\n\n if (!realm) {\n return false;\n }\n\n if (\n isPropertySet(realm, 'name') &&\n realm.name === REALM_MASTER_NAME\n ) {\n return true;\n }\n\n return realm?.id === resourceRealmId;\n}\n/**\n * Check if realm resource is readable.\n *\n * @param realm\n * @param resourceRealmId\n */\n\nexport function isRealmResourceReadable(realm: Partial<Realm>, resourceRealmId: string | string[]) {\n if (Array.isArray(resourceRealmId)) {\n if (resourceRealmId.length === 0) {\n return true;\n }\n for (let i = 0; i < resourceRealmId.length; i++) {\n if (isRealmResourceReadable(realm, resourceRealmId[i])) {\n return true;\n }\n }\n return false;\n }\n\n if (typeof realm === 'undefined') {\n return false;\n }\n\n if (\n isPropertySet(realm, 'name') &&\n realm.name === REALM_MASTER_NAME\n ) {\n return true;\n }\n\n return !resourceRealmId || realm?.id === resourceRealmId;\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum DomainEventName {\n CREATED = 'created',\n DELETED = 'deleted',\n UPDATED = 'updated',\n}\n\nexport const DomainEventNamespace = 'resources';\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function buildDomainChannelName(\n domain: string,\n id?: string | number,\n) {\n if (typeof id === 'string' || typeof id === 'number') {\n return `${domain}:${id}`;\n }\n\n return domain;\n}\n\n// todo: rename to buildEntityNamespaceName\nexport function buildDomainNamespaceName(id?: string) {\n return id ?\n `/resources:${id}` :\n '/resources';\n}\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { DomainEventFullName } from './types';\n\nexport function buildDomainEventFullName<\n ENTITY extends string,\n EVENT extends string,\n>(\n type: ENTITY,\n event: EVENT,\n) : DomainEventFullName<ENTITY, EVENT> {\n const eventCapitalized = event.substring(0, 1).toUpperCase() + event.substring(1);\n\n return type + eventCapitalized as DomainEventFullName<ENTITY, EVENT>;\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport enum EnvironmentName {\n TEST = 'test',\n DEVELOPMENT = 'development',\n PRODUCTION = 'production',\n}\n\nexport const MINUTE_IN_MS = 1000 * 60;\nexport const HOUR_IN_MS = MINUTE_IN_MS * 60;\nexport const DAY_IN_MS = HOUR_IN_MS * 24;\nexport const WEEK_IN_MS = DAY_IN_MS * 7;\nexport const MONTH_IN_MS = WEEK_IN_MS * 4;\n"],"names":["AsymmetricCryptoAlgorithmName","asyncGeneratorStep","arrayBufferToBase64","arrayBuffer","btoa","String","fromCharCode","apply","Uint8Array","exportAsymmetricPublicKey","key","exported","crypto","subtle","exportKey","exportAsymmetricPrivateKey","CryptoAsymmetricAlgorithm","generateKeyPair","algorithm","name","RSA_OAEP","keyPair","generateKey","ECDH","Error","publicExponent","PermissionName","isBoolTrue","input","isBoolFalse","isBool","hasOwnProperty","obj","prop","Object","prototype","call","isPropertySet","isError","e","extractErrorMessage","message","isHex","value","test","hexToUTF8","decodeURIComponent","match","join","URIError","getHostNameFromString","startsWith","url","URL","hostname","isObject","item","Array","isArray","createNanoID","alphabetOrLen","len","customAlphabet","nanoSeconds","BigInt","Math","floor","performance","timeOrigin","now","nullifyEmptyObjectProperties","data","keys","i","length","deleteUndefinedObjectProperties","parseProxyConnectionString","connectionStr","undefined","protocol","host","port","parseInt","auth","username","password","detectProxyConnectionConfig","envKeys","result","envKey","envVal","process","env","alphaNumHyphenUnderscoreRegex","registryRobotSecretRegex","wait","ms","Promise","resolve","setTimeout","isRealmResourceWritable","realm","resourceRealmId","REALM_MASTER_NAME","id","isRealmResourceReadable","DomainEventName","DomainEventNamespace","buildDomainChannelName","domain","buildDomainNamespaceName","buildDomainEventFullName","type","event","eventCapitalized","substring","toUpperCase","EnvironmentName","MINUTE_IN_MS","HOUR_IN_MS","DAY_IN_MS","WEEK_IN_MS","MONTH_IN_MS"],"mappings":";;;;;AAAA;;;;;IAOO,IAAKA,6BAAAA,iBAAAA,SAAAA,6BAAAA,EAAAA;;;AAAAA,IAAAA,OAAAA,6BAAAA;AAIX,CAAA,CAAA,EAAA;;ACXD;;;;;AAKC,IAAA,SAAAC,oBAAA,CAAA,GAAA,EAAA,OAAA,EAAA,MAAA,EAAA,KAAA,EAAA,MAAA,EAAA,GAAA,EAAA,GAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,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