-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1250703
commit a221a83
Showing
3 changed files
with
78 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,51 @@ | ||
/** | ||
* Represents a JSON Web Token (JWT) used in cryptographic operations. | ||
*/ | ||
export interface JWT { | ||
kty: string | ||
d: string | ||
crv: string | ||
kid: string | ||
x: string | ||
kty: string // Key type (e.g., 'EC' for Elliptic Curve) | ||
d: string // Private key (base64url encoded) | ||
crv: string // Cryptographic curve (e.g., 'secp256k1') | ||
kid: string // Key ID | ||
x: string // X-coordinate of the public key (base64url encoded) | ||
} | ||
|
||
/** | ||
* Represents a key used by an issuer to sign credentials. | ||
*/ | ||
export interface IssuerKey { | ||
type: string | ||
jwk: JWT | ||
type: string // Type of the key (e.g., 'JWK') | ||
jwk: JWT // The JSON Web Token associated with the issuer's key | ||
} | ||
|
||
/** | ||
* Represents the result of signing a credential. | ||
*/ | ||
export interface SignedCredential { | ||
jws: string | ||
header: Record<string, any> | ||
issuer: string | ||
jws: string // JSON Web Signature (JWS) of the credential | ||
header: Record<string, any> // Protected header used in the JWS | ||
issuer: string // DID or public key of the issuer | ||
} | ||
|
||
export interface IssuerKeyJWK { | ||
kty: string | ||
crv: string | ||
d: string | ||
x: string | ||
y: string | ||
alg: string | ||
use: string | ||
/** | ||
* Represents the common properties of a JSON Web Key (JWK). | ||
*/ | ||
interface BaseJWK { | ||
kty: string // Key type (e.g., 'EC' for Elliptic Curve) | ||
crv: string // Cryptographic curve (e.g., 'secp256k1') | ||
x: string // X-coordinate of the public key (base64url encoded) | ||
y: string // Y-coordinate of the public key (base64url encoded) | ||
alg: string // Algorithm used (e.g., 'ES256K') | ||
use: string // Intended use of the key (e.g., 'sig' for signing) | ||
} | ||
|
||
/** | ||
* Represents a JSON Web Key (JWK) for private signing operations. | ||
*/ | ||
export interface IssuerKeyJWK extends BaseJWK { | ||
d: string // Private key (base64url encoded) | ||
} | ||
|
||
/** | ||
* Represents a JSON Web Key (JWK) for public verification operations. | ||
*/ | ||
export interface IssuerPublicKeyJWK extends BaseJWK {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters