@oma3/omatrust 0.1.0-alpha.11 → 0.1.0-alpha.12
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/README.md +3 -0
- package/dist/app-registry/index.cjs +53 -0
- package/dist/app-registry/index.cjs.map +1 -1
- package/dist/app-registry/index.js +53 -0
- package/dist/app-registry/index.js.map +1 -1
- package/dist/identity/index.cjs +643 -164
- package/dist/identity/index.cjs.map +1 -1
- package/dist/identity/index.d.cts +2 -2
- package/dist/identity/index.d.ts +2 -2
- package/dist/identity/index.js +616 -165
- package/dist/identity/index.js.map +1 -1
- package/dist/{index-QueRiudB.d.cts → index-B5OC9_8B.d.cts} +155 -4
- package/dist/index-Bu-xxcv9.d.ts +407 -0
- package/dist/{index-C2w5EvFH.d.ts → index-C6WNgPRx.d.ts} +155 -4
- package/dist/index-C7odEbp6.d.cts +407 -0
- package/dist/index.cjs +1000 -185
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +981 -185
- package/dist/index.js.map +1 -1
- package/dist/reputation/index.browser.cjs +153 -148
- package/dist/reputation/index.browser.cjs.map +1 -1
- package/dist/reputation/index.browser.js +153 -148
- package/dist/reputation/index.browser.js.map +1 -1
- package/dist/reputation/index.cjs +477 -140
- package/dist/reputation/index.cjs.map +1 -1
- package/dist/reputation/index.d.cts +2 -2
- package/dist/reputation/index.d.ts +2 -2
- package/dist/reputation/index.js +475 -141
- package/dist/reputation/index.js.map +1 -1
- package/dist/{types-dpYxRq8N.d.cts → types-Dn0OwaNj.d.cts} +37 -11
- package/dist/{types-dpYxRq8N.d.ts → types-Dn0OwaNj.d.ts} +37 -11
- package/dist/widgets/index.cjs.map +1 -1
- package/dist/widgets/index.d.cts +3 -0
- package/dist/widgets/index.d.ts +3 -0
- package/dist/widgets/index.js.map +1 -1
- package/package.json +4 -2
- package/dist/index-BOvk-7Ku.d.cts +0 -235
- package/dist/index-R78TpAhN.d.ts +0 -235
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { A as AuthorizationMetadata, J as JwkValidationResult, a as JwsVerificationError, b as JwsVerificationFailure, c as JwsVerificationResult, P as PublicJwk, d as PublicKeySource, R as ResolveKeyOptions, e as ResolvedControllerDid, f as ResolvedPublicKey, g as computeJwkThumbprint, h as didJwkToJwk, i as extractAuthorizationMetadata, j as formatJktValue, k as jwkToDidJwk, p as publicJwkEquals, r as resolveDidUrlToControllerDid, l as resolveDidUrlToPublicKey, v as validatePublicJwk } from './types-dpYxRq8N.cjs';
|
|
2
|
-
|
|
3
|
-
type Hex$1 = `0x${string}`;
|
|
4
|
-
type Did = string;
|
|
5
|
-
declare function isValidDid(did: string): boolean;
|
|
6
|
-
declare function extractDidMethod(did: Did): string | null;
|
|
7
|
-
declare function extractDidIdentifier(did: Did): string | null;
|
|
8
|
-
declare function normalizeDomain(domain: string): string;
|
|
9
|
-
declare function normalizeDidWeb(input: string): Did;
|
|
10
|
-
declare function normalizeDidPkh(input: string): Did;
|
|
11
|
-
declare function normalizeDidHandle(input: string): Did;
|
|
12
|
-
declare function normalizeDidKey(input: string): Did;
|
|
13
|
-
declare function normalizeDid(input: string): Did;
|
|
14
|
-
declare function computeDidHash(did: Did): Hex$1;
|
|
15
|
-
declare function computeDidAddress(didHash: Hex$1): Hex$1;
|
|
16
|
-
declare function didToAddress(did: Did): Hex$1;
|
|
17
|
-
declare function validateDidAddress(did: Did, address: Hex$1): boolean;
|
|
18
|
-
declare function buildDidWeb(domain: string): Did;
|
|
19
|
-
declare function buildDidPkh(namespace: string, chainId: string | number, address: string): Did;
|
|
20
|
-
declare function buildEvmDidPkh(chainId: string | number, address: string): Did;
|
|
21
|
-
declare function buildDidPkhFromCaip10(caip10: string): Did;
|
|
22
|
-
declare function getChainIdFromDidPkh(did: Did): string | null;
|
|
23
|
-
declare function getAddressFromDidPkh(did: Did): string | null;
|
|
24
|
-
declare function getNamespaceFromDidPkh(did: Did): string | null;
|
|
25
|
-
declare function isEvmDidPkh(did: Did): boolean;
|
|
26
|
-
declare function getDomainFromDidWeb(did: Did): string | null;
|
|
27
|
-
/**
|
|
28
|
-
* Extract an EVM address from a DID or address-like identifier.
|
|
29
|
-
*
|
|
30
|
-
* Supports:
|
|
31
|
-
* - did:pkh (extracts the address portion — currently EVM only)
|
|
32
|
-
* - did:ethr (extracts the Ethereum address)
|
|
33
|
-
* - CAIP-10 format (e.g. eip155:1:0xABC)
|
|
34
|
-
* - Raw EVM addresses (0x + 40 hex chars)
|
|
35
|
-
*
|
|
36
|
-
* NOTE: This function is EVM-specific. It does not support non-EVM chains
|
|
37
|
-
* (e.g. Solana, Cosmos). Non-EVM did:pkh identifiers will throw.
|
|
38
|
-
* A future version may generalize to support multiple chain families.
|
|
39
|
-
*
|
|
40
|
-
* @param identifier - A DID, CAIP-10 string, or raw EVM address
|
|
41
|
-
* @returns The checksummed EVM address
|
|
42
|
-
* @throws OmaTrustError if the identifier cannot be resolved to an EVM address
|
|
43
|
-
*/
|
|
44
|
-
declare function extractAddressFromDid(identifier: string): string;
|
|
45
|
-
/** Result of private-key DID validation */
|
|
46
|
-
interface PrivateKeyDidValidation {
|
|
47
|
-
valid: boolean;
|
|
48
|
-
method: "pkh" | "jwk" | null;
|
|
49
|
-
error?: string;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Check if a DID uses a private-key method (can sign transactions/messages).
|
|
53
|
-
* Quick boolean check — use validatePrivateKeyDid() for detailed errors.
|
|
54
|
-
*/
|
|
55
|
-
declare function isPrivateKeyDid(did: string): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Validate that a DID is a well-formed private-key DID.
|
|
58
|
-
* Returns detailed validation result with method identification and error messages.
|
|
59
|
-
*
|
|
60
|
-
* Supported methods:
|
|
61
|
-
* - did:pkh — CAIP-10 blockchain account (deep validation for eip155)
|
|
62
|
-
* - did:jwk — JSON Web Key (structural validation)
|
|
63
|
-
*/
|
|
64
|
-
declare function validatePrivateKeyDid(did: string): PrivateKeyDidValidation;
|
|
65
|
-
/**
|
|
66
|
-
* Normalize a did:jwk DID.
|
|
67
|
-
* Validates structure and returns the DID unchanged (did:jwk is already canonical).
|
|
68
|
-
*/
|
|
69
|
-
declare function normalizeDidJwk(input: string): Did;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* DID URL Parsing — Phase 1
|
|
73
|
-
*
|
|
74
|
-
* Parses DID URLs (e.g. did:web:api.example.com#key-1) into their components.
|
|
75
|
-
* DID URLs are mutable key references / lookup handles, not durable controller DIDs.
|
|
76
|
-
*/
|
|
77
|
-
/** Parsed DID URL components */
|
|
78
|
-
interface ParsedDidUrl {
|
|
79
|
-
/** The original full DID URL */
|
|
80
|
-
didUrl: string;
|
|
81
|
-
/** The base DID (without fragment) */
|
|
82
|
-
did: string;
|
|
83
|
-
/** The fragment identifier (without the '#'), or null if no fragment */
|
|
84
|
-
fragment: string | null;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Parse a DID URL into its components.
|
|
88
|
-
*
|
|
89
|
-
* A DID URL may include a fragment (e.g. `did:web:api.example.com#key-1`).
|
|
90
|
-
* The fragment identifies a verification method, key reference, or other
|
|
91
|
-
* resource under the DID.
|
|
92
|
-
*
|
|
93
|
-
* DID URLs are mutable key references. They should not be used as durable
|
|
94
|
-
* controller DIDs. Use `resolveDidUrlControllerDid()` to derive a durable
|
|
95
|
-
* `did:jwk` from a DID URL.
|
|
96
|
-
*
|
|
97
|
-
* @param input - A DID URL string
|
|
98
|
-
* @returns Parsed components: didUrl, did, fragment
|
|
99
|
-
* @throws OmaTrustError with code INVALID_DID_URL if input is malformed
|
|
100
|
-
*/
|
|
101
|
-
declare function parseDidUrl(input: string): ParsedDidUrl;
|
|
102
|
-
/**
|
|
103
|
-
* Check whether a string is a DID URL (contains a fragment).
|
|
104
|
-
* Useful for guards that need to reject DID URLs where a bare DID is expected.
|
|
105
|
-
*/
|
|
106
|
-
declare function isDidUrl(input: string): boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Assert that a string is a bare DID (not a DID URL with a fragment).
|
|
109
|
-
* Throws if the input contains a fragment.
|
|
110
|
-
*
|
|
111
|
-
* Use this in functions that expect a subject DID and must reject DID URLs.
|
|
112
|
-
*/
|
|
113
|
-
declare function assertBareDid(input: string, paramName?: string): void;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Controller ID Comparison
|
|
117
|
-
*
|
|
118
|
-
* Determines whether two controller DIDs refer to the same entity.
|
|
119
|
-
* Handles DID normalization and EVM address-based fallback (chain-agnostic).
|
|
120
|
-
*/
|
|
121
|
-
/**
|
|
122
|
-
* Check if two controller DIDs refer to the same entity.
|
|
123
|
-
*
|
|
124
|
-
* Matching strategies (tried in order):
|
|
125
|
-
* 1. Exact normalized DID string match
|
|
126
|
-
* 2. EVM address match (chain-agnostic): if both DIDs resolve to the same
|
|
127
|
-
* EVM address, they match regardless of chain ID. This handles cases like
|
|
128
|
-
* did:pkh:eip155:1:0xABC matching did:pkh:eip155:137:0xABC.
|
|
129
|
-
* 3. JWK material match: if both are did:jwk, compare the decoded public key
|
|
130
|
-
* material directly (handles non-canonical encoding differences).
|
|
131
|
-
*
|
|
132
|
-
* @param a - First controller DID
|
|
133
|
-
* @param b - Second controller DID
|
|
134
|
-
* @returns true if both DIDs refer to the same controller
|
|
135
|
-
*/
|
|
136
|
-
declare function isSameControllerId(a: string, b: string): boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Extract an EVM address from a controller DID, if possible.
|
|
139
|
-
* Returns null for non-EVM controllers (did:jwk, non-eip155 did:pkh, etc.)
|
|
140
|
-
*/
|
|
141
|
-
declare function extractControllerEvmAddress(controllerDid: string): string | null;
|
|
142
|
-
|
|
143
|
-
type Caip10 = string;
|
|
144
|
-
type ParsedCaip10 = {
|
|
145
|
-
namespace: string;
|
|
146
|
-
reference: string;
|
|
147
|
-
address: string;
|
|
148
|
-
};
|
|
149
|
-
type ParsedCaip2 = {
|
|
150
|
-
namespace: string;
|
|
151
|
-
reference: string;
|
|
152
|
-
};
|
|
153
|
-
declare function parseCaip10(input: string): ParsedCaip10;
|
|
154
|
-
declare function buildCaip10(namespace: string, reference: string, address: string): Caip10;
|
|
155
|
-
declare function normalizeCaip10(input: string): Caip10;
|
|
156
|
-
declare function buildCaip2(namespace: string, reference: string): string;
|
|
157
|
-
declare function parseCaip2(caip2: string): ParsedCaip2;
|
|
158
|
-
|
|
159
|
-
type Hex = `0x${string}`;
|
|
160
|
-
declare function canonicalizeJson(obj: unknown): string;
|
|
161
|
-
declare function canonicalizeForHash(obj: unknown): {
|
|
162
|
-
jcsJson: string;
|
|
163
|
-
hash: Hex;
|
|
164
|
-
};
|
|
165
|
-
declare function hashCanonicalizedJson(obj: unknown, algorithm: "keccak256" | "sha256"): Hex;
|
|
166
|
-
|
|
167
|
-
declare const index_AuthorizationMetadata: typeof AuthorizationMetadata;
|
|
168
|
-
type index_Caip10 = Caip10;
|
|
169
|
-
type index_Did = Did;
|
|
170
|
-
declare const index_JwkValidationResult: typeof JwkValidationResult;
|
|
171
|
-
declare const index_JwsVerificationError: typeof JwsVerificationError;
|
|
172
|
-
declare const index_JwsVerificationFailure: typeof JwsVerificationFailure;
|
|
173
|
-
declare const index_JwsVerificationResult: typeof JwsVerificationResult;
|
|
174
|
-
type index_ParsedCaip10 = ParsedCaip10;
|
|
175
|
-
type index_ParsedCaip2 = ParsedCaip2;
|
|
176
|
-
type index_ParsedDidUrl = ParsedDidUrl;
|
|
177
|
-
type index_PrivateKeyDidValidation = PrivateKeyDidValidation;
|
|
178
|
-
declare const index_PublicJwk: typeof PublicJwk;
|
|
179
|
-
declare const index_PublicKeySource: typeof PublicKeySource;
|
|
180
|
-
declare const index_ResolveKeyOptions: typeof ResolveKeyOptions;
|
|
181
|
-
declare const index_ResolvedControllerDid: typeof ResolvedControllerDid;
|
|
182
|
-
declare const index_ResolvedPublicKey: typeof ResolvedPublicKey;
|
|
183
|
-
declare const index_assertBareDid: typeof assertBareDid;
|
|
184
|
-
declare const index_buildCaip10: typeof buildCaip10;
|
|
185
|
-
declare const index_buildCaip2: typeof buildCaip2;
|
|
186
|
-
declare const index_buildDidPkh: typeof buildDidPkh;
|
|
187
|
-
declare const index_buildDidPkhFromCaip10: typeof buildDidPkhFromCaip10;
|
|
188
|
-
declare const index_buildDidWeb: typeof buildDidWeb;
|
|
189
|
-
declare const index_buildEvmDidPkh: typeof buildEvmDidPkh;
|
|
190
|
-
declare const index_canonicalizeForHash: typeof canonicalizeForHash;
|
|
191
|
-
declare const index_canonicalizeJson: typeof canonicalizeJson;
|
|
192
|
-
declare const index_computeDidAddress: typeof computeDidAddress;
|
|
193
|
-
declare const index_computeDidHash: typeof computeDidHash;
|
|
194
|
-
declare const index_computeJwkThumbprint: typeof computeJwkThumbprint;
|
|
195
|
-
declare const index_didJwkToJwk: typeof didJwkToJwk;
|
|
196
|
-
declare const index_didToAddress: typeof didToAddress;
|
|
197
|
-
declare const index_extractAddressFromDid: typeof extractAddressFromDid;
|
|
198
|
-
declare const index_extractAuthorizationMetadata: typeof extractAuthorizationMetadata;
|
|
199
|
-
declare const index_extractControllerEvmAddress: typeof extractControllerEvmAddress;
|
|
200
|
-
declare const index_extractDidIdentifier: typeof extractDidIdentifier;
|
|
201
|
-
declare const index_extractDidMethod: typeof extractDidMethod;
|
|
202
|
-
declare const index_formatJktValue: typeof formatJktValue;
|
|
203
|
-
declare const index_getAddressFromDidPkh: typeof getAddressFromDidPkh;
|
|
204
|
-
declare const index_getChainIdFromDidPkh: typeof getChainIdFromDidPkh;
|
|
205
|
-
declare const index_getDomainFromDidWeb: typeof getDomainFromDidWeb;
|
|
206
|
-
declare const index_getNamespaceFromDidPkh: typeof getNamespaceFromDidPkh;
|
|
207
|
-
declare const index_hashCanonicalizedJson: typeof hashCanonicalizedJson;
|
|
208
|
-
declare const index_isDidUrl: typeof isDidUrl;
|
|
209
|
-
declare const index_isEvmDidPkh: typeof isEvmDidPkh;
|
|
210
|
-
declare const index_isPrivateKeyDid: typeof isPrivateKeyDid;
|
|
211
|
-
declare const index_isSameControllerId: typeof isSameControllerId;
|
|
212
|
-
declare const index_isValidDid: typeof isValidDid;
|
|
213
|
-
declare const index_jwkToDidJwk: typeof jwkToDidJwk;
|
|
214
|
-
declare const index_normalizeCaip10: typeof normalizeCaip10;
|
|
215
|
-
declare const index_normalizeDid: typeof normalizeDid;
|
|
216
|
-
declare const index_normalizeDidHandle: typeof normalizeDidHandle;
|
|
217
|
-
declare const index_normalizeDidJwk: typeof normalizeDidJwk;
|
|
218
|
-
declare const index_normalizeDidKey: typeof normalizeDidKey;
|
|
219
|
-
declare const index_normalizeDidPkh: typeof normalizeDidPkh;
|
|
220
|
-
declare const index_normalizeDidWeb: typeof normalizeDidWeb;
|
|
221
|
-
declare const index_normalizeDomain: typeof normalizeDomain;
|
|
222
|
-
declare const index_parseCaip10: typeof parseCaip10;
|
|
223
|
-
declare const index_parseCaip2: typeof parseCaip2;
|
|
224
|
-
declare const index_parseDidUrl: typeof parseDidUrl;
|
|
225
|
-
declare const index_publicJwkEquals: typeof publicJwkEquals;
|
|
226
|
-
declare const index_resolveDidUrlToControllerDid: typeof resolveDidUrlToControllerDid;
|
|
227
|
-
declare const index_resolveDidUrlToPublicKey: typeof resolveDidUrlToPublicKey;
|
|
228
|
-
declare const index_validateDidAddress: typeof validateDidAddress;
|
|
229
|
-
declare const index_validatePrivateKeyDid: typeof validatePrivateKeyDid;
|
|
230
|
-
declare const index_validatePublicJwk: typeof validatePublicJwk;
|
|
231
|
-
declare namespace index {
|
|
232
|
-
export { index_AuthorizationMetadata as AuthorizationMetadata, type index_Caip10 as Caip10, type index_Did as Did, type Hex$1 as Hex, index_JwkValidationResult as JwkValidationResult, index_JwsVerificationError as JwsVerificationError, index_JwsVerificationFailure as JwsVerificationFailure, index_JwsVerificationResult as JwsVerificationResult, type index_ParsedCaip10 as ParsedCaip10, type index_ParsedCaip2 as ParsedCaip2, type index_ParsedDidUrl as ParsedDidUrl, type index_PrivateKeyDidValidation as PrivateKeyDidValidation, index_PublicJwk as PublicJwk, index_PublicKeySource as PublicKeySource, index_ResolveKeyOptions as ResolveKeyOptions, index_ResolvedControllerDid as ResolvedControllerDid, index_ResolvedPublicKey as ResolvedPublicKey, index_assertBareDid as assertBareDid, index_buildCaip10 as buildCaip10, index_buildCaip2 as buildCaip2, index_buildDidPkh as buildDidPkh, index_buildDidPkhFromCaip10 as buildDidPkhFromCaip10, index_buildDidWeb as buildDidWeb, index_buildEvmDidPkh as buildEvmDidPkh, index_canonicalizeForHash as canonicalizeForHash, index_canonicalizeJson as canonicalizeJson, index_computeDidAddress as computeDidAddress, index_computeDidHash as computeDidHash, index_computeJwkThumbprint as computeJwkThumbprint, index_didJwkToJwk as didJwkToJwk, index_didToAddress as didToAddress, index_extractAddressFromDid as extractAddressFromDid, index_extractAuthorizationMetadata as extractAuthorizationMetadata, index_extractControllerEvmAddress as extractControllerEvmAddress, index_extractDidIdentifier as extractDidIdentifier, index_extractDidMethod as extractDidMethod, index_formatJktValue as formatJktValue, index_getAddressFromDidPkh as getAddressFromDidPkh, index_getChainIdFromDidPkh as getChainIdFromDidPkh, index_getDomainFromDidWeb as getDomainFromDidWeb, index_getNamespaceFromDidPkh as getNamespaceFromDidPkh, index_hashCanonicalizedJson as hashCanonicalizedJson, index_isDidUrl as isDidUrl, index_isEvmDidPkh as isEvmDidPkh, index_isPrivateKeyDid as isPrivateKeyDid, index_isSameControllerId as isSameControllerId, index_isValidDid as isValidDid, index_jwkToDidJwk as jwkToDidJwk, index_normalizeCaip10 as normalizeCaip10, index_normalizeDid as normalizeDid, index_normalizeDidHandle as normalizeDidHandle, index_normalizeDidJwk as normalizeDidJwk, index_normalizeDidKey as normalizeDidKey, index_normalizeDidPkh as normalizeDidPkh, index_normalizeDidWeb as normalizeDidWeb, index_normalizeDomain as normalizeDomain, index_parseCaip10 as parseCaip10, index_parseCaip2 as parseCaip2, index_parseDidUrl as parseDidUrl, index_publicJwkEquals as publicJwkEquals, index_resolveDidUrlToControllerDid as resolveDidUrlToControllerDid, index_resolveDidUrlToPublicKey as resolveDidUrlToPublicKey, index_validateDidAddress as validateDidAddress, index_validatePrivateKeyDid as validatePrivateKeyDid, index_validatePublicJwk as validatePublicJwk };
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export { isEvmDidPkh as A, isPrivateKeyDid as B, type Caip10 as C, type Did as D, isSameControllerId as E, isValidDid as F, normalizeCaip10 as G, type Hex$1 as H, normalizeDid as I, normalizeDidHandle as J, normalizeDidJwk as K, normalizeDidKey as L, normalizeDidPkh as M, normalizeDidWeb as N, normalizeDomain as O, type ParsedCaip10 as P, parseCaip10 as Q, parseCaip2 as R, parseDidUrl as S, validateDidAddress as T, validatePrivateKeyDid as U, type ParsedCaip2 as a, type ParsedDidUrl as b, type PrivateKeyDidValidation as c, assertBareDid as d, buildCaip10 as e, buildCaip2 as f, buildDidPkh as g, buildDidPkhFromCaip10 as h, index as i, buildDidWeb as j, buildEvmDidPkh as k, canonicalizeForHash as l, canonicalizeJson as m, computeDidAddress as n, computeDidHash as o, didToAddress as p, extractAddressFromDid as q, extractControllerEvmAddress as r, extractDidIdentifier as s, extractDidMethod as t, getAddressFromDidPkh as u, getChainIdFromDidPkh as v, getDomainFromDidWeb as w, getNamespaceFromDidPkh as x, hashCanonicalizedJson as y, isDidUrl as z };
|
package/dist/index-R78TpAhN.d.ts
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { A as AuthorizationMetadata, J as JwkValidationResult, a as JwsVerificationError, b as JwsVerificationFailure, c as JwsVerificationResult, P as PublicJwk, d as PublicKeySource, R as ResolveKeyOptions, e as ResolvedControllerDid, f as ResolvedPublicKey, g as computeJwkThumbprint, h as didJwkToJwk, i as extractAuthorizationMetadata, j as formatJktValue, k as jwkToDidJwk, p as publicJwkEquals, r as resolveDidUrlToControllerDid, l as resolveDidUrlToPublicKey, v as validatePublicJwk } from './types-dpYxRq8N.js';
|
|
2
|
-
|
|
3
|
-
type Hex$1 = `0x${string}`;
|
|
4
|
-
type Did = string;
|
|
5
|
-
declare function isValidDid(did: string): boolean;
|
|
6
|
-
declare function extractDidMethod(did: Did): string | null;
|
|
7
|
-
declare function extractDidIdentifier(did: Did): string | null;
|
|
8
|
-
declare function normalizeDomain(domain: string): string;
|
|
9
|
-
declare function normalizeDidWeb(input: string): Did;
|
|
10
|
-
declare function normalizeDidPkh(input: string): Did;
|
|
11
|
-
declare function normalizeDidHandle(input: string): Did;
|
|
12
|
-
declare function normalizeDidKey(input: string): Did;
|
|
13
|
-
declare function normalizeDid(input: string): Did;
|
|
14
|
-
declare function computeDidHash(did: Did): Hex$1;
|
|
15
|
-
declare function computeDidAddress(didHash: Hex$1): Hex$1;
|
|
16
|
-
declare function didToAddress(did: Did): Hex$1;
|
|
17
|
-
declare function validateDidAddress(did: Did, address: Hex$1): boolean;
|
|
18
|
-
declare function buildDidWeb(domain: string): Did;
|
|
19
|
-
declare function buildDidPkh(namespace: string, chainId: string | number, address: string): Did;
|
|
20
|
-
declare function buildEvmDidPkh(chainId: string | number, address: string): Did;
|
|
21
|
-
declare function buildDidPkhFromCaip10(caip10: string): Did;
|
|
22
|
-
declare function getChainIdFromDidPkh(did: Did): string | null;
|
|
23
|
-
declare function getAddressFromDidPkh(did: Did): string | null;
|
|
24
|
-
declare function getNamespaceFromDidPkh(did: Did): string | null;
|
|
25
|
-
declare function isEvmDidPkh(did: Did): boolean;
|
|
26
|
-
declare function getDomainFromDidWeb(did: Did): string | null;
|
|
27
|
-
/**
|
|
28
|
-
* Extract an EVM address from a DID or address-like identifier.
|
|
29
|
-
*
|
|
30
|
-
* Supports:
|
|
31
|
-
* - did:pkh (extracts the address portion — currently EVM only)
|
|
32
|
-
* - did:ethr (extracts the Ethereum address)
|
|
33
|
-
* - CAIP-10 format (e.g. eip155:1:0xABC)
|
|
34
|
-
* - Raw EVM addresses (0x + 40 hex chars)
|
|
35
|
-
*
|
|
36
|
-
* NOTE: This function is EVM-specific. It does not support non-EVM chains
|
|
37
|
-
* (e.g. Solana, Cosmos). Non-EVM did:pkh identifiers will throw.
|
|
38
|
-
* A future version may generalize to support multiple chain families.
|
|
39
|
-
*
|
|
40
|
-
* @param identifier - A DID, CAIP-10 string, or raw EVM address
|
|
41
|
-
* @returns The checksummed EVM address
|
|
42
|
-
* @throws OmaTrustError if the identifier cannot be resolved to an EVM address
|
|
43
|
-
*/
|
|
44
|
-
declare function extractAddressFromDid(identifier: string): string;
|
|
45
|
-
/** Result of private-key DID validation */
|
|
46
|
-
interface PrivateKeyDidValidation {
|
|
47
|
-
valid: boolean;
|
|
48
|
-
method: "pkh" | "jwk" | null;
|
|
49
|
-
error?: string;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Check if a DID uses a private-key method (can sign transactions/messages).
|
|
53
|
-
* Quick boolean check — use validatePrivateKeyDid() for detailed errors.
|
|
54
|
-
*/
|
|
55
|
-
declare function isPrivateKeyDid(did: string): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Validate that a DID is a well-formed private-key DID.
|
|
58
|
-
* Returns detailed validation result with method identification and error messages.
|
|
59
|
-
*
|
|
60
|
-
* Supported methods:
|
|
61
|
-
* - did:pkh — CAIP-10 blockchain account (deep validation for eip155)
|
|
62
|
-
* - did:jwk — JSON Web Key (structural validation)
|
|
63
|
-
*/
|
|
64
|
-
declare function validatePrivateKeyDid(did: string): PrivateKeyDidValidation;
|
|
65
|
-
/**
|
|
66
|
-
* Normalize a did:jwk DID.
|
|
67
|
-
* Validates structure and returns the DID unchanged (did:jwk is already canonical).
|
|
68
|
-
*/
|
|
69
|
-
declare function normalizeDidJwk(input: string): Did;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* DID URL Parsing — Phase 1
|
|
73
|
-
*
|
|
74
|
-
* Parses DID URLs (e.g. did:web:api.example.com#key-1) into their components.
|
|
75
|
-
* DID URLs are mutable key references / lookup handles, not durable controller DIDs.
|
|
76
|
-
*/
|
|
77
|
-
/** Parsed DID URL components */
|
|
78
|
-
interface ParsedDidUrl {
|
|
79
|
-
/** The original full DID URL */
|
|
80
|
-
didUrl: string;
|
|
81
|
-
/** The base DID (without fragment) */
|
|
82
|
-
did: string;
|
|
83
|
-
/** The fragment identifier (without the '#'), or null if no fragment */
|
|
84
|
-
fragment: string | null;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Parse a DID URL into its components.
|
|
88
|
-
*
|
|
89
|
-
* A DID URL may include a fragment (e.g. `did:web:api.example.com#key-1`).
|
|
90
|
-
* The fragment identifies a verification method, key reference, or other
|
|
91
|
-
* resource under the DID.
|
|
92
|
-
*
|
|
93
|
-
* DID URLs are mutable key references. They should not be used as durable
|
|
94
|
-
* controller DIDs. Use `resolveDidUrlControllerDid()` to derive a durable
|
|
95
|
-
* `did:jwk` from a DID URL.
|
|
96
|
-
*
|
|
97
|
-
* @param input - A DID URL string
|
|
98
|
-
* @returns Parsed components: didUrl, did, fragment
|
|
99
|
-
* @throws OmaTrustError with code INVALID_DID_URL if input is malformed
|
|
100
|
-
*/
|
|
101
|
-
declare function parseDidUrl(input: string): ParsedDidUrl;
|
|
102
|
-
/**
|
|
103
|
-
* Check whether a string is a DID URL (contains a fragment).
|
|
104
|
-
* Useful for guards that need to reject DID URLs where a bare DID is expected.
|
|
105
|
-
*/
|
|
106
|
-
declare function isDidUrl(input: string): boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Assert that a string is a bare DID (not a DID URL with a fragment).
|
|
109
|
-
* Throws if the input contains a fragment.
|
|
110
|
-
*
|
|
111
|
-
* Use this in functions that expect a subject DID and must reject DID URLs.
|
|
112
|
-
*/
|
|
113
|
-
declare function assertBareDid(input: string, paramName?: string): void;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Controller ID Comparison
|
|
117
|
-
*
|
|
118
|
-
* Determines whether two controller DIDs refer to the same entity.
|
|
119
|
-
* Handles DID normalization and EVM address-based fallback (chain-agnostic).
|
|
120
|
-
*/
|
|
121
|
-
/**
|
|
122
|
-
* Check if two controller DIDs refer to the same entity.
|
|
123
|
-
*
|
|
124
|
-
* Matching strategies (tried in order):
|
|
125
|
-
* 1. Exact normalized DID string match
|
|
126
|
-
* 2. EVM address match (chain-agnostic): if both DIDs resolve to the same
|
|
127
|
-
* EVM address, they match regardless of chain ID. This handles cases like
|
|
128
|
-
* did:pkh:eip155:1:0xABC matching did:pkh:eip155:137:0xABC.
|
|
129
|
-
* 3. JWK material match: if both are did:jwk, compare the decoded public key
|
|
130
|
-
* material directly (handles non-canonical encoding differences).
|
|
131
|
-
*
|
|
132
|
-
* @param a - First controller DID
|
|
133
|
-
* @param b - Second controller DID
|
|
134
|
-
* @returns true if both DIDs refer to the same controller
|
|
135
|
-
*/
|
|
136
|
-
declare function isSameControllerId(a: string, b: string): boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Extract an EVM address from a controller DID, if possible.
|
|
139
|
-
* Returns null for non-EVM controllers (did:jwk, non-eip155 did:pkh, etc.)
|
|
140
|
-
*/
|
|
141
|
-
declare function extractControllerEvmAddress(controllerDid: string): string | null;
|
|
142
|
-
|
|
143
|
-
type Caip10 = string;
|
|
144
|
-
type ParsedCaip10 = {
|
|
145
|
-
namespace: string;
|
|
146
|
-
reference: string;
|
|
147
|
-
address: string;
|
|
148
|
-
};
|
|
149
|
-
type ParsedCaip2 = {
|
|
150
|
-
namespace: string;
|
|
151
|
-
reference: string;
|
|
152
|
-
};
|
|
153
|
-
declare function parseCaip10(input: string): ParsedCaip10;
|
|
154
|
-
declare function buildCaip10(namespace: string, reference: string, address: string): Caip10;
|
|
155
|
-
declare function normalizeCaip10(input: string): Caip10;
|
|
156
|
-
declare function buildCaip2(namespace: string, reference: string): string;
|
|
157
|
-
declare function parseCaip2(caip2: string): ParsedCaip2;
|
|
158
|
-
|
|
159
|
-
type Hex = `0x${string}`;
|
|
160
|
-
declare function canonicalizeJson(obj: unknown): string;
|
|
161
|
-
declare function canonicalizeForHash(obj: unknown): {
|
|
162
|
-
jcsJson: string;
|
|
163
|
-
hash: Hex;
|
|
164
|
-
};
|
|
165
|
-
declare function hashCanonicalizedJson(obj: unknown, algorithm: "keccak256" | "sha256"): Hex;
|
|
166
|
-
|
|
167
|
-
declare const index_AuthorizationMetadata: typeof AuthorizationMetadata;
|
|
168
|
-
type index_Caip10 = Caip10;
|
|
169
|
-
type index_Did = Did;
|
|
170
|
-
declare const index_JwkValidationResult: typeof JwkValidationResult;
|
|
171
|
-
declare const index_JwsVerificationError: typeof JwsVerificationError;
|
|
172
|
-
declare const index_JwsVerificationFailure: typeof JwsVerificationFailure;
|
|
173
|
-
declare const index_JwsVerificationResult: typeof JwsVerificationResult;
|
|
174
|
-
type index_ParsedCaip10 = ParsedCaip10;
|
|
175
|
-
type index_ParsedCaip2 = ParsedCaip2;
|
|
176
|
-
type index_ParsedDidUrl = ParsedDidUrl;
|
|
177
|
-
type index_PrivateKeyDidValidation = PrivateKeyDidValidation;
|
|
178
|
-
declare const index_PublicJwk: typeof PublicJwk;
|
|
179
|
-
declare const index_PublicKeySource: typeof PublicKeySource;
|
|
180
|
-
declare const index_ResolveKeyOptions: typeof ResolveKeyOptions;
|
|
181
|
-
declare const index_ResolvedControllerDid: typeof ResolvedControllerDid;
|
|
182
|
-
declare const index_ResolvedPublicKey: typeof ResolvedPublicKey;
|
|
183
|
-
declare const index_assertBareDid: typeof assertBareDid;
|
|
184
|
-
declare const index_buildCaip10: typeof buildCaip10;
|
|
185
|
-
declare const index_buildCaip2: typeof buildCaip2;
|
|
186
|
-
declare const index_buildDidPkh: typeof buildDidPkh;
|
|
187
|
-
declare const index_buildDidPkhFromCaip10: typeof buildDidPkhFromCaip10;
|
|
188
|
-
declare const index_buildDidWeb: typeof buildDidWeb;
|
|
189
|
-
declare const index_buildEvmDidPkh: typeof buildEvmDidPkh;
|
|
190
|
-
declare const index_canonicalizeForHash: typeof canonicalizeForHash;
|
|
191
|
-
declare const index_canonicalizeJson: typeof canonicalizeJson;
|
|
192
|
-
declare const index_computeDidAddress: typeof computeDidAddress;
|
|
193
|
-
declare const index_computeDidHash: typeof computeDidHash;
|
|
194
|
-
declare const index_computeJwkThumbprint: typeof computeJwkThumbprint;
|
|
195
|
-
declare const index_didJwkToJwk: typeof didJwkToJwk;
|
|
196
|
-
declare const index_didToAddress: typeof didToAddress;
|
|
197
|
-
declare const index_extractAddressFromDid: typeof extractAddressFromDid;
|
|
198
|
-
declare const index_extractAuthorizationMetadata: typeof extractAuthorizationMetadata;
|
|
199
|
-
declare const index_extractControllerEvmAddress: typeof extractControllerEvmAddress;
|
|
200
|
-
declare const index_extractDidIdentifier: typeof extractDidIdentifier;
|
|
201
|
-
declare const index_extractDidMethod: typeof extractDidMethod;
|
|
202
|
-
declare const index_formatJktValue: typeof formatJktValue;
|
|
203
|
-
declare const index_getAddressFromDidPkh: typeof getAddressFromDidPkh;
|
|
204
|
-
declare const index_getChainIdFromDidPkh: typeof getChainIdFromDidPkh;
|
|
205
|
-
declare const index_getDomainFromDidWeb: typeof getDomainFromDidWeb;
|
|
206
|
-
declare const index_getNamespaceFromDidPkh: typeof getNamespaceFromDidPkh;
|
|
207
|
-
declare const index_hashCanonicalizedJson: typeof hashCanonicalizedJson;
|
|
208
|
-
declare const index_isDidUrl: typeof isDidUrl;
|
|
209
|
-
declare const index_isEvmDidPkh: typeof isEvmDidPkh;
|
|
210
|
-
declare const index_isPrivateKeyDid: typeof isPrivateKeyDid;
|
|
211
|
-
declare const index_isSameControllerId: typeof isSameControllerId;
|
|
212
|
-
declare const index_isValidDid: typeof isValidDid;
|
|
213
|
-
declare const index_jwkToDidJwk: typeof jwkToDidJwk;
|
|
214
|
-
declare const index_normalizeCaip10: typeof normalizeCaip10;
|
|
215
|
-
declare const index_normalizeDid: typeof normalizeDid;
|
|
216
|
-
declare const index_normalizeDidHandle: typeof normalizeDidHandle;
|
|
217
|
-
declare const index_normalizeDidJwk: typeof normalizeDidJwk;
|
|
218
|
-
declare const index_normalizeDidKey: typeof normalizeDidKey;
|
|
219
|
-
declare const index_normalizeDidPkh: typeof normalizeDidPkh;
|
|
220
|
-
declare const index_normalizeDidWeb: typeof normalizeDidWeb;
|
|
221
|
-
declare const index_normalizeDomain: typeof normalizeDomain;
|
|
222
|
-
declare const index_parseCaip10: typeof parseCaip10;
|
|
223
|
-
declare const index_parseCaip2: typeof parseCaip2;
|
|
224
|
-
declare const index_parseDidUrl: typeof parseDidUrl;
|
|
225
|
-
declare const index_publicJwkEquals: typeof publicJwkEquals;
|
|
226
|
-
declare const index_resolveDidUrlToControllerDid: typeof resolveDidUrlToControllerDid;
|
|
227
|
-
declare const index_resolveDidUrlToPublicKey: typeof resolveDidUrlToPublicKey;
|
|
228
|
-
declare const index_validateDidAddress: typeof validateDidAddress;
|
|
229
|
-
declare const index_validatePrivateKeyDid: typeof validatePrivateKeyDid;
|
|
230
|
-
declare const index_validatePublicJwk: typeof validatePublicJwk;
|
|
231
|
-
declare namespace index {
|
|
232
|
-
export { index_AuthorizationMetadata as AuthorizationMetadata, type index_Caip10 as Caip10, type index_Did as Did, type Hex$1 as Hex, index_JwkValidationResult as JwkValidationResult, index_JwsVerificationError as JwsVerificationError, index_JwsVerificationFailure as JwsVerificationFailure, index_JwsVerificationResult as JwsVerificationResult, type index_ParsedCaip10 as ParsedCaip10, type index_ParsedCaip2 as ParsedCaip2, type index_ParsedDidUrl as ParsedDidUrl, type index_PrivateKeyDidValidation as PrivateKeyDidValidation, index_PublicJwk as PublicJwk, index_PublicKeySource as PublicKeySource, index_ResolveKeyOptions as ResolveKeyOptions, index_ResolvedControllerDid as ResolvedControllerDid, index_ResolvedPublicKey as ResolvedPublicKey, index_assertBareDid as assertBareDid, index_buildCaip10 as buildCaip10, index_buildCaip2 as buildCaip2, index_buildDidPkh as buildDidPkh, index_buildDidPkhFromCaip10 as buildDidPkhFromCaip10, index_buildDidWeb as buildDidWeb, index_buildEvmDidPkh as buildEvmDidPkh, index_canonicalizeForHash as canonicalizeForHash, index_canonicalizeJson as canonicalizeJson, index_computeDidAddress as computeDidAddress, index_computeDidHash as computeDidHash, index_computeJwkThumbprint as computeJwkThumbprint, index_didJwkToJwk as didJwkToJwk, index_didToAddress as didToAddress, index_extractAddressFromDid as extractAddressFromDid, index_extractAuthorizationMetadata as extractAuthorizationMetadata, index_extractControllerEvmAddress as extractControllerEvmAddress, index_extractDidIdentifier as extractDidIdentifier, index_extractDidMethod as extractDidMethod, index_formatJktValue as formatJktValue, index_getAddressFromDidPkh as getAddressFromDidPkh, index_getChainIdFromDidPkh as getChainIdFromDidPkh, index_getDomainFromDidWeb as getDomainFromDidWeb, index_getNamespaceFromDidPkh as getNamespaceFromDidPkh, index_hashCanonicalizedJson as hashCanonicalizedJson, index_isDidUrl as isDidUrl, index_isEvmDidPkh as isEvmDidPkh, index_isPrivateKeyDid as isPrivateKeyDid, index_isSameControllerId as isSameControllerId, index_isValidDid as isValidDid, index_jwkToDidJwk as jwkToDidJwk, index_normalizeCaip10 as normalizeCaip10, index_normalizeDid as normalizeDid, index_normalizeDidHandle as normalizeDidHandle, index_normalizeDidJwk as normalizeDidJwk, index_normalizeDidKey as normalizeDidKey, index_normalizeDidPkh as normalizeDidPkh, index_normalizeDidWeb as normalizeDidWeb, index_normalizeDomain as normalizeDomain, index_parseCaip10 as parseCaip10, index_parseCaip2 as parseCaip2, index_parseDidUrl as parseDidUrl, index_publicJwkEquals as publicJwkEquals, index_resolveDidUrlToControllerDid as resolveDidUrlToControllerDid, index_resolveDidUrlToPublicKey as resolveDidUrlToPublicKey, index_validateDidAddress as validateDidAddress, index_validatePrivateKeyDid as validatePrivateKeyDid, index_validatePublicJwk as validatePublicJwk };
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export { isEvmDidPkh as A, isPrivateKeyDid as B, type Caip10 as C, type Did as D, isSameControllerId as E, isValidDid as F, normalizeCaip10 as G, type Hex$1 as H, normalizeDid as I, normalizeDidHandle as J, normalizeDidJwk as K, normalizeDidKey as L, normalizeDidPkh as M, normalizeDidWeb as N, normalizeDomain as O, type ParsedCaip10 as P, parseCaip10 as Q, parseCaip2 as R, parseDidUrl as S, validateDidAddress as T, validatePrivateKeyDid as U, type ParsedCaip2 as a, type ParsedDidUrl as b, type PrivateKeyDidValidation as c, assertBareDid as d, buildCaip10 as e, buildCaip2 as f, buildDidPkh as g, buildDidPkhFromCaip10 as h, index as i, buildDidWeb as j, buildEvmDidPkh as k, canonicalizeForHash as l, canonicalizeJson as m, computeDidAddress as n, computeDidHash as o, didToAddress as p, extractAddressFromDid as q, extractControllerEvmAddress as r, extractDidIdentifier as s, extractDidMethod as t, getAddressFromDidPkh as u, getChainIdFromDidPkh as v, getDomainFromDidWeb as w, getNamespaceFromDidPkh as x, hashCanonicalizedJson as y, isDidUrl as z };
|