Unverified Commit e581ce37 authored by Hong Minhee's avatar Hong Minhee
Browse files

signObject() & verifyObject()

parent 83daea28
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -85,6 +85,14 @@ To be released.

 -  Implemented Object Integrity Proofs.  [[FEP-8b32], [#54]]

     -  Added `signObject()` function.
     -  Added `SignObjectOptions` interface.
     -  Added `createProof()` function.
     -  Added `CreateProofOptions` interface.
     -  Added `verifyObject()` function.
     -  Added `VerifyObjectOptions` interface.
     -  Added `verifyProof()` function.
     -  Added `VerifyProofOptions` interface.
     -  Added `fetchKey()` function.
     -  Added `FetchKeyOptions` interface.

@@ -105,6 +113,7 @@ To be released.
 -  Added more log messages using the [LogTape] library.  Currently the below
    logger categories are used:

     -  `["fedify", "sig", "proof"]`
     -  `["fedify", "sig", "key"]`

[#54]: https://github.com/dahlia/fedify/issues/54
+319 −167

File changed.

Preview size limit exceeded, changes collapsed.

+8 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ export async function* generateEncoder(
    yield `
    array = [];
    for (const v of this.${await getFieldName(property.uri)}) {
      array.push(
      const element = (
    `;
    if (!areAllScalarTypes(property.range, types)) {
      yield 'v instanceof URL ? { "@id": v.href } : ';
@@ -55,6 +55,13 @@ export async function* generateEncoder(
    }
    yield `
      );
    `;
    if (!property.functional && property.container === "graph") {
      yield `array.push({ "@graph": element });`;
    } else {
      yield `array.push(element);`;
    }
    yield `;
    }
    if (array.length > 0) values[${JSON.stringify(property.uri)}] = array;
    `;
+5 −0
Original line number Diff line number Diff line
@@ -132,6 +132,11 @@ export type PropertySchema =
     * turned on).
     */
    singularAccessor?: boolean;

    /**
     * The container type of the property values.  It can be unspecified.
     */
    container?: "graph";
  }
  | PropertySchemaBase & PropertySchemaTyping & {
    /**
+6 −1
Original line number Diff line number Diff line
@@ -28,6 +28,11 @@ $defs:
              Whether to generate singular property accessors.  Regardless of
              this flag, plural property accessors are generated
              (unless functional is turned on).
            type: boolean
          container:
            description: >-
              The container type of the property values.  It can be unspecified.
            const: "graph"
        required:
        - pluralName
    - allOf:
Loading