@sd-jwt/decode
Advanced tools
Comparing version
@@ -1,5 +0,4 @@ | ||
import type { AsyncHasher, Hasher } from '@sd-jwt/types'; | ||
import type { AsyncHasher, Hasher, HasherAlgorithm } from '@sd-jwt/types'; | ||
import type { Disclosure } from '@sd-jwt/types'; | ||
import { HasherAlgorithm } from '@sd-jwt/utils'; | ||
export type CalculateDigestReturnType<HasherImplementation extends Hasher | AsyncHasher> = ReturnType<HasherImplementation> extends Promise<any> ? Promise<string> : string; | ||
export declare const disclosureCalculateDigest: <HI extends Hasher | AsyncHasher>(disclosure: Disclosure, algorithm: HasherAlgorithm, hasher: HI) => CalculateDigestReturnType<HI>; |
export { jwtFromCompact } from './jwt'; | ||
export { sdJwtFromCompact } from './sdJwt'; | ||
export { decodeSdJwtVc, sdJwtVcFromCompact } from './sdJwtVc'; | ||
export { keyBindingFromCompact } from './keyBinding'; | ||
export { keyBindingFromCompact, calculateSdHash } from './keyBinding'; | ||
export { disclosureCalculateDigest, disclosureToArray, disclosureFromArray, disclosureFromString, decodeDisclosuresInPayload } from './disclosures'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.decodeDisclosuresInPayload = exports.disclosureFromString = exports.disclosureFromArray = exports.disclosureToArray = exports.disclosureCalculateDigest = exports.keyBindingFromCompact = exports.sdJwtVcFromCompact = exports.decodeSdJwtVc = exports.sdJwtFromCompact = exports.jwtFromCompact = void 0; | ||
exports.decodeDisclosuresInPayload = exports.disclosureFromString = exports.disclosureFromArray = exports.disclosureToArray = exports.disclosureCalculateDigest = exports.calculateSdHash = exports.keyBindingFromCompact = exports.sdJwtVcFromCompact = exports.decodeSdJwtVc = exports.sdJwtFromCompact = exports.jwtFromCompact = void 0; | ||
var jwt_1 = require("./jwt"); | ||
@@ -13,2 +13,3 @@ Object.defineProperty(exports, "jwtFromCompact", { enumerable: true, get: function () { return jwt_1.jwtFromCompact; } }); | ||
Object.defineProperty(exports, "keyBindingFromCompact", { enumerable: true, get: function () { return keyBinding_1.keyBindingFromCompact; } }); | ||
Object.defineProperty(exports, "calculateSdHash", { enumerable: true, get: function () { return keyBinding_1.calculateSdHash; } }); | ||
var disclosures_1 = require("./disclosures"); | ||
@@ -15,0 +16,0 @@ Object.defineProperty(exports, "disclosureCalculateDigest", { enumerable: true, get: function () { return disclosures_1.disclosureCalculateDigest; } }); |
export * from './fromCompact'; | ||
export * from './sdHash'; |
@@ -18,2 +18,3 @@ "use strict"; | ||
__exportStar(require("./fromCompact"), exports); | ||
__exportStar(require("./sdHash"), exports); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.decodeSdJwtVc = void 0; | ||
const types_1 = require("@sd-jwt/types"); | ||
const utils_1 = require("@sd-jwt/utils"); | ||
const fromCompact_1 = require("./fromCompact"); | ||
const utils_2 = require("@sd-jwt/utils"); | ||
const fromCompact_1 = require("./fromCompact"); | ||
const utils_3 = require("@sd-jwt/utils"); | ||
const calculateDigest_1 = require("../disclosures/calculateDigest"); | ||
@@ -13,3 +13,3 @@ const disclosures_1 = require("../disclosures"); | ||
const { header, payload, signature, keyBinding, disclosures } = (0, fromCompact_1.sdJwtVcFromCompact)(compact); | ||
const hasherAlgorithm = (_a = (0, utils_3.getValueByKeyAnyLevel)(payload, '_sd_alg')) !== null && _a !== void 0 ? _a : utils_2.HasherAlgorithm.Sha256; | ||
const hasherAlgorithm = (_a = (0, utils_2.getValueByKeyAnyLevel)(payload, '_sd_alg')) !== null && _a !== void 0 ? _a : types_1.HasherAlgorithm.Sha256; | ||
const disclosuresWithDigestsResult = ((_b = disclosures === null || disclosures === void 0 ? void 0 : disclosures.map((disclosure) => { | ||
@@ -16,0 +16,0 @@ const digestResult = (0, calculateDigest_1.disclosureCalculateDigest)(disclosure, hasherAlgorithm, hasher); |
{ | ||
"name": "@sd-jwt/decode", | ||
"version": "0.2.0", | ||
"version": "0.2.1-alpha.0", | ||
"description": "Decode implementation of sd-jwt Draft 06 and sd-jwt-vc Draft 01", | ||
@@ -40,4 +40,4 @@ "license": "(MIT OR Apache-2.0)", | ||
"dependencies": { | ||
"@sd-jwt/types": "0.2.0", | ||
"@sd-jwt/utils": "0.2.0" | ||
"@sd-jwt/types": "0.2.1-alpha.0", | ||
"@sd-jwt/utils": "0.2.1-alpha.0" | ||
}, | ||
@@ -49,3 +49,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "8fb68d5a23b2bf157949346a6603dc40b1594195" | ||
"gitHead": "97e9d3699113bb04fb99d6421797cbd404e4a626" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
38908
5.17%469
4.22%+ Added
+ Added
- Removed
- Removed
Updated
Updated