-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cca8825
commit 7f1c85f
Showing
12 changed files
with
406 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Entity, Column, BaseEntity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm' | ||
import { Identity } from './identity' | ||
|
||
@Entity() | ||
export class Action extends BaseEntity { | ||
@PrimaryGeneratedColumn() | ||
id: string | ||
|
||
@Column() | ||
type: string | ||
|
||
@ManyToOne( | ||
type => Identity, | ||
identity => identity.actions, | ||
) | ||
identity: Identity | ||
|
||
@Column() | ||
timestamp: number | ||
|
||
@Column() | ||
data: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { | ||
Entity, | ||
Column, | ||
BaseEntity, | ||
ManyToOne, | ||
JoinTable, | ||
PrimaryGeneratedColumn, | ||
OneToMany, | ||
ManyToMany, | ||
} from 'typeorm' | ||
import { Identity } from './identity' | ||
import { Credential } from './credential' | ||
|
||
@Entity() | ||
export class Claim extends BaseEntity { | ||
@PrimaryGeneratedColumn() | ||
id: string | ||
|
||
@ManyToOne( | ||
type => Identity, | ||
identity => identity.issuedPresentations, | ||
) | ||
issuer: Identity | ||
|
||
@ManyToOne( | ||
type => Identity, | ||
identity => identity.receivedPresentations, | ||
) | ||
subject: Identity | ||
|
||
@ManyToOne( | ||
type => Credential, | ||
credential => credential.claims, | ||
) | ||
credential: Credential | ||
|
||
@Column() | ||
type: string | ||
|
||
@Column() | ||
value: string | ||
|
||
@Column() | ||
isObj: boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Entity, Column, PrimaryGeneratedColumn, BaseEntity } from 'typeorm' | ||
|
||
@Entity() | ||
export class CredentialContext extends BaseEntity { | ||
@PrimaryGeneratedColumn() | ||
id: string | ||
|
||
@Column() | ||
context: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Entity, Column, PrimaryGeneratedColumn, BaseEntity } from 'typeorm' | ||
|
||
@Entity() | ||
export class CredentialType extends BaseEntity { | ||
@PrimaryGeneratedColumn() | ||
id: string | ||
|
||
@Column() | ||
type: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { | ||
Entity, | ||
Column, | ||
BaseEntity, | ||
ManyToOne, | ||
JoinTable, | ||
PrimaryColumn, | ||
OneToMany, | ||
ManyToMany, | ||
} from 'typeorm' | ||
import { Identity } from './identity' | ||
import { Message } from './message' | ||
import { Presentation } from './presentation' | ||
import { CredentialContext } from './credential-context' | ||
import { CredentialType } from './credential-type' | ||
import { Claim } from './claim' | ||
|
||
@Entity() | ||
export class Credential extends BaseEntity { | ||
@PrimaryColumn() | ||
hash: string | ||
|
||
@ManyToOne( | ||
type => Identity, | ||
identity => identity.issuedCredentials, | ||
) | ||
issuer: Identity | ||
|
||
@ManyToOne( | ||
type => Identity, | ||
identity => identity.receivedCredentials, | ||
) | ||
subject: Identity | ||
|
||
@Column() | ||
issuedAt: number | ||
|
||
@Column() | ||
notBefore: number | ||
|
||
@Column() | ||
expiresAt: number | ||
|
||
@Column() | ||
raw: string | ||
|
||
@ManyToMany(type => CredentialContext) | ||
@JoinTable() | ||
context: CredentialContext[] | ||
|
||
@ManyToMany(type => CredentialType) | ||
@JoinTable() | ||
type: CredentialType[] | ||
|
||
@OneToMany( | ||
type => Claim, | ||
claim => claim.credential, | ||
) | ||
claims: Claim[] | ||
|
||
@ManyToMany( | ||
type => Presentation, | ||
presentation => presentation.credentials, | ||
) | ||
presentations: Presentation[] | ||
|
||
@ManyToMany( | ||
type => Message, | ||
message => message.presentations, | ||
) | ||
messages: Message[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Entity, Column, BaseEntity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm' | ||
import { Message } from './message' | ||
|
||
@Entity() | ||
export class MessageMetaData extends BaseEntity { | ||
@PrimaryGeneratedColumn() | ||
id: string | ||
|
||
@Column() | ||
type: string | ||
|
||
@Column() | ||
value: string | ||
|
||
@ManyToOne( | ||
type => Message, | ||
message => message.metaData, | ||
) | ||
message: Message | ||
|
||
@Column() | ||
timestamp: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { | ||
Entity, | ||
Column, | ||
BaseEntity, | ||
ManyToOne, | ||
ManyToMany, | ||
PrimaryGeneratedColumn, | ||
OneToMany, | ||
JoinTable, | ||
} from 'typeorm' | ||
import { Identity } from './identity' | ||
import { MessageMetaData } from './message-meta-data' | ||
import { Presentation } from './presentation' | ||
import { Credential } from './credential' | ||
|
||
@Entity() | ||
export class Message extends BaseEntity { | ||
@PrimaryGeneratedColumn() | ||
id: string | ||
|
||
@Column() | ||
threadId: string | ||
|
||
@Column() | ||
type: string | ||
|
||
@ManyToOne( | ||
type => Identity, | ||
identity => identity.sentMessages, | ||
) | ||
sender: Identity | ||
|
||
@ManyToOne( | ||
type => Identity, | ||
identity => identity.receivedMessages, | ||
) | ||
receiver: Identity | ||
|
||
@Column() | ||
timestamp: number | ||
|
||
@Column() | ||
raw: string | ||
|
||
@Column() | ||
data: string | ||
|
||
@OneToMany( | ||
type => MessageMetaData, | ||
messageMetaData => messageMetaData.message, | ||
) | ||
metaData: MessageMetaData[] | ||
|
||
@ManyToMany( | ||
type => Presentation, | ||
presentation => presentation.messages, | ||
) | ||
@JoinTable() | ||
presentations: Presentation[] | ||
|
||
@ManyToMany( | ||
type => Credential, | ||
credential => credential.messages, | ||
) | ||
@JoinTable() | ||
credentials: Credential[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Entity, Column, PrimaryGeneratedColumn, BaseEntity } from 'typeorm' | ||
|
||
@Entity() | ||
export class PresentationContext extends BaseEntity { | ||
@PrimaryGeneratedColumn() | ||
id: string | ||
|
||
@Column() | ||
context: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Entity, Column, PrimaryGeneratedColumn, BaseEntity } from 'typeorm' | ||
|
||
@Entity() | ||
export class PresentationType extends BaseEntity { | ||
@PrimaryGeneratedColumn() | ||
id: string | ||
|
||
@Column() | ||
type: string | ||
} |
Oops, something went wrong.