From 005727ba3d865022fab79131d2849b5c30185bcb Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Tue, 26 Sep 2023 23:10:35 +1000 Subject: [PATCH] Add publicKey field to actors --- .github/workflows/build.yml | 17 ++++ package.json | 81 ++++++++++--------- .../actors/actor.interface.ts | 12 +++ tsconfig.json | 2 +- 4 files changed, 75 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..84a10d7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,17 @@ +name: Build +on: + push: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout project + uses: actions/checkout@v3 + - name: Build and push + uses: alexthemaster/action-build-typescript@master + with: + pushToBranch: true + branch: "dist" + githubToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 4a11276..9effa26 100644 --- a/package.json +++ b/package.json @@ -1,37 +1,46 @@ { - "name": "activitypub-types", - "version": "1.0.3", - "description": "ActivityPub Typescript types", - "main": "./dist/index.js", - "scripts": { - "tsc": "tsc -p ./tsconfig.json", - "tsc:watch": "tsc -w -p ./tsconfig.json", - "lint:fix": "eslint --fix ." - }, - "devDependencies": { - "@typescript-eslint/eslint-plugin": "^5.54.1", - "@typescript-eslint/parser": "^5.54.1", - "eslint": "^8.36.0", - "typescript": "^4.9.5" - }, - "keywords": [ - "activitypub", - "typescript", - "types", - "models", - "activitystreams" - ], - "files": [ - "dist", - "LICENSE", - "README.md", - "package.json", - "package-lock.json" - ], - "author": "SiranWeb ", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/SiranWeb/activitypub-types" - } -} + "name": "activitypub-types", + "version": "1.0.4", + "description": "ActivityPub Typescript types", + "main": "./dist/index.js", + "scripts": { + "build": "tsc", + "tsc:watch": "tsc -w", + "lint:fix": "eslint --fix ." + }, + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^5.54.1", + "@typescript-eslint/parser": "^5.54.1", + "eslint": "^8.36.0", + "typescript": "^4.9.5" + }, + "keywords": [ + "activitypub", + "typescript", + "types", + "models", + "activitystreams" + ], + "files": [ + "dist", + "LICENSE", + "README.md", + "package.json", + "package-lock.json" + ], + "contributors": [ + { + "name": "SiranWeb", + "email": "siranweb@tuta.io" + }, + { + "name": "Spacebarchat", + "url": "https://spacebar.chat" + } + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/spacebarchat/activitypub-types" + } +} \ No newline at end of file diff --git a/src/model-interfaces/actors/actor.interface.ts b/src/model-interfaces/actors/actor.interface.ts index 9643fdb..e615a36 100644 --- a/src/model-interfaces/actors/actor.interface.ts +++ b/src/model-interfaces/actors/actor.interface.ts @@ -106,4 +106,16 @@ export interface APActor extends APObject { * {@link https://www.w3.org/TR/activitypub/#actors Docs} */ endpoints?: EndpointsField; + + /** + * The public key of this actor, used to sign activities. + */ + publicKey?: { + /** The ID of this public key. Typically `https://example.com/users/username#main-key`. */ + id: string; + /** The owner of this key. Typically matches actor ID. */ + owner: string; + /** The RSA public key. */ + publicKeyPem: string; + } } diff --git a/tsconfig.json b/tsconfig.json index feb2486..79e2ba6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,5 +11,5 @@ "skipLibCheck": true }, "include": ["src/**/*"], - "exclude": ["node_modules"], + "exclude": ["node_modules"] }