Skip to content

Commit a4920b1

Browse files
Add spec links.
Signed-off-by: Dmitri Zagidulin <[email protected]>
1 parent 508d6cd commit a4920b1

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/DID.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/*!
22
* Copyright (c) 2025 Digital Credentials Consortium. All rights reserved.
33
*/
4-
import { ILdType } from './LD';
4+
import { ILdType } from './LD'
5+
import { IPublicKey } from './KeyPair'
56

67
/**
78
* A Decentralized Identifier (DID) URL
@@ -11,8 +12,10 @@ export type IDID = `did:${string}`
1112

1213
export type IDidDocument = IDidDocument_v1_0 | IDidDocument_v1_1
1314

14-
export type IKeyIdOrObject = string | object
15+
export type KeyId = string
16+
export type IKeyIdOrObject = KeyId | IPublicKey
1517

18+
// @see https://www.w3.org/TR/cid-1.0/#services
1619
export interface IServiceObject {
1720
id?: string // a URL
1821
type: ILdType

src/KeyPair.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
* Copyright (c) 2025 Digital Credentials Consortium.
33
*/
44
export type IKeyPair = IVerificationKeyPair2018 | IVerificationKeyPair2020 |
5-
IMultikeyPair | IJsonWebKeyPair2020
5+
IMultikeyPair | IJsonWebKeyPair2020 | IJsonWebKeyPair
66

77
export type IPublicKey = IPublicKey2018 | IPublicKey2020 | IPublicMultikey
8-
| IJsonWebPublicKey2020
8+
| IJsonWebPublicKey
99

1010
export interface IKeyPairCore {
1111
'@context'?: string
@@ -33,27 +33,38 @@ export interface IVerificationKeyPair2020 extends IPublicKey2020 {
3333
privateKeyMultibase?: string
3434
}
3535

36+
/**
37+
* @see https://www.w3.org/TR/cid-1.0/#Multikey
38+
*/
3639
export interface IPublicMultikey extends IKeyPairCore {
3740
publicKeyMultibase?: string
3841
}
3942
export interface IMultikeyPair extends IPublicMultikey {
4043
secretKeyMultibase?: string
4144
}
4245

43-
export interface IJsonWebPublicKey2020 {
46+
export interface IJsonWebPublicKey {
4447
// Used by JsonWebKey2020
4548
publicKeyJwk?: IJsonWebKey
4649
}
47-
export interface IJsonWebKeyPair2020 extends IJsonWebPublicKey2020 {
50+
export interface IJsonWebKeyPair2020 extends IJsonWebPublicKey {
4851
privateKeyJwk?: IJsonWebKey
4952
}
53+
// @see https://www.w3.org/TR/cid-1.0/#JsonWebKey
54+
export interface IJsonWebKeyPair extends IJsonWebPublicKey {
55+
secretKeyJwk?: IJsonWebKey
56+
}
57+
5058
export interface IJsonWebKey {
5159
// Key type, e.g. 'RSA' or 'OKP'
5260
kty?: string
5361

5462
// Curve, used by elliptic cryptography keys (kty: 'OKP'), e.g. 'Ed25519'
5563
crv?: string
5664

65+
// Algorithm, e.g. 'ES384'
66+
alg?: string
67+
5768
// Public key, typically base64url encoded
5869
x?: string
5970

0 commit comments

Comments
 (0)