@microsoft/ccf-app 5.0.0-dev7 → 5.0.0-dev9
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/crypto.d.ts +1 -1
- package/crypto.js +1 -1
- package/global.d.ts +3 -3
- package/package.json +1 -1
- package/polyfill.js +26 -13
package/crypto.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const generateRsaKeyPair: (size: number, exponent?: number | unde
|
|
|
11
11
|
*/
|
|
12
12
|
export declare const generateEcdsaKeyPair: (curve: string) => import("./global.js").CryptoKeyPair;
|
|
13
13
|
/**
|
|
14
|
-
* @inheritDoc global!CCFCrypto.
|
|
14
|
+
* @inheritDoc global!CCFCrypto.generateEddsaKeyPair
|
|
15
15
|
*/
|
|
16
16
|
export declare const generateEddsaKeyPair: (curve: string) => import("./global.js").CryptoKeyPair;
|
|
17
17
|
/**
|
package/crypto.js
CHANGED
|
@@ -27,7 +27,7 @@ export const generateRsaKeyPair = ccf.crypto.generateRsaKeyPair;
|
|
|
27
27
|
*/
|
|
28
28
|
export const generateEcdsaKeyPair = ccf.crypto.generateEcdsaKeyPair;
|
|
29
29
|
/**
|
|
30
|
-
* @inheritDoc global!CCFCrypto.
|
|
30
|
+
* @inheritDoc global!CCFCrypto.generateEddsaKeyPair
|
|
31
31
|
*/
|
|
32
32
|
export const generateEddsaKeyPair = ccf.crypto.generateEddsaKeyPair;
|
|
33
33
|
/**
|
package/global.d.ts
CHANGED
|
@@ -298,7 +298,7 @@ export interface CCFCrypto {
|
|
|
298
298
|
/**
|
|
299
299
|
* Generate an EdDSA key pair.
|
|
300
300
|
*
|
|
301
|
-
* @param curve The name of the curve.
|
|
301
|
+
* @param curve The name of the curve. Only "curve25519" and "x25519" are supported.
|
|
302
302
|
*/
|
|
303
303
|
generateEddsaKeyPair(curve: string): CryptoKeyPair;
|
|
304
304
|
/**
|
|
@@ -362,7 +362,7 @@ export interface CCFCrypto {
|
|
|
362
362
|
rsaPemToJwk(pem: string, kid?: string): JsonWebKeyRSAPrivate;
|
|
363
363
|
/**
|
|
364
364
|
* Converts an EdDSA public key as PEM to JSON Web Key (JWK) object.
|
|
365
|
-
*
|
|
365
|
+
* Only Curve25519 and X25519 are supported.
|
|
366
366
|
*
|
|
367
367
|
* @param pem EdDSA public key as PEM
|
|
368
368
|
* @param kid Key identifier (optional)
|
|
@@ -370,7 +370,7 @@ export interface CCFCrypto {
|
|
|
370
370
|
pubEddsaPemToJwk(pem: string, kid?: string): JsonWebKeyEdDSAPublic;
|
|
371
371
|
/**
|
|
372
372
|
* Converts an EdDSA private key as PEM to JSON Web Key (JWK) object.
|
|
373
|
-
*
|
|
373
|
+
* Only Curve25519 and X25519 are supported.
|
|
374
374
|
*
|
|
375
375
|
* @param pem EdDSA private key as PEM
|
|
376
376
|
* @param kid Key identifier (optional)
|
package/package.json
CHANGED
package/polyfill.js
CHANGED
|
@@ -207,19 +207,32 @@ class CCFPolyfill {
|
|
|
207
207
|
return ecdsaKeyPair;
|
|
208
208
|
},
|
|
209
209
|
generateEddsaKeyPair(curve) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
210
|
+
if (curve === "curve25519") {
|
|
211
|
+
return jscrypto.generateKeyPairSync("ed25519", {
|
|
212
|
+
publicKeyEncoding: {
|
|
213
|
+
type: "spki",
|
|
214
|
+
format: "pem",
|
|
215
|
+
},
|
|
216
|
+
privateKeyEncoding: {
|
|
217
|
+
type: "pkcs8",
|
|
218
|
+
format: "pem",
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
if (curve !== "x25519")
|
|
224
|
+
throw new Error("Unsupported curve for EdDSA key pair generation: " + curve);
|
|
225
|
+
return jscrypto.generateKeyPairSync("x25519", {
|
|
226
|
+
publicKeyEncoding: {
|
|
227
|
+
type: "spki",
|
|
228
|
+
format: "pem",
|
|
229
|
+
},
|
|
230
|
+
privateKeyEncoding: {
|
|
231
|
+
type: "pkcs8",
|
|
232
|
+
format: "pem",
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
}
|
|
223
236
|
},
|
|
224
237
|
wrapKey(key, wrappingKey, parameters) {
|
|
225
238
|
if (parameters.name === "RSA-OAEP") {
|