Skip to content

Commit

Permalink
feat: add type definition for JWK formatted public keys (#80)
Browse files Browse the repository at this point in the history
* feat: adds type support for JWK formatted keys
* fix: remove private key related props
* fix: add a generic JsonWebKey prop
  • Loading branch information
elmariachi111 authored Feb 26, 2021
1 parent 2c11d29 commit f9b9c8d
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ export interface DIDDocument {
publicKey: PublicKey[]
authentication?: (string | PublicKey | Authentication)[]
/**
* @deprecated This does not appear in the did-core spec
*/
* @deprecated This does not appear in the did-core spec
*/
uportProfile?: any
service?: ServiceEndpoint[]
/**
* @deprecated this property has been removed from the did-core spec
*/
* @deprecated this property has been removed from the did-core spec
*/
created?: string
/**
* @deprecated this property has been removed from the did-core spec
*/
* @deprecated this property has been removed from the did-core spec
*/
updated?: string
/**
* @deprecated this property has been removed from the did-core spec
*/
* @deprecated this property has been removed from the did-core spec
*/
proof?: LinkedDataProof
keyAgreement?: (string | PublicKey)[]
}
Expand All @@ -44,6 +44,21 @@ export interface ServiceEndpoint {
description?: string
}

interface JsonWebKey {
alg?: string
crv?: string
e?: string
ext?: boolean
key_ops?: string[]
kid?: string
kty: string
n?: string
use?: string
x?: string
y?: string
[x: string]: any
}

export interface PublicKey {
id: string
type: string
Expand All @@ -53,11 +68,12 @@ export interface PublicKey {
publicKeyBase58?: string
publicKeyHex?: string
publicKeyPem?: string
publicKeyJwk?: JsonWebKey
}

/**
* @deprecated The `authentication` array should be an array of strings or `PublicKey`
*/
* @deprecated The `authentication` array should be an array of strings or `PublicKey`
*/
export interface Authentication {
type: string
publicKey: string
Expand Down

0 comments on commit f9b9c8d

Please sign in to comment.