@sphereon/ssi-sdk-ext.key-utils 0.36.1-next.70 → 0.37.0

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 CHANGED
@@ -38,6 +38,7 @@ __export(index_exports, {
38
38
  Key: () => Key,
39
39
  SIG_KEY_ALGS: () => SIG_KEY_ALGS,
40
40
  asn1DerToRawPublicKey: () => asn1DerToRawPublicKey,
41
+ base64ToBase64Url: () => base64ToBase64Url,
41
42
  calculateJwkThumbprint: () => calculateJwkThumbprint,
42
43
  calculateJwkThumbprintForKey: () => calculateJwkThumbprintForKey,
43
44
  coseKeyToJwk: () => coseKeyToJwk,
@@ -58,6 +59,7 @@ __export(index_exports, {
58
59
  isSameHash: () => isSameHash,
59
60
  jcsCanonicalize: () => jcsCanonicalize,
60
61
  joseAlgorithmToDigest: () => joseAlgorithmToDigest,
62
+ joseSignatureAlgToWebCrypto: () => joseSignatureAlgToWebCrypto,
61
63
  joseToCoseCurve: () => joseToCoseCurve,
62
64
  joseToCoseKeyOperation: () => joseToCoseKeyOperation,
63
65
  joseToCoseKty: () => joseToCoseKty,
@@ -985,6 +987,7 @@ function signatureAlgorithmToJoseAlgorithm(alg) {
985
987
  case "ES256K":
986
988
  return import_ssi_types.JoseSignatureAlgorithm.ES256K;
987
989
  case "ED25519":
990
+ case "Ed25519":
988
991
  case "EdDSA":
989
992
  return import_ssi_types.JoseSignatureAlgorithm.EdDSA;
990
993
  default:
@@ -1032,8 +1035,14 @@ var keyTypeFromCryptographicSuite = /* @__PURE__ */ __name((args) => {
1032
1035
  case "Ed25519":
1033
1036
  case "Ed25519Signature2018":
1034
1037
  case "Ed25519Signature2020":
1038
+ case "Ed25519VerificationKey2018":
1039
+ case "Ed25519VerificationKey2020":
1035
1040
  case "JcsEd25519Signature2020":
1036
1041
  return "Ed25519";
1042
+ case "X25519":
1043
+ case "X25519KeyAgreementKey2019":
1044
+ case "X25519KeyAgreementKey2020":
1045
+ return "X25519";
1037
1046
  case "JsonWebSignature2020":
1038
1047
  case "ES256":
1039
1048
  case "ECDSA":
@@ -1050,6 +1059,7 @@ var keyTypeFromCryptographicSuite = /* @__PURE__ */ __name((args) => {
1050
1059
  case "ES256K":
1051
1060
  case "EcdsaSecp256k1VerificationKey2019":
1052
1061
  case "EcdsaSecp256k1RecoveryMethod2020":
1062
+ case "Secp256k1VerificationKey2018":
1053
1063
  return "Secp256k1";
1054
1064
  }
1055
1065
  if (kty) {
@@ -1578,4 +1588,98 @@ function coseToJoseCurve(curve) {
1578
1588
  }
1579
1589
  }
1580
1590
  __name(coseToJoseCurve, "coseToJoseCurve");
1591
+ function joseSignatureAlgToWebCrypto(alg) {
1592
+ switch (alg) {
1593
+ case import_ssi_types2.JoseSignatureAlgorithm.RS256:
1594
+ case "RS256":
1595
+ return {
1596
+ name: "RSASSA-PKCS1-v1_5",
1597
+ hash: "SHA-256"
1598
+ };
1599
+ case import_ssi_types2.JoseSignatureAlgorithm.RS384:
1600
+ case "RS384":
1601
+ return {
1602
+ name: "RSASSA-PKCS1-v1_5",
1603
+ hash: "SHA-384"
1604
+ };
1605
+ case import_ssi_types2.JoseSignatureAlgorithm.RS512:
1606
+ case "RS512":
1607
+ return {
1608
+ name: "RSASSA-PKCS1-v1_5",
1609
+ hash: "SHA-512"
1610
+ };
1611
+ case import_ssi_types2.JoseSignatureAlgorithm.PS256:
1612
+ case "PS256":
1613
+ return {
1614
+ name: "RSA-PSS",
1615
+ hash: "SHA-256",
1616
+ saltLength: 32
1617
+ };
1618
+ case import_ssi_types2.JoseSignatureAlgorithm.PS384:
1619
+ case "PS384":
1620
+ return {
1621
+ name: "RSA-PSS",
1622
+ hash: "SHA-384",
1623
+ saltLength: 48
1624
+ };
1625
+ case import_ssi_types2.JoseSignatureAlgorithm.PS512:
1626
+ case "PS512":
1627
+ return {
1628
+ name: "RSA-PSS",
1629
+ hash: "SHA-512",
1630
+ saltLength: 64
1631
+ };
1632
+ case import_ssi_types2.JoseSignatureAlgorithm.ES256:
1633
+ case "ES256":
1634
+ return {
1635
+ name: "ECDSA",
1636
+ hash: "SHA-256"
1637
+ };
1638
+ case import_ssi_types2.JoseSignatureAlgorithm.ES384:
1639
+ case "ES384":
1640
+ return {
1641
+ name: "ECDSA",
1642
+ hash: "SHA-384"
1643
+ };
1644
+ case import_ssi_types2.JoseSignatureAlgorithm.ES512:
1645
+ case "ES512":
1646
+ return {
1647
+ name: "ECDSA",
1648
+ hash: "SHA-512"
1649
+ };
1650
+ case import_ssi_types2.JoseSignatureAlgorithm.ES256K:
1651
+ case "ES256K":
1652
+ return {
1653
+ name: "ECDSA",
1654
+ hash: "SHA-256"
1655
+ };
1656
+ case import_ssi_types2.JoseSignatureAlgorithm.EdDSA:
1657
+ case "EdDSA":
1658
+ return {
1659
+ name: "Ed25519",
1660
+ hash: ""
1661
+ };
1662
+ case import_ssi_types2.JoseSignatureAlgorithm.HS256:
1663
+ case "HS256":
1664
+ return {
1665
+ name: "HMAC",
1666
+ hash: "SHA-256"
1667
+ };
1668
+ case import_ssi_types2.JoseSignatureAlgorithm.HS384:
1669
+ case "HS384":
1670
+ return {
1671
+ name: "HMAC",
1672
+ hash: "SHA-384"
1673
+ };
1674
+ case import_ssi_types2.JoseSignatureAlgorithm.HS512:
1675
+ case "HS512":
1676
+ return {
1677
+ name: "HMAC",
1678
+ hash: "SHA-512"
1679
+ };
1680
+ default:
1681
+ throw Error(`Signature algorithm ${alg} not supported in Web Crypto API`);
1682
+ }
1683
+ }
1684
+ __name(joseSignatureAlgToWebCrypto, "joseSignatureAlgToWebCrypto");
1581
1685
  //# sourceMappingURL=index.cjs.map