This package define general interfaces to work with DID such as DIDDocument, DID Methods, Purposes, Services and Verification Methods.
npm install @quarkid/did-coreThis packages is used by DID Registry and DID Resolver.
It does not add functionality or services but exposes the interfaces that will be used by the rest of the packages
export interface DIDDocument {
"@context": string | string[] | undefined | null;
id: string;
verificationMethod: Array;
authentication: Array;
assertionMethod: Array;
keyAgreement: Array;
capabilityDelegation: Array;
capabilityInvocation: Array;
service?: Array
}
`Purpose
`
export abstract class Purpose {
abstract name: string;
}export class AuthenticationPurpose extends Purpose {
name = "authentication";
challenge?: string;
public constructor(init?: Partial) {
super();
Object.assign(this, init);
}
}
export class AssertionMethodPurpuse {
name = "assertionMethod";
}
export class CapabilityInvocationPurpose {
name = "capabilityInvocation";
}
export class KeyAgreementPurpose {
name = "keyAgreement";
}
`Service
`
id: string,
type: string,
serviceEndpoint: string | string[] | Record
`Verification Methods
`
export interface VerificationMethod {
id: string;
type: string;
controller: string;
}export interface VerificationMethodPublicKeyHex extends VerificationMethod {
type: VerificationMethodTypes.Ed25519VerificationKey2018 | VerificationMethodTypes.Bls12381G1Key2020 | VerificationMethodTypes.EcdsaSecp256k1VerificationKey2019;
publicKeyHex: string;
}
export interface VerificationMethodPublicKey58 extends VerificationMethod {
type: VerificationMethodTypes.Ed25519VerificationKey2018 | VerificationMethodTypes.Bls12381G1Key2020 | VerificationMethodTypes.EcdsaSecp256k1VerificationKey2019;
publicKeyBase58: string;
}
export interface VerificationMethodGpg extends VerificationMethod {
type: VerificationMethodTypes.GpgVerificationKey2020;
publicKeyGpg: string;
}
export interface VerificationMethodJwk extends VerificationMethod {
type: VerificationMethodTypes.JsonWebKey2020 | VerificationMethodTypes.EcdsaSecp256k1VerificationKey2019;
publicKeyJwk: {
crv: string;
x: string;
y: string;
kty: string;
kid?: string;
};
}
``