@twin.org/identity-connector-entity-storage 0.0.1-next.4 → 0.0.1-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var entity = require('@twin.org/entity');
|
|
4
4
|
var core = require('@twin.org/core');
|
|
5
5
|
var crypto = require('@twin.org/crypto');
|
|
6
|
+
var dataJsonLd = require('@twin.org/data-json-ld');
|
|
6
7
|
var entityStorageModels = require('@twin.org/entity-storage-models');
|
|
7
8
|
var identityModels = require('@twin.org/identity-models');
|
|
8
9
|
var standardsW3cDid = require('@twin.org/standards-w3c-did');
|
|
@@ -440,15 +441,9 @@ class EntityStorageIdentityConnector {
|
|
|
440
441
|
else if (core.Is.stringValue(types)) {
|
|
441
442
|
finalTypes.push(types);
|
|
442
443
|
}
|
|
443
|
-
const finalContexts = ["https://www.w3.org/2018/credentials/v1"];
|
|
444
|
-
if (core.Is.array(contexts)) {
|
|
445
|
-
finalContexts.push(...contexts);
|
|
446
|
-
}
|
|
447
|
-
else if (core.Is.stringValue(contexts)) {
|
|
448
|
-
finalContexts.push(contexts);
|
|
449
|
-
}
|
|
450
444
|
const verifiableCredential = {
|
|
451
|
-
"@context":
|
|
445
|
+
"@context": dataJsonLd.JsonLdProcessor.combineContexts("https://www.w3.org/2018/credentials/v1", contexts) ??
|
|
446
|
+
null,
|
|
452
447
|
id: credentialId,
|
|
453
448
|
type: finalTypes,
|
|
454
449
|
credentialSubject: subject,
|
|
@@ -720,15 +715,9 @@ class EntityStorageIdentityConnector {
|
|
|
720
715
|
else if (core.Is.stringValue(types)) {
|
|
721
716
|
finalTypes.push(types);
|
|
722
717
|
}
|
|
723
|
-
const finalContexts = ["https://www.w3.org/2018/credentials/v1"];
|
|
724
|
-
if (core.Is.array(contexts)) {
|
|
725
|
-
finalContexts.push(...contexts);
|
|
726
|
-
}
|
|
727
|
-
else if (core.Is.stringValue(contexts)) {
|
|
728
|
-
finalContexts.push(contexts);
|
|
729
|
-
}
|
|
730
718
|
const verifiablePresentation = {
|
|
731
|
-
"@context":
|
|
719
|
+
"@context": dataJsonLd.JsonLdProcessor.combineContexts("https://www.w3.org/2018/credentials/v1", contexts) ??
|
|
720
|
+
null,
|
|
732
721
|
type: finalTypes,
|
|
733
722
|
verifiableCredential: verifiableCredentials,
|
|
734
723
|
holder: idParts.id
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { property, entity, ComparisonOperator, EntitySchemaFactory, EntitySchemaHelper } from '@twin.org/entity';
|
|
2
2
|
import { Guards, Converter, RandomHelper, BitString, Compression, CompressionType, GeneralError, Is, NotFoundError, ObjectHelper, Coerce, JsonHelper, AlreadyExistsError, BaseError } from '@twin.org/core';
|
|
3
3
|
import { Sha256 } from '@twin.org/crypto';
|
|
4
|
+
import { JsonLdProcessor } from '@twin.org/data-json-ld';
|
|
4
5
|
import { EntityStorageConnectorFactory } from '@twin.org/entity-storage-models';
|
|
5
6
|
import { DocumentHelper } from '@twin.org/identity-models';
|
|
6
7
|
import { DidVerificationMethodType } from '@twin.org/standards-w3c-did';
|
|
@@ -438,15 +439,9 @@ class EntityStorageIdentityConnector {
|
|
|
438
439
|
else if (Is.stringValue(types)) {
|
|
439
440
|
finalTypes.push(types);
|
|
440
441
|
}
|
|
441
|
-
const finalContexts = ["https://www.w3.org/2018/credentials/v1"];
|
|
442
|
-
if (Is.array(contexts)) {
|
|
443
|
-
finalContexts.push(...contexts);
|
|
444
|
-
}
|
|
445
|
-
else if (Is.stringValue(contexts)) {
|
|
446
|
-
finalContexts.push(contexts);
|
|
447
|
-
}
|
|
448
442
|
const verifiableCredential = {
|
|
449
|
-
"@context":
|
|
443
|
+
"@context": JsonLdProcessor.combineContexts("https://www.w3.org/2018/credentials/v1", contexts) ??
|
|
444
|
+
null,
|
|
450
445
|
id: credentialId,
|
|
451
446
|
type: finalTypes,
|
|
452
447
|
credentialSubject: subject,
|
|
@@ -718,15 +713,9 @@ class EntityStorageIdentityConnector {
|
|
|
718
713
|
else if (Is.stringValue(types)) {
|
|
719
714
|
finalTypes.push(types);
|
|
720
715
|
}
|
|
721
|
-
const finalContexts = ["https://www.w3.org/2018/credentials/v1"];
|
|
722
|
-
if (Is.array(contexts)) {
|
|
723
|
-
finalContexts.push(...contexts);
|
|
724
|
-
}
|
|
725
|
-
else if (Is.stringValue(contexts)) {
|
|
726
|
-
finalContexts.push(contexts);
|
|
727
|
-
}
|
|
728
716
|
const verifiablePresentation = {
|
|
729
|
-
"@context":
|
|
717
|
+
"@context": JsonLdProcessor.combineContexts("https://www.w3.org/2018/credentials/v1", contexts) ??
|
|
718
|
+
null,
|
|
730
719
|
type: finalTypes,
|
|
731
720
|
verifiableCredential: verifiableCredentials,
|
|
732
721
|
holder: idParts.id
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type IJsonLdContextDefinitionRoot } from "@twin.org/data-json-ld";
|
|
1
2
|
import { type IIdentityConnector } from "@twin.org/identity-models";
|
|
2
3
|
import { DidVerificationMethodType, type IDidDocument, type IDidDocumentVerificationMethod, type IDidService, type IDidVerifiableCredential, type IDidVerifiablePresentation } from "@twin.org/standards-w3c-did";
|
|
3
4
|
/**
|
|
@@ -86,7 +87,7 @@ export declare class EntityStorageIdentityConnector implements IIdentityConnecto
|
|
|
86
87
|
* @returns The created verifiable credential and its token.
|
|
87
88
|
* @throws NotFoundError if the id can not be resolved.
|
|
88
89
|
*/
|
|
89
|
-
createVerifiableCredential<T>(controller: string, verificationMethodId: string, credentialId: string | undefined, types: string | string[] | undefined, subject: T | T[], contexts?:
|
|
90
|
+
createVerifiableCredential<T>(controller: string, verificationMethodId: string, credentialId: string | undefined, types: string | string[] | undefined, subject: T | T[], contexts?: IJsonLdContextDefinitionRoot, revocationIndex?: number): Promise<{
|
|
90
91
|
verifiableCredential: IDidVerifiableCredential<T>;
|
|
91
92
|
jwt: string;
|
|
92
93
|
}>;
|
|
@@ -126,7 +127,7 @@ export declare class EntityStorageIdentityConnector implements IIdentityConnecto
|
|
|
126
127
|
* @returns The created verifiable presentation and its token.
|
|
127
128
|
* @throws NotFoundError if the id can not be resolved.
|
|
128
129
|
*/
|
|
129
|
-
createVerifiablePresentation(controller: string, presentationMethodId: string, types: string | string[] | undefined, verifiableCredentials: string[], contexts?:
|
|
130
|
+
createVerifiablePresentation(controller: string, presentationMethodId: string, types: string | string[] | undefined, verifiableCredentials: string[], contexts?: IJsonLdContextDefinitionRoot, expiresInMinutes?: number): Promise<{
|
|
130
131
|
verifiablePresentation: IDidVerifiablePresentation;
|
|
131
132
|
jwt: string;
|
|
132
133
|
}>;
|
package/docs/changelog.md
CHANGED
|
@@ -294,7 +294,7 @@ The type for the data stored in the verifiable credential.
|
|
|
294
294
|
|
|
295
295
|
The subject data to store for the credential.
|
|
296
296
|
|
|
297
|
-
• **contexts?**: `
|
|
297
|
+
• **contexts?**: `IJsonLdContextDefinitionRoot`
|
|
298
298
|
|
|
299
299
|
Additional contexts to include in the credential.
|
|
300
300
|
|
|
@@ -450,7 +450,7 @@ The types for the data stored in the verifiable credential.
|
|
|
450
450
|
|
|
451
451
|
The credentials to use for creating the presentation in jwt format.
|
|
452
452
|
|
|
453
|
-
• **contexts?**: `
|
|
453
|
+
• **contexts?**: `IJsonLdContextDefinitionRoot`
|
|
454
454
|
|
|
455
455
|
Additional contexts to include in the presentation.
|
|
456
456
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/identity-connector-entity-storage",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.5",
|
|
4
4
|
"description": "Identity connector implementation using entity storage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@twin.org/data-core": "next",
|
|
20
20
|
"@twin.org/data-json-ld": "next",
|
|
21
21
|
"@twin.org/entity": "next",
|
|
22
|
-
"@twin.org/identity-models": "0.0.1-next.
|
|
22
|
+
"@twin.org/identity-models": "0.0.1-next.5",
|
|
23
23
|
"@twin.org/nameof": "next",
|
|
24
24
|
"@twin.org/standards-w3c-did": "next",
|
|
25
25
|
"@twin.org/vault-models": "next",
|