Skip to content

Latest commit

 

History

History
375 lines (263 loc) · 16.7 KB

File metadata and controls

375 lines (263 loc) · 16.7 KB

Schemas

Data Schemas are useful when enforcing a specific structure on a collection of data like a Verifiable Credential. Other than that, Data Verification schema and Data Encoding Schemas are used to verify and map the structure and contents of a Verifiable Credential.

These are the schemas used in all API operations mentioned before, such as Error, Credential, Jobs, Anchor, Registry, and so on.

For a detailed example of the schema workflow. Please refer here.

Error

This is a schema for an API Error.

Properties

NameTypeRequiredDescription
statusintegerfalseStatus of the error.
typestringfalseType of the error.
messagestringfalseMessage of the error.
Object Schemas
{
  "status": 0,
  "type": "string",
  "message": "string"
}

Hex32

32 byte hex string. Ignoring higher base (base64) for simplicity.

Properties

NameTypeRequiredDescription
Hex32stringfalse32 byte hex string. Ignoring higher base (base64) for simplicity.
"string"

JobStartedResult

Object containing unique id of the background task and associated data. This id can be used to query the job status.

Properties

NameTypeDescription
idJobIdUnique id of the background task. This id can be used to query the job status.
dataobjectData of the object.
{
  "id": "string",
  "data": {
    "did": "did:dock:xyz",
    "hexDid": "0x00",
  }
}

JobId

Unique id of the background task. This id can be used to query the job status

"string"

JobStatus

This is a schema used in Job operation to get a status of the job.

Enumerated Values

PropertyValueDescription
JobStatustodo or finalized or in_progress or error.Job Status variants.
"in_progress"

JobDesc

This is a schema used in Job operation to get description of the job including the result if it is available.

Properties

NameTypeDescription
idJobIdUnique id of the background task. This id can be used to query the job status.
statusJobStatusStatus of the job.
resultobjectfalse
{
  "id": "string",
  "result": {},
  "status": "todo",

}

DIDDock

DID as fully qualified, e.g., did:dock:.

Properties

NameTypeRequiredDescription
DIDstringfalseDID as fully qualified, e.g., did:dock:. You cannot specify your own DID, the DID value will be randomly generated.
"did:dock:xyz"

KeyType

This is a schema type of public key for DID.

Enumerated Values

PropertyValueDescription
KeyTypesr25519 or ed25519 or secp256k1keyType DID variants.
"sr25519"

SigType

This is a schema used in Presentation operation that represents a type of signature.

Enumerated Values

PropertyValueDescription
SigTypeSr25519Signature2020 or Ed25519Signature2018 or EcdsaSecp256k1Signature2019SigType signature variants.
"Sr25519Signature2020"

ProofPurpose

This is a schema that represents a purpose of credential.

Enumerated Values

PropertyValueDescription
ProofPurposeassertionMethod or authenticationPurpose of credential.
"assertionMethod"

Context

This is a schema that represents a JSON-LD context used in DID and Presentation.

[
  "string"
]

DIDDoc

This is a schema that represents a DID document. The current set of properties is incomplete

Properties

NameTypeRequiredDescription
@contextContextfalseJSON-LD context.
idDIDDockfalseDID as fully qualified, e.g., did:dock:.
authenticationarrayfalseDID authentication.
OBJECT SCHEMAS
{
  "@context": [
    "string"
  ],
  "id": "did:dock:xyz",
  "authentication": [
    {}
  ]
}

Credential

This is a schema that represents a credential format expected by API caller when issuing a credential.

Properties

NameTypeRequiredDescription
idstring(uri)falseCredential ID. The default value is a creds.dock.io uri with random ID.
context[string or object]falseCredential context array of string URIs and/or embedded JSON-LD context objects. If no context parameter is supplied, we will auto generate contexts for you. If you do supply this parameter, you must ensure that all JSON-LD terms are defined. This is for advanced users.
type[string]falseCredential type. The default value is ['VerifiableCredential']
subjectobject or [object]trueCredential subject or subjects array.
schemastringfalseSchema ID returned by create schema route or a valid URI
issuerDIDDockfalseCredential issuer. DID as fully qualified, e.g., did:dock:. If not supplied the credential will not be signed.
issuanceDatestring(date-time[RFC3339])falseThe date and time in GMT that the credential was issued specified in RFC 3339 format. The issuanceDate will be automatically set if not provided.
expirationDatestring(date-time[RFC3339])falseThe date and time in GMT that the credential expired is specified in RFC 3339 format. The default value of the expirationDate will be empty if the user does not provide it.
statusobject or stringfalseRevocation registry id or user supplied status object containg a Dock revocation registry identifier.
OBJECT SCHEMAS
{
  "context": [
    "string"
  ],
  "type": [
    "string"
  ],
  "subject": {},
  "issuer": "did:dock:xyz",
  "issuanceDate": "2019-08-24T14:15:22Z",
  "expirationDate": "2019-08-24T14:15:22Z",
  "status": "90b7dc6e8642bf1425c5a5ef2c3ff62bb689770843fdc0e2d79b97beb6c73311"
}

VerifiablePresentation

This is a schema that represents a Verifiable (signed) Presentation returned by API. The current set of properties is almost complete

Properties

NameTypeRequiredDescription
@contextContexttrueJSON-LD context.
idstring(uri)trueVerifiable (signed) presentation id.
typestringtrueVerifiable (signed) presentation type.
verifiableCredentialVerifiableCredentialtrueVerifiable (signed) Credential returned by API. The current set of properties is almost complete.
proofobjecttrueProof of credential.

Child Properties of Proof

NameTypeRequiredDescription
typeSigTypetrueType of signature.
proofPurposeProofPurposetruePurpose of credential.
verificationMethodstringtrueVerification method.
createdstring(date-time[RFC3339])trueThe date and time in GMT that the credential was created specified in RFC 3339 format.
proofValuestringtruenone
OBJECT SCHEMAS
{
  "@context": [
    "string"
  ],
  "id": "http://example.com",
  "type": [
    "string"
  ],
  "verifiableCredential": {
    "@context": [
      "string"
    ],
    "id": "https://creds.dock.io/f087cbfabc90f8b996971ba47598e82b1a03523cb9460217ad58a819cd9c09eb",
    "type": [
      "string"
    ],
    "credentialSubject": {},
    "issuer": "did:dock:xyz",
    "issuanceDate": "2019-08-24T14:15:22Z",
    "expirationDate": "2019-08-24T14:15:22Z",
    "credentialStatus": {},
    "proof": {
      "type": "Sr25519Signature2020",
      "proofPurpose": "assertionMethod",
      "verificationMethod": "string",
      "created": "2019-08-24T14:15:22Z",
      "proofValue": "string"
    }
  },
  "proof": {
    "type": "Sr25519Signature2020",
    "proofPurpose": "assertionMethod",
    "verificationMethod": "string",
    "created": "2019-08-24T14:15:22Z",
    "proofValue": "string"
  }
}

VerifiableCredential

This is a schema that represents a verifiable (signed) Credential returned by API. The current set of properties is almost complete.

Properties

NameTypeRequiredDescription
@contextContextfalseJSON-LD context.
idstring(uri)falseCredential id.
type[string]falseCredential type.
credentialSubjectanyfalseCredential subject.
issuerDIDDockfalseCredential issuer or DID as fully qualified, e.g., did:dock:.
issuanceDatestring(date-time[RFC3339])falseThe date and time in GMT that the credential was issued specified in RFC 3339 format. The issuanceDate will be automatically set if not provided.
expirationDatestring(date-time[RFC3339])falseThe date and time in GMT that the credential expired is specified in RFC 3339 format. The default value of the expirationDate will be empty if the user does not provide it.
credentialStatusanyfalseRevocation registry id or user supplied status object.
proofobjectfalseProof of credential.

Child Properties of Proof

NameTypeRequiredDescription
typeSigTypefalseType of signature.
proofPurposeProofPurposefalsePurpose of credential.
verificationMethodstringfalseVerification method.
createdstring(date-time[RFC3339])falseThe date and time in GMT that the credential was created specified in RFC 3339 format.
proofValuestringfalseValue of credential.
OBJECT SCHEMAS
{
  "@context": [
    "string"
  ],
  "id": "https://creds.dock.io/f087cbfabc90f8b996971ba47598e82b1a03523cb9460217ad58a819cd9c09eb",
  "type": [
    "string"
  ],
  "credentialSubject": {},
  "issuer": "did:dock:xyz",
  "issuanceDate": "2019-08-24T14:15:22Z",
  "expirationDate": "2019-08-24T14:15:22Z",
  "credentialStatus": {},
  "proof": {
    "type": "Sr25519Signature2020",
    "proofPurpose": "assertionMethod",
    "verificationMethod": "string",
    "created": "2019-08-24T14:15:22Z",
    "proofValue": "string"
  }
}

Anchor

An anchor, either a batched or single is the information that constitutes the credentials' proof of existence. The schema includes anchor, type (single, batch), block hash, block number and accompanying data (root, proofs) if any. It depends if the anchor was created using API or not.

{
  "type": "single/batch",
  "proofs": [],
  "blockHash": "string",
  "root": "string",
  "created_at": "YYYY-"
}

Registry

This is a schema that represents a Revocation registry used in Revocation or Unrevocation.

Properties

NameTypeRequiredDescription
addOnlybooleanfalseIf the addOnly value is true, they cannot unrevoke and delete the registry. The default value for this is false.
policy[DIDDock]falseOnly one policy supported as of now called OneOf.
{
  "addOnly": true,
  "policy": [
    "did:dock:xyz"
  ]
}

VerificationResponse

This is a schema that is used to define whether a credential/presentation is verified or not

{
  "verified": true,
  "results": [...]
}

Response

This is a schema that represents a default response for a request made.

{
  "code": 0
}

Message

This is a schema that represents a message send request. If the message is signed or encrypted use the ciphertext field. The typ field must be a valid DIDComm message type.

{
  "to": ["did:example:bob"],
  "ciphertext": "eyJhsad...AQ",
  "typ":"application/didcomm..."
}