import { Constructor } from "../../../utils/mixins.mjs"; import { KnownJwaKeyAgreementAlgorithm, KnownJwaSignatureAlgorithm } from "./jwa.mjs"; import { KmsJwkPublicAsymmetric } from "./knownJwk.mjs"; import { P256PublicJwk } from "./kty/ec/P256PublicJwk.mjs"; import { P384PublicJwk } from "./kty/ec/P384PublicJwk.mjs"; import { P521PublicJwk } from "./kty/ec/P521PublicJwk.mjs"; import { Secp256k1PublicJwk } from "./kty/ec/Secp256k1PublicJwk.mjs"; import { Ed25519PublicJwk } from "./kty/okp/Ed25519PublicJwk.mjs"; import { X25519PublicJwk } from "./kty/okp/X25519PublicJwk.mjs"; import { RsaPublicJwk } from "./kty/rsa/RsaPublicJwk.mjs"; import "./kty/index.mjs"; import { HashName } from "../../../crypto/hashes/Hasher.mjs"; import "../../../crypto/index.mjs"; //#region src/modules/kms/jwk/PublicJwk.d.ts declare const SupportedPublicJwks: (typeof Ed25519PublicJwk | typeof P256PublicJwk | typeof P384PublicJwk | typeof P521PublicJwk | typeof RsaPublicJwk | typeof Secp256k1PublicJwk | typeof X25519PublicJwk)[]; type SupportedPublicJwkClass = (typeof SupportedPublicJwks)[number]; type SupportedPublicJwk = Ed25519PublicJwk | P256PublicJwk | P384PublicJwk | P521PublicJwk | RsaPublicJwk | Secp256k1PublicJwk | X25519PublicJwk; type ExtractByJwk = T extends { jwk: infer J; } ? (K extends J ? T : never) : never; type ExtractByPublicKey = T extends { publicKey: infer J; } ? (K extends J ? T : never) : never; declare class PublicJwk { private readonly jwk; private constructor(); static fromUnknown(jwkJson: unknown): PublicJwk; static fromPublicJwk(jwk: Jwk): PublicJwk extends never ? SupportedPublicJwk : ExtractByJwk>; toJson({ includeKid }?: { includeKid?: boolean; }): Jwk['jwk']; /** * Get the signature algorithms supported for this jwk. * * If the jwk has an `alg` field defined it will only return that alg * and otherwise return all known supported signature algorithms. */ get supportedSignatureAlgorithms(): KnownJwaSignatureAlgorithm[]; get supportedEncryptionKeyAgreementAlgorithms(): KnownJwaKeyAgreementAlgorithm[]; /** * key type as defined in [JWA Specification](https://tools.ietf.org/html/rfc7518#section-6.1) */ get kty(): Jwk['jwk']['kty']; /** * Get the key id for a public jwk. If the public jwk does not have * a key id, an error will be thrown */ get keyId(): string; get hasKeyId(): boolean; set keyId(keyId: string); get legacyKeyId(): string; get publicKey(): Jwk['publicKey']; /** * Return the compressed public key. If the key type does not support compressed public keys, it will return null */ get compressedPublicKey(): Jwk['compressedPublicKey']; get JwkClass(): SupportedPublicJwkClass; /** * SHA-256 jwk thumbprint */ getJwkThumbprint(hashAlgorithm?: HashName): Uint8Array; /** * Get the first signature algorithm to use with this jwk. If the jwk has an `alg` field defined * it will use that alg, and otherwise fall back to the first supported signature algorithm. * * If no algorithm is supported it will throw an error */ get signatureAlgorithm(): this["supportedSignatureAlgorithms"][number]; assertSignatureAlgorithmSupported(alg: KnownJwaSignatureAlgorithm): asserts alg is this['supportedSignatureAlgorithms'][number]; static fromPublicKey(publicKey: Supported): PublicJwk>; /** * Returns the jwk encoded a Base58 multibase encoded multicodec key */ get fingerprint(): string; /** * Create a jwk instance based on a Base58 multibase encoded multicodec key */ static fromFingerprint(fingerprint: string): PublicJwk; /** * Check whether this PublicJwk instance is of a specific type */ is(jwkType1: Constructor, jwkType2?: Constructor, jwkType3?: Constructor): this is PublicJwk | PublicJwk | PublicJwk; /** * Convert the PublicJwk to another type. * * NOTE: only supported for Ed25519 to X25519 at the moment */ convertTo(type: Jwk extends Ed25519PublicJwk ? typeof X25519PublicJwk : never): Jwk extends Ed25519PublicJwk ? PublicJwk : never; /** * Check whether this jwk instance is the same as another jwk instance. * It does this by comparing the key types and public keys, not other fields * of the JWK such as keyId, use, etc.. */ equals(other: PublicJwk): boolean; /** * Get human description of a jwk type. This does * not include the (public) key material */ get jwkTypeHumanDescription(): string; static supportedPublicJwkClassForSignatureAlgorithm(alg: KnownJwaSignatureAlgorithm): SupportedPublicJwkClass; } //#endregion export { PublicJwk, SupportedPublicJwk, SupportedPublicJwkClass }; //# sourceMappingURL=PublicJwk.d.mts.map