File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " identity-based-encryption-bn254" ,
3- "version" : " 0.0.2 " ,
3+ "version" : " 0.0.3 " ,
44 "source" : " src/index.ts" ,
55 "main" : " ./dist/cjs/index.cjs" ,
66 "module" : " ./dist/esm/index.mjs" ,
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export class IBE {
1313
1414 createDecryptionKey ( secretKey : SecretKey | Uint8Array , identity : Identity ) : DecryptionKey {
1515 const sk = secretKey instanceof Uint8Array ? bn254 . fields . Fr . fromBytes ( secretKey ) : secretKey . sk
16- return { k : identity . i . multiply ( sk ) . toAffine ( ) }
16+ return { k : identity . i . multiply ( sk ) }
1717 }
1818
1919 encrypt ( message : Uint8Array , identity : Identity , publicKey : PublicKey ) {
@@ -23,7 +23,7 @@ export class IBE {
2323 decrypt ( ciphertext : Ciphertext , decryptionKey : DecryptionKey | Uint8Array ) : Uint8Array {
2424 try {
2525 const key = decryptionKey instanceof Uint8Array ? bn254 . G1 . ProjectivePoint . fromHex ( decryptionKey ) : decryptionKey . k
26- return decrypt ( ciphertext , key , this . opts )
26+ return decrypt ( ciphertext , key . toAffine ( ) , this . opts )
2727 } catch ( err ) {
2828 throw new Error ( "failed to decrypt the ciphertext - did you use the correct key?" )
2929 }
@@ -60,5 +60,5 @@ export type PublicKey = {
6060}
6161
6262export type DecryptionKey = {
63- k : G1
63+ k : ProjPointType < Fp >
6464}
Original file line number Diff line number Diff line change 11import * as asn1js from "asn1js"
22import { bn254 } from "@kevincharm/noble-bn254-drand"
3- import { Ciphertext } from "./crypto"
3+ import { Ciphertext , G2 } from "./crypto"
4+ import { ProjPointType } from "@noble/curves/esm/abstract/weierstrass"
5+ import { Fp } from "@noble/curves/esm/abstract/tower"
46
57/**
68 * Serialize Ciphertext to ASN.1 structure
You can’t perform that action at this time.
0 commit comments