gdc-common-utils-ts 1.0.5 → 1.0.8
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/AesManager.d.ts +27 -0
- package/dist/AesManager.js +62 -0
- package/dist/CryptographyService.d.ts +76 -0
- package/dist/CryptographyService.js +403 -0
- package/dist/constants/Schemas.d.ts +45 -0
- package/dist/constants/Schemas.js +48 -0
- package/dist/constants/index.js +1 -0
- package/{src/constants/schemaorg.ts → dist/constants/schemaorg.d.ts} +24 -116
- package/dist/constants/schemaorg.js +185 -0
- package/dist/cryptoDecode.d.ts +3 -0
- package/dist/cryptoDecode.js +90 -0
- package/dist/cryptoEncode.d.ts +1 -0
- package/dist/cryptoEncode.js +30 -0
- package/dist/cryptography.abstract.d.ts +13 -0
- package/{src/cryptography.abstract.ts → dist/cryptography.abstract.js} +6 -14
- package/dist/hmac.d.ts +2 -0
- package/{src/hmac.ts → dist/hmac.js} +4 -7
- package/dist/index.js +3 -0
- package/{src/interfaces/Cryptography.types.ts → dist/interfaces/Cryptography.types.d.ts} +71 -71
- package/dist/interfaces/Cryptography.types.js +8 -0
- package/dist/interfaces/ICryptoHelper.d.ts +28 -0
- package/dist/interfaces/ICryptoHelper.js +3 -0
- package/dist/interfaces/ICryptography.d.ts +154 -0
- package/dist/interfaces/ICryptography.js +3 -0
- package/dist/interfaces/IWallet.d.ts +55 -0
- package/dist/interfaces/IWallet.js +3 -0
- package/dist/interfaces/MlDsa.d.ts +9 -0
- package/{src/interfaces/MlDsa.ts → dist/interfaces/MlDsa.js} +1 -5
- package/dist/interfaces/MlKem.d.ts +11 -0
- package/{src/interfaces/MlKem.ts → dist/interfaces/MlKem.js} +0 -5
- package/dist/models/aes.d.ts +85 -0
- package/dist/models/aes.js +10 -0
- package/dist/models/auth.d.ts +35 -0
- package/dist/models/auth.js +3 -0
- package/{src/models/bundle.ts → dist/models/bundle.d.ts} +41 -63
- package/dist/models/bundle.js +26 -0
- package/dist/models/clinical-sections.d.ts +36 -0
- package/dist/models/clinical-sections.en.d.ts +75 -0
- package/dist/models/clinical-sections.en.js +81 -0
- package/dist/models/clinical-sections.js +32 -0
- package/dist/models/comm.d.ts +44 -0
- package/dist/models/comm.js +4 -0
- package/{src/models/confidential-job.ts → dist/models/confidential-job.d.ts} +23 -45
- package/dist/models/confidential-job.js +20 -0
- package/dist/models/confidential-message.d.ts +97 -0
- package/dist/models/confidential-message.js +4 -0
- package/{src/models/confidential-storage.ts → dist/models/confidential-storage.d.ts} +35 -56
- package/dist/models/confidential-storage.js +3 -0
- package/{src/models/consent-rule.ts → dist/models/consent-rule.d.ts} +22 -42
- package/dist/models/consent-rule.js +21 -0
- package/{src/models/crypto.ts → dist/models/crypto.d.ts} +5 -13
- package/dist/models/crypto.js +3 -0
- package/dist/models/device-license.d.ts +133 -0
- package/dist/models/device-license.js +3 -0
- package/{src/models/did.ts → dist/models/did.d.ts} +21 -30
- package/dist/models/did.js +3 -0
- package/dist/models/fhir-documents.d.ts +101 -0
- package/dist/models/fhir-documents.js +3 -0
- package/{src/models/index.ts → dist/models/index.d.ts} +2 -0
- package/dist/models/index.js +33 -0
- package/dist/models/indexing.d.ts +11 -0
- package/dist/models/indexing.js +18 -0
- package/dist/models/interoperable-claims.d.ts +68 -0
- package/dist/models/interoperable-claims.js +105 -0
- package/dist/models/issue.d.ts +57 -0
- package/dist/models/issue.js +75 -0
- package/dist/models/jsonapi.d.ts +13 -0
- package/dist/models/jsonapi.js +3 -0
- package/{src/models/jwe.ts → dist/models/jwe.d.ts} +10 -22
- package/dist/models/jwe.js +3 -0
- package/{src/models/jwk.ts → dist/models/jwk.d.ts} +0 -11
- package/dist/models/jwk.js +3 -0
- package/{src/models/jws.ts → dist/models/jws.d.ts} +0 -7
- package/dist/models/jws.js +3 -0
- package/dist/models/jwt.d.ts +9 -0
- package/dist/models/jwt.js +3 -0
- package/dist/models/multibase58.d.ts +13 -0
- package/dist/models/multibase58.js +40 -0
- package/dist/models/oidc4ida.common.model.d.ts +33 -0
- package/dist/models/oidc4ida.common.model.js +3 -0
- package/dist/models/oidc4ida.document.model.d.ts +50 -0
- package/dist/models/oidc4ida.document.model.js +3 -0
- package/{src/models/oidc4ida.electronicRecord.model.ts → dist/models/oidc4ida.electronicRecord.model.d.ts} +18 -37
- package/dist/models/oidc4ida.electronicRecord.model.js +3 -0
- package/{src/models/oidc4ida.evidence.model.ts → dist/models/oidc4ida.evidence.model.d.ts} +17 -35
- package/dist/models/oidc4ida.evidence.model.js +5 -0
- package/dist/models/openid-device.d.ts +119 -0
- package/dist/models/openid-device.js +3 -0
- package/dist/models/operation-outcome.d.ts +26 -0
- package/dist/models/operation-outcome.js +3 -0
- package/{src/models/params.ts → dist/models/params.d.ts} +20 -29
- package/dist/models/params.js +3 -0
- package/dist/models/resource-document.d.ts +14 -0
- package/dist/models/resource-document.js +3 -0
- package/dist/models/response.d.ts +1 -0
- package/dist/models/response.js +3 -0
- package/dist/models/urlPath.d.ts +58 -0
- package/dist/models/urlPath.js +76 -0
- package/dist/models/verifiable-credential.d.ts +45 -0
- package/dist/models/verifiable-credential.js +8 -0
- package/dist/utils/actor.d.ts +18 -0
- package/dist/utils/actor.js +36 -0
- package/dist/utils/base-convert.d.ts +20 -0
- package/{src/utils/base-convert.ts → dist/utils/base-convert.js} +23 -36
- package/dist/utils/baseN.d.ts +35 -0
- package/dist/utils/baseN.js +174 -0
- package/dist/utils/bundle.d.ts +6 -0
- package/dist/utils/bundle.js +32 -0
- package/dist/utils/content.d.ts +55 -0
- package/{src/utils/content.ts → dist/utils/content.js} +4 -10
- package/dist/utils/did.d.ts +67 -0
- package/dist/utils/did.js +123 -0
- package/dist/utils/format-converter.d.ts +21 -0
- package/dist/utils/format-converter.js +109 -0
- package/dist/utils/index.js +13 -0
- package/dist/utils/jwt.d.ts +52 -0
- package/dist/utils/jwt.js +153 -0
- package/dist/utils/manager-error.d.ts +15 -0
- package/dist/utils/manager-error.js +23 -0
- package/dist/utils/multibase58.d.ts +13 -0
- package/dist/utils/multibase58.js +40 -0
- package/dist/utils/multibasehash.d.ts +8 -0
- package/{src/utils/multibasehash.ts → dist/utils/multibasehash.js} +8 -13
- package/dist/utils/normalize.d.ts +16 -0
- package/{src/utils/normalize.ts → dist/utils/normalize.js} +15 -18
- package/dist/utils/object-convert.d.ts +20 -0
- package/{src/utils/object-convert.ts → dist/utils/object-convert.js} +10 -16
- package/dist/utils/string-convert.d.ts +24 -0
- package/{src/utils/string-convert.ts → dist/utils/string-convert.js} +5 -14
- package/dist/utils/string-utils.d.ts +25 -0
- package/{src/utils/string-utils.ts → dist/utils/string-utils.js} +12 -16
- package/dist/utils/url.d.ts +27 -0
- package/{src/utils/url.ts → dist/utils/url.js} +6 -7
- package/package.json +56 -14
- package/PUBLISHING.md +0 -33
- package/__tests__/AesManager.test.ts +0 -53
- package/__tests__/CryptographyService.test.ts +0 -194
- package/__tests__/bundle.test.ts +0 -29
- package/__tests__/content.test.ts +0 -72
- package/__tests__/crypto-encode-decode.test.ts +0 -52
- package/__tests__/crypto-hmac.test.ts +0 -21
- package/__tests__/did-generateServiceId.errors.test.ts +0 -8
- package/__tests__/did-generateServiceId.test.ts +0 -18
- package/__tests__/models-clinical-sections.test.ts +0 -32
- package/__tests__/models-multibase58.test.ts +0 -33
- package/__tests__/multibase58.errors.test.ts +0 -7
- package/__tests__/multibase58.test.ts +0 -28
- package/__tests__/multibasehash.test.ts +0 -25
- package/__tests__/utils-actor.test.ts +0 -46
- package/__tests__/utils-base-convert.test.ts +0 -57
- package/__tests__/utils-baseN.test.ts +0 -40
- package/__tests__/utils-did-extra.test.ts +0 -33
- package/__tests__/utils-format-converter.test.ts +0 -87
- package/__tests__/utils-jwt.test.ts +0 -57
- package/__tests__/utils-manager-error.test.ts +0 -11
- package/__tests__/utils-normalize.test.ts +0 -15
- package/__tests__/utils-object-convert.test.ts +0 -38
- package/__tests__/utils-string-convert.test.ts +0 -20
- package/__tests__/utils-string-utils.test.ts +0 -25
- package/__tests__/utils-url.test.ts +0 -21
- package/babel.config.cjs +0 -5
- package/jest.config.ts +0 -47
- package/src/AesManager.ts +0 -82
- package/src/CryptographyService.ts +0 -461
- package/src/JweManager.ts.txt +0 -365
- package/src/KmsService.txt +0 -493
- package/src/constants/Schemas.ts +0 -61
- package/src/cryptoDecode.ts +0 -104
- package/src/cryptoEncode.ts +0 -36
- package/src/interfaces/ICryptoHelper.ts +0 -33
- package/src/interfaces/ICryptography.ts +0 -177
- package/src/interfaces/IWallet.ts +0 -62
- package/src/models/aes.ts +0 -93
- package/src/models/auth.ts +0 -38
- package/src/models/bundle.txt +0 -93
- package/src/models/clinical-sections.en.ts +0 -82
- package/src/models/clinical-sections.ts +0 -64
- package/src/models/comm.ts +0 -63
- package/src/models/confidential-message.ts +0 -137
- package/src/models/device-license.ts +0 -161
- package/src/models/indexing.ts +0 -20
- package/src/models/issue.ts +0 -85
- package/src/models/jsonapi.ts +0 -19
- package/src/models/jwt.ts +0 -15
- package/src/models/multibase58.ts +0 -46
- package/src/models/oidc4ida.common.model.ts +0 -39
- package/src/models/oidc4ida.document.model.ts +0 -61
- package/src/models/openid-device.ts +0 -146
- package/src/models/operation-outcome.ts +0 -34
- package/src/models/resource-document.ts +0 -21
- package/src/models/response.ts +0 -5
- package/src/models/urlPath.ts +0 -76
- package/src/models/verifiable-credential.ts +0 -52
- package/src/types/noble-hashes.d.ts +0 -4
- package/src/utils/actor.ts +0 -56
- package/src/utils/baseN.ts +0 -203
- package/src/utils/bundle.ts +0 -30
- package/src/utils/did.ts +0 -155
- package/src/utils/format-converter.ts +0 -119
- package/src/utils/jwt.ts +0 -165
- package/src/utils/manager-error.ts +0 -27
- package/src/utils/multibase58.ts +0 -46
- package/tsconfig.json +0 -15
- /package/{src/constants/index.ts → dist/constants/index.d.ts} +0 -0
- /package/{src/index.ts → dist/index.d.ts} +0 -0
- /package/{src/utils/index.ts → dist/utils/index.d.ts} +0 -0
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
// Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
-
// File: src/models/schemaorg.ts
|
|
3
|
-
|
|
4
1
|
import { ParameterData } from "../models/params";
|
|
5
|
-
|
|
6
|
-
export enum ClaimsServiceSchemaorg {
|
|
2
|
+
export declare enum ClaimsServiceSchemaorg {
|
|
7
3
|
category = "org.schema.Service.category",
|
|
8
4
|
identifier = "org.schema.Service.identifier",
|
|
9
5
|
serviceType = "org.schema.Service.serviceType",
|
|
10
|
-
termsOfService = "org.schema.Service.termsOfService"
|
|
6
|
+
termsOfService = "org.schema.Service.termsOfService"
|
|
11
7
|
}
|
|
12
|
-
|
|
13
8
|
/**
|
|
14
9
|
* Defines the canonical claim names for the 'org.schema' context,
|
|
15
10
|
* based on Schema.org vocabulary.
|
|
16
11
|
*/
|
|
17
|
-
export enum ClaimsOrganizationSchemaorg {
|
|
12
|
+
export declare enum ClaimsOrganizationSchemaorg {
|
|
18
13
|
/** ISO 3166-1 alpha-2 (two-letter country code). The jurisdiction could be the country or the region (county, province or state) */
|
|
19
14
|
addressCountry = "org.schema.Organization.address.addressCountry",
|
|
20
15
|
/** ISO 3166-2 code for administrative divisions. The jurisdiction could be the country or the region (county, province or state) */
|
|
@@ -41,10 +36,9 @@ export enum ClaimsOrganizationSchemaorg {
|
|
|
41
36
|
email = "org.schema.Organization.email",
|
|
42
37
|
/** Public contact phone */
|
|
43
38
|
telephone = "org.schema.Organization.telephone",
|
|
44
|
-
numberOfEmployees = "org.schema.Organization.numberOfEmployees.value"
|
|
39
|
+
numberOfEmployees = "org.schema.Organization.numberOfEmployees.value"
|
|
45
40
|
}
|
|
46
|
-
|
|
47
|
-
export enum ClaimsOfferSchemaorg {
|
|
41
|
+
export declare enum ClaimsOfferSchemaorg {
|
|
48
42
|
acceptedPaymentMethod = "org.schema.Offer.acceptedPaymentMethod",
|
|
49
43
|
category = "org.schema.Offer.category",
|
|
50
44
|
checkoutPageURLTemplate = "org.schema.Offer.checkoutPageURLTemplate",
|
|
@@ -56,9 +50,8 @@ export enum ClaimsOfferSchemaorg {
|
|
|
56
50
|
offeredBy = "org.schema.Offer.offeredBy",
|
|
57
51
|
price = "org.schema.Offer.price",
|
|
58
52
|
priceCurrency = "org.schema.Offer.priceCurrency",
|
|
59
|
-
serialNumber = "org.schema.Offer.serialNumber"
|
|
53
|
+
serialNumber = "org.schema.Offer.serialNumber"
|
|
60
54
|
}
|
|
61
|
-
|
|
62
55
|
/** For Employees (and Employee Role, but no PII) and customers / related persons.
|
|
63
56
|
* - `givenName`: The given name of the person.
|
|
64
57
|
* - `familyName`: The primary family name or surname of the person.
|
|
@@ -67,7 +60,7 @@ export enum ClaimsOfferSchemaorg {
|
|
|
67
60
|
* - `name`: The transliterated full name of the person, useful for standardized naming
|
|
68
61
|
* conventions and international contexts.
|
|
69
62
|
*/
|
|
70
|
-
export enum ClaimsPersonSchemaorg {
|
|
63
|
+
export declare enum ClaimsPersonSchemaorg {
|
|
71
64
|
/** Second surname or mother's maiden name */
|
|
72
65
|
additionalName = "org.schema.Person.additionalName",
|
|
73
66
|
/** Short friendly name */
|
|
@@ -78,116 +71,31 @@ export enum ClaimsPersonSchemaorg {
|
|
|
78
71
|
gender = "org.schema.Person.gender",
|
|
79
72
|
givenName = "org.schema.Person.givenName",
|
|
80
73
|
hasOccupation = "org.schema.Person.hasOccupation",
|
|
81
|
-
identifier = "org.schema.Person.identifier"
|
|
82
|
-
identifierType = "org.schema.Person.identifier.additionalType"
|
|
83
|
-
identifierValue = "org.schema.Person.identifier.value"
|
|
74
|
+
identifier = "org.schema.Person.identifier",// the URN (composed by the provider)
|
|
75
|
+
identifierType = "org.schema.Person.identifier.additionalType",// retrieved from a form
|
|
76
|
+
identifierValue = "org.schema.Person.identifier.value",// retrieved from a form
|
|
84
77
|
/** ICAO transliteration of official given name (including middlenames), family name and addtional surname */
|
|
85
78
|
name = "org.schema.Person.name",
|
|
86
|
-
memberOf = "org.schema.Person.memberOf"
|
|
79
|
+
memberOf = "org.schema.Person.memberOf",// for employees
|
|
87
80
|
telephone = "org.schema.Person.telephone",
|
|
88
|
-
worksFor = "org.schema.Person.worksFor"
|
|
89
|
-
/*
|
|
90
|
-
gender = 'org.schema.Person.gender',
|
|
91
|
-
birthDate = 'org.schema.Person.birthdate', // Date: Date of birth.
|
|
92
|
-
birthPlace = 'org.schema.Person.birthplace', // Place: The place where the person was born.
|
|
93
|
-
nationality = 'org.schema.Person.nationality', // Country: Nationality of the person.
|
|
94
|
-
height = 'org.schema.Person.height',
|
|
95
|
-
// Properties from Thing
|
|
96
|
-
additionalType = 'org.schema.Person.additionaltype', // e.g.: 'Employee'
|
|
97
|
-
*/
|
|
81
|
+
worksFor = "org.schema.Person.worksFor"
|
|
98
82
|
}
|
|
99
|
-
|
|
100
83
|
/**
|
|
101
84
|
* Defines the flat claim structure for a schema.org/Action.
|
|
102
85
|
* This is used for requests where an entity (agent) performs an action,
|
|
103
86
|
* often with a human controller (participant) initiating it.
|
|
104
87
|
*/
|
|
105
|
-
export enum ClaimsActionSchemaorg {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
participantIdentifier = 'org.schema.Action.participant.identifier',
|
|
113
|
-
|
|
114
|
-
// The service provider or target of the action (e.g., the Fabric Network)
|
|
115
|
-
providerIdentifier = 'org.schema.Action.provider.identifier',
|
|
116
|
-
providerName = 'org.schema.Action.provider.name',
|
|
117
|
-
|
|
118
|
-
// The time the action was initiated
|
|
119
|
-
startTime = 'org.schema.Action.startTime',
|
|
88
|
+
export declare enum ClaimsActionSchemaorg {
|
|
89
|
+
agentIdentifier = "org.schema.Action.agent.identifier",
|
|
90
|
+
agentLegalName = "org.schema.Action.agent.legalName",
|
|
91
|
+
participantIdentifier = "org.schema.Action.participant.identifier",
|
|
92
|
+
providerIdentifier = "org.schema.Action.provider.identifier",
|
|
93
|
+
providerName = "org.schema.Action.provider.name",
|
|
94
|
+
startTime = "org.schema.Action.startTime"
|
|
120
95
|
}
|
|
121
|
-
|
|
122
|
-
export
|
|
123
|
-
|
|
124
|
-
HairColor = 'int.icao.mrtd.hair-color',
|
|
96
|
+
export declare const ICAOReverseDns = "int.icao";
|
|
97
|
+
export declare enum ICAOIdentityParams {
|
|
98
|
+
HairColor = "int.icao.mrtd.hair-color"
|
|
125
99
|
}
|
|
126
|
-
|
|
127
|
-
export const
|
|
128
|
-
ClaimsPersonSchemaorg.givenName,
|
|
129
|
-
ClaimsPersonSchemaorg.familyName,
|
|
130
|
-
ClaimsPersonSchemaorg.additionalName,
|
|
131
|
-
ClaimsPersonSchemaorg.email,
|
|
132
|
-
ClaimsPersonSchemaorg.telephone,
|
|
133
|
-
ClaimsPersonSchemaorg.birthDate,
|
|
134
|
-
ClaimsPersonSchemaorg.identifierType,
|
|
135
|
-
ClaimsPersonSchemaorg.identifierValue,
|
|
136
|
-
// ClaimsPersonSchemaorg.additionalType,
|
|
137
|
-
];
|
|
138
|
-
|
|
139
|
-
export const fullPersonParamsSchemaorg: ParameterData[] = [
|
|
140
|
-
{
|
|
141
|
-
name: ClaimsPersonSchemaorg.additionalName,
|
|
142
|
-
type: 'string',
|
|
143
|
-
value: undefined,
|
|
144
|
-
unique: true,
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
name: ClaimsPersonSchemaorg.familyName,
|
|
148
|
-
type: 'string',
|
|
149
|
-
value: undefined,
|
|
150
|
-
unique: true,
|
|
151
|
-
},
|
|
152
|
-
{ name: ClaimsPersonSchemaorg.email, type: 'string', value: undefined },
|
|
153
|
-
{
|
|
154
|
-
name: ClaimsPersonSchemaorg.givenName,
|
|
155
|
-
type: 'string',
|
|
156
|
-
value: undefined,
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
name: ClaimsPersonSchemaorg.telephone,
|
|
160
|
-
type: 'string',
|
|
161
|
-
value: undefined,
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
name: ClaimsPersonSchemaorg.gender,
|
|
165
|
-
type: 'string',
|
|
166
|
-
value: undefined,
|
|
167
|
-
unique: true,
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
name: ClaimsPersonSchemaorg.identifierType,
|
|
171
|
-
type: 'string',
|
|
172
|
-
value: undefined,
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
name: ClaimsPersonSchemaorg.identifierValue,
|
|
176
|
-
type: 'string',
|
|
177
|
-
value: undefined,
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
name: ClaimsPersonSchemaorg.birthDate,
|
|
181
|
-
type: 'string',
|
|
182
|
-
value: undefined,
|
|
183
|
-
unique: true,
|
|
184
|
-
},
|
|
185
|
-
/*
|
|
186
|
-
{
|
|
187
|
-
name: ClaimsPersonSchemaorg.additionalType,
|
|
188
|
-
type: 'string',
|
|
189
|
-
value: undefined,
|
|
190
|
-
},
|
|
191
|
-
*/
|
|
192
|
-
];
|
|
193
|
-
|
|
100
|
+
export declare const indexedPersonAttributeList: string[];
|
|
101
|
+
export declare const fullPersonParamsSchemaorg: ParameterData[];
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
// File: src/models/schemaorg.ts
|
|
3
|
+
export var ClaimsServiceSchemaorg;
|
|
4
|
+
(function (ClaimsServiceSchemaorg) {
|
|
5
|
+
ClaimsServiceSchemaorg["category"] = "org.schema.Service.category";
|
|
6
|
+
ClaimsServiceSchemaorg["identifier"] = "org.schema.Service.identifier";
|
|
7
|
+
ClaimsServiceSchemaorg["serviceType"] = "org.schema.Service.serviceType";
|
|
8
|
+
ClaimsServiceSchemaorg["termsOfService"] = "org.schema.Service.termsOfService";
|
|
9
|
+
})(ClaimsServiceSchemaorg || (ClaimsServiceSchemaorg = {}));
|
|
10
|
+
/**
|
|
11
|
+
* Defines the canonical claim names for the 'org.schema' context,
|
|
12
|
+
* based on Schema.org vocabulary.
|
|
13
|
+
*/
|
|
14
|
+
export var ClaimsOrganizationSchemaorg;
|
|
15
|
+
(function (ClaimsOrganizationSchemaorg) {
|
|
16
|
+
/** ISO 3166-1 alpha-2 (two-letter country code). The jurisdiction could be the country or the region (county, province or state) */
|
|
17
|
+
ClaimsOrganizationSchemaorg["addressCountry"] = "org.schema.Organization.address.addressCountry";
|
|
18
|
+
/** ISO 3166-2 code for administrative divisions. The jurisdiction could be the country or the region (county, province or state) */
|
|
19
|
+
ClaimsOrganizationSchemaorg["addressRegion"] = "org.schema.Organization.address.addressRegion";
|
|
20
|
+
ClaimsOrganizationSchemaorg["addressLocality"] = "org.schema.Organization.address.addressLocality";
|
|
21
|
+
ClaimsOrganizationSchemaorg["postalCode"] = "org.schema.Organization.address.postalCode";
|
|
22
|
+
ClaimsOrganizationSchemaorg["streetAddress"] = "org.schema.Organization.address.streetAddress";
|
|
23
|
+
/** `TAX` ID or `EI` (Employer ID): @see http://terminology.hl7.org/CodeSystem/v2-0203 */
|
|
24
|
+
ClaimsOrganizationSchemaorg["identifierType"] = "org.schema.Organization.identifier.additionalType";
|
|
25
|
+
ClaimsOrganizationSchemaorg["identifierValue"] = "org.schema.Organization.identifier.value";
|
|
26
|
+
/** Legal registered name */
|
|
27
|
+
ClaimsOrganizationSchemaorg["legalName"] = "org.schema.Organization.legalName";
|
|
28
|
+
/** Commercial name */
|
|
29
|
+
ClaimsOrganizationSchemaorg["name"] = "org.schema.Organization.name";
|
|
30
|
+
/** short url-friendly name (0-9,a-z) */
|
|
31
|
+
ClaimsOrganizationSchemaorg["alternateName"] = "org.schema.Organization.alternateName";
|
|
32
|
+
/** External URL for the service */
|
|
33
|
+
ClaimsOrganizationSchemaorg["url"] = "org.schema.Organization.url";
|
|
34
|
+
/** The identifier is a URN generated using the legal ID (TAX or EI) */
|
|
35
|
+
ClaimsOrganizationSchemaorg["identifier"] = "org.schema.Organization.identifier";
|
|
36
|
+
/** DUNS (free) or LEI could be provided */
|
|
37
|
+
ClaimsOrganizationSchemaorg["duns"] = "org.schema.Organization.duns";
|
|
38
|
+
/** Public contact email */
|
|
39
|
+
ClaimsOrganizationSchemaorg["email"] = "org.schema.Organization.email";
|
|
40
|
+
/** Public contact phone */
|
|
41
|
+
ClaimsOrganizationSchemaorg["telephone"] = "org.schema.Organization.telephone";
|
|
42
|
+
ClaimsOrganizationSchemaorg["numberOfEmployees"] = "org.schema.Organization.numberOfEmployees.value"; // to purchase licenses for device profile's activation
|
|
43
|
+
})(ClaimsOrganizationSchemaorg || (ClaimsOrganizationSchemaorg = {}));
|
|
44
|
+
export var ClaimsOfferSchemaorg;
|
|
45
|
+
(function (ClaimsOfferSchemaorg) {
|
|
46
|
+
ClaimsOfferSchemaorg["acceptedPaymentMethod"] = "org.schema.Offer.acceptedPaymentMethod";
|
|
47
|
+
ClaimsOfferSchemaorg["category"] = "org.schema.Offer.category";
|
|
48
|
+
ClaimsOfferSchemaorg["checkoutPageURLTemplate"] = "org.schema.Offer.checkoutPageURLTemplate";
|
|
49
|
+
ClaimsOfferSchemaorg["eligibleCustomerType"] = "org.schema.Offer.eligibleCustomerType";
|
|
50
|
+
ClaimsOfferSchemaorg["eligibleQuantityValue"] = "org.schema.Offer.eligibleQuantity.value";
|
|
51
|
+
ClaimsOfferSchemaorg["identifier"] = "org.schema.Offer.identifier";
|
|
52
|
+
ClaimsOfferSchemaorg["itemOfferedName"] = "org.schema.Offer.itemOffered.name";
|
|
53
|
+
ClaimsOfferSchemaorg["itemOfferedSku"] = "org.schema.Offer.itemOffered.sku";
|
|
54
|
+
ClaimsOfferSchemaorg["offeredBy"] = "org.schema.Offer.offeredBy";
|
|
55
|
+
ClaimsOfferSchemaorg["price"] = "org.schema.Offer.price";
|
|
56
|
+
ClaimsOfferSchemaorg["priceCurrency"] = "org.schema.Offer.priceCurrency";
|
|
57
|
+
ClaimsOfferSchemaorg["serialNumber"] = "org.schema.Offer.serialNumber";
|
|
58
|
+
})(ClaimsOfferSchemaorg || (ClaimsOfferSchemaorg = {}));
|
|
59
|
+
/** For Employees (and Employee Role, but no PII) and customers / related persons.
|
|
60
|
+
* - `givenName`: The given name of the person.
|
|
61
|
+
* - `familyName`: The primary family name or surname of the person.
|
|
62
|
+
* - `alternateName`: The second surname or mother's family name, used for facilitating searches
|
|
63
|
+
* and catering to cultures with multiple surnames.
|
|
64
|
+
* - `name`: The transliterated full name of the person, useful for standardized naming
|
|
65
|
+
* conventions and international contexts.
|
|
66
|
+
*/
|
|
67
|
+
export var ClaimsPersonSchemaorg;
|
|
68
|
+
(function (ClaimsPersonSchemaorg) {
|
|
69
|
+
/** Second surname or mother's maiden name */
|
|
70
|
+
ClaimsPersonSchemaorg["additionalName"] = "org.schema.Person.additionalName";
|
|
71
|
+
/** Short friendly name */
|
|
72
|
+
ClaimsPersonSchemaorg["alternateName"] = "org.schema.Person.alternateName";
|
|
73
|
+
ClaimsPersonSchemaorg["birthDate"] = "org.schema.Person.birthDate";
|
|
74
|
+
ClaimsPersonSchemaorg["email"] = "org.schema.Person.email";
|
|
75
|
+
ClaimsPersonSchemaorg["familyName"] = "org.schema.Person.familyName";
|
|
76
|
+
ClaimsPersonSchemaorg["gender"] = "org.schema.Person.gender";
|
|
77
|
+
ClaimsPersonSchemaorg["givenName"] = "org.schema.Person.givenName";
|
|
78
|
+
ClaimsPersonSchemaorg["hasOccupation"] = "org.schema.Person.hasOccupation";
|
|
79
|
+
ClaimsPersonSchemaorg["identifier"] = "org.schema.Person.identifier";
|
|
80
|
+
ClaimsPersonSchemaorg["identifierType"] = "org.schema.Person.identifier.additionalType";
|
|
81
|
+
ClaimsPersonSchemaorg["identifierValue"] = "org.schema.Person.identifier.value";
|
|
82
|
+
/** ICAO transliteration of official given name (including middlenames), family name and addtional surname */
|
|
83
|
+
ClaimsPersonSchemaorg["name"] = "org.schema.Person.name";
|
|
84
|
+
ClaimsPersonSchemaorg["memberOf"] = "org.schema.Person.memberOf";
|
|
85
|
+
ClaimsPersonSchemaorg["telephone"] = "org.schema.Person.telephone";
|
|
86
|
+
ClaimsPersonSchemaorg["worksFor"] = "org.schema.Person.worksFor";
|
|
87
|
+
/*
|
|
88
|
+
gender = 'org.schema.Person.gender',
|
|
89
|
+
birthDate = 'org.schema.Person.birthdate', // Date: Date of birth.
|
|
90
|
+
birthPlace = 'org.schema.Person.birthplace', // Place: The place where the person was born.
|
|
91
|
+
nationality = 'org.schema.Person.nationality', // Country: Nationality of the person.
|
|
92
|
+
height = 'org.schema.Person.height',
|
|
93
|
+
// Properties from Thing
|
|
94
|
+
additionalType = 'org.schema.Person.additionaltype', // e.g.: 'Employee'
|
|
95
|
+
*/
|
|
96
|
+
})(ClaimsPersonSchemaorg || (ClaimsPersonSchemaorg = {}));
|
|
97
|
+
/**
|
|
98
|
+
* Defines the flat claim structure for a schema.org/Action.
|
|
99
|
+
* This is used for requests where an entity (agent) performs an action,
|
|
100
|
+
* often with a human controller (participant) initiating it.
|
|
101
|
+
*/
|
|
102
|
+
export var ClaimsActionSchemaorg;
|
|
103
|
+
(function (ClaimsActionSchemaorg) {
|
|
104
|
+
// The primary agent performing the action (e.g., the Tenant Organization)
|
|
105
|
+
ClaimsActionSchemaorg["agentIdentifier"] = "org.schema.Action.agent.identifier";
|
|
106
|
+
ClaimsActionSchemaorg["agentLegalName"] = "org.schema.Action.agent.legalName";
|
|
107
|
+
// ... other flattened properties of the agent ...
|
|
108
|
+
// A co-agent participating in the action (e.g., the Human Controller T)
|
|
109
|
+
ClaimsActionSchemaorg["participantIdentifier"] = "org.schema.Action.participant.identifier";
|
|
110
|
+
// The service provider or target of the action (e.g., the Fabric Network)
|
|
111
|
+
ClaimsActionSchemaorg["providerIdentifier"] = "org.schema.Action.provider.identifier";
|
|
112
|
+
ClaimsActionSchemaorg["providerName"] = "org.schema.Action.provider.name";
|
|
113
|
+
// The time the action was initiated
|
|
114
|
+
ClaimsActionSchemaorg["startTime"] = "org.schema.Action.startTime";
|
|
115
|
+
})(ClaimsActionSchemaorg || (ClaimsActionSchemaorg = {}));
|
|
116
|
+
export const ICAOReverseDns = 'int.icao';
|
|
117
|
+
export var ICAOIdentityParams;
|
|
118
|
+
(function (ICAOIdentityParams) {
|
|
119
|
+
ICAOIdentityParams["HairColor"] = "int.icao.mrtd.hair-color";
|
|
120
|
+
})(ICAOIdentityParams || (ICAOIdentityParams = {}));
|
|
121
|
+
export const indexedPersonAttributeList = [
|
|
122
|
+
ClaimsPersonSchemaorg.givenName,
|
|
123
|
+
ClaimsPersonSchemaorg.familyName,
|
|
124
|
+
ClaimsPersonSchemaorg.additionalName,
|
|
125
|
+
ClaimsPersonSchemaorg.email,
|
|
126
|
+
ClaimsPersonSchemaorg.telephone,
|
|
127
|
+
ClaimsPersonSchemaorg.birthDate,
|
|
128
|
+
ClaimsPersonSchemaorg.identifierType,
|
|
129
|
+
ClaimsPersonSchemaorg.identifierValue,
|
|
130
|
+
// ClaimsPersonSchemaorg.additionalType,
|
|
131
|
+
];
|
|
132
|
+
export const fullPersonParamsSchemaorg = [
|
|
133
|
+
{
|
|
134
|
+
name: ClaimsPersonSchemaorg.additionalName,
|
|
135
|
+
type: 'string',
|
|
136
|
+
value: undefined,
|
|
137
|
+
unique: true,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: ClaimsPersonSchemaorg.familyName,
|
|
141
|
+
type: 'string',
|
|
142
|
+
value: undefined,
|
|
143
|
+
unique: true,
|
|
144
|
+
},
|
|
145
|
+
{ name: ClaimsPersonSchemaorg.email, type: 'string', value: undefined },
|
|
146
|
+
{
|
|
147
|
+
name: ClaimsPersonSchemaorg.givenName,
|
|
148
|
+
type: 'string',
|
|
149
|
+
value: undefined,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: ClaimsPersonSchemaorg.telephone,
|
|
153
|
+
type: 'string',
|
|
154
|
+
value: undefined,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: ClaimsPersonSchemaorg.gender,
|
|
158
|
+
type: 'string',
|
|
159
|
+
value: undefined,
|
|
160
|
+
unique: true,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: ClaimsPersonSchemaorg.identifierType,
|
|
164
|
+
type: 'string',
|
|
165
|
+
value: undefined,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: ClaimsPersonSchemaorg.identifierValue,
|
|
169
|
+
type: 'string',
|
|
170
|
+
value: undefined,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: ClaimsPersonSchemaorg.birthDate,
|
|
174
|
+
type: 'string',
|
|
175
|
+
value: undefined,
|
|
176
|
+
unique: true,
|
|
177
|
+
},
|
|
178
|
+
/*
|
|
179
|
+
{
|
|
180
|
+
name: ClaimsPersonSchemaorg.additionalType,
|
|
181
|
+
type: 'string',
|
|
182
|
+
value: undefined,
|
|
183
|
+
},
|
|
184
|
+
*/
|
|
185
|
+
];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function encodeJWT(senderKeysSet: any[], payload: any, recipientsEncKey: any[], header: any): string;
|
|
2
|
+
export declare function decodePayloadRequest(targetTenant: string, requestJAR: string | undefined, authorizationHeader: string | undefined): any;
|
|
3
|
+
export declare function decodeBase64Url(base64Url: string): string;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
// File: crypto-ts/cryptoEncode.ts
|
|
3
|
+
// Function to encode a payload into a JWT with the header "alg=none"
|
|
4
|
+
// senderTenant signs and encrypts to recipient(s)
|
|
5
|
+
export function encodeJWT(senderKeysSet, payload, recipientsEncKey, header) {
|
|
6
|
+
try {
|
|
7
|
+
// 1. Convert the header to JSON and then Base64Url encode it
|
|
8
|
+
const encodedHeader = base64UrlEncode(JSON.stringify(header));
|
|
9
|
+
// 2. Convert the payload to JSON and then Base64Url encode it
|
|
10
|
+
const encodedPayload = base64UrlEncode(JSON.stringify(payload));
|
|
11
|
+
// 3. No signature for `alg=none`, so we just return the concatenation of header and payload
|
|
12
|
+
// Format: `header.payload.` (no signature part)
|
|
13
|
+
const jwt = `${encodedHeader}.${encodedPayload}.`;
|
|
14
|
+
return jwt;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
console.error('Error encoding JWT:', error);
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
// Helper function to Base64Url encode a string (works for header and payload)
|
|
22
|
+
function base64UrlEncode(str) {
|
|
23
|
+
// Convert the string to a Base64 string (using standard Base64 encoding first)
|
|
24
|
+
const base64 = Buffer.from(str).toString('base64');
|
|
25
|
+
// Replace '+' with '-', '/' with '_', and remove the padding '='
|
|
26
|
+
return base64
|
|
27
|
+
.replace(/\+/g, '-') // Replace '+' with '-'
|
|
28
|
+
.replace(/\//g, '_') // Replace '/' with '_'
|
|
29
|
+
.replace(/=+$/, ''); // Remove any '=' padding at the end
|
|
30
|
+
}
|
|
31
|
+
// src/managers/cryptoDecode.ts
|
|
32
|
+
// TODO: decode, verify, encode, sign, encrypt, decrypt, all of them must be in the wallet
|
|
33
|
+
// Note: each tenant can have their own wallet.
|
|
34
|
+
// Function to decode JWT and handle Base64Url using native JavaScript functions
|
|
35
|
+
export function decodePayloadRequest(targetTenant, requestJAR, authorizationHeader) {
|
|
36
|
+
try {
|
|
37
|
+
let authToken;
|
|
38
|
+
// TODO: auth token could be protected in the request: payload.body.meta.http.header.bearer.source
|
|
39
|
+
// TODO: this function will decode the bearer (auth) token and set it here: payload.body.meta.http.header.bearer.decoded
|
|
40
|
+
// TODO: first of all the request must be decrypted in case of JWE, then the nested JWT is decoded
|
|
41
|
+
// If not in the JAR, look for auth token in the Authorization header (Bearer token)
|
|
42
|
+
if (authorizationHeader) {
|
|
43
|
+
authToken = authorizationHeader.replace('Bearer ', '').trim();
|
|
44
|
+
}
|
|
45
|
+
// If the token is not found, return an error
|
|
46
|
+
if (!authToken) {
|
|
47
|
+
throw new Error('No JWT found in request or Authorization header');
|
|
48
|
+
}
|
|
49
|
+
// Decode the JWT (Base64Url format as per the JOSE specification)
|
|
50
|
+
const [header, payload, signature] = authToken.split('.');
|
|
51
|
+
if (!payload) {
|
|
52
|
+
throw new Error('JWT payload is missing');
|
|
53
|
+
}
|
|
54
|
+
const decodedPayload = decodeBase64Url(payload);
|
|
55
|
+
// Return the decoded payload that contains the body and data
|
|
56
|
+
return decodedPayload;
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
console.error('Error decoding JWT payload:', error);
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export function decodeBase64Url(base64Url) {
|
|
64
|
+
try {
|
|
65
|
+
// Convert Base64Url to Base64 by replacing '-' with '+' and '_' with '/'
|
|
66
|
+
let base64 = base64Url
|
|
67
|
+
.replace(/-/g, '+') // Replace '-' with '+'
|
|
68
|
+
.replace(/_/g, '/'); // Replace '_' with '/'
|
|
69
|
+
// Ensure that Base64 has the correct size (padding)
|
|
70
|
+
const padding = base64.length % 4;
|
|
71
|
+
if (padding) {
|
|
72
|
+
base64 += '='.repeat(4 - padding); // Add the necessary padding
|
|
73
|
+
}
|
|
74
|
+
// Decode the Base64 string using Buffer (for Node.js)
|
|
75
|
+
const decodedString = Buffer.from(base64, 'base64').toString('utf-8');
|
|
76
|
+
// Check if decoding results in a valid JSON string
|
|
77
|
+
try {
|
|
78
|
+
JSON.parse(decodedString); // Ensure it's valid JSON
|
|
79
|
+
}
|
|
80
|
+
catch (e) {
|
|
81
|
+
console.error('Invalid Base64Url string:', e);
|
|
82
|
+
return ''; // Return empty string for invalid JSON payload
|
|
83
|
+
}
|
|
84
|
+
return decodedString;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.error('Error decoding Base64Url string:', error);
|
|
88
|
+
return ''; // Return empty string if there's an error during decoding
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function encodeJWT(senderKeysSet: any[], payload: any, recipientsEncKey: any[], header: any): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
// File: crypto-ts/cryptoEncode.ts
|
|
3
|
+
// Function to encode a payload into a JWT with the header "alg=none"
|
|
4
|
+
// senderTenant signs and encrypts to recipient(s)
|
|
5
|
+
export function encodeJWT(senderKeysSet, payload, recipientsEncKey, header) {
|
|
6
|
+
try {
|
|
7
|
+
// 1. Convert the header to JSON and then Base64Url encode it
|
|
8
|
+
const encodedHeader = base64UrlEncode(JSON.stringify(header));
|
|
9
|
+
// 2. Convert the payload to JSON and then Base64Url encode it
|
|
10
|
+
const encodedPayload = base64UrlEncode(JSON.stringify(payload));
|
|
11
|
+
// 3. No signature for `alg=none`, so we just return the concatenation of header and payload
|
|
12
|
+
// Format: `header.payload.` (no signature part)
|
|
13
|
+
const jwt = `${encodedHeader}.${encodedPayload}.`;
|
|
14
|
+
return jwt;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
console.error('Error encoding JWT:', error);
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
// Helper function to Base64Url encode a string (works for header and payload)
|
|
22
|
+
function base64UrlEncode(str) {
|
|
23
|
+
// Convert the string to a Base64 string (using standard Base64 encoding first)
|
|
24
|
+
const base64 = Buffer.from(str).toString('base64');
|
|
25
|
+
// Replace '+' with '-', '/' with '_', and remove the padding '='
|
|
26
|
+
return base64
|
|
27
|
+
.replace(/\+/g, '-') // Replace '+' with '-'
|
|
28
|
+
.replace(/\//g, '_') // Replace '/' with '_'
|
|
29
|
+
.replace(/=+$/, ''); // Remove any '=' padding at the end
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare abstract class CryptographyManagerAbstract {
|
|
2
|
+
protected publicJWK: {};
|
|
3
|
+
protected privateKeyBytes: Uint8Array;
|
|
4
|
+
constructor();
|
|
5
|
+
/** Initializes public and private keys. */
|
|
6
|
+
protected abstract newKeys(seedBytes?: Uint8Array): Promise<void>;
|
|
7
|
+
/** Sets the public and private keys to be used. */
|
|
8
|
+
protected setKeys(publicJWK: any, privateKeyBytes: Uint8Array): void;
|
|
9
|
+
/** Returns the public JWK */
|
|
10
|
+
getPublicJWK(): any;
|
|
11
|
+
/** Returns the public Key ID ('kid') or empty string */
|
|
12
|
+
getKeyID(): string;
|
|
13
|
+
}
|
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
// Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
2
|
// File: crypto-ts/cryptography.abstract.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
protected privateKeyBytes!: Uint8Array;
|
|
7
|
-
|
|
3
|
+
export class CryptographyManagerAbstract {
|
|
4
|
+
publicJWK = {};
|
|
5
|
+
privateKeyBytes;
|
|
8
6
|
constructor() {
|
|
9
7
|
}
|
|
10
|
-
|
|
11
|
-
/** Initializes public and private keys. */
|
|
12
|
-
protected abstract newKeys(seedBytes?: Uint8Array): Promise<void>;
|
|
13
|
-
|
|
14
8
|
/** Sets the public and private keys to be used. */
|
|
15
|
-
|
|
9
|
+
setKeys(publicJWK, privateKeyBytes) {
|
|
16
10
|
this.publicJWK = publicJWK;
|
|
17
11
|
this.privateKeyBytes = privateKeyBytes;
|
|
18
12
|
}
|
|
19
|
-
|
|
20
13
|
/** Returns the public JWK */
|
|
21
|
-
|
|
14
|
+
getPublicJWK() {
|
|
22
15
|
return this.publicJWK;
|
|
23
16
|
}
|
|
24
|
-
|
|
25
17
|
/** Returns the public Key ID ('kid') or empty string */
|
|
26
|
-
|
|
18
|
+
getKeyID() {
|
|
27
19
|
return this.getPublicJWK().kid ? this.getPublicJWK().kid : '';
|
|
28
20
|
}
|
|
29
21
|
}
|
package/dist/hmac.d.ts
ADDED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
// Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
2
|
// File: crypto-ts/hmac.ts
|
|
3
|
-
|
|
4
3
|
// Use explicit .js subpaths to satisfy package exports in Metro/Node ESM.
|
|
5
4
|
import { hmac } from '@noble/hashes/hmac.js';
|
|
6
5
|
import { sha3_256 } from '@noble/hashes/sha3.js';
|
|
7
|
-
import { Content } from './utils/content';
|
|
8
|
-
|
|
9
|
-
export async function computeHmacSha256(plaintext: string, hmacKeyBytes: Uint8Array): Promise<Uint8Array> {
|
|
6
|
+
import { Content } from './utils/content.js';
|
|
7
|
+
export async function computeHmacSha256(plaintext, hmacKeyBytes) {
|
|
10
8
|
return await hmac(sha3_256, hmacKeyBytes, Content.stringToBytesUTF8(plaintext));
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return Content.bytesToRawBase64UrlSafe(await computeHmacSha256(plaintext, hmacKeyBytes));
|
|
10
|
+
export async function computeHmacSha256Base64Url(plaintext, hmacKeyBytes) {
|
|
11
|
+
return Content.bytesToRawBase64UrlSafe(await computeHmacSha256(plaintext, hmacKeyBytes));
|
|
15
12
|
}
|
package/dist/index.js
ADDED