@sphereon/ssi-sdk-ext.key-utils 0.36.1-feature.SSISDK.70.integrate.digidentity.10 → 0.36.1-feature.SSISDK.70.integrate.digidentity.55
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/index.cjs +38 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +38 -3
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/functions.ts +41 -3
- package/src/types/key-util-types.ts +1 -0
package/dist/index.d.cts
CHANGED
|
@@ -45,6 +45,7 @@ type SignatureAlgorithmFromKeyArgs = {
|
|
|
45
45
|
};
|
|
46
46
|
type SignatureAlgorithmFromKeyTypeArgs = {
|
|
47
47
|
type: TKeyType;
|
|
48
|
+
algorithms?: string[];
|
|
48
49
|
};
|
|
49
50
|
type KeyTypeFromCryptographicSuiteArgs = {
|
|
50
51
|
crv?: string;
|
|
@@ -138,6 +139,7 @@ declare const isRawCompressedPublicKey: (key: Uint8Array) => boolean;
|
|
|
138
139
|
declare const toRawCompressedHexPublicKey: (rawPublicKey: Uint8Array, keyType: TKeyType) => string;
|
|
139
140
|
declare const hexStringFromUint8Array: (value: Uint8Array) => string;
|
|
140
141
|
declare const signatureAlgorithmFromKey: (args: SignatureAlgorithmFromKeyArgs) => Promise<JoseSignatureAlgorithm>;
|
|
142
|
+
declare function signatureAlgorithmToJoseAlgorithm(alg: string): JoseSignatureAlgorithm;
|
|
141
143
|
declare const signatureAlgorithmFromKeyType: (args: SignatureAlgorithmFromKeyTypeArgs) => JoseSignatureAlgorithm;
|
|
142
144
|
declare const keyTypeFromCryptographicSuite: (args: KeyTypeFromCryptographicSuiteArgs) => TKeyType;
|
|
143
145
|
declare function removeNulls<T>(obj: T | any): any;
|
|
@@ -236,4 +238,4 @@ declare const digestMethodParams: (hashAlgorithm: DigestAlgorithm) => {
|
|
|
236
238
|
};
|
|
237
239
|
declare const shaHasher: HasherSync;
|
|
238
240
|
|
|
239
|
-
export { type DigestAlgorithm, ENC_KEY_ALGS, type HashAlgorithm, type IImportProvidedOrGeneratedKeyArgs, type IKeyOpts, JWK_JCS_PUB_NAME, JWK_JCS_PUB_PREFIX, JwkKeyUse, Key, type KeyTypeFromCryptographicSuiteArgs, type KeyVisibility, SIG_KEY_ALGS, type SignatureAlgorithmFromKeyArgs, type SignatureAlgorithmFromKeyTypeArgs, type TDigestMethod, type TKeyType, type X509Opts, asn1DerToRawPublicKey, calculateJwkThumbprint, calculateJwkThumbprintForKey, coseKeyToJwk, coseToJoseCurve, coseToJoseKeyOperation, coseToJoseKty, coseToJoseSignatureAlg, digestMethodParams, generatePrivateKeyHex, getKms, globalCrypto, hexStringFromUint8Array, importProvidedOrGeneratedKey, isAsn1Der, isHash, isHashString, isRawCompressedPublicKey, isSameHash, jcsCanonicalize, joseAlgorithmToDigest, joseToCoseCurve, joseToCoseKeyOperation, joseToCoseKty, joseToCoseSignatureAlg, jwkDetermineUse, jwkJcsDecode, jwkJcsEncode, jwkToCoseKey, jwkToRawHexKey, keyTypeFromCryptographicSuite, logger, minimalJwk, normalizeHashAlgorithm, padLeft, removeNulls, rsaJwkToRawHexKey, sanitizedJwk, shaHasher, signatureAlgorithmFromKey, signatureAlgorithmFromKeyType, toBase64url, toJwk, toJwkFromKey, toPkcs1, toPkcs1FromHex, toRawCompressedHexPublicKey, validateJwk, verifyRawSignature, x25519PublicHexFromPrivateHex };
|
|
241
|
+
export { type DigestAlgorithm, ENC_KEY_ALGS, type HashAlgorithm, type IImportProvidedOrGeneratedKeyArgs, type IKeyOpts, JWK_JCS_PUB_NAME, JWK_JCS_PUB_PREFIX, JwkKeyUse, Key, type KeyTypeFromCryptographicSuiteArgs, type KeyVisibility, SIG_KEY_ALGS, type SignatureAlgorithmFromKeyArgs, type SignatureAlgorithmFromKeyTypeArgs, type TDigestMethod, type TKeyType, type X509Opts, asn1DerToRawPublicKey, calculateJwkThumbprint, calculateJwkThumbprintForKey, coseKeyToJwk, coseToJoseCurve, coseToJoseKeyOperation, coseToJoseKty, coseToJoseSignatureAlg, digestMethodParams, generatePrivateKeyHex, getKms, globalCrypto, hexStringFromUint8Array, importProvidedOrGeneratedKey, isAsn1Der, isHash, isHashString, isRawCompressedPublicKey, isSameHash, jcsCanonicalize, joseAlgorithmToDigest, joseToCoseCurve, joseToCoseKeyOperation, joseToCoseKty, joseToCoseSignatureAlg, jwkDetermineUse, jwkJcsDecode, jwkJcsEncode, jwkToCoseKey, jwkToRawHexKey, keyTypeFromCryptographicSuite, logger, minimalJwk, normalizeHashAlgorithm, padLeft, removeNulls, rsaJwkToRawHexKey, sanitizedJwk, shaHasher, signatureAlgorithmFromKey, signatureAlgorithmFromKeyType, signatureAlgorithmToJoseAlgorithm, toBase64url, toJwk, toJwkFromKey, toPkcs1, toPkcs1FromHex, toRawCompressedHexPublicKey, validateJwk, verifyRawSignature, x25519PublicHexFromPrivateHex };
|
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ type SignatureAlgorithmFromKeyArgs = {
|
|
|
45
45
|
};
|
|
46
46
|
type SignatureAlgorithmFromKeyTypeArgs = {
|
|
47
47
|
type: TKeyType;
|
|
48
|
+
algorithms?: string[];
|
|
48
49
|
};
|
|
49
50
|
type KeyTypeFromCryptographicSuiteArgs = {
|
|
50
51
|
crv?: string;
|
|
@@ -138,6 +139,7 @@ declare const isRawCompressedPublicKey: (key: Uint8Array) => boolean;
|
|
|
138
139
|
declare const toRawCompressedHexPublicKey: (rawPublicKey: Uint8Array, keyType: TKeyType) => string;
|
|
139
140
|
declare const hexStringFromUint8Array: (value: Uint8Array) => string;
|
|
140
141
|
declare const signatureAlgorithmFromKey: (args: SignatureAlgorithmFromKeyArgs) => Promise<JoseSignatureAlgorithm>;
|
|
142
|
+
declare function signatureAlgorithmToJoseAlgorithm(alg: string): JoseSignatureAlgorithm;
|
|
141
143
|
declare const signatureAlgorithmFromKeyType: (args: SignatureAlgorithmFromKeyTypeArgs) => JoseSignatureAlgorithm;
|
|
142
144
|
declare const keyTypeFromCryptographicSuite: (args: KeyTypeFromCryptographicSuiteArgs) => TKeyType;
|
|
143
145
|
declare function removeNulls<T>(obj: T | any): any;
|
|
@@ -236,4 +238,4 @@ declare const digestMethodParams: (hashAlgorithm: DigestAlgorithm) => {
|
|
|
236
238
|
};
|
|
237
239
|
declare const shaHasher: HasherSync;
|
|
238
240
|
|
|
239
|
-
export { type DigestAlgorithm, ENC_KEY_ALGS, type HashAlgorithm, type IImportProvidedOrGeneratedKeyArgs, type IKeyOpts, JWK_JCS_PUB_NAME, JWK_JCS_PUB_PREFIX, JwkKeyUse, Key, type KeyTypeFromCryptographicSuiteArgs, type KeyVisibility, SIG_KEY_ALGS, type SignatureAlgorithmFromKeyArgs, type SignatureAlgorithmFromKeyTypeArgs, type TDigestMethod, type TKeyType, type X509Opts, asn1DerToRawPublicKey, calculateJwkThumbprint, calculateJwkThumbprintForKey, coseKeyToJwk, coseToJoseCurve, coseToJoseKeyOperation, coseToJoseKty, coseToJoseSignatureAlg, digestMethodParams, generatePrivateKeyHex, getKms, globalCrypto, hexStringFromUint8Array, importProvidedOrGeneratedKey, isAsn1Der, isHash, isHashString, isRawCompressedPublicKey, isSameHash, jcsCanonicalize, joseAlgorithmToDigest, joseToCoseCurve, joseToCoseKeyOperation, joseToCoseKty, joseToCoseSignatureAlg, jwkDetermineUse, jwkJcsDecode, jwkJcsEncode, jwkToCoseKey, jwkToRawHexKey, keyTypeFromCryptographicSuite, logger, minimalJwk, normalizeHashAlgorithm, padLeft, removeNulls, rsaJwkToRawHexKey, sanitizedJwk, shaHasher, signatureAlgorithmFromKey, signatureAlgorithmFromKeyType, toBase64url, toJwk, toJwkFromKey, toPkcs1, toPkcs1FromHex, toRawCompressedHexPublicKey, validateJwk, verifyRawSignature, x25519PublicHexFromPrivateHex };
|
|
241
|
+
export { type DigestAlgorithm, ENC_KEY_ALGS, type HashAlgorithm, type IImportProvidedOrGeneratedKeyArgs, type IKeyOpts, JWK_JCS_PUB_NAME, JWK_JCS_PUB_PREFIX, JwkKeyUse, Key, type KeyTypeFromCryptographicSuiteArgs, type KeyVisibility, SIG_KEY_ALGS, type SignatureAlgorithmFromKeyArgs, type SignatureAlgorithmFromKeyTypeArgs, type TDigestMethod, type TKeyType, type X509Opts, asn1DerToRawPublicKey, calculateJwkThumbprint, calculateJwkThumbprintForKey, coseKeyToJwk, coseToJoseCurve, coseToJoseKeyOperation, coseToJoseKty, coseToJoseSignatureAlg, digestMethodParams, generatePrivateKeyHex, getKms, globalCrypto, hexStringFromUint8Array, importProvidedOrGeneratedKey, isAsn1Der, isHash, isHashString, isRawCompressedPublicKey, isSameHash, jcsCanonicalize, joseAlgorithmToDigest, joseToCoseCurve, joseToCoseKeyOperation, joseToCoseKty, joseToCoseSignatureAlg, jwkDetermineUse, jwkJcsDecode, jwkJcsEncode, jwkToCoseKey, jwkToRawHexKey, keyTypeFromCryptographicSuite, logger, minimalJwk, normalizeHashAlgorithm, padLeft, removeNulls, rsaJwkToRawHexKey, sanitizedJwk, shaHasher, signatureAlgorithmFromKey, signatureAlgorithmFromKeyType, signatureAlgorithmToJoseAlgorithm, toBase64url, toJwk, toJwkFromKey, toPkcs1, toPkcs1FromHex, toRawCompressedHexPublicKey, validateJwk, verifyRawSignature, x25519PublicHexFromPrivateHex };
|
package/dist/index.js
CHANGED
|
@@ -868,11 +868,45 @@ var hexStringFromUint8Array = /* @__PURE__ */ __name((value) => toString2(value,
|
|
|
868
868
|
var signatureAlgorithmFromKey = /* @__PURE__ */ __name(async (args) => {
|
|
869
869
|
const { key } = args;
|
|
870
870
|
return signatureAlgorithmFromKeyType({
|
|
871
|
-
type: key.type
|
|
871
|
+
type: key.type,
|
|
872
|
+
algorithms: key.meta?.algorithms
|
|
872
873
|
});
|
|
873
874
|
}, "signatureAlgorithmFromKey");
|
|
875
|
+
function signatureAlgorithmToJoseAlgorithm(alg) {
|
|
876
|
+
switch (alg) {
|
|
877
|
+
case "RSA_SHA256":
|
|
878
|
+
return JoseSignatureAlgorithm.RS256;
|
|
879
|
+
case "RSA_SHA384":
|
|
880
|
+
return JoseSignatureAlgorithm.RS384;
|
|
881
|
+
case "RSA_SHA512":
|
|
882
|
+
return JoseSignatureAlgorithm.RS512;
|
|
883
|
+
case "RSA_SSA_PSS_SHA256_MGF1":
|
|
884
|
+
return JoseSignatureAlgorithm.PS256;
|
|
885
|
+
case "RSA_SSA_PSS_SHA384_MGF1":
|
|
886
|
+
return JoseSignatureAlgorithm.PS384;
|
|
887
|
+
case "RSA_SSA_PSS_SHA512_MGF1":
|
|
888
|
+
return JoseSignatureAlgorithm.PS512;
|
|
889
|
+
case "ECDSA_SHA256":
|
|
890
|
+
return JoseSignatureAlgorithm.ES256;
|
|
891
|
+
case "ECDSA_SHA384":
|
|
892
|
+
return JoseSignatureAlgorithm.ES384;
|
|
893
|
+
case "ECDSA_SHA512":
|
|
894
|
+
return JoseSignatureAlgorithm.ES512;
|
|
895
|
+
case "ES256K":
|
|
896
|
+
return JoseSignatureAlgorithm.ES256K;
|
|
897
|
+
case "ED25519":
|
|
898
|
+
case "EdDSA":
|
|
899
|
+
return JoseSignatureAlgorithm.EdDSA;
|
|
900
|
+
default:
|
|
901
|
+
return alg;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
__name(signatureAlgorithmToJoseAlgorithm, "signatureAlgorithmToJoseAlgorithm");
|
|
874
905
|
var signatureAlgorithmFromKeyType = /* @__PURE__ */ __name((args) => {
|
|
875
|
-
const { type } = args;
|
|
906
|
+
const { type, algorithms } = args;
|
|
907
|
+
if (algorithms && algorithms.length > 0) {
|
|
908
|
+
return signatureAlgorithmToJoseAlgorithm(algorithms[0]);
|
|
909
|
+
}
|
|
876
910
|
switch (type) {
|
|
877
911
|
case "Ed25519":
|
|
878
912
|
case "X25519":
|
|
@@ -886,7 +920,7 @@ var signatureAlgorithmFromKeyType = /* @__PURE__ */ __name((args) => {
|
|
|
886
920
|
case "Secp256k1":
|
|
887
921
|
return JoseSignatureAlgorithm.ES256K;
|
|
888
922
|
case "RSA":
|
|
889
|
-
return JoseSignatureAlgorithm.
|
|
923
|
+
return JoseSignatureAlgorithm.RS256;
|
|
890
924
|
default:
|
|
891
925
|
throw new Error(`Key type '${type}' not supported`);
|
|
892
926
|
}
|
|
@@ -1498,6 +1532,7 @@ export {
|
|
|
1498
1532
|
shaHasher,
|
|
1499
1533
|
signatureAlgorithmFromKey,
|
|
1500
1534
|
signatureAlgorithmFromKeyType,
|
|
1535
|
+
signatureAlgorithmToJoseAlgorithm,
|
|
1501
1536
|
toBase64url,
|
|
1502
1537
|
toJwk,
|
|
1503
1538
|
toJwkFromKey,
|