@twin.org/identity-connector-entity-storage 0.0.1-next.26 → 0.0.1-next.28
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 +36 -3
- package/dist/esm/index.mjs +37 -4
- package/docs/changelog.md +1 -1
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -160,6 +160,7 @@ class EntityStorageIdentityConnector {
|
|
|
160
160
|
const bitString = new core.BitString(EntityStorageIdentityConnector._REVOCATION_BITS_SIZE);
|
|
161
161
|
const compressed = await core.Compression.compress(bitString.getBits(), core.CompressionType.Gzip);
|
|
162
162
|
const didDocument = {
|
|
163
|
+
"@context": standardsW3cDid.DidContexts.Context,
|
|
163
164
|
id: did,
|
|
164
165
|
service: [
|
|
165
166
|
{
|
|
@@ -553,7 +554,19 @@ class EntityStorageIdentityConnector {
|
|
|
553
554
|
core.ObjectHelper.propertySet(verifiableCredential.credentialSubject, "id", jwtPayload.sub);
|
|
554
555
|
}
|
|
555
556
|
}
|
|
556
|
-
const
|
|
557
|
+
const credentialStatus = verifiableCredential.credentialStatus;
|
|
558
|
+
let revoked = false;
|
|
559
|
+
if (core.Is.object(credentialStatus)) {
|
|
560
|
+
revoked = await this.checkRevocation(issuerDidDocument, credentialStatus.revocationBitmapIndex);
|
|
561
|
+
}
|
|
562
|
+
else if (core.Is.arrayValue(credentialStatus)) {
|
|
563
|
+
for (let i = 0; i < credentialStatus.length; i++) {
|
|
564
|
+
revoked = await this.checkRevocation(issuerDidDocument, credentialStatus[i].revocationBitmapIndex);
|
|
565
|
+
if (revoked) {
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
557
570
|
return {
|
|
558
571
|
revoked,
|
|
559
572
|
verifiableCredential: revoked ? undefined : verifiableCredential
|
|
@@ -782,10 +795,30 @@ class EntityStorageIdentityConnector {
|
|
|
782
795
|
throw new core.NotFoundError(this.CLASS_NAME, "documentNotFound", issuerDocumentId);
|
|
783
796
|
}
|
|
784
797
|
await EntityStorageIdentityConnector.verifyDocument(issuerDidDocument, this._vaultConnector);
|
|
785
|
-
issuers.push(
|
|
798
|
+
issuers.push({
|
|
799
|
+
"@context": standardsW3cDid.DidContexts.Context,
|
|
800
|
+
...issuerDidDocument
|
|
801
|
+
});
|
|
786
802
|
const vc = jwt.payload.vc;
|
|
787
803
|
if (core.Is.object(vc)) {
|
|
788
|
-
|
|
804
|
+
const credentialStatus = vc.credentialStatus;
|
|
805
|
+
if (core.Is.object(credentialStatus)) {
|
|
806
|
+
revoked = await this.checkRevocation({
|
|
807
|
+
"@context": standardsW3cDid.DidContexts.Context,
|
|
808
|
+
...issuerDidDocument
|
|
809
|
+
}, credentialStatus.revocationBitmapIndex);
|
|
810
|
+
}
|
|
811
|
+
else if (core.Is.arrayValue(credentialStatus)) {
|
|
812
|
+
for (let i = 0; i < credentialStatus.length; i++) {
|
|
813
|
+
revoked = await this.checkRevocation({
|
|
814
|
+
"@context": standardsW3cDid.DidContexts.Context,
|
|
815
|
+
...issuerDidDocument
|
|
816
|
+
}, credentialStatus[i].revocationBitmapIndex);
|
|
817
|
+
if (revoked) {
|
|
818
|
+
break;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
789
822
|
}
|
|
790
823
|
}
|
|
791
824
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { Sha256 } from '@twin.org/crypto';
|
|
|
4
4
|
import { JsonLdProcessor } from '@twin.org/data-json-ld';
|
|
5
5
|
import { EntityStorageConnectorFactory } from '@twin.org/entity-storage-models';
|
|
6
6
|
import { DocumentHelper } from '@twin.org/identity-models';
|
|
7
|
-
import { DidVerificationMethodType, DidTypes,
|
|
7
|
+
import { DidContexts, DidVerificationMethodType, DidTypes, DidCryptoSuites } from '@twin.org/standards-w3c-did';
|
|
8
8
|
import { VaultConnectorFactory, VaultKeyType } from '@twin.org/vault-models';
|
|
9
9
|
import { Jwt } from '@twin.org/web';
|
|
10
10
|
|
|
@@ -158,6 +158,7 @@ class EntityStorageIdentityConnector {
|
|
|
158
158
|
const bitString = new BitString(EntityStorageIdentityConnector._REVOCATION_BITS_SIZE);
|
|
159
159
|
const compressed = await Compression.compress(bitString.getBits(), CompressionType.Gzip);
|
|
160
160
|
const didDocument = {
|
|
161
|
+
"@context": DidContexts.Context,
|
|
161
162
|
id: did,
|
|
162
163
|
service: [
|
|
163
164
|
{
|
|
@@ -551,7 +552,19 @@ class EntityStorageIdentityConnector {
|
|
|
551
552
|
ObjectHelper.propertySet(verifiableCredential.credentialSubject, "id", jwtPayload.sub);
|
|
552
553
|
}
|
|
553
554
|
}
|
|
554
|
-
const
|
|
555
|
+
const credentialStatus = verifiableCredential.credentialStatus;
|
|
556
|
+
let revoked = false;
|
|
557
|
+
if (Is.object(credentialStatus)) {
|
|
558
|
+
revoked = await this.checkRevocation(issuerDidDocument, credentialStatus.revocationBitmapIndex);
|
|
559
|
+
}
|
|
560
|
+
else if (Is.arrayValue(credentialStatus)) {
|
|
561
|
+
for (let i = 0; i < credentialStatus.length; i++) {
|
|
562
|
+
revoked = await this.checkRevocation(issuerDidDocument, credentialStatus[i].revocationBitmapIndex);
|
|
563
|
+
if (revoked) {
|
|
564
|
+
break;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
555
568
|
return {
|
|
556
569
|
revoked,
|
|
557
570
|
verifiableCredential: revoked ? undefined : verifiableCredential
|
|
@@ -780,10 +793,30 @@ class EntityStorageIdentityConnector {
|
|
|
780
793
|
throw new NotFoundError(this.CLASS_NAME, "documentNotFound", issuerDocumentId);
|
|
781
794
|
}
|
|
782
795
|
await EntityStorageIdentityConnector.verifyDocument(issuerDidDocument, this._vaultConnector);
|
|
783
|
-
issuers.push(
|
|
796
|
+
issuers.push({
|
|
797
|
+
"@context": DidContexts.Context,
|
|
798
|
+
...issuerDidDocument
|
|
799
|
+
});
|
|
784
800
|
const vc = jwt.payload.vc;
|
|
785
801
|
if (Is.object(vc)) {
|
|
786
|
-
|
|
802
|
+
const credentialStatus = vc.credentialStatus;
|
|
803
|
+
if (Is.object(credentialStatus)) {
|
|
804
|
+
revoked = await this.checkRevocation({
|
|
805
|
+
"@context": DidContexts.Context,
|
|
806
|
+
...issuerDidDocument
|
|
807
|
+
}, credentialStatus.revocationBitmapIndex);
|
|
808
|
+
}
|
|
809
|
+
else if (Is.arrayValue(credentialStatus)) {
|
|
810
|
+
for (let i = 0; i < credentialStatus.length; i++) {
|
|
811
|
+
revoked = await this.checkRevocation({
|
|
812
|
+
"@context": DidContexts.Context,
|
|
813
|
+
...issuerDidDocument
|
|
814
|
+
}, credentialStatus[i].revocationBitmapIndex);
|
|
815
|
+
if (revoked) {
|
|
816
|
+
break;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
787
820
|
}
|
|
788
821
|
}
|
|
789
822
|
}
|
package/docs/changelog.md
CHANGED
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.28",
|
|
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.28",
|
|
23
23
|
"@twin.org/nameof": "next",
|
|
24
24
|
"@twin.org/standards-w3c-did": "next",
|
|
25
25
|
"@twin.org/vault-models": "next",
|