@sphereon/ssi-sdk-ext.did-utils 0.28.1-feature.oyd.cmsm.improv.20 → 0.28.1-next.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { TKeyType } from '@sphereon/ssi-sdk-ext.key-utils'
2
- import { IAgentContext, IDIDManager, IIdentifier, IKeyManager, IResolver } from '@veramo/core'
3
- import { JWTHeader, JWTPayload, JWTVerifyOptions } from 'did-jwt'
4
- import { Resolvable } from 'did-resolver'
1
+ import type { TKeyType } from '@sphereon/ssi-sdk-ext.key-utils'
2
+ import type { IAgentContext, IDIDManager, IIdentifier, IKeyManager, IResolver } from '@veramo/core'
3
+ import type { JWTHeader, JWTPayload, JWTVerifyOptions } from 'did-jwt'
4
+ import type { Resolvable } from 'did-resolver'
5
5
 
6
6
  export enum SupportedDidMethodEnum {
7
7
  DID_ETHR = 'ethr',
@@ -1,190 +0,0 @@
1
- import { JwkKeyUse, TKeyType } from '@sphereon/ssi-sdk-ext.key-utils';
2
- import { JWK } from '@sphereon/ssi-types';
3
- import { DIDDocument, DIDDocumentSection, DIDResolutionResult, IAgentContext, IDIDManager, IIdentifier, IKey, IResolver } from '@veramo/core';
4
- import { _ExtendedIKey, _ExtendedVerificationMethod, _NormalizedVerificationMethod } from '@veramo/utils';
5
- import { Signer } from 'did-jwt';
6
- import { DIDResolutionOptions, Resolvable, VerificationMethod } from 'did-resolver';
7
- import { CreateIdentifierOpts, CreateOrGetIdentifierOpts, GetOrCreateResult, GetSignerArgs, IdentifierProviderOpts, IDIDOptions, SignJwtArgs } from './types';
8
- export declare const getAuthenticationKey: ({ identifier, offlineWhenNoDIDRegistered, noVerificationMethodFallback, keyType, controllerKey, }: {
9
- identifier: IIdentifier;
10
- keyType?: TKeyType;
11
- offlineWhenNoDIDRegistered?: boolean;
12
- noVerificationMethodFallback?: boolean;
13
- controllerKey?: boolean;
14
- }, context: IAgentContext<IResolver & IDIDManager>) => Promise<_ExtendedIKey>;
15
- export declare const getFirstKeyWithRelation: ({ identifier, offlineWhenNoDIDRegistered, noVerificationMethodFallback, keyType, controllerKey, vmRelationship, }: {
16
- identifier: IIdentifier;
17
- keyType?: TKeyType;
18
- offlineWhenNoDIDRegistered?: boolean;
19
- noVerificationMethodFallback?: boolean;
20
- controllerKey?: boolean;
21
- vmRelationship: DIDDocumentSection;
22
- }, context: IAgentContext<IResolver & IDIDManager>) => Promise<_ExtendedIKey>;
23
- export declare const getOrCreatePrimaryIdentifier: (context: IAgentContext<IDIDManager>, opts?: CreateOrGetIdentifierOpts) => Promise<GetOrCreateResult<IIdentifier>>;
24
- export declare const getPrimaryIdentifier: (context: IAgentContext<IDIDManager>, opts?: IdentifierProviderOpts) => Promise<IIdentifier | undefined>;
25
- export declare const createIdentifier: (context: IAgentContext<IDIDManager>, opts?: CreateIdentifierOpts) => Promise<IIdentifier>;
26
- export declare const getFirstKeyWithRelationFromDIDDoc: ({ identifier, vmRelationship, keyType, errorOnNotFound, didDocument, controllerKey, }: {
27
- identifier: IIdentifier;
28
- controllerKey?: boolean;
29
- vmRelationship?: DIDDocumentSection;
30
- keyType?: TKeyType;
31
- errorOnNotFound?: boolean;
32
- didDocument?: DIDDocument;
33
- }, context: IAgentContext<IResolver & IDIDManager>) => Promise<_ExtendedIKey | undefined>;
34
- export declare const getEthereumAddressFromKey: ({ key }: {
35
- key: IKey;
36
- }) => any;
37
- export declare const getControllerKey: ({ identifier }: {
38
- identifier: IIdentifier;
39
- }) => IKey;
40
- export declare const getKeys: ({ jwkThumbprint, kms, identifier, kmsKeyRef, keyType, controllerKey, }: {
41
- identifier: IIdentifier;
42
- kmsKeyRef?: string;
43
- keyType?: TKeyType;
44
- kms?: string;
45
- jwkThumbprint?: string;
46
- controllerKey?: boolean;
47
- }) => IKey[];
48
- /**
49
- * Dereferences keys from DID document and normalizes them for easy comparison.
50
- *
51
- * When dereferencing keyAgreement keys, only Ed25519 and X25519 curves are supported.
52
- * Other key types are omitted from the result and Ed25519 keys are converted to X25519
53
- *
54
- * @returns a Promise that resolves to the list of dereferenced keys.
55
- *
56
- * @beta This API may change without a BREAKING CHANGE notice.
57
- */
58
- export declare function dereferenceDidKeysWithJwkSupport(didDocument: DIDDocument, section: DIDDocumentSection | undefined, context: IAgentContext<IResolver>): Promise<_NormalizedVerificationMethod[]>;
59
- export declare function jwkTtoPublicKeyHex(jwk: JWK): string;
60
- /**
61
- * Converts the publicKey of a VerificationMethod to hex encoding (publicKeyHex)
62
- *
63
- * @param pk - the VerificationMethod to be converted
64
- * @param convert - when this flag is set to true, Ed25519 keys are converted to their X25519 pairs
65
- * @returns the hex encoding of the public key
66
- *
67
- * @beta This API may change without a BREAKING CHANGE notice.
68
- */
69
- export declare function extractPublicKeyHexWithJwkSupport(pk: _ExtendedVerificationMethod, convert?: boolean): string;
70
- export declare function isEvenHexString(hex: string): boolean;
71
- /**
72
- * Converts the publicKey of a VerificationMethod to hex encoding (publicKeyHex)
73
- *
74
- * @param pk - the VerificationMethod to be converted
75
- * @param convert - when this flag is set to true, Ed25519 keys are converted to their X25519 pairs
76
- * @returns the hex encoding of the public key
77
- *
78
- * @beta This API may change without a BREAKING CHANGE notice.
79
- */
80
- export declare function extractPublicKeyHex(pk: _ExtendedVerificationMethod, convert?: boolean): string;
81
- export declare function verificationMethodToJwk(vm: VerificationMethod): JWK;
82
- export type DidDocumentJwks = Record<Exclude<DIDDocumentSection, 'publicKey' | 'service'>, Array<JWK>>;
83
- export declare function didDocumentToJwks(didDocument: DIDDocument): DidDocumentJwks;
84
- /**
85
- * Maps the keys of a locally managed {@link @veramo/core#IIdentifier | IIdentifier} to the corresponding
86
- * {@link did-resolver#VerificationMethod | VerificationMethod} entries from the DID document.
87
- *
88
- * @param identifier - the identifier to be mapped
89
- * @param section - the section of the DID document to be mapped (see
90
- * {@link https://www.w3.org/TR/did-core/#verification-relationships | verification relationships}), but can also be
91
- * `verificationMethod` to map all the keys.
92
- * @param didDocument
93
- * @param context - the veramo agent context, which must contain a {@link @veramo/core#IResolver | IResolver}
94
- * implementation that can resolve the DID document of the identifier.
95
- *
96
- * @returns an array of mapped keys. The corresponding verification method is added to the `meta.verificationMethod`
97
- * property of the key.
98
- *
99
- * @beta This API may change without a BREAKING CHANGE notice.
100
- */
101
- export declare function mapIdentifierKeysToDocWithJwkSupport({ identifier, vmRelationship, didDocument, }: {
102
- identifier: IIdentifier;
103
- vmRelationship?: DIDDocumentSection;
104
- didDocument?: DIDDocument;
105
- }, context: IAgentContext<IResolver & IDIDManager>): Promise<_ExtendedIKey[]>;
106
- export declare function getAgentDIDMethods(context: IAgentContext<IDIDManager>): Promise<string[]>;
107
- export declare function getDID(idOpts: {
108
- identifier: IIdentifier | string;
109
- }): string;
110
- export declare function toDID(identifier: string | IIdentifier | Partial<IIdentifier>): string;
111
- export declare function toDIDs(identifiers?: (string | IIdentifier | Partial<IIdentifier>)[]): string[];
112
- export declare function getKey({ identifier, vmRelationship, kmsKeyRef, }: {
113
- identifier: IIdentifier;
114
- vmRelationship?: DIDDocumentSection;
115
- kmsKeyRef?: string;
116
- }, context: IAgentContext<IResolver & IDIDManager>): Promise<IKey>;
117
- /**
118
- * Get the real kid as used in JWTs. This is the kid in the VM or in the JWT, not the kid in the Veramo/Sphereon keystore. That was just a poorly chosen name
119
- * @param key
120
- * @param idOpts
121
- * @param context
122
- */
123
- export declare function determineKid({ key, idOpts, }: {
124
- key: IKey;
125
- idOpts: {
126
- identifier: IIdentifier | string;
127
- kmsKeyRef?: string;
128
- };
129
- }, context: IAgentContext<IResolver & IDIDManager>): Promise<string>;
130
- export declare function getSupportedDIDMethods(didOpts: IDIDOptions, context: IAgentContext<IDIDManager>): Promise<string[]>;
131
- export declare function getAgentResolver(context: IAgentContext<IResolver & IDIDManager>, opts?: {
132
- localResolution?: boolean;
133
- uniresolverResolution?: boolean;
134
- resolverResolution?: boolean;
135
- }): Resolvable;
136
- export declare class AgentDIDResolver implements Resolvable {
137
- private readonly context;
138
- private readonly resolverResolution;
139
- private readonly uniresolverResolution;
140
- private readonly localResolution;
141
- constructor(context: IAgentContext<IResolver & IDIDManager>, opts?: {
142
- uniresolverResolution?: boolean;
143
- localResolution?: boolean;
144
- resolverResolution?: boolean;
145
- });
146
- resolve(didUrl: string, options?: DIDResolutionOptions): Promise<DIDResolutionResult>;
147
- }
148
- /**
149
- * Please note that this is not an exact representation of the actual DID Document.
150
- *
151
- * We try to do our best, to map keys onto relevant verification methods and relationships, but we simply lack the context
152
- * of the actual DID method here. Do not relly on this method for DID resolution. It is only handy for offline use cases
153
- * when no DID Document is cached. For DID:WEB it does provide an accurate representation!
154
- *
155
- * @param identifier
156
- * @param opts
157
- */
158
- export declare function toDidDocument(identifier?: IIdentifier, opts?: {
159
- did?: string;
160
- use?: JwkKeyUse[];
161
- }): DIDDocument | undefined;
162
- export declare function toDidResolutionResult(identifier?: IIdentifier, opts?: {
163
- did?: string;
164
- supportedMethods?: string[];
165
- }): DIDResolutionResult;
166
- export declare function asDidWeb(hostnameOrDID: string): Promise<string>;
167
- /**
168
- * @deprecated Replaced by the new signer service
169
- */
170
- export declare const signDidJWT: (args: SignJwtArgs) => Promise<string>;
171
- /**
172
- * @deprecated Replaced by the new signer service
173
- */
174
- export declare const getDidSigner: (args: GetSignerArgs & {
175
- idOpts: {
176
- /**
177
- * @deprecated
178
- */
179
- identifier: IIdentifier | string;
180
- /**
181
- * @deprecated
182
- */
183
- verificationMethodSection?: DIDDocumentSection;
184
- /**
185
- * @deprecated
186
- */
187
- kmsKeyRef?: string;
188
- };
189
- }) => Promise<Signer>;
190
- //# sourceMappingURL=did-functions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"did-functions.d.ts","sourceRoot":"","sources":["../src/did-functions.ts"],"names":[],"mappings":"AAEA,OAAO,EAGH,SAAS,EAIT,QAAQ,EAEX,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EAAC,GAAG,EAAC,MAAM,qBAAqB,CAAA;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