Skip to content
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"@credo-ts/push-notifications": "^0.7.1",
"@credo-ts/question-answer": "0.6.2",
"@credo-ts/tenants": "0.6.2",
"@hyperledger/anoncreds-nodejs": "0.3.1",
"@hyperledger/indy-vdr-nodejs": "0.2.2",
"@hyperledger/anoncreds-nodejs": "^0.3.4",
"@hyperledger/indy-vdr-nodejs": "^0.2.3",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/exporter-logs-otlp-http": "^0.202.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.202.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
diff --git a/node_modules/@credo-ts/core/build/modules/vc/data-integrity/jsonldUtil.d.mts b/node_modules/@credo-ts/core/build/modules/vc/data-integrity/jsonldUtil.d.mts
index 5a311c1..4d640d0 100644
--- a/node_modules/@credo-ts/core/build/modules/vc/data-integrity/jsonldUtil.d.mts
+++ b/node_modules/@credo-ts/core/build/modules/vc/data-integrity/jsonldUtil.d.mts
@@ -14,7 +14,7 @@ interface Proof extends JsonObject {
verificationMethod: string | VerificationMethod;
[key: string]: JsonValue;
}
-interface DocumentLoaderResult {
+export interface DocumentLoaderResult {
contextUrl?: string | null;
documentUrl: string;
document: Record<string, unknown>;
diff --git a/node_modules/@credo-ts/core/build/modules/vc/data-integrity/libraries/nativeDocumentLoader.mjs b/node_modules/@credo-ts/core/build/modules/vc/data-integrity/libraries/nativeDocumentLoader.mjs
index 49ee03f..aa7e43a 100644
--- a/node_modules/@credo-ts/core/build/modules/vc/data-integrity/libraries/nativeDocumentLoader.mjs
+++ b/node_modules/@credo-ts/core/build/modules/vc/data-integrity/libraries/nativeDocumentLoader.mjs
@@ -2,7 +2,7 @@

//#region src/modules/vc/data-integrity/libraries/nativeDocumentLoader.ts
async function getNativeDocumentLoader() {
- const loader = await import("@digitalcredentials/jsonld/lib/documentLoaders/node");
+ const loader = await import("@digitalcredentials/jsonld/lib/documentLoaders/node.js");
if (!loader) throw new Error("Could not load node document loader. Module did not contain a loader function");
if (typeof loader === "function") return loader;
if (typeof loader === "object" && typeof loader.default === "function") return loader.default;
diff --git a/node_modules/@credo-ts/core/build/modules/vc/data-integrity/libraries/nativeDocumentLoader.native.mjs b/node_modules/@credo-ts/core/build/modules/vc/data-integrity/libraries/nativeDocumentLoader.native.mjs
index 6a8ca37..0287e99 100644
--- a/node_modules/@credo-ts/core/build/modules/vc/data-integrity/libraries/nativeDocumentLoader.native.mjs
+++ b/node_modules/@credo-ts/core/build/modules/vc/data-integrity/libraries/nativeDocumentLoader.native.mjs
@@ -1,8 +1,9 @@


+
//#region src/modules/vc/data-integrity/libraries/nativeDocumentLoader.native.ts
async function getNativeDocumentLoader() {
- const loader = await import("@digitalcredentials/jsonld/lib/documentLoaders/xhr");
+ const loader = await import("@digitalcredentials/jsonld/lib/documentLoaders/xhr.js");
if (!loader) throw new Error("Could not load node document loader. Module did not contain a loader function");
if (typeof loader === "function") return loader;
if (typeof loader === "object" && typeof loader.default === "function") return loader.default;
diff --git a/node_modules/@credo-ts/core/build/utils/version.d.mts b/node_modules/@credo-ts/core/build/utils/version.d.mts
index a71659d..8ed88e2 100644
--- a/node_modules/@credo-ts/core/build/utils/version.d.mts
Expand Down
22 changes: 22 additions & 0 deletions patches/@digitalcredentials+jsonld-signatures+12.0.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/node_modules/@digitalcredentials/jsonld-signatures/lib/suites/LinkedDataSignature.js b/node_modules/@digitalcredentials/jsonld-signatures/lib/suites/LinkedDataSignature.js
index 3aec367..4bb5517 100644
--- a/node_modules/@digitalcredentials/jsonld-signatures/lib/suites/LinkedDataSignature.js
+++ b/node_modules/@digitalcredentials/jsonld-signatures/lib/suites/LinkedDataSignature.js
@@ -204,7 +204,7 @@ module.exports = class LinkedDataSignature extends LinkedDataProof {
documentLoader,
// throw errors if any values would be dropped due to missing
// definitions or relative URLs
- safe: true,
+ safe: false,
skipExpansion,
useNative: this.useNativeCanonize,
...this.canonizeOptions
@@ -301,7 +301,7 @@ module.exports = class LinkedDataSignature extends LinkedDataProof {
'@context': constants.SECURITY_CONTEXT_URL,
'@embed': '@always',
id: verificationMethod
- }, {documentLoader, compactToRelative: false, safe: true});
+ }, {documentLoader, compactToRelative: false, safe: false});
if(!framed) {
throw new Error(`Verification method ${verificationMethod} not found.`);
}
8 changes: 8 additions & 0 deletions src/cliAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Refer from: https://github.com/credebl/mobile-sdk/blob/main/packages/ssi/src/wallet/wallet.ts
import '@openwallet-foundation/askar-nodejs'
import '@hyperledger/indy-vdr-nodejs'
import '@hyperledger/anoncreds-nodejs'

Check warning on line 5 in src/cliAgent.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'@hyperledger/anoncreds-nodejs' imported multiple times.

See more on https://sonarcloud.io/project/issues?id=credebl_afj-controller&issues=AZ0-1cwicQvc8vmi7w2S&open=AZ0-1cwicQvc8vmi7w2S&pullRequest=359
import type { AskarModuleConfigStoreOptions } from '@credo-ts/askar'
import type { InitConfig } from '@credo-ts/core'
import type { IndyVdrPoolConfig } from '@credo-ts/indy-vdr'
Expand Down Expand Up @@ -150,6 +151,7 @@
autoAcceptProofs: DidCommAutoAcceptProof,
walletScheme: AskarMultiWalletDatabaseScheme,
storeOptions: AskarModuleConfigStoreOptions,
endpoints: string[],
) => {
const legacyIndyCredentialFormat = new LegacyIndyDidCommCredentialFormatService()
const legacyIndyProofFormat = new LegacyIndyDidCommProofFormatService()
Expand Down Expand Up @@ -197,6 +199,7 @@
mediationRecipient: true,
messagePickup: true,
mediator: false,
endpoints: endpoints || [],

basicMessages: true,
connections: {
Expand Down Expand Up @@ -298,6 +301,7 @@
autoAcceptProofs: DidCommAutoAcceptProof,
walletScheme: AskarMultiWalletDatabaseScheme,
walletConfig: AskarModuleConfigStoreOptions,
endpoints: string[],
) => {
const modules = getModules(
networkConfig,
Expand All @@ -311,6 +315,7 @@
autoAcceptProofs,
walletScheme,
walletConfig,
endpoints,
)
return {
tenants: new TenantsModule<typeof modules>({
Expand Down Expand Up @@ -341,6 +346,7 @@

export async function runRestAgent(restConfig: AriesRestConfig) {
const {
endpoints,
schemaFileServerURL,
logLevel,
inboundTransports = [],
Expand Down Expand Up @@ -431,19 +437,20 @@
let modules

if (afjConfig.tenancy) {
modules = await getWithTenantModules(
networkConfig,
didRegistryContractAddress || '',
fileServerToken || '',
fileServerUrl || '',
rpcUrl || '',
schemaManagerContractAddress || '',
autoAcceptConnections || true,
autoAcceptCredentials || DidCommAutoAcceptCredential.Always,
autoAcceptProofs || DidCommAutoAcceptProof.ContentApproved,
walletScheme || AskarMultiWalletDatabaseScheme.ProfilePerWallet,
walletConfig,
endpoints || [],
)

Check failure on line 453 in src/cliAgent.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unexpected `await` of a non-Promise (non-"Thenable") value.

See more on https://sonarcloud.io/project/issues?id=credebl_afj-controller&issues=AZ0-1cwicQvc8vmi7w2T&open=AZ0-1cwicQvc8vmi7w2T&pullRequest=359
} else {
modules = getModules(
networkConfig,
Expand All @@ -457,6 +464,7 @@
autoAcceptProofs || DidCommAutoAcceptProof.ContentApproved,
walletScheme || AskarMultiWalletDatabaseScheme.ProfilePerWallet,
walletConfig,
endpoints || [],
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ export class CredentialDefinitionController extends Controller {
await request.agent.modules.anoncreds.registerCredentialDefinition(credentialDefinitionPayload)

if (registerCredentialDefinitionResult.credentialDefinitionState.state === CredentialEnum.Failed) {
const failureReason = registerCredentialDefinitionResult.credentialDefinitionState?.reason ?? 'Failed to register credential definition on ledger'
throw new InternalServerError(failureReason)
const failureReason =
registerCredentialDefinitionResult.credentialDefinitionState?.reason ??
'Failed to register credential definition on ledger'
throw new InternalServerError(failureReason)
}

if (registerCredentialDefinitionResult.credentialDefinitionState.state === CredentialEnum.Wait) {
Expand Down
41 changes: 14 additions & 27 deletions src/controllers/did/DidController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@
return { did: did, didDocument: didDocument }
}

// TODO: Right now we are using seed as privateKey for did creation. Fix this is API payload

Check warning on line 513 in src/controllers/did/DidController.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=credebl_afj-controller&issues=AZ1I2jxl3BtDWpZWGVVr&open=AZ1I2jxl3BtDWpZWGVVr&pullRequest=359
public async handleWeb(agent: AgentType, didOptions: DidCreate) {
let didDocument: DidDocument
if (!didOptions.domain) {
Expand All @@ -532,44 +533,24 @@
const did = `did:${didOptions.method}:${domain}`
const keyId = `${did}#key-1`

// TODO: Remove comments afterwards
// const key = await agent.kms.createKey({
// keyType: didOptions.keyType,
// // Commenting for now, as per the multi-tenant endpoint
// // privateKey: TypedArrayEncoder.fromString(didOptions.seed),
// seed: TypedArrayEncoder.fromString(didOptions.seed),
// })

// const ed25519Key = await agent.kms.createKey({
// type: {
// crv: 'Ed25519',
// kty: 'OKP',
// }
// })
// const publicJwk = Kms.PublicJwk.fromPublicJwk(ed25519Key.publicJwk)
// const { privateJwk } = transformPrivateKeyToPrivateJwk({
// type: {
// crv: 'Ed25519',
// kty: 'OKP',
// },
// privateKey: TypedArrayEncoder.fromString(didOptions.seed),
// })
let key
let publicJwk

if (didOptions.keyType === KeyAlgorithm.Ed25519) {
const { privateJwk } = transformSeedToPrivateJwk({
const { privateJwk } = transformPrivateKeyToPrivateJwk({
type: {
crv: 'Ed25519',
kty: 'OKP',
},
seed: TypedArrayEncoder.fromString(didOptions.seed),
privateKey: TypedArrayEncoder.fromString(didOptions.seed),
})

const key = await agent.kms.importKey({ privateJwk })
key = await agent.kms.importKey({ privateJwk })

const publicJwk = Kms.PublicJwk.fromPublicJwk(key.publicJwk)
publicJwk = Kms.PublicJwk.fromPublicJwk(key.publicJwk)
Comment thread
GHkrishna marked this conversation as resolved.
didDocument = new DidDocumentBuilder(did)
.addContext('https://w3id.org/security/suites/ed25519-2018/v1')
.addVerificationMethod(getEd25519VerificationKey2018({ id: keyId, controller: did, publicJwk }))
.addVerificationMethod(getEd25519VerificationKey2018({ id: keyId, publicJwk, controller: did }))
.addAuthentication(keyId)
.addAssertionMethod(keyId)
.build()
Expand All @@ -584,6 +565,12 @@
did,
overwrite: true,
didDocument,
keys: [
{
didDocumentRelativeKeyId: `#key-1`,
kmsKeyId: key.keyId,
},
],
})
return { did, didDocument }
}
Expand Down
Loading