-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from elribonazo/feature/improve-types
fix: Improve types.
- Loading branch information
Showing
4 changed files
with
45 additions
and
42 deletions.
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
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
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 |
---|---|---|
@@ -1,38 +1,46 @@ | ||
import { Domain } from "@input-output-hk/atala-prism-wallet-sdk"; | ||
import type { Domain } from "@input-output-hk/atala-prism-wallet-sdk"; | ||
import { RxJsonSchema, RxCollection, RxDatabase } from "rxdb"; | ||
export type ExcludeKeys<T, K extends keyof T> = Omit<T, K>; | ||
|
||
export type ExcludeKeys<T, K extends keyof T> = { | ||
[P in Exclude<keyof T, K>]: T[P]; | ||
}; | ||
|
||
export type GenerateDBSchema<T> = RxJsonSchema<T> & { | ||
encrypted: (keyof T)[]; | ||
}; | ||
export type MessagesCollection = RxCollection<Domain.Message>; | ||
export type PlutoDatabase = RxDatabase<{ | ||
messages: MessagesCollection; | ||
}>; | ||
|
||
export type CredentialSchemaType = Domain.VerifiableCredential; | ||
export type DIDSchemaType = ExcludeKeys< | ||
Domain.DID & { readonly alias: string; readonly did: string }, | ||
"toString" | ||
>; | ||
export type DIDPairSchemaType = Domain.DIDPair & { readonly id: string }; | ||
export type KeySchemaType = ExcludeKeys< | ||
ExcludeKeys< | ||
ExcludeKeys< | ||
ExcludeKeys< | ||
ExcludeKeys< | ||
ExcludeKeys< | ||
ExcludeKeys< | ||
ExcludeKeys<Domain.Key & { readonly id: string }, "isExportable">, | ||
"size" | ||
>, | ||
"getProperty" | ||
>, | ||
"isDerivable" | ||
>, | ||
"isSignable" | ||
>, | ||
"getEncoded" | ||
>, | ||
"canVerify" | ||
>, | ||
"isCurve" | ||
Domain.Key & { readonly id: string }, | ||
| "isExportable" | ||
| "size" | ||
| "getProperty" | ||
| "isDerivable" | ||
| "isSignable" | ||
| "getEncoded" | ||
| "canVerify" | ||
| "isCurve" | ||
>; | ||
|
||
export type MediarorSchemaType = { | ||
id: string; | ||
mediatorDID: string; | ||
hostDID: string; | ||
routingDID: string; | ||
}; | ||
export type MessageSchemaType = Domain.Message; | ||
|
||
export type PlutoCollections = { | ||
messages: RxCollection<MessageSchemaType>; | ||
dids: RxCollection<DIDSchemaType>; | ||
verifiableCredentials: RxCollection<CredentialSchemaType>; | ||
didpairs: RxCollection<DIDPairSchemaType>; | ||
mediators: RxCollection<MediarorSchemaType>; | ||
privateKeys: RxCollection<KeySchemaType>; | ||
}; | ||
export type PlutoDatabase = RxDatabase<PlutoCollections>; |