diff --git a/src/keys/symmetric.ts b/src/keys/symmetric.ts index b517e46..7dfc742 100644 --- a/src/keys/symmetric.ts +++ b/src/keys/symmetric.ts @@ -3,6 +3,6 @@ import { CryptoKey } from "./key"; export class SymmetricKey extends CryptoKey { public override readonly kty = "oct"; - public override readonly type: "secret" = "secret"; + public override readonly type = "secret" as const; } diff --git a/src/mechs/ec/private_key.ts b/src/mechs/ec/private_key.ts index 1855223..28c1f72 100644 --- a/src/mechs/ec/private_key.ts +++ b/src/mechs/ec/private_key.ts @@ -5,7 +5,7 @@ import { AsymmetricKey } from "../../keys"; import { getOidByNamedCurve } from "./helper"; export class EcPrivateKey extends AsymmetricKey implements IJsonConvertible { - public readonly type: "private" = "private"; + public readonly type = "private" as const; public override algorithm!: EcKeyAlgorithm; public getKey() { diff --git a/src/mechs/ec/public_key.ts b/src/mechs/ec/public_key.ts index 8911228..8a16c51 100644 --- a/src/mechs/ec/public_key.ts +++ b/src/mechs/ec/public_key.ts @@ -6,7 +6,7 @@ import { getOidByNamedCurve } from "./helper"; export class EcPublicKey extends AsymmetricKey implements IJsonConvertible { - public readonly type: "public" = "public"; + public readonly type = "public" as const; public override algorithm!: EcKeyAlgorithm; public getKey() { @@ -39,7 +39,7 @@ export class EcPublicKey extends AsymmetricKey implements IJsonConvertible { keyInfo.publicKeyAlgorithm.parameters = AsnSerializer.serialize( new core.asn1.ObjectIdentifier(getOidByNamedCurve(json.crv)), ); - keyInfo.publicKey = AsnSerializer.toASN(key).valueHex; + keyInfo.publicKey = (AsnSerializer.toASN(key) as any).valueHex; this.data = Buffer.from(AsnSerializer.serialize(keyInfo)); diff --git a/src/mechs/ed/private_key.ts b/src/mechs/ed/private_key.ts index df4b1f6..0040446 100644 --- a/src/mechs/ed/private_key.ts +++ b/src/mechs/ed/private_key.ts @@ -5,7 +5,7 @@ import { AsymmetricKey } from "../../keys"; import { getOidByNamedCurve } from "./helper"; export class EdPrivateKey extends AsymmetricKey implements IJsonConvertible { - public readonly type: "private" = "private"; + public readonly type = "private" as const; public override algorithm!: EcKeyAlgorithm; public getKey() { diff --git a/src/mechs/ed/public_key.ts b/src/mechs/ed/public_key.ts index 939a013..3262238 100644 --- a/src/mechs/ed/public_key.ts +++ b/src/mechs/ed/public_key.ts @@ -7,7 +7,7 @@ import { getOidByNamedCurve } from "./helper"; export class EdPublicKey extends AsymmetricKey implements IJsonConvertible { - public readonly type: "public" = "public"; + public readonly type = "public" as const; public override algorithm!: EcKeyAlgorithm; public getKey() { diff --git a/src/mechs/rsa/private_key.ts b/src/mechs/rsa/private_key.ts index 0fd17b6..2545147 100644 --- a/src/mechs/rsa/private_key.ts +++ b/src/mechs/rsa/private_key.ts @@ -5,7 +5,7 @@ import { AsymmetricKey } from "../../keys"; import { getJwkAlgorithm } from "./helper"; export class RsaPrivateKey extends AsymmetricKey { - public readonly type: "private" = "private"; + public readonly type = "private" as const; public override algorithm!: RsaHashedKeyAlgorithm; public getKey() { diff --git a/src/mechs/rsa/public_key.ts b/src/mechs/rsa/public_key.ts index 32f01d3..ab8c430 100644 --- a/src/mechs/rsa/public_key.ts +++ b/src/mechs/rsa/public_key.ts @@ -5,7 +5,7 @@ import { AsymmetricKey } from "../../keys/asymmetric"; import { getJwkAlgorithm } from "./helper"; export class RsaPublicKey extends AsymmetricKey { - public readonly type: "public" = "public"; + public readonly type = "public" as const; public override algorithm!: RsaHashedKeyAlgorithm; public getKey() {