Skip to content

Commit

Permalink
Merge branch 'develop' into release/v4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
VolkerSchiewe committed Dec 2, 2019
2 parents 2e8f167 + 2706b3b commit 8ef38da
Show file tree
Hide file tree
Showing 12 changed files with 149 additions and 29 deletions.
5 changes: 3 additions & 2 deletions js/credentials/credential/credential.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ICredentialAttrs, IClaimSection } from './types';
import { BaseMetadata, ContextEntry } from 'cred-types-jolocom-core';
import { BaseMetadata } from 'cred-types-jolocom-core';
import { ISignedCredCreationArgs } from '../signedCredential/types';
import { JsonLdContext } from '../../linkedData/types';
export declare class Credential {
private '_@context';
private _id;
Expand All @@ -11,7 +12,7 @@ export declare class Credential {
claim: IClaimSection;
type: string[];
name: string;
context: ContextEntry[];
context: JsonLdContext;
static create<T extends BaseMetadata>({ metadata, claim, subject, }: ISignedCredCreationArgs<T>): Credential;
static fromJSON(json: ICredentialAttrs): Credential;
toJSON(): ICredentialAttrs;
Expand Down
6 changes: 3 additions & 3 deletions js/credentials/credential/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ContextEntry, ClaimInterface } from 'cred-types-jolocom-core';
import { ClaimInterface } from 'cred-types-jolocom-core';
import { JsonLdObject } from '../../linkedData/types';
declare type ClaimType = string | number | boolean | {};
export declare type ClaimEntry = ClaimType | ClaimInterface;
export interface IClaimSection {
id?: string;
[x: string]: ClaimEntry;
}
export interface ICredentialAttrs {
'@context': ContextEntry[];
export interface ICredentialAttrs extends JsonLdObject {
type: string[];
name?: string;
claim: ClaimEntry;
Expand Down
6 changes: 3 additions & 3 deletions js/credentials/signedCredential/signedCredential.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
import 'reflect-metadata';
import { ISignedCredCreationArgs, ISignedCredentialAttrs } from './types';
import { IDigestable, ILinkedDataSignature } from '../../linkedDataSignature/types';
import { BaseMetadata, ContextEntry } from 'cred-types-jolocom-core';
import { BaseMetadata } from 'cred-types-jolocom-core';
import { IClaimSection } from '../credential/types';
import { JsonLdContext } from '../../linkedData/types';
import { ISigner } from '../../registries/types';
interface IIssInfo {
keyId: string;
Expand All @@ -19,7 +20,7 @@ export declare class SignedCredential implements IDigestable {
private _issued;
private _expires?;
private _proof;
context: ContextEntry[];
context: JsonLdContext;
id: string;
issuer: string;
issued: Date;
Expand All @@ -34,7 +35,6 @@ export declare class SignedCredential implements IDigestable {
static create<T extends BaseMetadata>(credentialOptions: ISignedCredCreationArgs<T>, issInfo: IIssInfo, expires?: Date): Promise<SignedCredential>;
private prepareSignature;
digest(): Promise<Buffer>;
private normalize;
static fromJSON(json: ISignedCredentialAttrs): SignedCredential;
toJSON(): ISignedCredentialAttrs;
}
Expand Down
5 changes: 2 additions & 3 deletions js/credentials/signedCredential/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { ICredentialAttrs, IClaimSection } from '../credential/types';
import { ILinkedDataSignatureAttrs } from '../../linkedDataSignature/types';
import { BaseMetadata } from 'cred-types-jolocom-core';
export interface ISignedCredentialAttrs extends ICredentialAttrs {
import { SignedJsonLdObject } from '../../linkedData/types';
export interface ISignedCredentialAttrs extends SignedJsonLdObject, ICredentialAttrs {
id: string;
issuer: string;
issued: string;
expires?: string;
claim: IClaimSection;
proof: ILinkedDataSignatureAttrs;
}
export interface ISignedCredCreationArgs<T extends BaseMetadata> {
metadata: T;
Expand Down
5 changes: 2 additions & 3 deletions js/identity/didDocument/didDocument.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { IDidDocumentAttrs } from './types';
import { AuthenticationSection, PublicKeySection, ServiceEndpointsSection } from './sections';
import { ISigner } from '../../registries/types';
import { ContextEntry } from 'cred-types-jolocom-core';
import { JsonLdContext } from '../../linkedData/types';
import { ILinkedDataSignature, IDigestable } from '../../linkedDataSignature/types';
export declare class DidDocument implements IDigestable {
private _id;
Expand All @@ -12,7 +12,7 @@ export declare class DidDocument implements IDigestable {
private _created;
private _proof;
private '_@context';
context: ContextEntry[];
context: JsonLdContext;
did: string;
authentication: AuthenticationSection[];
publicKey: PublicKeySection[];
Expand All @@ -28,7 +28,6 @@ export declare class DidDocument implements IDigestable {
static fromPublicKey(publicKey: Buffer): DidDocument;
private prepareSignature;
digest(): Promise<Buffer>;
normalize(): Promise<string>;
toJSON(): IDidDocumentAttrs;
static fromJSON(json: IDidDocumentAttrs): DidDocument;
}
7 changes: 4 additions & 3 deletions js/identity/didDocument/sections/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
export interface IPublicKeySectionAttrs {
import { JsonLdObject } from '../../../linkedData/types';
export interface IPublicKeySectionAttrs extends JsonLdObject {
id: string;
type: string;
publicKeyHex: string;
}
export interface IAuthenticationSectionAttrs {
export interface IAuthenticationSectionAttrs extends JsonLdObject {
publicKey: string;
type: string;
}
export interface IServiceEndpointSectionAttrs {
export interface IServiceEndpointSectionAttrs extends JsonLdObject {
id: string;
type: string;
serviceEndpoint: string;
Expand Down
7 changes: 2 additions & 5 deletions js/identity/didDocument/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { IPublicKeySectionAttrs, IAuthenticationSectionAttrs, IServiceEndpointSectionAttrs } from './sections/types';
import { ILinkedDataSignatureAttrs } from '../../linkedDataSignature/types';
import { ContextEntry } from 'cred-types-jolocom-core';
export interface IDidDocumentAttrs {
'@context': ContextEntry[];
import { SignedJsonLdObject } from '../../linkedData/types';
export interface IDidDocumentAttrs extends SignedJsonLdObject {
id: string;
authentication: IAuthenticationSectionAttrs[];
publicKey: IPublicKeySectionAttrs[];
service: IServiceEndpointSectionAttrs[];
created: string;
proof: ILinkedDataSignatureAttrs;
}
8 changes: 8 additions & 0 deletions js/linkedData/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// <reference types="node" />
import { ILinkedDataSignatureAttrs } from '../linkedDataSignature/types';
import { IRegistry } from '../registries/types';
import { JsonLdObject, SignedJsonLdObject, JsonLdContext } from './types';
export declare const normalizeJsonLd: ({ ["@context"]: _, ...data }: JsonLdObject, context: JsonLdContext) => Promise<any>;
export declare const normalizeLdProof: ({ signatureValue, id, type, ...toNormalize }: ILinkedDataSignatureAttrs, context: JsonLdContext) => Promise<string>;
export declare const digestJsonLd: ({ proof, ["@context"]: _, ...data }: SignedJsonLdObject, context: JsonLdContext) => Promise<Buffer>;
export declare const validateJsonLd: (json: SignedJsonLdObject, customRegistry?: IRegistry) => Promise<boolean>;
12 changes: 12 additions & 0 deletions js/linkedData/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ILinkedDataSignatureAttrs } from '../linkedDataSignature/types';
import { ContextEntry } from 'cred-types-jolocom-core';
declare type JsonLdPrimitive = string | number | boolean | JsonLdObject | JsonLdObject[];
export declare type JsonLdContext = ContextEntry | ContextEntry[];
export interface JsonLdObject {
'@context'?: JsonLdContext;
[key: string]: JsonLdPrimitive | JsonLdPrimitive[];
}
export interface SignedJsonLdObject extends JsonLdObject {
proof: ILinkedDataSignatureAttrs;
}
export {};
3 changes: 2 additions & 1 deletion js/linkedDataSignature/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// <reference types="node" />
import { JsonLdObject } from '../linkedData/types';
export interface ISerializable {
toJSON: () => {};
}
Expand All @@ -16,7 +17,7 @@ export interface IDigestable {
keyId: string;
};
}
export interface ILinkedDataSignatureAttrs {
export interface ILinkedDataSignatureAttrs extends JsonLdObject {
type: string;
created: string;
creator: string;
Expand Down
108 changes: 105 additions & 3 deletions js/utils/contexts.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,105 @@
import { ContextEntry } from 'cred-types-jolocom-core';
export declare const defaultContext: ContextEntry[];
export declare const defaultContextIdentity: ContextEntry[];
export declare const defaultContext: {
id: string;
type: string;
cred: string;
schema: string;
dc: string;
xsd: string;
sec: string;
Credential: string;
issuer: {
'@id': string;
'@type': string;
};
issued: {
'@id': string;
'@type': string;
};
claim: {
'@id': string;
'@type': string;
};
credential: {
'@id': string;
'@type': string;
};
expires: {
'@id': string;
'@type': string;
};
proof: {
'@id': string;
'@type': string;
};
EcdsaKoblitzSignature2016: string;
created: {
'@id': string;
'@type': string;
};
creator: {
'@id': string;
'@type': string;
};
domain: string;
nonce: string;
signatureValue: string;
}[];
export declare const defaultContextIdentity: {
id: string;
type: string;
dc: string;
rdfs: string;
schema: string;
sec: string;
didv: string;
xsd: string;
AuthenticationSuite: string;
CryptographicKey: string;
LinkedDataSignature2016: string;
authentication: string;
created: {
'@id': string;
'@type': string;
};
creator: {
'@id': string;
'@type': string;
};
digestAlgorithm: string;
digestValue: string;
domain: string;
entity: string;
expires: {
'@id': string;
'@type': string;
};
name: string;
nonce: string;
normalizationAlgorithm: string;
owner: {
'@id': string;
'@type': string;
};
privateKey: {
'@id': string;
'@type': string;
};
proof: string;
proofAlgorithm: string;
proofType: string;
proofValue: string;
publicKey: {
'@id': string;
'@type': string;
'@container': string;
};
publicKeyHex: string;
requiredProof: string;
revoked: {
'@id': string;
'@type': string;
};
signature: string;
signatureAlgorithm: string;
signatureValue: string;
}[];
6 changes: 3 additions & 3 deletions js/vaultedKeyProvider/softwareProvider.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="node" />
import { IDigestable } from '../linkedDataSignature/types';
import { IVaultedKeyProvider, IKeyDerivationArgs } from './types';
import { IKeyDerivationArgs, IVaultedKeyProvider } from './types';
export interface EncryptedData {
keys: EncryptedKey[];
data: string;
Expand All @@ -26,8 +26,8 @@ export declare class SoftwareKeyProvider implements IVaultedKeyProvider {
static verifyDigestable(publicKey: Buffer, toVerify: IDigestable): Promise<boolean>;
private static encrypt;
private static decrypt;
encryptHybrid(data: object, derivationArgs: IKeyDerivationArgs): Promise<string>;
decryptHybrid(encryptedData: EncryptedData, derivationArg: IKeyDerivationArgs): Promise<string>;
encryptHybrid(data: object, derivationArgs: IKeyDerivationArgs): Promise<EncryptedData>;
decryptHybrid(encryptedData: EncryptedData, derivationArg: IKeyDerivationArgs): Promise<object>;
private stringifyEncryptedData;
private parseEncryptedData;
private static normalizePassword;
Expand Down

0 comments on commit 8ef38da

Please sign in to comment.