@interop/wallet-core 0.51.0 → 0.52.1
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/README.md +7 -11
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +2 -2
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.js +1 -1
- package/dist/clientAnnex/forget.d.ts +18 -6
- package/dist/clientAnnex/forget.d.ts.map +1 -1
- package/dist/clientAnnex/forget.js +19 -6
- package/dist/clientAnnex/forget.js.map +1 -1
- package/dist/clientAnnex/forgetLast.d.ts +33 -20
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
- package/dist/clientAnnex/forgetLast.js +43 -17
- package/dist/clientAnnex/forgetLast.js.map +1 -1
- package/dist/clientAnnex/gc.d.ts +3 -3
- package/dist/clientAnnex/gc.d.ts.map +1 -1
- package/dist/clientAnnex/gc.js +2 -2
- package/dist/clientAnnex/gc.js.map +1 -1
- package/dist/clientAnnex/index.d.ts +5 -5
- package/dist/clientAnnex/index.d.ts.map +1 -1
- package/dist/clientAnnex/index.js +4 -4
- package/dist/clientAnnex/index.js.map +1 -1
- package/dist/clientAnnex/ladder.d.ts +19 -11
- package/dist/clientAnnex/ladder.d.ts.map +1 -1
- package/dist/clientAnnex/ladder.js +77 -14
- package/dist/clientAnnex/ladder.js.map +1 -1
- package/dist/clientAnnex/ladderAnchored.d.ts +36 -7
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/ladderAnchored.js +80 -18
- package/dist/clientAnnex/ladderAnchored.js.map +1 -1
- package/dist/clientAnnex/log.d.ts +6 -6
- package/dist/clientAnnex/log.d.ts.map +1 -1
- package/dist/clientAnnex/log.js +8 -8
- package/dist/clientAnnex/log.js.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts +7 -7
- package/dist/clientAnnex/recoveryLadderAnchored.js +9 -9
- package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
- package/dist/clientAnnex/selfEnroll.d.ts +6 -4
- package/dist/clientAnnex/selfEnroll.d.ts.map +1 -1
- package/dist/clientAnnex/selfEnroll.js +19 -7
- package/dist/clientAnnex/selfEnroll.js.map +1 -1
- package/dist/clients/listing.d.ts +1 -1
- package/dist/clients/listing.d.ts.map +1 -1
- package/dist/clients/listing.js +1 -1
- package/dist/clients/listing.js.map +1 -1
- package/dist/clients/revocation.d.ts +1 -1
- package/dist/clients/rosterPolicy.d.ts +1 -1
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/descriptors/acquire.js +1 -1
- package/dist/descriptors/logSource.d.ts +1 -2
- package/dist/descriptors/logSource.d.ts.map +1 -1
- package/dist/descriptors/logSource.js +2 -2
- package/dist/descriptors/logSource.js.map +1 -1
- package/dist/enrollment/enrollment.d.ts +1 -1
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +2 -1
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/genesis/accountGenesis.d.ts +1 -1
- package/dist/genesis/accountGenesis.d.ts.map +1 -1
- package/dist/genesis/accountGenesis.js +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/keyring/kdf.d.ts +6 -20
- package/dist/keyring/kdf.d.ts.map +1 -1
- package/dist/keyring/kdf.js +8 -5
- package/dist/keyring/kdf.js.map +1 -1
- package/dist/keyring/unlockSpace.js +1 -1
- package/dist/keys/rosterLogStore.d.ts +16 -14
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +149 -32
- package/dist/keys/rosterLogStore.js.map +1 -1
- package/dist/keys/rosterStore.d.ts +8 -7
- package/dist/keys/rosterStore.d.ts.map +1 -1
- package/dist/keys/rosterStore.js +6 -6
- package/dist/keys/rosterStore.js.map +1 -1
- package/dist/keys/spaceEpochs.d.ts +1 -1
- package/dist/keys/spaceEpochs.js +1 -1
- package/dist/keys/userKeyRoster.d.ts +3 -3
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +3 -3
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/recovery/index.d.ts +2 -2
- package/dist/recovery/index.js +2 -2
- package/dist/recovery/recoveryDelegation.js +1 -1
- package/dist/recovery/recoveryDelegation.js.map +1 -1
- package/dist/recovery/recoveryWebvh.d.ts +4 -4
- package/dist/recovery/recoveryWebvh.js +5 -5
- package/dist/request/appKey.d.ts +9 -3
- package/dist/request/appKey.d.ts.map +1 -1
- package/dist/request/appKey.js +13 -8
- package/dist/request/appKey.js.map +1 -1
- package/dist/request/classify.d.ts.map +1 -1
- package/dist/request/classify.js +13 -1
- package/dist/request/classify.js.map +1 -1
- package/dist/request/ephemeralExchange.d.ts +6 -1
- package/dist/request/ephemeralExchange.d.ts.map +1 -1
- package/dist/request/ephemeralExchange.js +6 -1
- package/dist/request/ephemeralExchange.js.map +1 -1
- package/dist/request/exchangeClient.d.ts +0 -23
- package/dist/request/exchangeClient.d.ts.map +1 -1
- package/dist/request/exchangeClient.js +30 -1
- package/dist/request/exchangeClient.js.map +1 -1
- package/dist/request/index.d.ts +4 -1
- package/dist/request/index.d.ts.map +1 -1
- package/dist/request/index.js +4 -1
- package/dist/request/index.js.map +1 -1
- package/dist/request/interactionRequest.d.ts +23 -0
- package/dist/request/interactionRequest.d.ts.map +1 -0
- package/dist/request/interactionRequest.js +46 -0
- package/dist/request/interactionRequest.js.map +1 -0
- package/dist/request/interactionUrl.d.ts +3 -14
- package/dist/request/interactionUrl.d.ts.map +1 -1
- package/dist/request/interactionUrl.js +20 -1
- package/dist/request/interactionUrl.js.map +1 -1
- package/dist/resourceLog/controller.d.ts +48 -49
- package/dist/resourceLog/controller.d.ts.map +1 -1
- package/dist/resourceLog/controller.js +40 -20
- package/dist/resourceLog/controller.js.map +1 -1
- package/dist/resourceLog/errors.d.ts +12 -78
- package/dist/resourceLog/errors.d.ts.map +1 -1
- package/dist/resourceLog/errors.js +12 -79
- package/dist/resourceLog/errors.js.map +1 -1
- package/dist/resourceLog/index.d.ts +17 -22
- package/dist/resourceLog/index.d.ts.map +1 -1
- package/dist/resourceLog/index.js +16 -21
- package/dist/resourceLog/index.js.map +1 -1
- package/dist/resourceLog/license.d.ts +27 -26
- package/dist/resourceLog/license.d.ts.map +1 -1
- package/dist/resourceLog/license.js +31 -30
- package/dist/resourceLog/license.js.map +1 -1
- package/dist/unlock/index.d.ts +6 -6
- package/dist/unlock/index.d.ts.map +1 -1
- package/dist/unlock/index.js +5 -5
- package/dist/unlock/retire.d.ts +29 -28
- package/dist/unlock/retire.d.ts.map +1 -1
- package/dist/unlock/retire.js +25 -16
- package/dist/unlock/retire.js.map +1 -1
- package/dist/unlock/standingClient.d.ts +1 -1
- package/dist/unlock/standingClient.js +3 -3
- package/dist/unlock/standingWebvh.d.ts +28 -10
- package/dist/unlock/standingWebvh.d.ts.map +1 -1
- package/dist/unlock/standingWebvh.js +75 -37
- package/dist/unlock/standingWebvh.js.map +1 -1
- package/dist/unlock/unlockRecord.js +1 -1
- package/dist/webvh/delegatedLogStore.d.ts +2 -2
- package/dist/webvh/delegatedLogStore.js +2 -2
- package/dist/webvh/didWeb.js +1 -1
- package/dist/webvh/didWeb.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +3 -3
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +5 -5
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/listClients.js +1 -1
- package/dist/webvh/listClients.js.map +1 -1
- package/dist/webvh/verifyLog.d.ts +1 -1
- package/dist/webvh/verifyLog.d.ts.map +1 -1
- package/dist/webvh/verifyLog.js +1 -2
- package/dist/webvh/verifyLog.js.map +1 -1
- package/package.json +5 -9
- package/dist/display/alignment.d.ts +0 -55
- package/dist/display/alignment.d.ts.map +0 -1
- package/dist/display/alignment.js +0 -117
- package/dist/display/alignment.js.map +0 -1
- package/dist/display/credentialName.d.ts +0 -42
- package/dist/display/credentialName.d.ts.map +0 -1
- package/dist/display/credentialName.js +0 -106
- package/dist/display/credentialName.js.map +0 -1
- package/dist/display/displayFields.d.ts +0 -59
- package/dist/display/displayFields.d.ts.map +0 -1
- package/dist/display/displayFields.js +0 -136
- package/dist/display/displayFields.js.map +0 -1
- package/dist/display/evidence.d.ts +0 -50
- package/dist/display/evidence.d.ts.map +0 -1
- package/dist/display/evidence.js +0 -67
- package/dist/display/evidence.js.map +0 -1
- package/dist/display/image.d.ts +0 -18
- package/dist/display/image.d.ts.map +0 -1
- package/dist/display/image.js +0 -23
- package/dist/display/image.js.map +0 -1
- package/dist/display/index.d.ts +0 -38
- package/dist/display/index.d.ts.map +0 -1
- package/dist/display/index.js +0 -32
- package/dist/display/index.js.map +0 -1
- package/dist/display/issuer.d.ts +0 -105
- package/dist/display/issuer.d.ts.map +0 -1
- package/dist/display/issuer.js +0 -126
- package/dist/display/issuer.js.map +0 -1
- package/dist/display/obv3.d.ts +0 -82
- package/dist/display/obv3.d.ts.map +0 -1
- package/dist/display/obv3.js +0 -117
- package/dist/display/obv3.js.map +0 -1
- package/dist/display/parse.d.ts +0 -66
- package/dist/display/parse.d.ts.map +0 -1
- package/dist/display/parse.js +0 -104
- package/dist/display/parse.js.map +0 -1
- package/dist/display/subject.d.ts +0 -79
- package/dist/display/subject.d.ts.map +0 -1
- package/dist/display/subject.js +0 -124
- package/dist/display/subject.js.map +0 -1
- package/dist/display/text.d.ts +0 -53
- package/dist/display/text.d.ts.map +0 -1
- package/dist/display/text.js +0 -78
- package/dist/display/text.js.map +0 -1
- package/dist/display/types.d.ts +0 -55
- package/dist/display/types.d.ts.map +0 -1
- package/dist/display/types.js +0 -41
- package/dist/display/types.js.map +0 -1
- package/dist/display/validity.d.ts +0 -51
- package/dist/display/validity.d.ts.map +0 -1
- package/dist/display/validity.js +0 -51
- package/dist/display/validity.js.map +0 -1
- package/dist/display/verificationView.d.ts +0 -115
- package/dist/display/verificationView.d.ts.map +0 -1
- package/dist/display/verificationView.js +0 -199
- package/dist/display/verificationView.js.map +0 -1
- package/dist/resourceLog/append.d.ts +0 -112
- package/dist/resourceLog/append.d.ts.map +0 -1
- package/dist/resourceLog/append.js +0 -197
- package/dist/resourceLog/append.js.map +0 -1
- package/dist/resourceLog/entry.d.ts +0 -68
- package/dist/resourceLog/entry.d.ts.map +0 -1
- package/dist/resourceLog/entry.js +0 -167
- package/dist/resourceLog/entry.js.map +0 -1
- package/dist/resourceLog/pin.d.ts +0 -82
- package/dist/resourceLog/pin.d.ts.map +0 -1
- package/dist/resourceLog/pin.js +0 -57
- package/dist/resourceLog/pin.js.map +0 -1
- package/dist/resourceLog/seal.d.ts +0 -97
- package/dist/resourceLog/seal.d.ts.map +0 -1
- package/dist/resourceLog/seal.js +0 -113
- package/dist/resourceLog/seal.js.map +0 -1
- package/dist/resourceLog/verify.d.ts +0 -96
- package/dist/resourceLog/verify.d.ts.map +0 -1
- package/dist/resourceLog/verify.js +0 -474
- package/dist/resourceLog/verify.js.map +0 -1
- package/dist/resourceLog/vmFragment.d.ts +0 -33
- package/dist/resourceLog/vmFragment.d.ts.map +0 -1
- package/dist/resourceLog/vmFragment.js +0 -39
- package/dist/resourceLog/vmFragment.js.map +0 -1
package/dist/display/types.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Credential type predicates.
|
|
6
|
-
*
|
|
7
|
-
* Drift resolution: DCW and Freewallet disagreed on the resume check -- DCW's
|
|
8
|
-
* took a `credentialSubject` and did a case-insensitive SUBSTRING match on its
|
|
9
|
-
* `type`, while Freewallet's took the whole VC and did an exact
|
|
10
|
-
* `subject.type === 'Resume'`; and DCW's own callers passed the whole VC to the
|
|
11
|
-
* subject-typed function. Rather than pick one, TWO clearly-named functions are
|
|
12
|
-
* exposed:
|
|
13
|
-
*
|
|
14
|
-
* - `isResumeCredentialSubject(subject)` -- DCW's case-insensitive substring
|
|
15
|
-
* check over a subject's `type`.
|
|
16
|
-
* - `isResumeCredential(vc)` -- a vc-typed entry point that reads the subject's
|
|
17
|
-
* `type` off the VC and applies the same substring check, fixing both
|
|
18
|
-
* Freewallet's exact-match miss (`['...','Resume']`) and DCW's callers that
|
|
19
|
-
* passed a VC to a subject-typed function.
|
|
20
|
-
*
|
|
21
|
-
* `isEmploymentCredential` / `isVolunteerCredential` are DCW's, verbatim, over
|
|
22
|
-
* the VC's top-level `type`.
|
|
23
|
-
*/
|
|
24
|
-
import type { ICredentialSubject, IVerifiableCredential } from '@interop/data-integrity-core';
|
|
25
|
-
/**
|
|
26
|
-
* Whether a credential SUBJECT is a resume, by a case-insensitive substring
|
|
27
|
-
* match (`'resume'`) over its `type` (string or array).
|
|
28
|
-
*
|
|
29
|
-
* @param credentialSubject {ICredentialSubject}
|
|
30
|
-
* @returns {boolean}
|
|
31
|
-
*/
|
|
32
|
-
export declare function isResumeCredentialSubject(credentialSubject: ICredentialSubject): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Whether a CREDENTIAL is a resume, by applying the subject-level substring
|
|
35
|
-
* check to the VC's (first) subject `type`.
|
|
36
|
-
*
|
|
37
|
-
* @param vc {IVerifiableCredential}
|
|
38
|
-
* @returns {boolean}
|
|
39
|
-
*/
|
|
40
|
-
export declare function isResumeCredential(vc: IVerifiableCredential): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Whether a credential's top-level `type` includes `'EmploymentCredential'`.
|
|
43
|
-
*
|
|
44
|
-
* @param credential {IVerifiableCredential}
|
|
45
|
-
* @returns {boolean}
|
|
46
|
-
*/
|
|
47
|
-
export declare function isEmploymentCredential(credential: IVerifiableCredential): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Whether a credential's top-level `type` includes `'VolunteeringCredential'`.
|
|
50
|
-
*
|
|
51
|
-
* @param credential {IVerifiableCredential}
|
|
52
|
-
* @returns {boolean}
|
|
53
|
-
*/
|
|
54
|
-
export declare function isVolunteerCredential(credential: IVerifiableCredential): boolean;
|
|
55
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/display/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,8BAA8B,CAAA;AAIrC;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,iBAAiB,EAAE,kBAAkB,GACpC,OAAO,CAIT;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAET"}
|
package/dist/display/types.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { typeArray } from '@interop/data-integrity-core/guards';
|
|
2
|
-
import { getSubject } from './subject.js';
|
|
3
|
-
/**
|
|
4
|
-
* Whether a credential SUBJECT is a resume, by a case-insensitive substring
|
|
5
|
-
* match (`'resume'`) over its `type` (string or array).
|
|
6
|
-
*
|
|
7
|
-
* @param credentialSubject {ICredentialSubject}
|
|
8
|
-
* @returns {boolean}
|
|
9
|
-
*/
|
|
10
|
-
export function isResumeCredentialSubject(credentialSubject) {
|
|
11
|
-
return typeArray(credentialSubject?.type).some(type => type.toLowerCase().includes('resume'));
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Whether a CREDENTIAL is a resume, by applying the subject-level substring
|
|
15
|
-
* check to the VC's (first) subject `type`.
|
|
16
|
-
*
|
|
17
|
-
* @param vc {IVerifiableCredential}
|
|
18
|
-
* @returns {boolean}
|
|
19
|
-
*/
|
|
20
|
-
export function isResumeCredential(vc) {
|
|
21
|
-
return isResumeCredentialSubject(getSubject(vc));
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Whether a credential's top-level `type` includes `'EmploymentCredential'`.
|
|
25
|
-
*
|
|
26
|
-
* @param credential {IVerifiableCredential}
|
|
27
|
-
* @returns {boolean}
|
|
28
|
-
*/
|
|
29
|
-
export function isEmploymentCredential(credential) {
|
|
30
|
-
return typeArray(credential?.type).includes('EmploymentCredential');
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Whether a credential's top-level `type` includes `'VolunteeringCredential'`.
|
|
34
|
-
*
|
|
35
|
-
* @param credential {IVerifiableCredential}
|
|
36
|
-
* @returns {boolean}
|
|
37
|
-
*/
|
|
38
|
-
export function isVolunteerCredential(credential) {
|
|
39
|
-
return typeArray(credential?.type).includes('VolunteeringCredential');
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/display/types.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,iBAAqC;IAErC,OAAO,SAAS,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACpD,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACtC,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAyB;IAC1D,OAAO,yBAAyB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAA;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAiC;IAEjC,OAAO,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAA;AACrE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAiC;IAEjC,OAAO,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAA;AACvE,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Validity-period readers for both VC Data Model 1.0 (`issuanceDate` /
|
|
6
|
-
* `expirationDate`) and 2.0 (`validFrom` / `validUntil`). The library returns
|
|
7
|
-
* the raw ISO strings and a `Date` -- never a formatted string -- so each app
|
|
8
|
-
* applies its own locale formatting on top (the raw-values seam).
|
|
9
|
-
*
|
|
10
|
-
* Drift resolution: this is the union of DCW's `credentialValidityPeriod.ts`
|
|
11
|
-
* (which had `getIssuanceDate` / `getExpirationDate` / `isExpired` returning
|
|
12
|
-
* `undefined` when absent) and Freewallet's `formatDate.ts` (which had
|
|
13
|
-
* `getExpirationInstant` returning `Date | null`, plus an empty-string variant
|
|
14
|
-
* of `getExpirationDate`). DCW's `undefined` convention wins for the string
|
|
15
|
-
* getters; Freewallet's `''`-returning wrapper is trivially reproduced app-side
|
|
16
|
-
* as `getExpirationDate(vc) ?? ''`.
|
|
17
|
-
*/
|
|
18
|
-
import type { IVerifiableCredential } from '@interop/data-integrity-core';
|
|
19
|
-
/**
|
|
20
|
-
* The issuance instant as a raw ISO string: VC 2.0 `validFrom` preferred, else
|
|
21
|
-
* VC 1.0 `issuanceDate`, else `undefined`.
|
|
22
|
-
*
|
|
23
|
-
* @param credential {IVerifiableCredential}
|
|
24
|
-
* @returns {string | undefined}
|
|
25
|
-
*/
|
|
26
|
-
export declare function getIssuanceDate(credential: IVerifiableCredential): string | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* The expiration instant as a raw ISO string: VC 2.0 `validUntil` preferred,
|
|
29
|
-
* else VC 1.0 `expirationDate`, else `undefined`.
|
|
30
|
-
*
|
|
31
|
-
* @param credential {IVerifiableCredential}
|
|
32
|
-
* @returns {string | undefined}
|
|
33
|
-
*/
|
|
34
|
-
export declare function getExpirationDate(credential: IVerifiableCredential): string | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* The expiration instant as a `Date`, or `null` when there is no expiration or
|
|
37
|
-
* it does not parse.
|
|
38
|
-
*
|
|
39
|
-
* @param credential {IVerifiableCredential}
|
|
40
|
-
* @returns {Date | null}
|
|
41
|
-
*/
|
|
42
|
-
export declare function getExpirationInstant(credential: IVerifiableCredential): Date | null;
|
|
43
|
-
/**
|
|
44
|
-
* Whether the credential has an expiration date that is already in the past.
|
|
45
|
-
* A credential with no expiration is never expired.
|
|
46
|
-
*
|
|
47
|
-
* @param credential {IVerifiableCredential}
|
|
48
|
-
* @returns {boolean}
|
|
49
|
-
*/
|
|
50
|
-
export declare function isExpired(credential: IVerifiableCredential): boolean;
|
|
51
|
-
//# sourceMappingURL=validity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validity.d.ts","sourceRoot":"","sources":["../../src/display/validity.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEzE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,qBAAqB,GAChC,MAAM,GAAG,SAAS,CAEpB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,qBAAqB,GAChC,MAAM,GAAG,SAAS,CAEpB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,qBAAqB,GAChC,IAAI,GAAG,IAAI,CAOb;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAOpE"}
|
package/dist/display/validity.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The issuance instant as a raw ISO string: VC 2.0 `validFrom` preferred, else
|
|
3
|
-
* VC 1.0 `issuanceDate`, else `undefined`.
|
|
4
|
-
*
|
|
5
|
-
* @param credential {IVerifiableCredential}
|
|
6
|
-
* @returns {string | undefined}
|
|
7
|
-
*/
|
|
8
|
-
export function getIssuanceDate(credential) {
|
|
9
|
-
return credential.validFrom ?? credential.issuanceDate;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* The expiration instant as a raw ISO string: VC 2.0 `validUntil` preferred,
|
|
13
|
-
* else VC 1.0 `expirationDate`, else `undefined`.
|
|
14
|
-
*
|
|
15
|
-
* @param credential {IVerifiableCredential}
|
|
16
|
-
* @returns {string | undefined}
|
|
17
|
-
*/
|
|
18
|
-
export function getExpirationDate(credential) {
|
|
19
|
-
return credential.validUntil ?? credential.expirationDate;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* The expiration instant as a `Date`, or `null` when there is no expiration or
|
|
23
|
-
* it does not parse.
|
|
24
|
-
*
|
|
25
|
-
* @param credential {IVerifiableCredential}
|
|
26
|
-
* @returns {Date | null}
|
|
27
|
-
*/
|
|
28
|
-
export function getExpirationInstant(credential) {
|
|
29
|
-
const iso = getExpirationDate(credential);
|
|
30
|
-
if (!iso) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
const date = new Date(iso);
|
|
34
|
-
return Number.isNaN(date.getTime()) ? null : date;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Whether the credential has an expiration date that is already in the past.
|
|
38
|
-
* A credential with no expiration is never expired.
|
|
39
|
-
*
|
|
40
|
-
* @param credential {IVerifiableCredential}
|
|
41
|
-
* @returns {boolean}
|
|
42
|
-
*/
|
|
43
|
-
export function isExpired(credential) {
|
|
44
|
-
const expiration = getExpirationDate(credential);
|
|
45
|
-
if (!expiration) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
const timestamp = Date.parse(String(expiration));
|
|
49
|
-
return !Number.isNaN(timestamp) && timestamp < Date.now();
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=validity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validity.js","sourceRoot":"","sources":["../../src/display/validity.ts"],"names":[],"mappings":"AAmBA;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAiC;IAEjC,OAAO,UAAU,CAAC,SAAS,IAAI,UAAU,CAAC,YAAY,CAAA;AACxD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,UAAiC;IAEjC,OAAO,UAAU,CAAC,UAAU,IAAI,UAAU,CAAC,cAAc,CAAA;AAC3D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAiC;IAEjC,MAAM,GAAG,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAA;IACzC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAA;IAC1B,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AACnD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,UAAiC;IACzD,MAAM,UAAU,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAA;IAChD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;IAChD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;AAC3D,CAAC"}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Verification-to-UI derivation: pure readers over a `verifyCredential` result
|
|
6
|
-
* `log[]`. No conflict existed between the apps -- they read different things
|
|
7
|
-
* from the same log -- so both are extracted:
|
|
8
|
-
*
|
|
9
|
-
* - `buildVerificationChecklist` (Freewallet) builds the five-step
|
|
10
|
-
* supportedFormat / signature / issuer / revocation / expiration checklist,
|
|
11
|
-
* each `{ valid, message, status }`, plus the `getVerificationAggregateStatus`
|
|
12
|
-
* / `isFullyVerified` / `isExpiredOnly` / `hasVerificationWarning` rollups.
|
|
13
|
-
* - `issuerRecognizedByVerification` (backs DCW's `shouldDisableUrls`) reports
|
|
14
|
-
* whether the `registered_issuer` entry confirms a registry match.
|
|
15
|
-
*
|
|
16
|
-
* i18n stays OUT of the library: instead of Freewallet's injected `TFunction`
|
|
17
|
-
* or DCW's hardcoded English, `buildVerificationChecklist` takes an injected
|
|
18
|
-
* `labels` map keyed by {@link ChecklistMsgKey}. Each app supplies its own
|
|
19
|
-
* strings (Freewallet from `t(...)`, DCW its English literals).
|
|
20
|
-
*/
|
|
21
|
-
import type { IVerifiableCredential } from '@interop/data-integrity-core';
|
|
22
|
-
/**
|
|
23
|
-
* Per-step severity.
|
|
24
|
-
*/
|
|
25
|
-
export type VerificationStepStatus = 'positive' | 'warning' | 'negative';
|
|
26
|
-
/**
|
|
27
|
-
* One checklist step.
|
|
28
|
-
*/
|
|
29
|
-
export interface VerificationStep {
|
|
30
|
-
valid: boolean;
|
|
31
|
-
message: string;
|
|
32
|
-
status: VerificationStepStatus;
|
|
33
|
-
error?: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* The five-step checklist, with `expiry` / `status` legacy aliases.
|
|
37
|
-
*/
|
|
38
|
-
export interface VerificationChecklist {
|
|
39
|
-
supportedFormat: VerificationStep;
|
|
40
|
-
signature: VerificationStep;
|
|
41
|
-
issuer: VerificationStep;
|
|
42
|
-
revocation: VerificationStep;
|
|
43
|
-
expiration: VerificationStep;
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated Use `expiration`.
|
|
46
|
-
*/
|
|
47
|
-
expiry: VerificationStep;
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated Use `revocation`.
|
|
50
|
-
*/
|
|
51
|
-
status: VerificationStep;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Rolled-up verification outcome.
|
|
55
|
-
*/
|
|
56
|
-
export type VerificationAggregateStatus = 'verified' | 'warning' | 'not_verified';
|
|
57
|
-
/**
|
|
58
|
-
* The message keys `buildVerificationChecklist` looks up in the `labels` map.
|
|
59
|
-
*/
|
|
60
|
-
export type ChecklistMsgKey = 'supportedFormatOk' | 'supportedFormatFail' | 'signatureOk' | 'signatureFail' | 'issuerOk' | 'issuerFail' | 'revocationOk' | 'revocationFail' | 'expirationOk' | 'expirationFail' | 'noExpiration';
|
|
61
|
-
/**
|
|
62
|
-
* Builds the five-step verification checklist from a raw `verifyCredential`
|
|
63
|
-
* payload, the credential, and an injected `labels` map.
|
|
64
|
-
*
|
|
65
|
-
* @param raw {Record<string, unknown>} the raw verify result
|
|
66
|
-
* @param credential {IVerifiableCredential}
|
|
67
|
-
* @param labels {Record<ChecklistMsgKey, string>} localized message strings
|
|
68
|
-
* @returns {VerificationChecklist}
|
|
69
|
-
*/
|
|
70
|
-
export declare function buildVerificationChecklist(raw: Record<string, unknown>, credential: IVerifiableCredential, labels: Record<ChecklistMsgKey, string>): VerificationChecklist;
|
|
71
|
-
/**
|
|
72
|
-
* Rolls the checklist up to a single status. Hard failures (bad signature /
|
|
73
|
-
* format / revocation) yield `'not_verified'`; a soft issue (unknown issuer or
|
|
74
|
-
* expired) yields `'warning'`; otherwise `'verified'`.
|
|
75
|
-
*
|
|
76
|
-
* @param result {VerificationChecklist | null}
|
|
77
|
-
* @returns {VerificationAggregateStatus | null}
|
|
78
|
-
*/
|
|
79
|
-
export declare function getVerificationAggregateStatus(result: VerificationChecklist | null): VerificationAggregateStatus | null;
|
|
80
|
-
/**
|
|
81
|
-
* Whether every check passed.
|
|
82
|
-
*
|
|
83
|
-
* @param result {VerificationChecklist | null}
|
|
84
|
-
* @returns {boolean}
|
|
85
|
-
*/
|
|
86
|
-
export declare function isFullyVerified(result: VerificationChecklist | null): boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Whether the only failing check is expiration (everything else passed).
|
|
89
|
-
*
|
|
90
|
-
* @param result {VerificationChecklist | null}
|
|
91
|
-
* @returns {boolean}
|
|
92
|
-
*/
|
|
93
|
-
export declare function isExpiredOnly(result: VerificationChecklist | null): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Whether the aggregate status is a warning.
|
|
96
|
-
*
|
|
97
|
-
* @param result {VerificationChecklist | null}
|
|
98
|
-
* @returns {boolean}
|
|
99
|
-
*/
|
|
100
|
-
export declare function hasVerificationWarning(result: VerificationChecklist | null): boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Whether verification confirms a registered issuer: the `registered_issuer`
|
|
103
|
-
* log entry is valid and (when present) its `matchingIssuers` is non-empty.
|
|
104
|
-
* Backs DCW's `shouldDisableUrls` (a one-line app wrapper:
|
|
105
|
-
* `!issuerRecognizedByVerification(log)`).
|
|
106
|
-
*
|
|
107
|
-
* @param log {Array<{ id: string; valid?: boolean; matchingIssuers?: unknown[] }> | undefined}
|
|
108
|
-
* @returns {boolean}
|
|
109
|
-
*/
|
|
110
|
-
export declare function issuerRecognizedByVerification(log?: Array<{
|
|
111
|
-
id: string;
|
|
112
|
-
valid?: boolean;
|
|
113
|
-
matchingIssuers?: unknown[];
|
|
114
|
-
}>): boolean;
|
|
115
|
-
//# sourceMappingURL=verificationView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verificationView.d.ts","sourceRoot":"","sources":["../../src/display/verificationView.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAIzE;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAA;AAExE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,sBAAsB,CAAA;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,gBAAgB,CAAA;IACjC,SAAS,EAAE,gBAAgB,CAAA;IAC3B,MAAM,EAAE,gBAAgB,CAAA;IACxB,UAAU,EAAE,gBAAgB,CAAA;IAC5B,UAAU,EAAE,gBAAgB,CAAA;IAC5B;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAA;IACxB;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAA;CACzB;AAED;;GAEG;AACH,MAAM,MAAM,2BAA2B,GACrC,UAAU,GAAG,SAAS,GAAG,cAAc,CAAA;AAEzC;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,mBAAmB,GACnB,qBAAqB,GACrB,aAAa,GACb,eAAe,GACf,UAAU,GACV,YAAY,GACZ,cAAc,GACd,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,cAAc,CAAA;AAiKlB;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,UAAU,EAAE,qBAAqB,EACjC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,GACtC,qBAAqB,CA8BvB;AAED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,qBAAqB,GAAG,IAAI,GACnC,2BAA2B,GAAG,IAAI,CAmBpC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,GAAG,OAAO,CAE7E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,GAAG,OAAO,CAW3E;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,qBAAqB,GAAG,IAAI,GACnC,OAAO,CAET;AAED;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAC5C,GAAG,CAAC,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,EAAE,CAAA;CAAE,CAAC,GACxE,OAAO,CAcT"}
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { getExpirationInstant } from './validity.js';
|
|
2
|
-
import { typeArray } from '@interop/data-integrity-core/guards';
|
|
3
|
-
const STEP_ID = {
|
|
4
|
-
validSignature: 'valid_signature',
|
|
5
|
-
expiration: 'expiration',
|
|
6
|
-
revocation: 'revocation_status',
|
|
7
|
-
registeredIssuer: 'registered_issuer'
|
|
8
|
-
};
|
|
9
|
-
const SUPPORTED_CREDENTIAL_TYPES = [
|
|
10
|
-
'VerifiableCredential',
|
|
11
|
-
'OpenBadgeCredential'
|
|
12
|
-
];
|
|
13
|
-
function getVerifyLogFromPayload(raw) {
|
|
14
|
-
const results = raw.results;
|
|
15
|
-
const logFromFirstResult = results?.[0]?.log;
|
|
16
|
-
if (Array.isArray(logFromFirstResult)) {
|
|
17
|
-
return logFromFirstResult;
|
|
18
|
-
}
|
|
19
|
-
const topLevelLog = raw.log;
|
|
20
|
-
if (Array.isArray(topLevelLog)) {
|
|
21
|
-
return topLevelLog;
|
|
22
|
-
}
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
function step(valid, message, severity, error) {
|
|
26
|
-
return {
|
|
27
|
-
valid,
|
|
28
|
-
message,
|
|
29
|
-
status: severity,
|
|
30
|
-
...(error ? { error } : {})
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function logValid(entry) {
|
|
34
|
-
if (!entry) {
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
return entry.valid === true && !entry.error;
|
|
38
|
-
}
|
|
39
|
-
function supportedFormatStep(credential, labels) {
|
|
40
|
-
const hasKnownType = typeArray(credential.type).some(type => SUPPORTED_CREDENTIAL_TYPES.includes(type));
|
|
41
|
-
return step(hasKnownType, hasKnownType ? labels.supportedFormatOk : labels.supportedFormatFail, hasKnownType ? 'positive' : 'negative');
|
|
42
|
-
}
|
|
43
|
-
function signatureStep(entry, labels) {
|
|
44
|
-
const valid = logValid(entry) ?? false;
|
|
45
|
-
return step(valid, valid ? labels.signatureOk : labels.signatureFail, valid ? 'positive' : 'negative', entry?.error?.message);
|
|
46
|
-
}
|
|
47
|
-
function issuerStep(entry, labels) {
|
|
48
|
-
const valid = logValid(entry) ?? false;
|
|
49
|
-
return step(valid, valid ? labels.issuerOk : labels.issuerFail, valid ? 'positive' : 'warning', entry?.error?.message);
|
|
50
|
-
}
|
|
51
|
-
function revocationStep(entry, credential, labels) {
|
|
52
|
-
if (!credential.credentialStatus && !entry) {
|
|
53
|
-
return step(true, labels.revocationOk, 'positive');
|
|
54
|
-
}
|
|
55
|
-
const valid = logValid(entry) ?? true;
|
|
56
|
-
return step(valid, valid ? labels.revocationOk : labels.revocationFail, valid ? 'positive' : 'negative', entry?.error?.message);
|
|
57
|
-
}
|
|
58
|
-
function expirationStep(entry, credential, labels) {
|
|
59
|
-
const exp = getExpirationInstant(credential);
|
|
60
|
-
const hasExpirationDate = exp != null;
|
|
61
|
-
if (!hasExpirationDate && !entry) {
|
|
62
|
-
return step(true, labels.noExpiration, 'positive');
|
|
63
|
-
}
|
|
64
|
-
if (entry) {
|
|
65
|
-
const valid = logValid(entry) ?? false;
|
|
66
|
-
return step(valid, valid ? labels.expirationOk : labels.expirationFail, valid ? 'positive' : 'warning', entry.error?.message);
|
|
67
|
-
}
|
|
68
|
-
const expired = exp.getTime() < Date.now();
|
|
69
|
-
return step(!expired, expired ? labels.expirationFail : labels.expirationOk, expired ? 'warning' : 'positive');
|
|
70
|
-
}
|
|
71
|
-
function withGlobalErr(stepValue, globalErr) {
|
|
72
|
-
if (stepValue.valid || !globalErr) {
|
|
73
|
-
return stepValue;
|
|
74
|
-
}
|
|
75
|
-
return { ...stepValue, error: stepValue.error ?? globalErr };
|
|
76
|
-
}
|
|
77
|
-
function attachLegacyAliases(checklist) {
|
|
78
|
-
return {
|
|
79
|
-
...checklist,
|
|
80
|
-
expiry: checklist.expiration,
|
|
81
|
-
status: checklist.revocation
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Builds the five-step verification checklist from a raw `verifyCredential`
|
|
86
|
-
* payload, the credential, and an injected `labels` map.
|
|
87
|
-
*
|
|
88
|
-
* @param raw {Record<string, unknown>} the raw verify result
|
|
89
|
-
* @param credential {IVerifiableCredential}
|
|
90
|
-
* @param labels {Record<ChecklistMsgKey, string>} localized message strings
|
|
91
|
-
* @returns {VerificationChecklist}
|
|
92
|
-
*/
|
|
93
|
-
export function buildVerificationChecklist(raw, credential, labels) {
|
|
94
|
-
const log = getVerifyLogFromPayload(raw);
|
|
95
|
-
const byId = (id) => log.find(line => line.id === id);
|
|
96
|
-
const resultsWithError = raw.results;
|
|
97
|
-
const globalErr = typeof resultsWithError?.[0]?.error?.message === 'string'
|
|
98
|
-
? resultsWithError[0].error.message
|
|
99
|
-
: undefined;
|
|
100
|
-
const checklist = {
|
|
101
|
-
supportedFormat: supportedFormatStep(credential, labels),
|
|
102
|
-
signature: signatureStep(byId(STEP_ID.validSignature), labels),
|
|
103
|
-
issuer: issuerStep(byId(STEP_ID.registeredIssuer), labels),
|
|
104
|
-
revocation: revocationStep(byId(STEP_ID.revocation), credential, labels),
|
|
105
|
-
expiration: expirationStep(byId(STEP_ID.expiration), credential, labels)
|
|
106
|
-
};
|
|
107
|
-
if (!globalErr) {
|
|
108
|
-
return attachLegacyAliases(checklist);
|
|
109
|
-
}
|
|
110
|
-
return attachLegacyAliases({
|
|
111
|
-
supportedFormat: withGlobalErr(checklist.supportedFormat, globalErr),
|
|
112
|
-
signature: withGlobalErr(checklist.signature, globalErr),
|
|
113
|
-
issuer: withGlobalErr(checklist.issuer, globalErr),
|
|
114
|
-
revocation: withGlobalErr(checklist.revocation, globalErr),
|
|
115
|
-
expiration: withGlobalErr(checklist.expiration, globalErr)
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Rolls the checklist up to a single status. Hard failures (bad signature /
|
|
120
|
-
* format / revocation) yield `'not_verified'`; a soft issue (unknown issuer or
|
|
121
|
-
* expired) yields `'warning'`; otherwise `'verified'`.
|
|
122
|
-
*
|
|
123
|
-
* @param result {VerificationChecklist | null}
|
|
124
|
-
* @returns {VerificationAggregateStatus | null}
|
|
125
|
-
*/
|
|
126
|
-
export function getVerificationAggregateStatus(result) {
|
|
127
|
-
if (!result) {
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
const hasFailure = !result.signature.valid ||
|
|
131
|
-
!result.supportedFormat.valid ||
|
|
132
|
-
!result.revocation.valid;
|
|
133
|
-
const hasWarning = !result.issuer.valid || !result.expiration.valid;
|
|
134
|
-
if (hasFailure) {
|
|
135
|
-
return 'not_verified';
|
|
136
|
-
}
|
|
137
|
-
if (hasWarning) {
|
|
138
|
-
return 'warning';
|
|
139
|
-
}
|
|
140
|
-
return 'verified';
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Whether every check passed.
|
|
144
|
-
*
|
|
145
|
-
* @param result {VerificationChecklist | null}
|
|
146
|
-
* @returns {boolean}
|
|
147
|
-
*/
|
|
148
|
-
export function isFullyVerified(result) {
|
|
149
|
-
return getVerificationAggregateStatus(result) === 'verified';
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Whether the only failing check is expiration (everything else passed).
|
|
153
|
-
*
|
|
154
|
-
* @param result {VerificationChecklist | null}
|
|
155
|
-
* @returns {boolean}
|
|
156
|
-
*/
|
|
157
|
-
export function isExpiredOnly(result) {
|
|
158
|
-
if (!result) {
|
|
159
|
-
return false;
|
|
160
|
-
}
|
|
161
|
-
return (result.signature.valid &&
|
|
162
|
-
result.supportedFormat.valid &&
|
|
163
|
-
result.issuer.valid &&
|
|
164
|
-
result.revocation.valid &&
|
|
165
|
-
!result.expiration.valid);
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Whether the aggregate status is a warning.
|
|
169
|
-
*
|
|
170
|
-
* @param result {VerificationChecklist | null}
|
|
171
|
-
* @returns {boolean}
|
|
172
|
-
*/
|
|
173
|
-
export function hasVerificationWarning(result) {
|
|
174
|
-
return getVerificationAggregateStatus(result) === 'warning';
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Whether verification confirms a registered issuer: the `registered_issuer`
|
|
178
|
-
* log entry is valid and (when present) its `matchingIssuers` is non-empty.
|
|
179
|
-
* Backs DCW's `shouldDisableUrls` (a one-line app wrapper:
|
|
180
|
-
* `!issuerRecognizedByVerification(log)`).
|
|
181
|
-
*
|
|
182
|
-
* @param log {Array<{ id: string; valid?: boolean; matchingIssuers?: unknown[] }> | undefined}
|
|
183
|
-
* @returns {boolean}
|
|
184
|
-
*/
|
|
185
|
-
export function issuerRecognizedByVerification(log) {
|
|
186
|
-
if (!Array.isArray(log)) {
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
return log.some(entry => {
|
|
190
|
-
if (entry.id !== 'registered_issuer') {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
const { matchingIssuers } = entry;
|
|
194
|
-
return entry.valid && Array.isArray(matchingIssuers)
|
|
195
|
-
? matchingIssuers.length > 0
|
|
196
|
-
: Boolean(entry.valid);
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
//# sourceMappingURL=verificationView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verificationView.js","sourceRoot":"","sources":["../../src/display/verificationView.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAA;AA0D/D,MAAM,OAAO,GAAG;IACd,cAAc,EAAE,iBAAiB;IACjC,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,mBAAmB;IAC/B,gBAAgB,EAAE,mBAAmB;CAC7B,CAAA;AAEV,MAAM,0BAA0B,GAAG;IACjC,sBAAsB;IACtB,qBAAqB;CACtB,CAAA;AAQD,SAAS,uBAAuB,CAAC,GAA4B;IAC3D,MAAM,OAAO,GAAG,GAAG,CAAC,OAAiD,CAAA;IACrE,MAAM,kBAAkB,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAA;IAC5C,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACtC,OAAO,kBAAkB,CAAA;IAC3B,CAAC;IACD,MAAM,WAAW,GAAG,GAAG,CAAC,GAAG,CAAA;IAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QAC/B,OAAO,WAAwB,CAAA;IACjC,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AAED,SAAS,IAAI,CACX,KAAc,EACd,OAAe,EACf,QAAgC,EAChC,KAAc;IAEd,OAAO;QACL,KAAK;QACL,OAAO;QACP,MAAM,EAAE,QAAQ;QAChB,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KA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KAAK,CAAA;QACjC,OAAO,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC;YAClD,CAAC,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC;YAC5B,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { type ResourceLogEntry, type ResourceLogStore } from '@interop/was-client/log';
|
|
2
|
-
import type { ResourceLogController } from './controller.js';
|
|
3
|
-
import { type ResourceLogSigner } from './entry.js';
|
|
4
|
-
import type { ResourceLogPinStore } from './pin.js';
|
|
5
|
-
import { type VerifiedResourceLog } from './verify.js';
|
|
6
|
-
/**
|
|
7
|
-
* Reads and fully verifies a log through the store seam, advancing the
|
|
8
|
-
* chain-head pin. Resolves `null` when the log resource does not exist yet
|
|
9
|
-
* (the pre-genesis state). The one read entry point every consumer -- a
|
|
10
|
-
* login-time roster read, a pre-append verification, a first-contact
|
|
11
|
-
* bootstrap -- goes through, so the pin rules cannot be bypassed by reading
|
|
12
|
-
* around them.
|
|
13
|
-
*
|
|
14
|
-
* @param options {object}
|
|
15
|
-
* @param options.store {ResourceLogStore} the log's transport seam
|
|
16
|
-
* @param options.controller {ResourceLogController} the verified controller
|
|
17
|
-
* view
|
|
18
|
-
* @param options.expectedMethod {string} the format identifier expected
|
|
19
|
-
* (also confirming any `history` dispatch hint the caller followed)
|
|
20
|
-
* @param options.pinStore {ResourceLogPinStore} this client's pin for this
|
|
21
|
-
* log
|
|
22
|
-
* @param options.logId {string} the pin-slot key for this log, from
|
|
23
|
-
* `resourceLogPinId`
|
|
24
|
-
* @returns {Promise<{ verified: VerifiedResourceLog; etag?: string } | null>}
|
|
25
|
-
*/
|
|
26
|
-
export declare function readResourceLog({ store, controller, expectedMethod, pinStore, logId }: {
|
|
27
|
-
store: ResourceLogStore;
|
|
28
|
-
controller: ResourceLogController;
|
|
29
|
-
expectedMethod: string;
|
|
30
|
-
pinStore: ResourceLogPinStore;
|
|
31
|
-
logId: string;
|
|
32
|
-
}): Promise<{
|
|
33
|
-
verified: VerifiedResourceLog;
|
|
34
|
-
etag?: string;
|
|
35
|
-
} | null>;
|
|
36
|
-
/**
|
|
37
|
-
* Appends one state change: verify, build against the verified head, CAS,
|
|
38
|
-
* rebase-and-retry on conflict, confirm by read-back. `buildState` is the
|
|
39
|
-
* rebase hook -- it is called with the current verified log on every attempt
|
|
40
|
-
* and returns the full next state built on THAT head's state (or `null` to
|
|
41
|
-
* signal the change is already present, making a re-run converge instead of
|
|
42
|
-
* duplicating an entry). Refuses a log whose verified head is a terminal
|
|
43
|
-
* handover entry ({@link ResourceLogClosedError}).
|
|
44
|
-
*
|
|
45
|
-
* @param options {object}
|
|
46
|
-
* @param options.store {ResourceLogStore}
|
|
47
|
-
* @param options.controller {ResourceLogController}
|
|
48
|
-
* @param options.expectedMethod {string}
|
|
49
|
-
* @param options.pinStore {ResourceLogPinStore}
|
|
50
|
-
* @param options.logId {string} the pin-slot key for this log, from
|
|
51
|
-
* `resourceLogPinId`
|
|
52
|
-
* @param options.signer {ResourceLogSigner}
|
|
53
|
-
* @param options.buildState {function} `(verified) => state | null` -- the
|
|
54
|
-
* full next state rebased on the verified head, or `null` when the head
|
|
55
|
-
* already carries the change
|
|
56
|
-
* @param [options.versionTime] {string} RFC3339 UTC; defaults to now
|
|
57
|
-
* @param [options.maxAttempts] {number} CAS attempts before giving up
|
|
58
|
-
* (default 3)
|
|
59
|
-
* @returns {Promise<VerifiedResourceLog>} the read-back, re-verified log
|
|
60
|
-
* (whether or not this call appended)
|
|
61
|
-
*/
|
|
62
|
-
export declare function appendResourceLog({ store, controller, expectedMethod, pinStore, logId, signer, buildState, versionTime, maxAttempts }: {
|
|
63
|
-
store: ResourceLogStore;
|
|
64
|
-
controller: ResourceLogController;
|
|
65
|
-
expectedMethod: string;
|
|
66
|
-
pinStore: ResourceLogPinStore;
|
|
67
|
-
logId: string;
|
|
68
|
-
signer: ResourceLogSigner;
|
|
69
|
-
buildState: (verified: VerifiedResourceLog) => Promise<ResourceLogEntry['state'] | null> | ResourceLogEntry['state'] | null;
|
|
70
|
-
versionTime?: string;
|
|
71
|
-
maxAttempts?: number;
|
|
72
|
-
}): Promise<VerifiedResourceLog>;
|
|
73
|
-
/**
|
|
74
|
-
* Creates a log with its genesis entry, guarded create-if-absent, and
|
|
75
|
-
* confirms by read-back. Losing the create race to a concurrent provisioner
|
|
76
|
-
* adopts the winner's log (the create is CAS, never clobbering): the served
|
|
77
|
-
* log is verified and pinned, and the caller reconciles its intended state
|
|
78
|
-
* through an ordinary {@link appendResourceLog}. First contact is where the
|
|
79
|
-
* pin is established, so the pin store is written either way.
|
|
80
|
-
*
|
|
81
|
-
* @param options {object}
|
|
82
|
-
* @param options.store {ResourceLogStore}
|
|
83
|
-
* @param options.controller {ResourceLogController}
|
|
84
|
-
* @param options.method {string} the format identifier to declare
|
|
85
|
-
* @param options.pinStore {ResourceLogPinStore}
|
|
86
|
-
* @param options.logId {string} the pin-slot key for this log, from
|
|
87
|
-
* `resourceLogPinId`
|
|
88
|
-
* @param options.signer {ResourceLogSigner}
|
|
89
|
-
* @param options.state {ResourceLogEntry['state']} the full initial state
|
|
90
|
-
* @param [options.previousLog] {object} handover successors only
|
|
91
|
-
* @param [options.versionTime] {string} RFC3339 UTC; defaults to now
|
|
92
|
-
* @returns {Promise<{ verified: VerifiedResourceLog; created: boolean }>}
|
|
93
|
-
* the verified log as it now stands, and whether this call created it
|
|
94
|
-
*/
|
|
95
|
-
export declare function createResourceLog({ store, controller, method, pinStore, logId, signer, state, previousLog, versionTime }: {
|
|
96
|
-
store: ResourceLogStore;
|
|
97
|
-
controller: ResourceLogController;
|
|
98
|
-
method: string;
|
|
99
|
-
pinStore: ResourceLogPinStore;
|
|
100
|
-
logId: string;
|
|
101
|
-
signer: ResourceLogSigner;
|
|
102
|
-
state: ResourceLogEntry['state'];
|
|
103
|
-
previousLog?: {
|
|
104
|
-
scid: string;
|
|
105
|
-
head: string;
|
|
106
|
-
};
|
|
107
|
-
versionTime?: string;
|
|
108
|
-
}): Promise<{
|
|
109
|
-
verified: VerifiedResourceLog;
|
|
110
|
-
created: boolean;
|
|
111
|
-
}>;
|
|
112
|
-
//# sourceMappingURL=append.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"append.d.ts","sourceRoot":"","sources":["../../src/resourceLog/append.ts"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAE5D,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAqB,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEzE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,eAAe,CAAC,EACpC,KAAK,EACL,UAAU,EACV,cAAc,EACd,QAAQ,EACR,KAAK,EACN,EAAE;IACD,KAAK,EAAE,gBAAgB,CAAA;IACvB,UAAU,EAAE,qBAAqB,CAAA;IACjC,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,KAAK,EAAE,MAAM,CAAA;CACd,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,mBAAmB,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAcnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,KAAK,EACL,UAAU,EACV,cAAc,EACd,QAAQ,EACR,KAAK,EACL,MAAM,EACN,UAAU,EACV,WAAW,EACX,WAAe,EAChB,EAAE;IACD,KAAK,E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