Skip to content

Commit

Permalink
fix: use base64 for custom profiles and update depends (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
santese committed May 29, 2024
1 parent 3d16855 commit 7d51844
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 97 deletions.
126 changes: 63 additions & 63 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
{
"author": "Caleb Albers <calebalbers@gmail.com>",
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"dependencies": {
"@expo/plist": "0.1.0",
"axios": "1.6.8",
"http-cookie-agent": "6.0.3",
"tough-cookie": "4.1.3",
"uuid": "9.0.1"
},
"description": "",
"devDependencies": {
"@pliancy/eslint-config-ts": "1.1.1",
"@pliancy/semantic-release-config-npm": "2.2.0",
"@types/jest": "29.5.12",
"@types/node": "20.12.4",
"@types/tough-cookie": "4.0.5",
"@types/uuid": "9.0.8",
"commitizen": "4.3.0",
"concurrently": "8.2.2",
"cpy-cli": "5.0.0",
"cz-conventional-changelog": "3.3.0",
"husky": "9.0.11",
"jest": "29.7.0",
"open": "10.1.0",
"pinst": "3.0.0",
"rimraf": "5.0.5",
"ts-jest": "29.1.2",
"typescript": "5.4.3"
},
"keywords": [
"addigy",
"addigy api",
"rest api",
"rest"
],
"license": "MIT",
"main": "index.js",
"name": "addigy",
"repository": {
"type": "git",
"url": "https://github.com/pliancy/addigy-node"
},
"scripts": {
"build": "concurrently 'yarn clean' 'yarn test' 'yarn tsc' 'yarn copy'",
"build:check": "tsc --noEmit",
"clean": "rimraf coverage dist tmp",
"copy": "pinst --disable && cpy package.json dist && cpy README.md dist && pinst --enable",
"lint": "eslint \"src/**/*.ts\" --fix",
"postinstall": "husky install",
"qa": "concurrently 'yarn lint' 'yarn test' ' yarn clean' 'yarn build:check'",
"semantic-release": "semantic-release",
"test": "jest",
"tsc": "tsc -p tsconfig.build.json"
},
"types": "index.d.ts",
"version": "2.10.3",
"volta": {
"node": "20.12.1",
"yarn": "1.22.22"
"author": "Caleb Albers <calebalbers@gmail.com>",
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"dependencies": {
"@expo/plist": "0.1.3",
"axios": "1.7.2",
"http-cookie-agent": "6.0.5",
"tough-cookie": "4.1.4",
"uuid": "9.0.1"
},
"description": "",
"devDependencies": {
"@pliancy/eslint-config-ts": "1.1.1",
"@pliancy/semantic-release-config-npm": "2.2.0",
"@types/jest": "29.5.12",
"@types/node": "20.12.12",
"@types/tough-cookie": "4.0.5",
"@types/uuid": "9.0.8",
"commitizen": "4.3.0",
"concurrently": "8.2.2",
"cpy-cli": "5.0.0",
"cz-conventional-changelog": "3.3.0",
"husky": "9.0.11",
"jest": "29.7.0",
"open": "10.1.0",
"pinst": "3.0.0",
"rimraf": "5.0.7",
"ts-jest": "29.1.4",
"typescript": "5.4.5"
},
"keywords": [
"addigy",
"addigy api",
"rest api",
"rest"
],
"license": "MIT",
"main": "index.js",
"name": "addigy",
"repository": {
"type": "git",
"url": "https://github.com/pliancy/addigy-node"
},
"scripts": {
"build": "concurrently 'yarn clean' 'yarn test' 'yarn tsc' 'yarn copy'",
"build:check": "tsc --noEmit",
"clean": "rimraf coverage dist tmp",
"copy": "pinst --disable && cpy package.json dist && cpy README.md dist && pinst --enable",
"lint": "eslint \"src/**/*.ts\" --fix",
"postinstall": "husky install",
"qa": "concurrently 'yarn lint' 'yarn test' ' yarn clean' 'yarn build:check'",
"semantic-release": "semantic-release",
"test": "jest",
"tsc": "tsc -p tsconfig.build.json"
},
"types": "index.d.ts",
"version": "2.10.3",
"volta": {
"node": "20.12.1",
"yarn": "1.22.22"
}
}
14 changes: 12 additions & 2 deletions src/lib/mdm/mdm-profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,27 @@ export class MdmProfiles {
headers: { origin: Urls.appProd },
})

/**
* Create a custom profile
* @param authObject - The auth object
* @param name - The name of the custom profile
* @param customProfileBase64 - The base64 encoded custom profile
* @param supportedOsVersions - The supported OS versions -
* @param payloadScope - The payload scope
* @param is_profile_signed - Whether the profile is signed
*/
async createCustomProfile(
authObject: IAddigyInternalAuthObject,
name: string,
customProfileText: string,
customProfileBase64: string,
supportedOsVersions: SupportedOsVersions,
payloadScope: 'System' | 'User' = 'System',
is_profile_signed = false,
): Promise<any> {
const groupUUID = uuidv4()

const customProfileText = Buffer.from(customProfileBase64, 'base64').toString('utf-8')

const customProfileJson = plist.parse(customProfileText)
// Keys for customProfileJson need to be snake_case
const updateCustomProfileJson = Object.entries(customProfileJson).reduce(
Expand All @@ -33,7 +44,6 @@ export class MdmProfiles {
},
{} as any,
)
const customProfileBase64 = Buffer.from(customProfileText).toString('base64')

const payload: CustomProfilePayload = {
addigy_payload_type: 'com.addigy.custom.mdm.payload',
Expand Down
64 changes: 32 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,10 @@
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.0.tgz#a5417ae8427873f1dd08b70b3574b453e67b5f7f"
integrity sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==

"@expo/plist@0.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@expo/plist/-/plist-0.1.0.tgz#eabc95f951d14e10c87fd0443ee01d567371f058"
integrity sha512-xWD+8vIFif0wKyuqe3fmnmnSouXYucciZXFzS0ZD5OV9eSAS1RGQI5FaGGJ6zxJ4mpdy/4QzbLdBjnYE5vxA0g==
"@expo/plist@0.1.3":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@expo/plist/-/plist-0.1.3.tgz#b4fbee2c4f7a88512a4853d85319f4d95713c529"
integrity sha512-GW/7hVlAylYg1tUrEASclw1MMk9FP4ZwyFAY/SUTJIhPDQHtfOlXREyWV3hhrHdX/K+pS73GNgdfT6E/e+kBbg==
dependencies:
"@xmldom/xmldom" "~0.7.7"
base64-js "^1.2.3"
Expand Down Expand Up @@ -1224,10 +1224,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-15.12.5.tgz#9a78318a45d75c9523d2396131bd3cca54b2d185"
integrity sha512-se3yX7UHv5Bscf8f1ERKvQOD6sTyycH3hdaoozvaLxgUiY5lIGEeH37AD0G0Qi9kPqihPn0HOfd2yaIEN9VwEg==

"@types/node@20.12.4":
version "20.12.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.4.tgz#af5921bd75ccdf3a3d8b3fa75bf3d3359268cd11"
integrity sha512-E+Fa9z3wSQpzgYQdYmme5X3OTuejnnTx88A6p6vkkJosR3KBz+HpE3kqNm98VE6cfLFcISx7zW7MsJkH6KwbTw==
"@types/node@20.12.12":
version "20.12.12"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.12.tgz#7cbecdf902085cec634fdb362172dfe12b8f2050"
integrity sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==
dependencies:
undici-types "~5.26.4"

Expand Down Expand Up @@ -1632,10 +1632,10 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==

axios@1.6.8:
version "1.6.8"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.8.tgz#66d294951f5d988a00e87a0ffb955316a619ea66"
integrity sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==
axios@1.7.2:
version "1.7.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.2.tgz#b625db8a7051fbea61c35a3cbb3a1daa7b9c7621"
integrity sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==
dependencies:
follow-redirects "^1.15.6"
form-data "^4.0.0"
Expand Down Expand Up @@ -3462,10 +3462,10 @@ http-cache-semantics@^4.1.0:
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390"
integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==

http-cookie-agent@6.0.3:
version "6.0.3"
resolved "https://registry.yarnpkg.com/http-cookie-agent/-/http-cookie-agent-6.0.3.tgz#21a7bafb8dc9b9960e6fd7c67d20aacf64f68eeb"
integrity sha512-6JdymEgWgsg9VQ5VN9FGpRRcivyu4WdM0Ud3kW+Q0PB7knt0EFtlhNPU8wCuscXLfIEI5y6jEMdFTBODNsJR6g==
http-cookie-agent@6.0.5:
version "6.0.5"
resolved "https://registry.yarnpkg.com/http-cookie-agent/-/http-cookie-agent-6.0.5.tgz#23b490439464424a689d80ea7f3a560a4a893ab8"
integrity sha512-sfZ8fDgDP3B1YB+teqSnAK1aPgBu8reUUGxSsndP2XnYN6cM29EURXWXZqQQiaRdor3B4QjpkUNfv21syaO4DA==
dependencies:
agent-base "^7.1.1"

Expand Down Expand Up @@ -6079,10 +6079,10 @@ reusify@^1.0.4:
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==

rimraf@5.0.5:
version "5.0.5"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-5.0.5.tgz#9be65d2d6e683447d2e9013da2bf451139a61ccf"
integrity sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==
rimraf@5.0.7:
version "5.0.7"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-5.0.7.tgz#27bddf202e7d89cb2e0381656380d1734a854a74"
integrity sha512-nV6YcJo5wbLW77m+8KjH8aB/7/rxQy9SZ0HY5shnwULfS+9nmTtVXAJET5NdZmCzA4fPI/Hm1wo/Po/4mopOdg==
dependencies:
glob "^10.3.7"

Expand Down Expand Up @@ -6720,10 +6720,10 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"

tough-cookie@4.1.3:
version "4.1.3"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.3.tgz#97b9adb0728b42280aa3d814b6b999b2ff0318bf"
integrity sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==
tough-cookie@4.1.4:
version "4.1.4"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36"
integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==
dependencies:
psl "^1.1.33"
punycode "^2.1.1"
Expand Down Expand Up @@ -6773,10 +6773,10 @@ ts-api-utils@^1.0.1:
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331"
integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==

ts-jest@29.1.2:
version "29.1.2"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.2.tgz#7613d8c81c43c8cb312c6904027257e814c40e09"
integrity sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==
ts-jest@29.1.4:
version "29.1.4"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.4.tgz#26f8a55ce31e4d2ef7a1fd47dc7fa127e92793ef"
integrity sha512-YiHwDhSvCiItoAgsKtoLFCuakDzDsJ1DLDnSouTaTmdOcOwIkSzbLXduaQ6M5DRVhuZC/NYaaZ/mtHbWMv/S6Q==
dependencies:
bs-logger "0.x"
fast-json-stable-stringify "2.x"
Expand Down Expand Up @@ -6873,10 +6873,10 @@ typescript@5.4.2:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.2.tgz#0ae9cebcfae970718474fe0da2c090cad6577372"
integrity sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==

typescript@5.4.3:
version "5.4.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.3.tgz#5c6fedd4c87bee01cd7a528a30145521f8e0feff"
integrity sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==
typescript@5.4.5:
version "5.4.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611"
integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==

uglify-js@^3.1.4:
version "3.13.10"
Expand Down

0 comments on commit 7d51844

Please sign in to comment.