Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: typing issues with jsonld #21

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import type {
SuiteSignOptions,
} from './types'

import jsonld from '@digitalcredentials/jsonld'
import { suites } from '@digitalcredentials/jsonld-signatures'
import jsonld from 'jsonld'

import { AriesFrameworkError } from '../../../error'
import { SECURITY_CONTEXT_BBS_URL, SECURITY_CONTEXT_URL } from '../../../modules/vc/constants'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import type { JsonObject } from '../../../types'

import jsonld from 'jsonld'
import jsonld from '@digitalcredentials/jsonld'

import { SECURITY_PROOF_URL } from '../../../modules/vc/constants'
import { W3cVerifiableCredential } from '../../../modules/vc/models'
Expand Down

This file was deleted.

17 changes: 0 additions & 17 deletions packages/core/src/crypto/signature-suites/bbs/types/jsonld.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/core/src/utils/jsonld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface Proof extends JsonObject {
export interface DocumentLoaderResult {
contextUrl?: string | null
documentUrl: string
document: JsonObject
document: Record<string, unknown>
}

export type DocumentLoader = (url: string) => Promise<DocumentLoaderResult>
Expand Down
38 changes: 20 additions & 18 deletions packages/core/types/jsonld.d.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
/* eslint-disable */

import { JsonObject } from '../src/types'

export interface DocumentLoaderResult {
contextUrl?: string | null
documentUrl: string
document: JsonObject
}

export type DocumentLoader = (url: string) => Promise<DocumentLoaderResult>

declare module '@digitalcredentials/jsonld' {
export const compact: (document: any, context: any, options?: any) => any
export const fromRDF: (document: any) => any
export const frame: (document: any, revealDocument: any, options?: any) => any
export const canonize: (document: any, options?: any) => any
export const expand: (document: any, options?: any) => any

export interface DocumentLoaderResult {
contextUrl?: string | null
documentUrl: string
document: Record<string, unknown>
}

export type DocumentLoader = (url: string) => Promise<DocumentLoaderResult>
}

// declare module '@digitalcredentials/jsonld/lib/documentLoaders/xhr' {
// const documentLoader: DocumentLoader
// export default documentLoader
// }
declare module '@digitalcredentials/jsonld/lib/documentLoaders/xhr' {
import { DocumentLoader } from '@digitalcredentials/jsonld'

const documentLoader: () => DocumentLoader
export default documentLoader
}

// declare module '@digitalcredentials/jsonld/lib/documentLoaders/node' {
// const documentLoader: DocumentLoader
// export default documentLoader
// }
declare module '@digitalcredentials/jsonld/lib/documentLoaders/node' {
import { DocumentLoader } from '@digitalcredentials/jsonld'

const documentLoader: () => DocumentLoader
export default documentLoader
}
Loading