/**
 * Elliptic curve used.
 */ export class CurveLabel { static values : CurveLabel [ ] = [ ] ; static SECP224R1 = new CurveLabel ( 'P-224' , 1 , 'p224' ) ; static SECP256R1 = new CurveLabel ( 'P-256' , 2 , 'p256' ) ; static SECP384R1 = new CurveLabel ( 'P-384' , 3 , 'p384' ) ; static SECP521R1 = new CurveLabel ( 'P-521' , 4 , 'p521' ) ; static SM2P256V1 = new CurveLabel ( 'sm2p256v1' , 20 , 'sm2p256v1' ) ; static ED25519 = new CurveLabel ( 'ed25519' , 25 , 'ed25519' ) ; param hex static fromHex ( hex ) { const item = CurveLabel . values . find ( ( v ) => v . hex === hex ) ; if ( item === undefined ) { throw new Error ( 'Enum value not found' ) ; } return item ; } param label static fromLabel ( label ) { const item = CurveLabel . values . find ( ( v ) => v . label === label ) ; if ( item === undefined ) { throw new Error ( 'Enum value not found' ) ; } return item ; } label : string ; hex : number ; preset : string ; constructor ( label , hex , preset ) { this . label = label ; this . hex = hex ; this . preset = preset ; CurveLabel . values . push ( this ) ; } }