Skip to content

Models

TyronZIL-js extends the implementation of the following data structures from the Sidetree protocol:

Public key model

interface PublicKeyModel {
    id: string;
    key?: string;
}

The ID MUST be unique and correspond to one of the Public Key Purposes.

Verification method model

It extends the public key model:

interface VerificationMethodModel {
    id: string;
    type: string;
    publicKeyBase58: string;
}

The type defaults to "SchnorrSecp256k1VerificationKey2019".

Public key purpose

It corresponds to the Verification Relationship for a public key aka verification method.

enum PublicKeyPurpose {
  General = 'general',
  Auth = 'auth',
  Agreement = 'agreement',
  Assertion = 'assertion',
  Delegation = 'delegation',
  Invocation = 'invocation',
  XSGD = 'xsgd'
}

DID Service endpoint model

interface DidServiceEndpointModel {
    id: string;
    type: string;
    endpoint: string;
}

Patch model

interface PatchModel {
    action: PatchAction;
    ids?: string[];        //the IDs of the DID-Document elements to remove
    keyInput?: PublicKeyInput[];
    services?: TransitionValue[];
}

Patch action

enum PatchAction {
    AddKeys = 'add-public-keys',
    RemoveKeys = 'remove-public-keys',
    AddServices = 'add-service-endpoints',
    RemoveServices = 'remove-service-endpoints',
    CustomAction = '-custom-action',
}