{"_id":"@dscvr-one/dscvr-sdk","_rev":"6-93b6c695eab379c09a459afadc00f9c1","name":"@dscvr-one/dscvr-sdk","dist-tags":{"latest":"1.0.6"},"versions":{"1.0.0":{"name":"@dscvr-one/dscvr-sdk","version":"1.0.0","keywords":[],"author":"","license":"ISC","_id":"@dscvr-one/dscvr-sdk@1.0.0","maintainers":[{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},{"name":"chandra-dscvr","email":"chandra@dscvr.one"},{"name":"jimmy-dscvr","email":"jimmy@dscvr.one"}],"dist":{"shasum":"f6f3333f0d48344a23cf956a1273f951769e98a5","tarball":"https://registry.npmjs.org/@dscvr-one/dscvr-sdk/-/dscvr-sdk-1.0.0.tgz","fileCount":24,"integrity":"sha512-lcdO6S4uhtAlNC1i4EkG6302jFgPahezJL+M9EbwxDu6mhsAdMVGgFVWhgtqfuXniPhMNOjQ5ylX2i+ELyd46A==","signatures":[{"sig":"MEQCICEXH04NxQt+jBJ3twzkJgh0DFPgzuQpnJgEkIPR1r0PAiB8glmZBncRdVKZkfS/hl/uKKMuVJCL9pr6jbPGhoOi2w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":196485},"main":"src/index.ts","gitHead":"7694bd51bbcdd6999d05ad1699ade0fce13f0468","scripts":{"lint":"eslint 'src/**/*.{ts,js}'","build":"tsup","format":"prettier --write 'src/**/*.{ts,js,json,md}'","prepare":"pnpm build","generate":"npx tsx ./src/generate.ts","type-check":"tsc --noEmit"},"_npmUser":{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},"_npmVersion":"10.9.0","description":"The DSCVR SDK is a TypeScript library designed to facilitate interactions with the DSCVR platform, leveraging DSCVR's Social Fabric Protocol","directories":{},"_nodeVersion":"23.2.0","dependencies":{"@dfinity/agent":"^2.1.3","@dfinity/candid":"^2.1.3","@dfinity/identity":"^2.1.3","@dfinity/principal":"^2.1.3","@dfinity/identity-secp256k1":"^2.1.3"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.16.0","prettier":"^3.4.2","ts-morph":"^24.0.0","typescript":"^5.7.2","@types/node":"^22.10.1","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^8.17.0","@typescript-eslint/eslint-plugin":"^8.17.0"},"_npmOperationalInternal":{"tmp":"tmp/dscvr-sdk_1.0.0_1734373955684_0.07885611922469193","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@dscvr-one/dscvr-sdk","version":"1.0.1","keywords":["dscvr","sdk","dscvr-sdk"],"author":"","license":"ISC","_id":"@dscvr-one/dscvr-sdk@1.0.1","maintainers":[{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},{"name":"chandra-dscvr","email":"chandra@dscvr.one"},{"name":"jimmy-dscvr","email":"jimmy@dscvr.one"}],"dist":{"shasum":"3496568530735f2f6657cfc135ebe39be8e4d89f","tarball":"https://registry.npmjs.org/@dscvr-one/dscvr-sdk/-/dscvr-sdk-1.0.1.tgz","fileCount":26,"integrity":"sha512-ISURGeGQnFyg4jO+C18pqMfva3fMrCygWzh+24Uxh8ppr0MsDfJy1WueBAXR6l01G/zU7ZCQvEuHcJa/rWiGTw==","signatures":[{"sig":"MEQCIDqRImin/QBEDzA/G4Oukw5neERFTIOrKnQOOMBVu4o4AiBHAn1VSmhve/3Kv90DcxxuwyQUSI4kawEX7GB3DvUtDg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":312641},"main":"src/index.ts","gitHead":"069520b17ac9b7b2be6899b592dd2906892fb574","scripts":{"lint":"eslint 'src/**/*.{ts,js}'","build":"tsup","format":"prettier --write 'src/**/*.{ts,js,json,md}'","prepare":"pnpm build","generate":"npx tsx ./src/generate.ts","type-check":"tsc --noEmit"},"_npmUser":{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},"_npmVersion":"10.9.0","description":"The DSCVR SDK is a TypeScript library designed to facilitate interactions with the DSCVR platform, leveraging DSCVR's Social Fabric Protocol","directories":{},"_nodeVersion":"23.2.0","dependencies":{"@dfinity/agent":"^2.1.3","@dfinity/candid":"^2.1.3","@dfinity/identity":"^2.1.3","@dfinity/principal":"^2.1.3","@dfinity/identity-secp256k1":"^2.1.3"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.16.0","prettier":"^3.4.2","ts-morph":"^24.0.0","typescript":"^5.7.2","@types/node":"^22.10.1","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^8.17.0","@typescript-eslint/eslint-plugin":"^8.17.0"},"_npmOperationalInternal":{"tmp":"tmp/dscvr-sdk_1.0.1_1736794423875_0.675708974891911","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@dscvr-one/dscvr-sdk","version":"1.0.2","keywords":["dscvr","sdk","dscvr-sdk"],"author":"","license":"ISC","_id":"@dscvr-one/dscvr-sdk@1.0.2","maintainers":[{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},{"name":"chandra-dscvr","email":"chandra@dscvr.one"},{"name":"jimmy-dscvr","email":"jimmy@dscvr.one"}],"dist":{"shasum":"e7464d1326f45b20780cf63f95fe4b3d2b047080","tarball":"https://registry.npmjs.org/@dscvr-one/dscvr-sdk/-/dscvr-sdk-1.0.2.tgz","fileCount":30,"integrity":"sha512-gvHCWvweuQTZ+/lWhPa8gdLNLEIDkj8J0R+orWwtbsejy7Y7Nsf0bPWpa3yr7d91Q79c/QlkBZgyjbUxx2L5pw==","signatures":[{"sig":"MEUCIC0gZkLUyRpya83Zmn5wP2OuIBrunmYA/aMImwDDCDKaAiEA5LspQ11if5P5qpD1IU+S4qpo3+FlGYunR3WSdEzx0e0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":883210},"main":"src/index.ts","gitHead":"069520b17ac9b7b2be6899b592dd2906892fb574","scripts":{"lint":"eslint 'src/**/*.{ts,js}'","build":"tsup","format":"prettier --write 'src/**/*.{ts,js,json,md}'","prepare":"pnpm build","generate":"npx tsx ./src/generate.ts","type-check":"tsc --noEmit"},"_npmUser":{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},"_npmVersion":"10.9.0","description":"The DSCVR SDK is a TypeScript library designed to facilitate interactions with the DSCVR platform, leveraging DSCVR's Social Fabric Protocol","directories":{},"_nodeVersion":"23.2.0","dependencies":{"@dfinity/agent":"^2.1.3","@dfinity/candid":"^2.1.3","@dfinity/identity":"^2.1.3","@dfinity/principal":"^2.1.3","@dfinity/identity-secp256k1":"^2.1.3"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.16.0","prettier":"^3.4.2","ts-morph":"^24.0.0","typescript":"^5.7.2","@types/node":"^22.10.1","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^8.17.0","@typescript-eslint/eslint-plugin":"^8.17.0"},"_npmOperationalInternal":{"tmp":"tmp/dscvr-sdk_1.0.2_1736794617358_0.7185325563611058","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@dscvr-one/dscvr-sdk","version":"1.0.3","keywords":["dscvr","sdk","dscvr-sdk"],"author":"","license":"ISC","_id":"@dscvr-one/dscvr-sdk@1.0.3","maintainers":[{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},{"name":"chandra-dscvr","email":"chandra@dscvr.one"},{"name":"jimmy-dscvr","email":"jimmy@dscvr.one"}],"dist":{"shasum":"5a2971bb9fa2f7fad23593147bc4628a0151b195","tarball":"https://registry.npmjs.org/@dscvr-one/dscvr-sdk/-/dscvr-sdk-1.0.3.tgz","fileCount":30,"integrity":"sha512-eeJ3AqqJYACd4h4o95bPGVvIJPdLIr1gnVhJyog3Fe1Wa1ovFwXXrH7GmicbPtOqX23XstHai6f+e1038/v9oQ==","signatures":[{"sig":"MEQCIChpGEMu/2jQPvls2Ak0K9MUwfQxlI2Z6TgRLhsSUyNoAiBTKsKuX1CX4dvhjiJPpIBUCOv9IzQLovwx/o+2LmICOQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":883210},"main":"src/index.ts","gitHead":"069520b17ac9b7b2be6899b592dd2906892fb574","scripts":{"lint":"eslint 'src/**/*.{ts,js}'","build":"tsup","format":"prettier --write 'src/**/*.{ts,js,json,md}'","prepare":"pnpm build","generate":"npx tsx ./src/generate.ts","type-check":"tsc --noEmit"},"_npmUser":{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},"_npmVersion":"10.9.0","description":"The DSCVR SDK is a TypeScript library designed to facilitate interactions with the DSCVR platform, leveraging DSCVR's Social Fabric Protocol","directories":{},"_nodeVersion":"23.2.0","dependencies":{"@dfinity/agent":"^2.1.3","@dfinity/candid":"^2.1.3","@dfinity/identity":"^2.1.3","@dfinity/principal":"^2.1.3","@dfinity/identity-secp256k1":"^2.1.3"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.16.0","prettier":"^3.4.2","ts-morph":"^24.0.0","typescript":"^5.7.2","@types/node":"^22.10.1","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^8.17.0","@typescript-eslint/eslint-plugin":"^8.17.0"},"_npmOperationalInternal":{"tmp":"tmp/dscvr-sdk_1.0.3_1736794726909_0.7774751978597247","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@dscvr-one/dscvr-sdk","version":"1.0.4","keywords":["dscvr","sdk","dscvr-sdk"],"author":"","license":"ISC","_id":"@dscvr-one/dscvr-sdk@1.0.4","maintainers":[{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},{"name":"chandra-dscvr","email":"chandra@dscvr.one"},{"name":"jimmy-dscvr","email":"jimmy@dscvr.one"}],"dist":{"shasum":"64a2373b3d655468f77855d36868c9cec8d496d4","tarball":"https://registry.npmjs.org/@dscvr-one/dscvr-sdk/-/dscvr-sdk-1.0.4.tgz","fileCount":12,"integrity":"sha512-XxonD62mBt3WAxp7qUl2AS9+n9IDm4AJ03R6cX6nAJH3Jq2ZFEFmrAKRu8MCSFflnsJd1SsP6rBISqZ7cvm2dA==","signatures":[{"sig":"MEYCIQCG9Wo5OGLANt0J6ek7kTs2mGdFixhVLQfhpBCdJTrTpgIhAJRLkQm/rtOjYfmeC2kHXnrrI6XTdMjdRaFKOByCPjik","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":701229},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"069520b17ac9b7b2be6899b592dd2906892fb574","scripts":{"lint":"eslint 'src/**/*.{ts,js}'","build":"tsup","format":"prettier --write 'src/**/*.{ts,js,json,md}'","prepare":"pnpm build","generate":"npx tsx ./src/generate.ts","type-check":"tsc --noEmit"},"_npmUser":{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},"_npmVersion":"10.9.0","description":"The DSCVR SDK is a TypeScript library designed to facilitate interactions with the DSCVR platform, leveraging DSCVR's Social Fabric Protocol","directories":{},"_nodeVersion":"23.2.0","dependencies":{"@dfinity/agent":"^2.1.3","@dfinity/candid":"^2.1.3","@dfinity/identity":"^2.1.3","@dfinity/principal":"^2.1.3","@dfinity/identity-secp256k1":"^2.1.3"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.16.0","prettier":"^3.4.2","ts-morph":"^24.0.0","typescript":"^5.7.2","@types/node":"^22.10.1","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^8.17.0","@typescript-eslint/eslint-plugin":"^8.17.0"},"_npmOperationalInternal":{"tmp":"tmp/dscvr-sdk_1.0.4_1736795262574_0.13965560613601413","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@dscvr-one/dscvr-sdk","version":"1.0.5","keywords":["dscvr","sdk","dscvr-sdk"],"author":"","license":"ISC","_id":"@dscvr-one/dscvr-sdk@1.0.5","maintainers":[{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},{"name":"chandra-dscvr","email":"chandra@dscvr.one"},{"name":"jimmy-dscvr","email":"jimmy@dscvr.one"}],"dist":{"shasum":"a2eac438fb57c72af80b3edc49521f6e14f23bb4","tarball":"https://registry.npmjs.org/@dscvr-one/dscvr-sdk/-/dscvr-sdk-1.0.5.tgz","fileCount":11,"integrity":"sha512-AfIjpfjka4DtV1Ph0TMz+XA68e1QKlVkwmVmR7gH3JA0MiFk9y7s/VAH4X/xuFNuO/cFydwRt8jFCN8pDAkYkw==","signatures":[{"sig":"MEYCIQCogRcCigKnbnbI6rne8HOKBYvOz8gV4Sl3F5LTr4sh9AIhAIM6EIpzAN1hpDZxCxpDQTaQDkOezNZUxVwQpNvruE7J","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":700799},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"069520b17ac9b7b2be6899b592dd2906892fb574","scripts":{"lint":"eslint 'src/**/*.{ts,js}'","build":"tsup","format":"prettier --write 'src/**/*.{ts,js,json,md}'","prepare":"pnpm build","generate":"npx tsx ./src/generate.ts","type-check":"tsc --noEmit"},"_npmUser":{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},"_npmVersion":"10.9.0","description":"The DSCVR SDK is a TypeScript library designed to facilitate interactions with the DSCVR platform, leveraging DSCVR's Social Fabric Protocol","directories":{},"_nodeVersion":"23.2.0","dependencies":{"@dfinity/agent":"^2.1.3","@dfinity/candid":"^2.1.3","@dfinity/identity":"^2.1.3","@dfinity/principal":"^2.1.3","@dfinity/identity-secp256k1":"^2.1.3"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","eslint":"^9.16.0","prettier":"^3.4.2","ts-morph":"^24.0.0","typescript":"^5.7.2","@types/node":"^22.10.1","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^8.17.0","@typescript-eslint/eslint-plugin":"^8.17.0"},"_npmOperationalInternal":{"tmp":"tmp/dscvr-sdk_1.0.5_1736795650790_0.8395983414567554","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@dscvr-one/dscvr-sdk","version":"1.0.6","description":"The DSCVR SDK is a TypeScript library designed to facilitate interactions with the DSCVR platform, leveraging DSCVR's Social Fabric Protocol","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsup","lint":"eslint 'src/**/*.{ts,js}'","format":"prettier --write 'src/**/*.{ts,js,json,md}'","type-check":"tsc --noEmit","prepare":"pnpm build","generate":"npx tsx ./src/generate.ts"},"keywords":["dscvr","sdk","dscvr-sdk"],"author":"","license":"ISC","devDependencies":{"@types/node":"^22.10.1","@typescript-eslint/eslint-plugin":"^8.17.0","@typescript-eslint/parser":"^8.17.0","eslint":"^9.16.0","eslint-config-prettier":"^9.1.0","prettier":"^3.4.2","ts-morph":"^24.0.0","tsup":"^8.3.5","typescript":"^5.7.2"},"dependencies":{"@dfinity/agent":"^2.1.3","@dfinity/candid":"^2.1.3","@dfinity/identity":"^2.1.3","@dfinity/identity-secp256k1":"^2.1.3","@dfinity/principal":"^2.1.3"},"_id":"@dscvr-one/dscvr-sdk@1.0.6","gitHead":"b92d3f3b7f3ee65b794088ce1a5d3ff060f3221d","_nodeVersion":"23.2.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-yd5aQ60EP/UA3ZCQ55Gqf2viCQEGtej61Bo5P8Wnc4E6ORJvEzw/WAKDO52/3J8ExIbCZZ9wjWfFrswe5+4x1w==","shasum":"65a80c625a91650c1fd27bd330dc71b5a509664c","tarball":"https://registry.npmjs.org/@dscvr-one/dscvr-sdk/-/dscvr-sdk-1.0.6.tgz","fileCount":11,"unpackedSize":933005,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB1wcF90Sm3wgFWYZ21IY0aFoG97Nb/WkKp7K0OhuM29AiA2FaD3aCoANj5fixmBoM9V9XYBZHin097caMWSIQSVbA=="}]},"_npmUser":{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},"directories":{},"maintainers":[{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},{"name":"chandra-dscvr","email":"chandra@dscvr.one"},{"name":"jimmy-dscvr","email":"jimmy@dscvr.one"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dscvr-sdk_1.0.6_1737054532798_0.5657299531910314"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-16T18:32:35.599Z","modified":"2025-01-16T19:08:53.304Z","1.0.0":"2024-12-16T18:32:35.938Z","1.0.1":"2025-01-13T18:53:44.179Z","1.0.2":"2025-01-13T18:56:57.595Z","1.0.3":"2025-01-13T18:58:47.223Z","1.0.4":"2025-01-13T19:07:42.833Z","1.0.5":"2025-01-13T19:14:11.038Z","1.0.6":"2025-01-16T19:08:53.107Z"},"license":"ISC","keywords":["dscvr","sdk","dscvr-sdk"],"description":"The DSCVR SDK is a TypeScript library designed to facilitate interactions with the DSCVR platform, leveraging DSCVR's Social Fabric Protocol","maintainers":[{"name":"rckprtr_dscvr","email":"rick@dscvr.one"},{"name":"chandra-dscvr","email":"chandra@dscvr.one"},{"name":"jimmy-dscvr","email":"jimmy@dscvr.one"}],"readme":"# DSCVR SDK\n\nThe DSCVR SDK is a TypeScript library designed to facilitate interactions with the DSCVR platform, leveraging DSCVR's Social Fabric Protocol\n\n## Features\n\n- Users - Create, Read, Update, Delete\n- Content - Create, Read, Update, Delete\n- Portals - Create, Read, Update, Manage Roles\n- Feeds\n\n## Installation\n\n\n```bash\npnpm install @dscvr-one/dscvr-sdk\n```\nor\n```bash\nnpm install @dscvr-one/dscvr-sdk\n```\n\n\n## Examples\n\n### Create Identity\n\nUse the output Principal from this script and set it in your DSCVR profile.\n\n1. Goto your user profile settings\n\n![Profile Settings](assets/settings.png)\n\n2. Click `integrations`\n\n3. Scroll to bottom\n\n4. Set your DSCVR Principal\n\n![Integrations](assets/integrations.png)\n\n\n```ts\nimport { Ed25519KeyIdentity } from '@dscvr-one/dscvr-sdk';\nimport fs from 'fs';\n\nconst main = () => {\n    let identity = Ed25519KeyIdentity.generate();\n    console.log('Identity created:', identity.getPrincipal().toString());\n\n    //save the identity to a file in ./.keys/dscvr-identity.json\n    fs.writeFileSync('./.keys/dscvr-identity.json', JSON.stringify(identity.toJSON()));\n\n    //load the identity from the file\n    let loadedIdentity = Ed25519KeyIdentity.fromJSON(fs.readFileSync('./.keys/dscvr-identity.json').toString());\n    console.log('Identity loaded:', loadedIdentity.getPrincipal().toString());\n};\n\nmain();\n```\n\nExample Output\n```bash\nIdentity created: 24xqa-heqzm-pc6yh-cn2kz-635nr-yxgk2-55x6a-5srrd-a4mom-ea4jf-fae\nIdentity loaded: 24xqa-heqzm-pc6yh-cn2kz-635nr-yxgk2-55x6a-5srrd-a4mom-ea4jf-fae\n```\n\n### Get and Update the User\n\n```ts\nimport { Ed25519KeyIdentity, DSCVRProtocol } from \"@dscvr-one/dscvr-sdk\";\nimport fs from \"fs\";\n\nconst main = async () => {\n  //Load the identity from the file\n  let identity = Ed25519KeyIdentity.fromJSON(\n    fs.readFileSync(\"./.keys/dscvr-identity.json\").toString()\n  );\n  console.log(\"Identity loaded:\", identity.getPrincipal().toString());\n\n  //Create a new DSCVRProtocol instance with the loaded identity\n  let protocol = new DSCVRProtocol(identity);\n\n  //Get self\n  let selfResult = await protocol.user.getSelf();\n\n  if (selfResult.type === \"success\") {\n    let user = selfResult.data;\n    console.log(\"User:\", user);\n  } else {\n    console.error(\"Error creating post:\", selfResult.error);\n  }\n\n  //Update avatar\n  let setAvatarResult = await protocol.user.updateAvatar(\n    \"https://i.ibb.co/nPDRY9q/avatar.png\"\n  );\n  if (setAvatarResult.type === \"success\") {\n    console.log(\"Avatar updated\");\n  } else {\n    console.error(\"Error updating avatar:\", setAvatarResult.error);\n  }\n\n  //Update cover photo\n  let setCoverPhotoResult = await protocol.user.updateCoverPhoto(\n    \"https://i.ibb.co/zPGTXDG/cover-photo.png\"\n  );\n  if (setCoverPhotoResult.type === \"success\") {\n    console.log(\"Cover photo updated\");\n  } else {\n    console.error(\"Error updating cover photo:\", setCoverPhotoResult.error);\n  }\n\n  //Update bio\n  let setBioResult = await protocol.user.updateBio(\n    \"Hello, I'm using the DSCVR SDK!\"\n  );\n  if (setBioResult.type === \"success\") {\n    console.log(\"Bio updated\");\n  } else {\n    console.error(\"Error updating bio:\", setBioResult.error);\n  }\n};\n\nmain();\n```\n\n### Create Post, Get Post, and Edit Post\n\n```ts\nimport { Ed25519KeyIdentity, DSCVRProtocol } from \"@dscvr-one/dscvr-sdk\";\nimport fs from \"fs\";\n\nconst main = async () => {\n  //Load the identity from the file\n  let identity = Ed25519KeyIdentity.fromJSON(\n    fs.readFileSync(\"./.keys/dscvr-identity.json\").toString()\n  );\n  console.log(\"Identity loaded:\", identity.getPrincipal().toString());\n\n  //Create a new DSCVRProtocol instance with the loaded identity\n  let protocol = new DSCVRProtocol(identity);\n\n  //Create a post to your profile\n  let postResult = await protocol.content.createSelfPost(\"Hello, DSCVR!\");\n\n  if (postResult.type === \"success\") {\n    let post = postResult.data;\n    console.log(\"Post created:\", post.id);\n    console.log(\"Post URL:\", `https://dscvr.one/post/${post.id}`);\n\n    //Get the post\n    let getContentResult = await protocol.content.getContent(post.id);\n    if (getContentResult.type === \"success\") {\n      let content = getContentResult.data;\n      console.log(\"Content:\", content);\n    } else {\n      console.error(\"Error getting content:\", getContentResult.error);\n    }\n\n    //Update the post\n    let updatePostResult = await protocol.content.updateContent(\n      post.id,\n      \"Hello, DSCVR! Updated\"\n    );\n    if (updatePostResult.type === \"success\") {\n      console.log(\"Post updated\");\n    } else {\n      console.error(\"Error updating post:\", updatePostResult.error);\n    }\n  } else {\n    console.error(\"Error creating post:\", postResult.error);\n  }\n};\n\nmain();\n```\n\nExample Output\n```bash\nIdentity loaded: bug6q-2lwju-tkuip-d76yw-e4zbg-bxt3q-msuuo-c4zso-fgolg-hz4y5-aqe\nPost created: 1201410873629868033n\nPost URL: https://dscvr.one/post/1201410873629868033\nContent: {...}\nPost updated\n```\n\n### Create Portal\n```ts\nimport { Ed25519KeyIdentity, DSCVRProtocol } from \"@dscvr-one/dscvr-sdk\";\nimport fs from \"fs\";\n\nconst main = async () => {\n  //Load the identity from the file\n  let identity = Ed25519KeyIdentity.fromJSON(\n    fs.readFileSync(\"./.keys/dscvr-identity.json\").toString()\n  );\n  console.log(\"Identity loaded:\", identity.getPrincipal().toString());\n\n  //Create a new DSCVRProtocol instance with the loaded identity\n  let protocol = new DSCVRProtocol(identity);\n\n  //Create Portal: cost 500 DSCVR Points\n  let portalCreateResult = await protocol.portal.createPortal({\n    is_nsfw: false,\n    name: \"DSCVR SDK Test\",\n    slug: \"dscvr-sdk-test\",\n    description: \"This is a test portal created using the DSCVR SDK\",\n    icon_url: \"https://i.ibb.co/MhkCV6z/portal-example.png\",\n  });\n\n  if (portalCreateResult.type === \"success\") {\n    let portal = portalCreateResult.data;\n    console.log(\"Portal created:\", portal.id);\n    console.log(\"Portal URL:\", `https://dscvr.one/p/${portal.slug}`);\n  } else {\n    console.error(\"Error creating portal:\", portalCreateResult.error);\n  }\n};\n\nmain();\n```\n\nExample Output\n```bash\nIdentity loaded: bug6q-2lwju-tkuip-d76yw-e4zbg-bxt3q-msuuo-c4zso-fgolg-hz4y5-aqe\nPortal created: 11289821n\nPortal URL: https://dscvr.one/p/dscvr-sdk-test\n```\n\n\n### Update Portal and Get Permissions/Roles\n\n```ts\nimport { Ed25519KeyIdentity, DSCVRProtocol, PermissionBuilder } from \"@dscvr-one/dscvr-sdk\";\nimport fs from \"fs\";\n\nconst main = async () => {\n  //Load the identity from the file\n  let identity = Ed25519KeyIdentity.fromJSON(\n    fs.readFileSync(\"./.keys/dscvr-identity.json\").toString()\n  );\n  console.log(\"Identity loaded:\", identity.getPrincipal().toString());\n\n  //Create a new DSCVRProtocol instance with the loaded identity\n  let protocol = new DSCVRProtocol(identity);\n\n  //Get Portal\n    let portalResult = await protocol.portal.getPortal(\"dscvr-sdk-test\");\n    if (portalResult.type === \"success\") {\n        let portal = portalResult.data;\n        console.log(\"Portal:\", portal);\n\n        let isPortalMemberResult = await protocol.portal.isUserPortalMember(portal.id, identity.getPrincipal());\n        if (isPortalMemberResult.type === \"success\") {\n            let isMember = isPortalMemberResult.data;\n            console.log(\"Is Portal Member:\", isMember);\n        } else {\n            console.error(\"Error checking if user is portal member:\", isPortalMemberResult.error);\n        }\n\n        let getMemberRoleResult = await protocol.portal.getUserPortalRoles(portal.id, identity.getPrincipal());\n        if (getMemberRoleResult.type === \"success\") {\n            const portalMember = getMemberRoleResult.data;\n            const userPermissions = PermissionBuilder.getFromValue(Number(portalMember.portal.perm));\n            console.log(\"Member Permissions:\", userPermissions);\n            console.log(\"Member Roles:\", portalMember);\n        } else {\n            console.error(\"Error getting user portal roles:\", getMemberRoleResult.error);\n        }\n\n        //Update Portal Cover Photo\n        let updatePortalResult = await protocol.portal.updatePortalCoverPhoto(portal.id, \"https://i.ibb.co/m5840kL/portal-cover.png\");\n        if (updatePortalResult.type === \"success\") {\n            console.log(\"Portal cover photo updated\");\n        } else {\n            console.error(\"Error updating portal cover photo:\", updatePortalResult.error);\n        }\n\n        //Get Portal Roles\n        let memberRolesResult = await protocol.portal.getPortalRoles(portal.id);\n        if (memberRolesResult.type === \"success\") {\n            let memberRoles = memberRolesResult.data;\n            console.log(\"Member Roles:\", memberRoles);\n        } else {\n            console.error(\"Error getting portal member roles:\", memberRolesResult.error);\n        }\n\n    } else {\n        console.error(\"Error getting portal:\", portalResult.error);\n    }\n};\n\nmain();\n```\n\n\n### Create and assign Portal Role\n\n```ts\nimport {\n  Ed25519KeyIdentity,\n  DSCVRProtocol,\n  PermissionFlags,\n  ROLE_COLORS,\n} from \"@dscvr-one/dscvr-sdk\";\nimport fs from \"fs\";\n\nconst main = async () => {\n  //Load the identity from the file\n  let identity = Ed25519KeyIdentity.fromJSON(\n    fs.readFileSync(\"./.keys/dscvr-identity.json\").toString()\n  );\n  console.log(\"Identity loaded:\", identity.getPrincipal().toString());\n\n  //Create a new DSCVRProtocol instance with the loaded identity\n  let protocol = new DSCVRProtocol(identity);\n\n  //role name\n  const roleName = \"Test Role\";\n\n  //Get Portal\n  let portalResult = await protocol.portal.getPortal(\"dscvr-sdk-test\");\n  if (portalResult.type === \"success\") {\n    let portal = portalResult.data;\n    console.log(\"Portal:\", portal);\n\n    //Get all roles\n    let rolesResult = await protocol.portal.getPortalRoles(portal.id);\n    let testRole = null;\n    if (rolesResult.type === \"success\") {\n      let roles = rolesResult.data;\n      console.log(\"Roles:\", roles);\n      testRole = roles.find((role) => role.name === roleName);\n    } else {\n      console.error(\"Error getting portal roles:\", rolesResult.error);\n    }\n\n    if (!testRole) {\n      //Use OR operator to combine permission flags\n      let permissionFlag =\n        PermissionFlags.CREATE_CONTENT_COMMENT | //allows a user to comment\n        PermissionFlags.CREATE_CONTENT_POST | //allows a user to post\n        PermissionFlags.REACT_CONTENT; //allows a user to react\n\n      let createRoleResult = await protocol.portal.addPortalRole(portal.id, {\n        permissions: BigInt(permissionFlag),\n        name: roleName,\n        color: ROLE_COLORS[\"Amber Blaze\"], //you can use any color techincally, but this is a list of supported colors by DSCVR\n        ordinal: 1n,\n        icon_url: \"\", //not used\n      });\n\n      if (createRoleResult.type === \"success\") {\n        testRole = createRoleResult.data;\n        console.log(\"Role created:\", testRole);\n      } else {\n        console.error(\"Error creating role:\", createRoleResult.error);\n      }\n    }\n\n    if (testRole) {\n      //Get user member Roles\n      let userMemberResult = await protocol.portal.getUserPortalRoles(\n        portal.id,\n        identity.getPrincipal()\n      );\n      if (userMemberResult.type === \"success\") {\n        const portalMember = userMemberResult.data;\n\n        //Add the user to the role, if the user has the role it will not be added again but will return the existing roles\n        let addRoleResult = await protocol.portal.addMemberRole(\n          portal.id,\n          portalMember.member.id,\n          testRole.id\n        );\n        if (addRoleResult.type === \"success\") {\n          let memberViews = addRoleResult.data;\n          if (memberViews.length > 0) {\n            let hasRole = memberViews[0].roles.find(\n              (role) => role.id === testRole.id\n            );\n            if (hasRole) {\n              console.log(\"User has role:\", hasRole);\n            } else {\n              console.error(\"User does not have role:\", testRole);\n            }\n          } else {\n            console.error(\"User not found?\");\n          }\n          console.log(\"Role added to user\", addRoleResult.data);\n        } else {\n          console.error(\"Error adding role to user:\", addRoleResult.error);\n        }\n      } else {\n        console.error(\n          \"Error getting user portal roles:\",\n          userMemberResult.error\n        );\n      }\n    }\n  } else {\n    console.error(\"Error getting portal:\", portalResult.error);\n  }\n};\n\nmain();\n```\n\n\n## Contributing\nContributions are welcome! If you find any issues or have suggestions for improvement, feel free to open an issue or submit a pull request.\n\n## License\nThis project is licensed under the MIT License.\n\n## Acknowledgements\nSpecial thanks to the DSCVR team for their support and the community for their valuable feedback.\n\n","readmeFilename":"README.md"}