Unverified Commit 0b8a9121 authored by Hong Minhee's avatar Hong Minhee
Browse files
parent 904b9c78
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -8,6 +8,10 @@ Version 0.12.0

To be released.

 -  Added `ChatMessage` class to Activity Vocabulary API.  [[#85]]

[#85]: https://github.com/dahlia/fedify/issues/85


Version 0.11.0
--------------
+241 −14

File changed.

Preview size limit exceeded, changes collapsed.

+4 −3
Original line number Diff line number Diff line
import { importMultibaseKey } from "@fedify/fedify/runtime";
import { DataIntegrityProof, Multikey } from "@fedify/fedify/vocab";
import { assertEquals, assertInstanceOf, assertRejects } from "@std/assert";
import { decodeHex } from "@std/encoding/hex";
import { decodeHex, encodeHex } from "@std/encoding/hex";
import { decode } from "multibase";
import { mockDocumentLoader } from "../testing/docloader.ts";
import {
@@ -73,11 +73,12 @@ test("createProof()", async () => {
  assertEquals(proof.cryptosuite, "eddsa-jcs-2022");
  assertEquals(proof.verificationMethodId, ed25519PublicKey.id);
  assertEquals(proof.proofPurpose, "assertionMethod");
  console.log(encodeHex(proof.proofValue!));
  assertEquals(
    proof.proofValue,
    decodeHex(
      "670e09df6555540b202f9a3993217cefc2e90a34dc94c0149fb646808645715f" +
        "dad4c3e403da70c524ee4a8578486cf1a1782d6974a2c28fff909afda0b38101",
      "ebea8d8f81181a6e3ef5c2455da00a2773bd94231e558b7ff0dd46566e6d0a94" +
        "549264a9b3e435e136fb5f100f07bb0dbbb25566d5deea83dfd1be6a3104b202",
    ),
  );
  assertEquals(proof.created, created);
+102 −0
Original line number Diff line number Diff line
@@ -102,6 +102,108 @@ snapshot[`Deno.inspect(Emoji) [auto] 3`] = `
}'
`;

snapshot[`Deno.inspect(ChatMessage) [auto] 1`] = `
'ChatMessage {
  id: URL "https://example.com/",
  attachments: [ Object {}, Link {}, PropertyValue {} ],
  attributions: [ Application {}, Group {}, Organization {}, Person {}, Service {} ],
  audience: Object {},
  contents: [ "hello", <en> "hello" ],
  contexts: [ Object {}, Link {} ],
  names: [ "hello", <en> "hello" ],
  endTime: 2024-03-03T08:30:06.796196096Z,
  generators: [ Object {}, Link {} ],
  icon: Image {},
  image: Image {},
  replyTargets: [ Object {}, Link {} ],
  locations: [ Object {}, Link {} ],
  previews: [ Link {}, Object {} ],
  published: 2024-03-03T08:30:06.796196096Z,
  replies: Collection {},
  startTime: 2024-03-03T08:30:06.796196096Z,
  summaries: [ "hello", <en> "hello" ],
  tags: [ Object {}, Link {} ],
  updated: 2024-03-03T08:30:06.796196096Z,
  urls: [ URL "https://example.com/", Link {} ],
  to: Object {},
  bto: Object {},
  cc: Object {},
  bcc: Object {},
  mediaType: "hello",
  duration: PT1H,
  sensitive: true,
  proof: DataIntegrityProof {}
}'
`;

snapshot[`Deno.inspect(ChatMessage) [auto] 2`] = `
'ChatMessage {
  id: URL "https://example.com/",
  attachments: [ URL "https://example.com/" ],
  attribution: URL "https://example.com/",
  audience: URL "https://example.com/",
  contents: [ "hello", <en> "hello" ],
  contexts: [ URL "https://example.com/" ],
  names: [ "hello", <en> "hello" ],
  endTime: 2024-03-03T08:30:06.796196096Z,
  generators: [ URL "https://example.com/" ],
  icon: URL "https://example.com/",
  image: URL "https://example.com/",
  replyTarget: URL "https://example.com/",
  location: URL "https://example.com/",
  preview: URL "https://example.com/",
  published: 2024-03-03T08:30:06.796196096Z,
  replies: URL "https://example.com/",
  startTime: 2024-03-03T08:30:06.796196096Z,
  summaries: [ "hello", <en> "hello" ],
  tags: [ URL "https://example.com/" ],
  updated: 2024-03-03T08:30:06.796196096Z,
  urls: [ URL "https://example.com/", Link {} ],
  to: URL "https://example.com/",
  bto: URL "https://example.com/",
  cc: URL "https://example.com/",
  bcc: URL "https://example.com/",
  mediaType: "hello",
  duration: PT1H,
  sensitive: true,
  proof: URL "https://example.com/"
}'
`;

snapshot[`Deno.inspect(ChatMessage) [auto] 3`] = `
'ChatMessage {
  id: URL "https://example.com/",
  attachments: [ Object {}, Object {} ],
  attributions: [ Application {}, Application {} ],
  audiences: [ Object {}, Object {} ],
  contents: [ "hello", "hello" ],
  contexts: [ Object {}, Object {} ],
  names: [ "hello", "hello" ],
  endTime: 2024-03-03T08:30:06.796196096Z,
  generators: [ Object {}, Object {} ],
  icons: [ Image {}, Image {} ],
  images: [ Image {}, Image {} ],
  replyTargets: [ Object {}, Object {} ],
  locations: [ Object {}, Object {} ],
  previews: [ Link {}, Link {} ],
  published: 2024-03-03T08:30:06.796196096Z,
  replies: Collection {},
  startTime: 2024-03-03T08:30:06.796196096Z,
  summaries: [ "hello", "hello" ],
  tags: [ Object {}, Object {} ],
  updated: 2024-03-03T08:30:06.796196096Z,
  urls: [ URL "https://example.com/", URL "https://example.com/" ],
  tos: [ Object {}, Object {} ],
  btos: [ Object {}, Object {} ],
  ccs: [ Object {}, Object {} ],
  bccs: [ Object {}, Object {} ],
  mediaType: "hello",
  duration: PT1H,
  sensitive: true,
  proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ]
}'
`;

snapshot[`Deno.inspect(PropertyValue) [auto] 1`] = `'PropertyValue { id: URL "https://example.com/", name: "hello", value: "hello" }'`;

snapshot[`Deno.inspect(PropertyValue) [auto] 2`] = `'PropertyValue { id: URL "https://example.com/", name: "hello", value: "hello" }'`;

vocab/chatmessage.yaml

0 → 100644
+18 −0
Original line number Diff line number Diff line
$schema: ../codegen/schema.yaml
name: ChatMessage
uri: "http://litepub.social/ns#ChatMessage"
extends: "https://www.w3.org/ns/activitystreams#Object"
entity: true
description: |
  `ChatMessage`s are the messages sent in 1-on-1 chats.  They are similar to
  {@link Note}s, but the addressing is done by having a single AP actor in
  the `to` field.  Addressing multiple actors is not allowed.  These messages
  are always private, there is no public version of them.  They are created with
  a {@link Create} activity.
defaultContext:
- "https://www.w3.org/ns/activitystreams"
- "https://w3id.org/security/data-integrity/v1"
- toot: "http://joinmastodon.org/ns#"
  Emoji: "toot:Emoji"
  ChatMessage: "http://litepub.social/ns#ChatMessage"
properties: []
Loading