Skip to content

Commit

Permalink
[SignedDidDocument] types and proto added. (#81)
Browse files Browse the repository at this point in the history
* [SignedDidDocument] type added.

* [DidDocService] from protos leveraged.

* cleanup

* [SignedDidDocument] proto added.
  • Loading branch information
rsmets authored Nov 24, 2021
1 parent 47e01b3 commit 1067ecd
Show file tree
Hide file tree
Showing 14 changed files with 476 additions and 26 deletions.
23 changes: 16 additions & 7 deletions build/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Literal, Static, Union } from "runtypes";
import { SemVer } from 'semver';
import { UnsignedPresentation as UnsignedPresentationPb, Presentation as PresentationPb } from "./protos/presentation";
import { UnsignedPresentationRequest as UnsignedPresentationRequestPb, PresentationRequest as PresentationRequestPb } from "./protos/presentationRequest";
import { DidDocument as DidDocumentPb, DidDocumentService } from "./protos/didDocument";
import { DidDocument as DidDocumentPb, SignedDidDocument as SignedDidDocumentPb, DidDocumentService } from "./protos/didDocument";
import { Proof as ProofPb } from "./protos/proof";
import { UnsignedCredential as UnsignedCredentialPb, Credential as CredentialPb, CredentialRequest as CredentialRequestPb, CredentialStatusInfo, IssueCredentialOptions, IssueCredentialsOptions, EncryptedCredential as EncryptedCredentialPb, EncryptedCredentialOptions as EncryptedCredentialOptionsPb, EncryptedCredentialEnriched, SubjectCredentialRequest } from "./protos/credential";
import { EncryptedData as EncryptedDataPb, EncryptedKey, RSAPadding, PublicKeyInfo as PublicKeyInfoPb } from "./protos/crypto";
Expand All @@ -15,7 +15,7 @@ import { VerifierInfo as VerifierInfoPb } from "./protos/verifier";
* The "Pb" serves to differentiate until we can ditch the legacy ts defined types.
*/
export { UnsignedPresentationPb, PresentationPb, };
export { DidDocumentPb, DidDocumentService };
export { DidDocumentPb, DidDocumentService, SignedDidDocumentPb };
export { UnsignedPresentationRequestPb, PresentationRequestPb, };
export { IssueCredentialOptions, IssueCredentialsOptions, CredentialStatusInfo, CredentialRequestPb, UnsignedCredentialPb, CredentialPb, EncryptedCredentialPb, EncryptedCredentialOptionsPb, EncryptedCredentialEnriched, RSAPadding, SubjectCredentialRequest };
export { PresentationRequestEnriched };
Expand Down Expand Up @@ -658,11 +658,20 @@ export interface DidDocument {
created: Date;
updated: Date;
publicKey: PublicKeyInfo[];
service: {
id: string;
serviceEndpoint: string;
type: string;
}[];
service: DidDocumentService[];
}
/**
* Interface to encapsulate a signed Subject Did Document.
* Note: it breaks the name convention of the singed type counterpart being the simpler name of the two, however because the unsigned DidDocument definition was claimed first, this is an exception to the rule.
*/
export interface SignedDidDocument {
'@context': ['https://www.w3.org/ns/did/v1', ...string[]];
id: string;
created: Date;
updated: Date;
publicKey: PublicKeyInfo[];
service: DidDocumentService[];
proof: Proof;
}
/**
* Type to encapsulate supported key types in did documents.
Expand Down
2 changes: 1 addition & 1 deletion build/index.d.ts.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions build/protos/credential.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export interface Credential {
/** optional in the ts types */
expirationDate: Date | undefined;
}
/** Object that encapsulates Credential information requested. */
/**
* Object that encapsulates Credential information requested.
* Note this is used moslty used within Presentations and PresentationRequests. However it can also be used as an UnsignedCredentialRequest when dealing with a signed SubjectCredentialRequest.
*/
export interface CredentialRequest {
/** the string matching the desire credential type */
type: string;
Expand All @@ -48,13 +51,14 @@ export interface CredentialRequest {
/**
* Object that encapsulates a Subject's request for a Credential.
* Note: this is different than the original CredentialRequest which lives in a Presentation(Request) object.
* Also, it breaks the name convention of the singed type counterpart being the simpler name of the two, however because the unsigned CredentialRequest definition was claimed first, this is an exception to the rule.
*/
export interface SubjectCredentialRequest {
/** the string matching the desire credential type */
type: string;
/** list of acceptable issuer DIDs that have issued the credential */
issuers: string[];
/** to denote wether this particular credential is required in response to the PresentationRequest. Defaults behavior resolves this to true. */
/** to denote wether this particular credential is required. Defaults behavior resolves this to true. */
required: boolean;
/** proof signed by the subject */
proof: Proof | undefined;
Expand Down
2 changes: 1 addition & 1 deletion build/protos/credential.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/protos/credential.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 1067ecd

Please sign in to comment.