@sphereon/ssi-types 0.18.2-next.9 → 0.18.2-unstable.13
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/LICENSE +201 -201
- package/README.md +49 -49
- package/dist/index.d.ts +3 -3
- package/dist/index.js +19 -19
- package/dist/mapper/credential-mapper.d.ts +107 -107
- package/dist/mapper/credential-mapper.js +556 -556
- package/dist/mapper/index.d.ts +1 -1
- package/dist/mapper/index.js +17 -17
- package/dist/types/did.d.ts +35 -35
- package/dist/types/did.js +75 -75
- package/dist/types/generic.d.ts +7 -7
- package/dist/types/generic.js +2 -2
- package/dist/types/index.d.ts +6 -6
- package/dist/types/index.js +22 -22
- package/dist/types/pex.d.ts +35 -35
- package/dist/types/pex.js +2 -2
- package/dist/types/sd-jwt-vc.d.ts +170 -170
- package/dist/types/sd-jwt-vc.js +71 -71
- package/dist/types/vc.d.ts +23 -23
- package/dist/types/vc.js +23 -23
- package/dist/types/w3c-vc.d.ts +247 -247
- package/dist/types/w3c-vc.js +29 -29
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +17 -17
- package/dist/utils/object.d.ts +6 -6
- package/dist/utils/object.js +20 -20
- package/package.json +2 -2
- package/src/index.ts +3 -3
- package/src/mapper/credential-mapper.ts +686 -686
- package/src/mapper/index.ts +1 -1
- package/src/types/generic.ts +8 -8
- package/src/types/index.ts +6 -6
- package/src/types/pex.ts +36 -36
- package/src/types/sd-jwt-vc.ts +232 -232
- package/src/types/vc.ts +62 -62
- package/src/types/w3c-vc.ts +300 -300
- package/src/utils/index.ts +1 -1
- package/src/utils/object.ts +19 -19
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
import { DocumentFormat, IPresentation, IVerifiableCredential, IVerifiablePresentation, JwtDecodedVerifiableCredential, JwtDecodedVerifiablePresentation, OriginalVerifiableCredential, OriginalVerifiablePresentation, UniformVerifiablePresentation, W3CVerifiableCredential, W3CVerifiablePresentation, WrappedVerifiableCredential, WrappedVerifiablePresentation, SdJwtDecodedVerifiableCredential, SdJwtDecodedVerifiableCredentialPayload, ICredential, isWrappedSdJwtVerifiableCredential, isWrappedSdJwtVerifiablePresentation, isWrappedW3CVerifiableCredential, isWrappedW3CVerifiablePresentation, Hasher, AsyncHasher } from '../types';
|
|
2
|
-
export declare class CredentialMapper {
|
|
3
|
-
/**
|
|
4
|
-
* Decodes a compact SD-JWT vc to it's decoded variant. This method can be used when the hasher implementation used is Async, and therefore not suitable for usage
|
|
5
|
-
* with the other decode methods.
|
|
6
|
-
*/
|
|
7
|
-
static decodeSdJwtVcAsync(compactSdJwtVc: string, hasher: AsyncHasher): Promise<SdJwtDecodedVerifiableCredential>;
|
|
8
|
-
/**
|
|
9
|
-
* Decodes a Verifiable Presentation to a uniform format.
|
|
10
|
-
*
|
|
11
|
-
* When decoding SD-JWT credentials, a hasher implementation must be provided. The hasher implementation must be sync. When using
|
|
12
|
-
* an async hasher implementation, use the decodeSdJwtVcAsync method instead and you can provide the decoded payload to methods
|
|
13
|
-
* instead of the compact SD-JWT.
|
|
14
|
-
*
|
|
15
|
-
* @param hasher Hasher implementation to use for SD-JWT decoding.
|
|
16
|
-
*/
|
|
17
|
-
static decodeVerifiablePresentation(presentation: OriginalVerifiablePresentation, hasher?: Hasher): JwtDecodedVerifiablePresentation | IVerifiablePresentation | SdJwtDecodedVerifiableCredential;
|
|
18
|
-
/**
|
|
19
|
-
* Decodes a Verifiable Credential to a uniform format.
|
|
20
|
-
*
|
|
21
|
-
* When decoding SD-JWT credentials, a hasher implementation must be provided. The hasher implementation must be sync. When using
|
|
22
|
-
* an async hasher implementation, use the decodeSdJwtVcAsync method instead and you can provide the decoded payload to methods
|
|
23
|
-
* instead of the compact SD-JWT.
|
|
24
|
-
*
|
|
25
|
-
* @param hasher Hasher implementation to use for SD-JWT decoding
|
|
26
|
-
*/
|
|
27
|
-
static decodeVerifiableCredential(credential: OriginalVerifiableCredential, hasher?: Hasher): JwtDecodedVerifiableCredential | IVerifiableCredential | SdJwtDecodedVerifiableCredential;
|
|
28
|
-
/**
|
|
29
|
-
* Converts a presentation to a wrapped presentation.
|
|
30
|
-
*
|
|
31
|
-
* When decoding SD-JWT credentials, a hasher implementation must be provided. The hasher implementation must be sync. When using
|
|
32
|
-
* an async hasher implementation, use the decodeSdJwtVcAsync method instead and you can provide the decoded payload to methods
|
|
33
|
-
* instead of the compact SD-JWT.
|
|
34
|
-
*
|
|
35
|
-
* @param hasher Hasher implementation to use for SD-JWT decoding
|
|
36
|
-
*/
|
|
37
|
-
static toWrappedVerifiablePresentation(originalPresentation: OriginalVerifiablePresentation, opts?: {
|
|
38
|
-
maxTimeSkewInMS?: number;
|
|
39
|
-
hasher?: Hasher;
|
|
40
|
-
}): WrappedVerifiablePresentation;
|
|
41
|
-
/**
|
|
42
|
-
* Converts a list of credentials to a list of wrapped credentials.
|
|
43
|
-
*
|
|
44
|
-
* When decoding SD-JWT credentials, a hasher implementation must be provided. The hasher implementation must be sync. When using
|
|
45
|
-
* an async hasher implementation, use the decodeSdJwtVcAsync method instead and you can provide the decoded payload to methods
|
|
46
|
-
* instead of the compact SD-JWT.
|
|
47
|
-
*
|
|
48
|
-
* @param hasher Hasher implementation to use for SD-JWT decoding
|
|
49
|
-
*/
|
|
50
|
-
static toWrappedVerifiableCredentials(verifiableCredentials: OriginalVerifiableCredential[], opts?: {
|
|
51
|
-
maxTimeSkewInMS?: number;
|
|
52
|
-
hasher?: Hasher;
|
|
53
|
-
}): WrappedVerifiableCredential[];
|
|
54
|
-
/**
|
|
55
|
-
* Converts a credential to a wrapped credential.
|
|
56
|
-
*
|
|
57
|
-
* When decoding SD-JWT credentials, a hasher implementation must be provided. The hasher implementation must be sync. When using
|
|
58
|
-
* an async hasher implementation, use the decodeSdJwtVcAsync method instead and you can provide the decoded payload to methods
|
|
59
|
-
* instead of the compact SD-JWT.
|
|
60
|
-
*
|
|
61
|
-
* @param hasher Hasher implementation to use for SD-JWT decoding
|
|
62
|
-
*/
|
|
63
|
-
static toWrappedVerifiableCredential(verifiableCredential: OriginalVerifiableCredential, opts?: {
|
|
64
|
-
maxTimeSkewInMS?: number;
|
|
65
|
-
hasher?: Hasher;
|
|
66
|
-
}): WrappedVerifiableCredential;
|
|
67
|
-
static isJwtEncoded(original: OriginalVerifiableCredential | OriginalVerifiablePresentation): original is string;
|
|
68
|
-
static isSdJwtEncoded(original: OriginalVerifiableCredential | OriginalVerifiablePresentation): original is string;
|
|
69
|
-
static isW3cCredential(credential: ICredential | SdJwtDecodedVerifiableCredential): credential is ICredential;
|
|
70
|
-
static isW3cPresentation(presentation: UniformVerifiablePresentation | IPresentation | SdJwtDecodedVerifiableCredential): presentation is IPresentation;
|
|
71
|
-
static isSdJwtDecodedCredentialPayload(credential: ICredential | SdJwtDecodedVerifiableCredentialPayload): credential is SdJwtDecodedVerifiableCredentialPayload;
|
|
72
|
-
static areOriginalVerifiableCredentialsEqual(firstOriginal: OriginalVerifiableCredential, secondOriginal: OriginalVerifiableCredential): boolean;
|
|
73
|
-
private static isJsonLdAsString;
|
|
74
|
-
static isSdJwtDecodedCredential(original: OriginalVerifiableCredential | OriginalVerifiablePresentation | ICredential | IPresentation): original is SdJwtDecodedVerifiableCredential;
|
|
75
|
-
static isJwtDecodedCredential(original: OriginalVerifiableCredential): original is JwtDecodedVerifiableCredential;
|
|
76
|
-
static isJwtDecodedPresentation(original: OriginalVerifiablePresentation): original is JwtDecodedVerifiablePresentation;
|
|
77
|
-
static isWrappedSdJwtVerifiableCredential: typeof isWrappedSdJwtVerifiableCredential;
|
|
78
|
-
static isWrappedSdJwtVerifiablePresentation: typeof isWrappedSdJwtVerifiablePresentation;
|
|
79
|
-
static isWrappedW3CVerifiableCredential: typeof isWrappedW3CVerifiableCredential;
|
|
80
|
-
static isWrappedW3CVerifiablePresentation: typeof isWrappedW3CVerifiablePresentation;
|
|
81
|
-
static jwtEncodedPresentationToUniformPresentation(jwt: string, makeCredentialsUniform?: boolean, opts?: {
|
|
82
|
-
maxTimeSkewInMS?: number;
|
|
83
|
-
}): IPresentation;
|
|
84
|
-
static jwtDecodedPresentationToUniformPresentation(decoded: JwtDecodedVerifiablePresentation, makeCredentialsUniform?: boolean, opts?: {
|
|
85
|
-
maxTimeSkewInMS?: number;
|
|
86
|
-
}): IVerifiablePresentation;
|
|
87
|
-
static toUniformCredential(verifiableCredential: OriginalVerifiableCredential, opts?: {
|
|
88
|
-
maxTimeSkewInMS?: number;
|
|
89
|
-
}): IVerifiableCredential;
|
|
90
|
-
static toUniformPresentation(presentation: OriginalVerifiablePresentation, opts?: {
|
|
91
|
-
maxTimeSkewInMS?: number;
|
|
92
|
-
addContextIfMissing?: boolean;
|
|
93
|
-
}): IVerifiablePresentation;
|
|
94
|
-
static jwtEncodedCredentialToUniformCredential(jwt: string, opts?: {
|
|
95
|
-
maxTimeSkewInMS?: number;
|
|
96
|
-
}): IVerifiableCredential;
|
|
97
|
-
static jwtDecodedCredentialToUniformCredential(decoded: JwtDecodedVerifiableCredential, opts?: {
|
|
98
|
-
maxTimeSkewInMS?: number;
|
|
99
|
-
}): IVerifiableCredential;
|
|
100
|
-
static toExternalVerifiableCredential(verifiableCredential: any): IVerifiableCredential;
|
|
101
|
-
static storedCredentialToOriginalFormat(credential: OriginalVerifiableCredential): W3CVerifiableCredential;
|
|
102
|
-
static storedPresentationToOriginalFormat(presentation: OriginalVerifiablePresentation): W3CVerifiablePresentation;
|
|
103
|
-
static toCompactJWT(jwtDocument: W3CVerifiableCredential | JwtDecodedVerifiableCredential | W3CVerifiablePresentation | JwtDecodedVerifiablePresentation | string): string;
|
|
104
|
-
static detectDocumentType(document: W3CVerifiableCredential | W3CVerifiablePresentation | JwtDecodedVerifiableCredential | JwtDecodedVerifiablePresentation | SdJwtDecodedVerifiableCredential): DocumentFormat;
|
|
105
|
-
private static hasJWTProofType;
|
|
106
|
-
private static getFirstProof;
|
|
107
|
-
}
|
|
1
|
+
import { DocumentFormat, IPresentation, IVerifiableCredential, IVerifiablePresentation, JwtDecodedVerifiableCredential, JwtDecodedVerifiablePresentation, OriginalVerifiableCredential, OriginalVerifiablePresentation, UniformVerifiablePresentation, W3CVerifiableCredential, W3CVerifiablePresentation, WrappedVerifiableCredential, WrappedVerifiablePresentation, SdJwtDecodedVerifiableCredential, SdJwtDecodedVerifiableCredentialPayload, ICredential, isWrappedSdJwtVerifiableCredential, isWrappedSdJwtVerifiablePresentation, isWrappedW3CVerifiableCredential, isWrappedW3CVerifiablePresentation, Hasher, AsyncHasher } from '../types';
|
|
2
|
+
export declare class CredentialMapper {
|
|
3
|
+
/**
|
|
4
|
+
* Decodes a compact SD-JWT vc to it's decoded variant. This method can be used when the hasher implementation used is Async, and therefore not suitable for usage
|
|
5
|
+
* with the other decode methods.
|
|
6
|
+
*/
|
|
7
|
+
static decodeSdJwtVcAsync(compactSdJwtVc: string, hasher: AsyncHasher): Promise<SdJwtDecodedVerifiableCredential>;
|
|
8
|
+
/**
|
|
9
|
+
* Decodes a Verifiable Presentation to a uniform format.
|
|
10
|
+
*
|
|
11
|
+
* When decoding SD-JWT credentials, a hasher implementation must be provided. The hasher implementation must be sync. When using
|
|
12
|
+
* an async hasher implementation, use the decodeSdJwtVcAsync method instead and you can provide the decoded payload to methods
|
|
13
|
+
* instead of the compact SD-JWT.
|
|
14
|
+
*
|
|
15
|
+
* @param hasher Hasher implementation to use for SD-JWT decoding.
|
|
16
|
+
*/
|
|
17
|
+
static decodeVerifiablePresentation(presentation: OriginalVerifiablePresentation, hasher?: Hasher): JwtDecodedVerifiablePresentation | IVerifiablePresentation | SdJwtDecodedVerifiableCredential;
|
|
18
|
+
/**
|
|
19
|
+
* Decodes a Verifiable Credential to a uniform format.
|
|
20
|
+
*
|
|
21
|
+
* When decoding SD-JWT credentials, a hasher implementation must be provided. The hasher implementation must be sync. When using
|
|
22
|
+
* an async hasher implementation, use the decodeSdJwtVcAsync method instead and you can provide the decoded payload to methods
|
|
23
|
+
* instead of the compact SD-JWT.
|
|
24
|
+
*
|
|
25
|
+
* @param hasher Hasher implementation to use for SD-JWT decoding
|
|
26
|
+
*/
|
|
27
|
+
static decodeVerifiableCredential(credential: OriginalVerifiableCredential, hasher?: Hasher): JwtDecodedVerifiableCredential | IVerifiableCredential | SdJwtDecodedVerifiableCredential;
|
|
28
|
+
/**
|
|
29
|
+
* Converts a presentation to a wrapped presentation.
|
|
30
|
+
*
|
|
31
|
+
* When decoding SD-JWT credentials, a hasher implementation must be provided. The hasher implementation must be sync. When using
|
|
32
|
+
* an async hasher implementation, use the decodeSdJwtVcAsync method instead and you can provide the decoded payload to methods
|
|
33
|
+
* instead of the compact SD-JWT.
|
|
34
|
+
*
|
|
35
|
+
* @param hasher Hasher implementation to use for SD-JWT decoding
|
|
36
|
+
*/
|
|
37
|
+
static toWrappedVerifiablePresentation(originalPresentation: OriginalVerifiablePresentation, opts?: {
|
|
38
|
+
maxTimeSkewInMS?: number;
|
|
39
|
+
hasher?: Hasher;
|
|
40
|
+
}): WrappedVerifiablePresentation;
|
|
41
|
+
/**
|
|
42
|
+
* Converts a list of credentials to a list of wrapped credentials.
|
|
43
|
+
*
|
|
44
|
+
* When decoding SD-JWT credentials, a hasher implementation must be provided. The hasher implementation must be sync. When using
|
|
45
|
+
* an async hasher implementation, use the decodeSdJwtVcAsync method instead and you can provide the decoded payload to methods
|
|
46
|
+
* instead of the compact SD-JWT.
|
|
47
|
+
*
|
|
48
|
+
* @param hasher Hasher implementation to use for SD-JWT decoding
|
|
49
|
+
*/
|
|
50
|
+
static toWrappedVerifiableCredentials(verifiableCredentials: OriginalVerifiableCredential[], opts?: {
|
|
51
|
+
maxTimeSkewInMS?: number;
|
|
52
|
+
hasher?: Hasher;
|
|
53
|
+
}): WrappedVerifiableCredential[];
|
|
54
|
+
/**
|
|
55
|
+
* Converts a credential to a wrapped credential.
|
|
56
|
+
*
|
|
57
|
+
* When decoding SD-JWT credentials, a hasher implementation must be provided. The hasher implementation must be sync. When using
|
|
58
|
+
* an async hasher implementation, use the decodeSdJwtVcAsync method instead and you can provide the decoded payload to methods
|
|
59
|
+
* instead of the compact SD-JWT.
|
|
60
|
+
*
|
|
61
|
+
* @param hasher Hasher implementation to use for SD-JWT decoding
|
|
62
|
+
*/
|
|
63
|
+
static toWrappedVerifiableCredential(verifiableCredential: OriginalVerifiableCredential, opts?: {
|
|
64
|
+
maxTimeSkewInMS?: number;
|
|
65
|
+
hasher?: Hasher;
|
|
66
|
+
}): WrappedVerifiableCredential;
|
|
67
|
+
static isJwtEncoded(original: OriginalVerifiableCredential | OriginalVerifiablePresentation): original is string;
|
|
68
|
+
static isSdJwtEncoded(original: OriginalVerifiableCredential | OriginalVerifiablePresentation): original is string;
|
|
69
|
+
static isW3cCredential(credential: ICredential | SdJwtDecodedVerifiableCredential): credential is ICredential;
|
|
70
|
+
static isW3cPresentation(presentation: UniformVerifiablePresentation | IPresentation | SdJwtDecodedVerifiableCredential): presentation is IPresentation;
|
|
71
|
+
static isSdJwtDecodedCredentialPayload(credential: ICredential | SdJwtDecodedVerifiableCredentialPayload): credential is SdJwtDecodedVerifiableCredentialPayload;
|
|
72
|
+
static areOriginalVerifiableCredentialsEqual(firstOriginal: OriginalVerifiableCredential, secondOriginal: OriginalVerifiableCredential): boolean;
|
|
73
|
+
private static isJsonLdAsString;
|
|
74
|
+
static isSdJwtDecodedCredential(original: OriginalVerifiableCredential | OriginalVerifiablePresentation | ICredential | IPresentation): original is SdJwtDecodedVerifiableCredential;
|
|
75
|
+
static isJwtDecodedCredential(original: OriginalVerifiableCredential): original is JwtDecodedVerifiableCredential;
|
|
76
|
+
static isJwtDecodedPresentation(original: OriginalVerifiablePresentation): original is JwtDecodedVerifiablePresentation;
|
|
77
|
+
static isWrappedSdJwtVerifiableCredential: typeof isWrappedSdJwtVerifiableCredential;
|
|
78
|
+
static isWrappedSdJwtVerifiablePresentation: typeof isWrappedSdJwtVerifiablePresentation;
|
|
79
|
+
static isWrappedW3CVerifiableCredential: typeof isWrappedW3CVerifiableCredential;
|
|
80
|
+
static isWrappedW3CVerifiablePresentation: typeof isWrappedW3CVerifiablePresentation;
|
|
81
|
+
static jwtEncodedPresentationToUniformPresentation(jwt: string, makeCredentialsUniform?: boolean, opts?: {
|
|
82
|
+
maxTimeSkewInMS?: number;
|
|
83
|
+
}): IPresentation;
|
|
84
|
+
static jwtDecodedPresentationToUniformPresentation(decoded: JwtDecodedVerifiablePresentation, makeCredentialsUniform?: boolean, opts?: {
|
|
85
|
+
maxTimeSkewInMS?: number;
|
|
86
|
+
}): IVerifiablePresentation;
|
|
87
|
+
static toUniformCredential(verifiableCredential: OriginalVerifiableCredential, opts?: {
|
|
88
|
+
maxTimeSkewInMS?: number;
|
|
89
|
+
}): IVerifiableCredential;
|
|
90
|
+
static toUniformPresentation(presentation: OriginalVerifiablePresentation, opts?: {
|
|
91
|
+
maxTimeSkewInMS?: number;
|
|
92
|
+
addContextIfMissing?: boolean;
|
|
93
|
+
}): IVerifiablePresentation;
|
|
94
|
+
static jwtEncodedCredentialToUniformCredential(jwt: string, opts?: {
|
|
95
|
+
maxTimeSkewInMS?: number;
|
|
96
|
+
}): IVerifiableCredential;
|
|
97
|
+
static jwtDecodedCredentialToUniformCredential(decoded: JwtDecodedVerifiableCredential, opts?: {
|
|
98
|
+
maxTimeSkewInMS?: number;
|
|
99
|
+
}): IVerifiableCredential;
|
|
100
|
+
static toExternalVerifiableCredential(verifiableCredential: any): IVerifiableCredential;
|
|
101
|
+
static storedCredentialToOriginalFormat(credential: OriginalVerifiableCredential): W3CVerifiableCredential;
|
|
102
|
+
static storedPresentationToOriginalFormat(presentation: OriginalVerifiablePresentation): W3CVerifiablePresentation;
|
|
103
|
+
static toCompactJWT(jwtDocument: W3CVerifiableCredential | JwtDecodedVerifiableCredential | W3CVerifiablePresentation | JwtDecodedVerifiablePresentation | string): string;
|
|
104
|
+
static detectDocumentType(document: W3CVerifiableCredential | W3CVerifiablePresentation | JwtDecodedVerifiableCredential | JwtDecodedVerifiablePresentation | SdJwtDecodedVerifiableCredential): DocumentFormat;
|
|
105
|
+
private static hasJWTProofType;
|
|
106
|
+
private static getFirstProof;
|
|
107
|
+
}
|
|
108
108
|
//# sourceMappingURL=credential-mapper.d.ts.map
|