Skip to content

Commit

Permalink
fix(typescript): don't expose non existant classes, fix decode key
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Jan 23, 2020
1 parent 2a7780c commit 0f8bf88
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export namespace JWK {
passphrase?: string;
}

class Key {
interface Key {
kty: keyType;
type: keyObjectTypes;
private: boolean;
Expand All @@ -98,7 +98,7 @@ export namespace JWK {
algorithms(operation?: keyOperation): Set<string>;
}

class RSAKey extends Key {
interface RSAKey extends Key {
kty: 'RSA';
type: asymmetricKeyObjectTypes;
secret: false;
Expand All @@ -114,7 +114,7 @@ export namespace JWK {
toJWK(private?: boolean): JWKRSAKey;
}

class ECKey extends Key {
interface ECKey extends Key {
kty: 'EC';
secret: false;
type: asymmetricKeyObjectTypes;
Expand All @@ -126,7 +126,7 @@ export namespace JWK {
toJWK(private?: boolean): JWKECKey;
}

class OKPKey extends Key {
interface OKPKey extends Key {
kty: 'OKP';
secret: false;
type: asymmetricKeyObjectTypes;
Expand All @@ -137,7 +137,7 @@ export namespace JWK {
toJWK(private?: boolean): JWKOKPKey;
}

class OctKey extends Key {
interface OctKey extends Key {
kty: 'oct';
type: 'secret';
private: false;
Expand Down Expand Up @@ -331,19 +331,19 @@ export namespace JWE {
}

export namespace JWT {
interface completeResult {
interface completeResult<T = JWK.Key> {
payload: object;
header: object;
signature: string;
key: JWK.Key;
key: T;
}

interface DecodeOptions<komplet> {
complete?: komplet;
}

function decode(jwt: string, options?: DecodeOptions<false>): object;
function decode(jwt: string, options?: DecodeOptions<true>): completeResult;
function decode(jwt: string, options?: DecodeOptions<true>): completeResult<undefined>;

interface VerifyOptions<komplet> {
complete?: komplet;
Expand Down

0 comments on commit 0f8bf88

Please sign in to comment.