@credo-ts/indy-vdr 0.6.1-pr-2091-20241119140918 → 0.6.2-alpha-20251210145840
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/build/IndyVdrApi.d.mts +42 -0
- package/build/IndyVdrApi.d.mts.map +1 -0
- package/build/IndyVdrApi.mjs +72 -0
- package/build/IndyVdrApi.mjs.map +1 -0
- package/build/IndyVdrModule.d.mts +20 -0
- package/build/IndyVdrModule.d.mts.map +1 -0
- package/build/IndyVdrModule.mjs +30 -0
- package/build/IndyVdrModule.mjs.map +1 -0
- package/build/IndyVdrModuleConfig.d.mts +72 -0
- package/build/IndyVdrModuleConfig.d.mts.map +1 -0
- package/build/IndyVdrModuleConfig.mjs +18 -0
- package/build/IndyVdrModuleConfig.mjs.map +1 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorate.mjs +10 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateMetadata.mjs +7 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateParam.mjs +9 -0
- package/build/anoncreds/IndyVdrAnonCredsRegistry.d.mts +125 -0
- package/build/anoncreds/IndyVdrAnonCredsRegistry.d.mts.map +1 -0
- package/build/anoncreds/IndyVdrAnonCredsRegistry.mjs +586 -0
- package/build/anoncreds/IndyVdrAnonCredsRegistry.mjs.map +1 -0
- package/build/anoncreds/index.d.mts +1 -0
- package/build/anoncreds/index.mjs +1 -0
- package/build/anoncreds/utils/identifiers.mjs +29 -0
- package/build/anoncreds/utils/identifiers.mjs.map +1 -0
- package/build/anoncreds/utils/transform.mjs +63 -0
- package/build/anoncreds/utils/transform.mjs.map +1 -0
- package/build/dids/IndyVdrIndyDidRegistrar.d.mts +92 -0
- package/build/dids/IndyVdrIndyDidRegistrar.d.mts.map +1 -0
- package/build/dids/IndyVdrIndyDidRegistrar.mjs +290 -0
- package/build/dids/IndyVdrIndyDidRegistrar.mjs.map +1 -0
- package/build/dids/IndyVdrIndyDidResolver.d.mts +12 -0
- package/build/dids/IndyVdrIndyDidResolver.d.mts.map +1 -0
- package/build/dids/IndyVdrIndyDidResolver.mjs +36 -0
- package/build/dids/IndyVdrIndyDidResolver.mjs.map +1 -0
- package/build/dids/IndyVdrSovDidResolver.d.mts +13 -0
- package/build/dids/IndyVdrSovDidResolver.d.mts.map +1 -0
- package/build/dids/IndyVdrSovDidResolver.mjs +70 -0
- package/build/dids/IndyVdrSovDidResolver.mjs.map +1 -0
- package/build/dids/didIndyUtil.mjs +147 -0
- package/build/dids/didIndyUtil.mjs.map +1 -0
- package/build/dids/didSovUtil.mjs +118 -0
- package/build/dids/didSovUtil.mjs.map +1 -0
- package/build/dids/index.d.mts +3 -0
- package/build/dids/index.mjs +3 -0
- package/build/error/IndyVdrError.mjs +12 -0
- package/build/error/IndyVdrError.mjs.map +1 -0
- package/build/error/IndyVdrNotConfiguredError.mjs +12 -0
- package/build/error/IndyVdrNotConfiguredError.mjs.map +1 -0
- package/build/error/IndyVdrNotFound.mjs +12 -0
- package/build/error/IndyVdrNotFound.mjs.map +1 -0
- package/build/error/index.mjs +3 -0
- package/build/index.d.mts +12 -0
- package/build/index.mjs +12 -0
- package/build/pool/IndyVdrPool.d.mts +61 -0
- package/build/pool/IndyVdrPool.d.mts.map +1 -0
- package/build/pool/IndyVdrPool.mjs +104 -0
- package/build/pool/IndyVdrPool.mjs.map +1 -0
- package/build/pool/IndyVdrPoolService.d.mts +54 -0
- package/build/pool/IndyVdrPoolService.d.mts.map +1 -0
- package/build/pool/IndyVdrPoolService.mjs +157 -0
- package/build/pool/IndyVdrPoolService.mjs.map +1 -0
- package/build/pool/index.d.mts +2 -0
- package/build/pool/index.mjs +2 -0
- package/build/utils/did.mjs +48 -0
- package/build/utils/did.mjs.map +1 -0
- package/build/utils/promises.mjs +20 -0
- package/build/utils/promises.mjs.map +1 -0
- package/build/utils/sign.mjs +24 -0
- package/build/utils/sign.mjs.map +1 -0
- package/package.json +19 -19
- package/build/IndyVdrApi.d.ts +0 -34
- package/build/IndyVdrApi.js +0 -82
- package/build/IndyVdrApi.js.map +0 -1
- package/build/IndyVdrModule.d.ts +0 -14
- package/build/IndyVdrModule.js +0 -31
- package/build/IndyVdrModule.js.map +0 -1
- package/build/IndyVdrModuleConfig.d.ts +0 -66
- package/build/IndyVdrModuleConfig.js +0 -18
- package/build/IndyVdrModuleConfig.js.map +0 -1
- package/build/anoncreds/IndyVdrAnonCredsRegistry.d.ts +0 -113
- package/build/anoncreds/IndyVdrAnonCredsRegistry.js +0 -682
- package/build/anoncreds/IndyVdrAnonCredsRegistry.js.map +0 -1
- package/build/anoncreds/index.d.ts +0 -1
- package/build/anoncreds/index.js +0 -18
- package/build/anoncreds/index.js.map +0 -1
- package/build/anoncreds/utils/identifiers.d.ts +0 -5
- package/build/anoncreds/utils/identifiers.js +0 -40
- package/build/anoncreds/utils/identifiers.js.map +0 -1
- package/build/anoncreds/utils/transform.d.ts +0 -32
- package/build/anoncreds/utils/transform.js +0 -91
- package/build/anoncreds/utils/transform.js.map +0 -1
- package/build/dids/IndyVdrIndyDidRegistrar.d.ts +0 -85
- package/build/dids/IndyVdrIndyDidRegistrar.js +0 -338
- package/build/dids/IndyVdrIndyDidRegistrar.js.map +0 -1
- package/build/dids/IndyVdrIndyDidResolver.d.ts +0 -7
- package/build/dids/IndyVdrIndyDidResolver.js +0 -39
- package/build/dids/IndyVdrIndyDidResolver.js.map +0 -1
- package/build/dids/IndyVdrSovDidResolver.d.ts +0 -8
- package/build/dids/IndyVdrSovDidResolver.js +0 -79
- package/build/dids/IndyVdrSovDidResolver.js.map +0 -1
- package/build/dids/didIndyUtil.d.ts +0 -47
- package/build/dids/didIndyUtil.js +0 -241
- package/build/dids/didIndyUtil.js.map +0 -1
- package/build/dids/didSovUtil.d.ts +0 -26
- package/build/dids/didSovUtil.js +0 -180
- package/build/dids/didSovUtil.js.map +0 -1
- package/build/dids/index.d.ts +0 -3
- package/build/dids/index.js +0 -10
- package/build/dids/index.js.map +0 -1
- package/build/error/IndyVdrError.d.ts +0 -6
- package/build/error/IndyVdrError.js +0 -11
- package/build/error/IndyVdrError.js.map +0 -1
- package/build/error/IndyVdrNotConfiguredError.d.ts +0 -6
- package/build/error/IndyVdrNotConfiguredError.js +0 -11
- package/build/error/IndyVdrNotConfiguredError.js.map +0 -1
- package/build/error/IndyVdrNotFound.d.ts +0 -6
- package/build/error/IndyVdrNotFound.js +0 -11
- package/build/error/IndyVdrNotFound.js.map +0 -1
- package/build/error/index.d.ts +0 -3
- package/build/error/index.js +0 -20
- package/build/error/index.js.map +0 -1
- package/build/index.d.ts +0 -5
- package/build/index.js +0 -27
- package/build/index.js.map +0 -1
- package/build/pool/IndyVdrPool.d.ts +0 -54
- package/build/pool/IndyVdrPool.js +0 -131
- package/build/pool/IndyVdrPool.js.map +0 -1
- package/build/pool/IndyVdrPoolService.d.ts +0 -55
- package/build/pool/IndyVdrPoolService.js +0 -175
- package/build/pool/IndyVdrPoolService.js.map +0 -1
- package/build/pool/index.d.ts +0 -2
- package/build/pool/index.js +0 -19
- package/build/pool/index.js.map +0 -1
- package/build/utils/did.d.ts +0 -32
- package/build/utils/did.js +0 -57
- package/build/utils/did.js.map +0 -1
- package/build/utils/promises.d.ts +0 -11
- package/build/utils/promises.js +0 -26
- package/build/utils/promises.js.map +0 -1
- package/build/utils/sign.d.ts +0 -5
- package/build/utils/sign.js +0 -23
- package/build/utils/sign.js.map +0 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { IndyVdrError } from "../error/IndyVdrError.mjs";
|
|
2
|
+
import { IndyVdrNotConfiguredError } from "../error/IndyVdrNotConfiguredError.mjs";
|
|
3
|
+
import { IndyVdrNotFoundError } from "../error/IndyVdrNotFound.mjs";
|
|
4
|
+
import "../error/index.mjs";
|
|
5
|
+
import { IndyVdrPool } from "./IndyVdrPool.mjs";
|
|
6
|
+
import { IndyVdrModuleConfig } from "../IndyVdrModuleConfig.mjs";
|
|
7
|
+
import { isSelfCertifiedDid } from "../utils/did.mjs";
|
|
8
|
+
import { allSettled, onlyFulfilled, onlyRejected } from "../utils/promises.mjs";
|
|
9
|
+
import { __decorateMetadata } from "../_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateMetadata.mjs";
|
|
10
|
+
import { __decorateParam } from "../_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateParam.mjs";
|
|
11
|
+
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.99.0/helpers/decorate.mjs";
|
|
12
|
+
import { didIndyRegex } from "@credo-ts/anoncreds";
|
|
13
|
+
import { CacheModuleConfig, InjectionSymbols, inject, injectable } from "@credo-ts/core";
|
|
14
|
+
import { GetNymRequest } from "@hyperledger/indy-vdr-shared";
|
|
15
|
+
|
|
16
|
+
//#region src/pool/IndyVdrPoolService.ts
|
|
17
|
+
var _ref;
|
|
18
|
+
let IndyVdrPoolService = class IndyVdrPoolService$1 {
|
|
19
|
+
constructor(logger, indyVdrModuleConfig) {
|
|
20
|
+
this.pools = [];
|
|
21
|
+
this.logger = logger;
|
|
22
|
+
this.indyVdrModuleConfig = indyVdrModuleConfig;
|
|
23
|
+
this.pools = this.indyVdrModuleConfig.networks.map((poolConfig) => new IndyVdrPool(poolConfig));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get the most appropriate pool for the given did.
|
|
27
|
+
* If the did is a qualified indy did, the pool will be determined based on the namespace.
|
|
28
|
+
* If it is a legacy unqualified indy did, the pool will be determined based on the algorithm as described in this document:
|
|
29
|
+
* https://docs.google.com/document/d/109C_eMsuZnTnYe2OAd02jAts1vC4axwEKIq7_4dnNVA/edit
|
|
30
|
+
*
|
|
31
|
+
* This method will optionally return a nym response when the did has been resolved to determine the ledger
|
|
32
|
+
* either now or in the past. The nymResponse can be used to prevent multiple ledger quries fetching the same
|
|
33
|
+
* did
|
|
34
|
+
*/
|
|
35
|
+
async getPoolForDid(agentContext, did) {
|
|
36
|
+
const match = did.match(didIndyRegex);
|
|
37
|
+
if (match) {
|
|
38
|
+
const [, namespace] = match;
|
|
39
|
+
const pool = this.getPoolForNamespace(namespace);
|
|
40
|
+
if (pool) return { pool };
|
|
41
|
+
throw new IndyVdrError(`Pool for indy namespace '${namespace}' not found`);
|
|
42
|
+
}
|
|
43
|
+
return await this.getPoolForLegacyDid(agentContext, did);
|
|
44
|
+
}
|
|
45
|
+
async getPoolForLegacyDid(agentContext, did) {
|
|
46
|
+
const pools = this.pools;
|
|
47
|
+
if (pools.length === 0) throw new IndyVdrNotConfiguredError("No indy ledgers configured. Provide at least one pool configuration in IndyVdrModuleConfigOptions.networks");
|
|
48
|
+
const cache = agentContext.dependencyManager.resolve(CacheModuleConfig).cache;
|
|
49
|
+
const cacheKey = `IndyVdrPoolService:${did}`;
|
|
50
|
+
const cachedNymResponse = await cache.get(agentContext, cacheKey);
|
|
51
|
+
const pool = this.pools.find((pool$1) => pool$1.indyNamespace === cachedNymResponse?.indyNamespace);
|
|
52
|
+
if (cachedNymResponse && pool) {
|
|
53
|
+
this.logger.trace(`Found ledger id '${pool.indyNamespace}' for did '${did}' in cache`);
|
|
54
|
+
return {
|
|
55
|
+
pool,
|
|
56
|
+
nymResponse: cachedNymResponse.nymResponse
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const { successful, rejected } = await this.getSettledDidResponsesFromPools(did, pools);
|
|
60
|
+
if (successful.length === 0) {
|
|
61
|
+
const allNotFound = rejected.every((e) => e.reason instanceof IndyVdrNotFoundError);
|
|
62
|
+
const rejectedOtherThanNotFound = rejected.filter((e) => !(e.reason instanceof IndyVdrNotFoundError));
|
|
63
|
+
if (allNotFound) throw new IndyVdrNotFoundError(`Did '${did}' not found on any of the ledgers (total ${this.pools.length}).`);
|
|
64
|
+
throw new IndyVdrError(`Unknown error retrieving did '${did}' from '${rejectedOtherThanNotFound.length}' of '${pools.length}' ledgers. ${rejectedOtherThanNotFound[0].reason}`, { cause: rejectedOtherThanNotFound[0].reason });
|
|
65
|
+
}
|
|
66
|
+
let value = successful.find((response) => isSelfCertifiedDid(response.value.did.nymResponse.did, response.value.did.nymResponse.verkey))?.value;
|
|
67
|
+
if (!value) {
|
|
68
|
+
const production = successful.filter((s) => s.value.pool.config.isProduction);
|
|
69
|
+
const nonProduction = successful.filter((s) => !s.value.pool.config.isProduction);
|
|
70
|
+
value = (production.length >= 1 ? production : nonProduction)[0].value;
|
|
71
|
+
}
|
|
72
|
+
await cache.set(agentContext, cacheKey, {
|
|
73
|
+
nymResponse: {
|
|
74
|
+
did: value.did.nymResponse.did,
|
|
75
|
+
verkey: value.did.nymResponse.verkey
|
|
76
|
+
},
|
|
77
|
+
indyNamespace: value.did.indyNamespace
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
pool: value.pool,
|
|
81
|
+
nymResponse: value.did.nymResponse
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
async getSettledDidResponsesFromPools(did, pools) {
|
|
85
|
+
this.logger.trace(`Retrieving did '${did}' from ${pools.length} ledgers`);
|
|
86
|
+
const didResponses = await allSettled(pools.map((pool) => this.getDidFromPool(did, pool)));
|
|
87
|
+
const successful = onlyFulfilled(didResponses);
|
|
88
|
+
this.logger.trace(`Retrieved ${successful.length} responses from ledgers for did '${did}'`);
|
|
89
|
+
return {
|
|
90
|
+
rejected: onlyRejected(didResponses),
|
|
91
|
+
successful
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Refresh the pool connections asynchronously
|
|
96
|
+
*/
|
|
97
|
+
refreshPoolConnections() {
|
|
98
|
+
return Promise.allSettled(this.pools.map((pool) => pool.refreshConnection()));
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get all pool transactions
|
|
102
|
+
*/
|
|
103
|
+
getAllPoolTransactions() {
|
|
104
|
+
return Promise.allSettled(this.pools.map(async (pool) => {
|
|
105
|
+
return {
|
|
106
|
+
config: pool.config,
|
|
107
|
+
transactions: await pool.transactions
|
|
108
|
+
};
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Get the most appropriate pool for the given indyNamespace
|
|
113
|
+
*/
|
|
114
|
+
getPoolForNamespace(indyNamespace) {
|
|
115
|
+
if (this.pools.length === 0) throw new IndyVdrNotConfiguredError("No indy ledgers configured. Provide at least one pool configuration in IndyVdrModuleConfigOptions.networks");
|
|
116
|
+
const pool = this.pools.find((pool$1) => pool$1.indyNamespace === indyNamespace);
|
|
117
|
+
if (!pool) throw new IndyVdrError(`No ledgers found for indy namespace '${indyNamespace}'.`);
|
|
118
|
+
return pool;
|
|
119
|
+
}
|
|
120
|
+
async getDidFromPool(did, pool) {
|
|
121
|
+
try {
|
|
122
|
+
this.logger.trace(`Get public did '${did}' from ledger '${pool.indyNamespace}'`);
|
|
123
|
+
const request = new GetNymRequest({ dest: did });
|
|
124
|
+
this.logger.trace(`Submitting get did request for did '${did}' to ledger '${pool.indyNamespace}'`);
|
|
125
|
+
const response = await pool.submitRequest(request);
|
|
126
|
+
if (!response.result.data) throw new IndyVdrNotFoundError(`Did ${did} not found on indy pool with namespace ${pool.indyNamespace}`);
|
|
127
|
+
const result = JSON.parse(response.result.data);
|
|
128
|
+
this.logger.trace(`Retrieved did '${did}' from ledger '${pool.indyNamespace}'`, result);
|
|
129
|
+
return {
|
|
130
|
+
did: {
|
|
131
|
+
nymResponse: {
|
|
132
|
+
did: result.dest,
|
|
133
|
+
verkey: result.verkey
|
|
134
|
+
},
|
|
135
|
+
indyNamespace: pool.indyNamespace
|
|
136
|
+
},
|
|
137
|
+
pool,
|
|
138
|
+
response
|
|
139
|
+
};
|
|
140
|
+
} catch (error) {
|
|
141
|
+
this.logger.trace(`Error retrieving did '${did}' from ledger '${pool.indyNamespace}'`, {
|
|
142
|
+
error,
|
|
143
|
+
did
|
|
144
|
+
});
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
IndyVdrPoolService = __decorate([
|
|
150
|
+
injectable(),
|
|
151
|
+
__decorateParam(0, inject(InjectionSymbols.Logger)),
|
|
152
|
+
__decorateMetadata("design:paramtypes", [Object, typeof (_ref = typeof IndyVdrModuleConfig !== "undefined" && IndyVdrModuleConfig) === "function" ? _ref : Object])
|
|
153
|
+
], IndyVdrPoolService);
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
156
|
+
export { IndyVdrPoolService };
|
|
157
|
+
//# sourceMappingURL=IndyVdrPoolService.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IndyVdrPoolService.mjs","names":["IndyVdrPoolService","logger: Logger","pool"],"sources":["../../src/pool/IndyVdrPoolService.ts"],"sourcesContent":["import { didIndyRegex } from '@credo-ts/anoncreds'\nimport type { AgentContext } from '@credo-ts/core'\nimport { CacheModuleConfig, InjectionSymbols, inject, injectable, type Logger } from '@credo-ts/core'\nimport type { GetNymResponse } from '@hyperledger/indy-vdr-shared'\nimport { GetNymRequest } from '@hyperledger/indy-vdr-shared'\nimport { IndyVdrError, IndyVdrNotConfiguredError, IndyVdrNotFoundError } from '../error'\nimport { IndyVdrModuleConfig } from '../IndyVdrModuleConfig'\nimport { isSelfCertifiedDid } from '../utils/did'\nimport { allSettled, onlyFulfilled, onlyRejected } from '../utils/promises'\n\nimport { IndyVdrPool } from './IndyVdrPool'\n\nexport interface CachedDidResponse {\n nymResponse: {\n did: string\n verkey: string\n }\n indyNamespace: string\n}\n@injectable()\nexport class IndyVdrPoolService {\n public pools: IndyVdrPool[] = []\n private logger: Logger\n private indyVdrModuleConfig: IndyVdrModuleConfig\n\n public constructor(@inject(InjectionSymbols.Logger) logger: Logger, indyVdrModuleConfig: IndyVdrModuleConfig) {\n this.logger = logger\n this.indyVdrModuleConfig = indyVdrModuleConfig\n\n this.pools = this.indyVdrModuleConfig.networks.map((poolConfig) => new IndyVdrPool(poolConfig))\n }\n\n /**\n * Get the most appropriate pool for the given did.\n * If the did is a qualified indy did, the pool will be determined based on the namespace.\n * If it is a legacy unqualified indy did, the pool will be determined based on the algorithm as described in this document:\n * https://docs.google.com/document/d/109C_eMsuZnTnYe2OAd02jAts1vC4axwEKIq7_4dnNVA/edit\n *\n * This method will optionally return a nym response when the did has been resolved to determine the ledger\n * either now or in the past. The nymResponse can be used to prevent multiple ledger quries fetching the same\n * did\n */\n public async getPoolForDid(\n agentContext: AgentContext,\n did: string\n ): Promise<{ pool: IndyVdrPool; nymResponse?: CachedDidResponse['nymResponse'] }> {\n // Check if the did starts with did:indy\n const match = did.match(didIndyRegex)\n\n if (match) {\n const [, namespace] = match\n\n const pool = this.getPoolForNamespace(namespace)\n\n if (pool) return { pool }\n\n throw new IndyVdrError(`Pool for indy namespace '${namespace}' not found`)\n }\n return await this.getPoolForLegacyDid(agentContext, did)\n }\n\n private async getPoolForLegacyDid(\n agentContext: AgentContext,\n did: string\n ): Promise<{ pool: IndyVdrPool; nymResponse?: CachedDidResponse['nymResponse'] }> {\n const pools = this.pools\n\n if (pools.length === 0) {\n throw new IndyVdrNotConfiguredError(\n 'No indy ledgers configured. Provide at least one pool configuration in IndyVdrModuleConfigOptions.networks'\n )\n }\n\n const cache = agentContext.dependencyManager.resolve(CacheModuleConfig).cache\n const cacheKey = `IndyVdrPoolService:${did}`\n\n const cachedNymResponse = await cache.get<CachedDidResponse>(agentContext, cacheKey)\n const pool = this.pools.find((pool) => pool.indyNamespace === cachedNymResponse?.indyNamespace)\n\n // If we have the nym response with associated pool in the cache, we'll use that\n if (cachedNymResponse && pool) {\n this.logger.trace(`Found ledger id '${pool.indyNamespace}' for did '${did}' in cache`)\n return { pool, nymResponse: cachedNymResponse.nymResponse }\n }\n\n const { successful, rejected } = await this.getSettledDidResponsesFromPools(did, pools)\n\n if (successful.length === 0) {\n const allNotFound = rejected.every((e) => e.reason instanceof IndyVdrNotFoundError)\n const rejectedOtherThanNotFound = rejected.filter((e) => !(e.reason instanceof IndyVdrNotFoundError))\n\n // All ledgers returned response that the did was not found\n if (allNotFound) {\n throw new IndyVdrNotFoundError(`Did '${did}' not found on any of the ledgers (total ${this.pools.length}).`)\n }\n\n // one or more of the ledgers returned an unknown error\n throw new IndyVdrError(\n `Unknown error retrieving did '${did}' from '${rejectedOtherThanNotFound.length}' of '${pools.length}' ledgers. ${rejectedOtherThanNotFound[0].reason}`,\n { cause: rejectedOtherThanNotFound[0].reason }\n )\n }\n\n // If there are self certified DIDs we always prefer it over non self certified DIDs\n // We take the first self certifying DID as we take the order in the\n // IndyVdrModuleConfigOptions.networks config as the order of preference of ledgers\n let value = successful.find((response) =>\n isSelfCertifiedDid(response.value.did.nymResponse.did, response.value.did.nymResponse.verkey)\n )?.value\n\n if (!value) {\n // Split between production and nonProduction ledgers. If there is at least one\n // successful response from a production ledger, only keep production ledgers\n // otherwise we only keep the non production ledgers.\n const production = successful.filter((s) => s.value.pool.config.isProduction)\n const nonProduction = successful.filter((s) => !s.value.pool.config.isProduction)\n const productionOrNonProduction = production.length >= 1 ? production : nonProduction\n\n // We take the first value as we take the order in the IndyVdrModuleConfigOptions.networks\n // config as the order of preference of ledgers\n value = productionOrNonProduction[0].value\n }\n\n await cache.set(agentContext, cacheKey, {\n nymResponse: {\n did: value.did.nymResponse.did,\n verkey: value.did.nymResponse.verkey,\n },\n indyNamespace: value.did.indyNamespace,\n })\n return { pool: value.pool, nymResponse: value.did.nymResponse }\n }\n\n private async getSettledDidResponsesFromPools(did: string, pools: IndyVdrPool[]) {\n this.logger.trace(`Retrieving did '${did}' from ${pools.length} ledgers`)\n const didResponses = await allSettled(pools.map((pool) => this.getDidFromPool(did, pool)))\n\n const successful = onlyFulfilled(didResponses)\n this.logger.trace(`Retrieved ${successful.length} responses from ledgers for did '${did}'`)\n\n const rejected = onlyRejected(didResponses)\n\n return {\n rejected,\n successful,\n }\n }\n\n /**\n * Refresh the pool connections asynchronously\n */\n public refreshPoolConnections() {\n return Promise.allSettled(this.pools.map((pool) => pool.refreshConnection()))\n }\n\n /**\n * Get all pool transactions\n */\n public getAllPoolTransactions() {\n return Promise.allSettled(\n this.pools.map(async (pool) => {\n return { config: pool.config, transactions: await pool.transactions }\n })\n )\n }\n\n /**\n * Get the most appropriate pool for the given indyNamespace\n */\n public getPoolForNamespace(indyNamespace: string) {\n if (this.pools.length === 0) {\n throw new IndyVdrNotConfiguredError(\n 'No indy ledgers configured. Provide at least one pool configuration in IndyVdrModuleConfigOptions.networks'\n )\n }\n\n const pool = this.pools.find((pool) => pool.indyNamespace === indyNamespace)\n\n if (!pool) {\n throw new IndyVdrError(`No ledgers found for indy namespace '${indyNamespace}'.`)\n }\n\n return pool\n }\n\n private async getDidFromPool(did: string, pool: IndyVdrPool): Promise<PublicDidRequest> {\n try {\n this.logger.trace(`Get public did '${did}' from ledger '${pool.indyNamespace}'`)\n const request = new GetNymRequest({ dest: did })\n\n this.logger.trace(`Submitting get did request for did '${did}' to ledger '${pool.indyNamespace}'`)\n const response = await pool.submitRequest(request)\n\n if (!response.result.data) {\n throw new IndyVdrNotFoundError(`Did ${did} not found on indy pool with namespace ${pool.indyNamespace}`)\n }\n\n const result = JSON.parse(response.result.data)\n\n this.logger.trace(`Retrieved did '${did}' from ledger '${pool.indyNamespace}'`, result)\n\n return {\n did: { nymResponse: { did: result.dest, verkey: result.verkey }, indyNamespace: pool.indyNamespace },\n pool,\n response,\n }\n } catch (error) {\n this.logger.trace(`Error retrieving did '${did}' from ledger '${pool.indyNamespace}'`, {\n error,\n did,\n })\n throw error\n }\n }\n}\n\nexport interface PublicDidRequest {\n did: CachedDidResponse\n pool: IndyVdrPool\n response: GetNymResponse\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { TypedArrayEncoder } from "@credo-ts/core";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/did.ts
|
|
4
|
+
/**
|
|
5
|
+
* Based on DidUtils implementation in Aries Framework .NET
|
|
6
|
+
* @see: https://github.com/hyperledger/aries-framework-dotnet/blob/f90eaf9db8548f6fc831abea917e906201755763/src/Hyperledger.Aries/Utils/DidUtils.cs
|
|
7
|
+
*
|
|
8
|
+
* Some context about full verkeys versus abbreviated verkeys:
|
|
9
|
+
* A standard verkey is 32 bytes, and by default in Indy the DID is chosen as the first 16 bytes of that key, before base58 encoding.
|
|
10
|
+
* An abbreviated verkey replaces the first 16 bytes of the verkey with ~ when it matches the DID.
|
|
11
|
+
*
|
|
12
|
+
* When a full verkey is used to register on the ledger, this is stored as a full verkey on the ledger and also returned from the ledger as a full verkey.
|
|
13
|
+
* The same applies to an abbreviated verkey. If an abbreviated verkey is used to register on the ledger, this is stored as an abbreviated verkey on the ledger and also returned from the ledger as an abbreviated verkey.
|
|
14
|
+
*
|
|
15
|
+
* For this reason we need some methods to check whether verkeys are full or abbreviated, so we can align this with `indy.abbreviateVerkey`
|
|
16
|
+
*
|
|
17
|
+
* Aries Framework .NET also abbreviates verkey before sending to ledger:
|
|
18
|
+
* https://github.com/hyperledger/aries-framework-dotnet/blob/f90eaf9db8548f6fc831abea917e906201755763/src/Hyperledger.Aries/Ledger/DefaultLedgerService.cs#L139-L147
|
|
19
|
+
*/
|
|
20
|
+
const ABBREVIATED_VERKEY_REGEX = /^~[1-9A-HJ-NP-Za-km-z]{21,22}$/;
|
|
21
|
+
/**
|
|
22
|
+
* Check whether the did is a self certifying did. If the verkey is abbreviated this method
|
|
23
|
+
* will always return true. Make sure that the verkey you pass in this method belongs to the
|
|
24
|
+
* did passed in
|
|
25
|
+
*
|
|
26
|
+
* @return Boolean indicating whether the did is self certifying
|
|
27
|
+
*/
|
|
28
|
+
function isSelfCertifiedDid(did, verkey) {
|
|
29
|
+
if (isAbbreviatedVerkey(verkey)) return true;
|
|
30
|
+
if (indyDidFromPublicKeyBase58(verkey) === did) return true;
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
function indyDidFromPublicKeyBase58(publicKeyBase58) {
|
|
34
|
+
const buffer = TypedArrayEncoder.fromBase58(publicKeyBase58);
|
|
35
|
+
return TypedArrayEncoder.toBase58(buffer.slice(0, 16));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Check a base58 encoded string against a regex expression to determine if it is a valid abbreviated verkey
|
|
39
|
+
* @param verkey Base58 encoded string representation of an abbreviated verkey
|
|
40
|
+
* @returns Boolean indicating if the string is a valid abbreviated verkey
|
|
41
|
+
*/
|
|
42
|
+
function isAbbreviatedVerkey(verkey) {
|
|
43
|
+
return ABBREVIATED_VERKEY_REGEX.test(verkey);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { isSelfCertifiedDid };
|
|
48
|
+
//# sourceMappingURL=did.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did.mjs","names":[],"sources":["../../src/utils/did.ts"],"sourcesContent":["/**\n * Based on DidUtils implementation in Aries Framework .NET\n * @see: https://github.com/hyperledger/aries-framework-dotnet/blob/f90eaf9db8548f6fc831abea917e906201755763/src/Hyperledger.Aries/Utils/DidUtils.cs\n *\n * Some context about full verkeys versus abbreviated verkeys:\n * A standard verkey is 32 bytes, and by default in Indy the DID is chosen as the first 16 bytes of that key, before base58 encoding.\n * An abbreviated verkey replaces the first 16 bytes of the verkey with ~ when it matches the DID.\n *\n * When a full verkey is used to register on the ledger, this is stored as a full verkey on the ledger and also returned from the ledger as a full verkey.\n * The same applies to an abbreviated verkey. If an abbreviated verkey is used to register on the ledger, this is stored as an abbreviated verkey on the ledger and also returned from the ledger as an abbreviated verkey.\n *\n * For this reason we need some methods to check whether verkeys are full or abbreviated, so we can align this with `indy.abbreviateVerkey`\n *\n * Aries Framework .NET also abbreviates verkey before sending to ledger:\n * https://github.com/hyperledger/aries-framework-dotnet/blob/f90eaf9db8548f6fc831abea917e906201755763/src/Hyperledger.Aries/Ledger/DefaultLedgerService.cs#L139-L147\n */\n\nimport { TypedArrayEncoder } from '@credo-ts/core'\n\nexport const ABBREVIATED_VERKEY_REGEX = /^~[1-9A-HJ-NP-Za-km-z]{21,22}$/\n\n/**\n * Check whether the did is a self certifying did. If the verkey is abbreviated this method\n * will always return true. Make sure that the verkey you pass in this method belongs to the\n * did passed in\n *\n * @return Boolean indicating whether the did is self certifying\n */\nexport function isSelfCertifiedDid(did: string, verkey: string): boolean {\n // If the verkey is Abbreviated, it means the full verkey\n // is the did + the verkey\n if (isAbbreviatedVerkey(verkey)) {\n return true\n }\n\n const didFromVerkey = indyDidFromPublicKeyBase58(verkey)\n\n if (didFromVerkey === did) {\n return true\n }\n\n return false\n}\n\nexport function indyDidFromPublicKeyBase58(publicKeyBase58: string): string {\n const buffer = TypedArrayEncoder.fromBase58(publicKeyBase58)\n\n const did = TypedArrayEncoder.toBase58(buffer.slice(0, 16))\n\n return did\n}\n\n/**\n * Check a base58 encoded string against a regex expression to determine if it is a valid abbreviated verkey\n * @param verkey Base58 encoded string representation of an abbreviated verkey\n * @returns Boolean indicating if the string is a valid abbreviated verkey\n */\nexport function isAbbreviatedVerkey(verkey: string): boolean {\n return ABBREVIATED_VERKEY_REGEX.test(verkey)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAa,2BAA2B;;;;;;;;AASxC,SAAgB,mBAAmB,KAAa,QAAyB;AAGvE,KAAI,oBAAoB,OAAO,CAC7B,QAAO;AAKT,KAFsB,2BAA2B,OAAO,KAElC,IACpB,QAAO;AAGT,QAAO;;AAGT,SAAgB,2BAA2B,iBAAiC;CAC1E,MAAM,SAAS,kBAAkB,WAAW,gBAAgB;AAI5D,QAFY,kBAAkB,SAAS,OAAO,MAAM,GAAG,GAAG,CAAC;;;;;;;AAU7D,SAAgB,oBAAoB,QAAyB;AAC3D,QAAO,yBAAyB,KAAK,OAAO"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/utils/promises.ts
|
|
2
|
+
function allSettled(promises) {
|
|
3
|
+
return Promise.all(promises.map((p) => p.then((value) => ({
|
|
4
|
+
status: "fulfilled",
|
|
5
|
+
value
|
|
6
|
+
})).catch((reason) => ({
|
|
7
|
+
status: "rejected",
|
|
8
|
+
reason
|
|
9
|
+
}))));
|
|
10
|
+
}
|
|
11
|
+
function onlyFulfilled(entries) {
|
|
12
|
+
return entries.filter((e) => e.status === "fulfilled");
|
|
13
|
+
}
|
|
14
|
+
function onlyRejected(entries) {
|
|
15
|
+
return entries.filter((e) => e.status === "rejected");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { allSettled, onlyFulfilled, onlyRejected };
|
|
20
|
+
//# sourceMappingURL=promises.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promises.mjs","names":[],"sources":["../../src/utils/promises.ts"],"sourcesContent":["// This file polyfills the allSettled method introduced in ESNext\n\nexport type AllSettledFulfilled<T> = {\n status: 'fulfilled'\n value: T\n}\n\nexport type AllSettledRejected = {\n status: 'rejected'\n // biome-ignore lint/suspicious/noExplicitAny: no explanation\n reason: any\n}\n\nexport function allSettled<T>(promises: Promise<T>[]) {\n return Promise.all(\n promises.map((p) =>\n p\n .then(\n (value) =>\n ({\n status: 'fulfilled',\n value,\n }) as AllSettledFulfilled<T>\n )\n .catch(\n (reason) =>\n ({\n status: 'rejected',\n reason,\n }) as AllSettledRejected\n )\n )\n )\n}\n\nexport function onlyFulfilled<T>(entries: Array<AllSettledFulfilled<T> | AllSettledRejected>) {\n // We filter for only the rejected values, so we can safely cast the type\n return entries.filter((e) => e.status === 'fulfilled') as AllSettledFulfilled<T>[]\n}\n\nexport function onlyRejected<T>(entries: Array<AllSettledFulfilled<T> | AllSettledRejected>) {\n // We filter for only the rejected values, so we can safely cast the type\n return entries.filter((e) => e.status === 'rejected') as AllSettledRejected[]\n}\n"],"mappings":";AAaA,SAAgB,WAAc,UAAwB;AACpD,QAAO,QAAQ,IACb,SAAS,KAAK,MACZ,EACG,MACE,WACE;EACC,QAAQ;EACR;EACD,EACJ,CACA,OACE,YACE;EACC,QAAQ;EACR;EACD,EACJ,CACJ,CACF;;AAGH,SAAgB,cAAiB,SAA6D;AAE5F,QAAO,QAAQ,QAAQ,MAAM,EAAE,WAAW,YAAY;;AAGxD,SAAgB,aAAgB,SAA6D;AAE3F,QAAO,QAAQ,QAAQ,MAAM,EAAE,WAAW,WAAW"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { verificationPublicJwkForIndyDid } from "../dids/didIndyUtil.mjs";
|
|
2
|
+
import { AgentContext, Kms, TypedArrayEncoder } from "@credo-ts/core";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/sign.ts
|
|
5
|
+
async function multiSignRequest(agentContext, request, signingKey, identifier) {
|
|
6
|
+
const { signature } = await agentContext.dependencyManager.resolve(Kms.KeyManagementApi).sign({
|
|
7
|
+
data: TypedArrayEncoder.fromString(request.signatureInput),
|
|
8
|
+
algorithm: "EdDSA",
|
|
9
|
+
keyId: signingKey.keyId
|
|
10
|
+
});
|
|
11
|
+
request.setMultiSignature({
|
|
12
|
+
signature,
|
|
13
|
+
identifier
|
|
14
|
+
});
|
|
15
|
+
return request;
|
|
16
|
+
}
|
|
17
|
+
async function signRequest(agentContext, pool, request, submitterDid) {
|
|
18
|
+
const signingKey = await verificationPublicJwkForIndyDid(agentContext, submitterDid);
|
|
19
|
+
return await pool.prepareWriteRequest(agentContext, request, signingKey);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { multiSignRequest, signRequest };
|
|
24
|
+
//# sourceMappingURL=sign.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign.mjs","names":[],"sources":["../../src/utils/sign.ts"],"sourcesContent":["import { AgentContext, Kms, TypedArrayEncoder } from '@credo-ts/core'\nimport type { IndyVdrRequest } from '@hyperledger/indy-vdr-shared'\nimport { verificationPublicJwkForIndyDid } from '../dids/didIndyUtil'\nimport type { IndyVdrPool } from '../pool'\n\nexport async function multiSignRequest<Request extends IndyVdrRequest>(\n agentContext: AgentContext,\n request: Request,\n signingKey: Kms.PublicJwk<Kms.Ed25519PublicJwk>,\n identifier: string\n) {\n const kms = agentContext.dependencyManager.resolve(Kms.KeyManagementApi)\n const { signature } = await kms.sign({\n data: TypedArrayEncoder.fromString(request.signatureInput),\n algorithm: 'EdDSA',\n keyId: signingKey.keyId,\n })\n\n request.setMultiSignature({\n signature,\n identifier,\n })\n\n return request\n}\n\nexport async function signRequest<Request extends IndyVdrRequest>(\n agentContext: AgentContext,\n pool: IndyVdrPool,\n request: Request,\n submitterDid: string\n) {\n const signingKey = await verificationPublicJwkForIndyDid(agentContext, submitterDid)\n const signedRequest = await pool.prepareWriteRequest(agentContext, request, signingKey)\n\n return signedRequest\n}\n"],"mappings":";;;;AAKA,eAAsB,iBACpB,cACA,SACA,YACA,YACA;CAEA,MAAM,EAAE,cAAc,MADV,aAAa,kBAAkB,QAAQ,IAAI,iBAAiB,CACxC,KAAK;EACnC,MAAM,kBAAkB,WAAW,QAAQ,eAAe;EAC1D,WAAW;EACX,OAAO,WAAW;EACnB,CAAC;AAEF,SAAQ,kBAAkB;EACxB;EACA;EACD,CAAC;AAEF,QAAO;;AAGT,eAAsB,YACpB,cACA,MACA,SACA,cACA;CACA,MAAM,aAAa,MAAM,gCAAgC,cAAc,aAAa;AAGpF,QAFsB,MAAM,KAAK,oBAAoB,cAAc,SAAS,WAAW"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@credo-ts/indy-vdr",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
"exports": {
|
|
4
|
+
".": "./build/index.mjs",
|
|
5
|
+
"./package.json": "./package.json"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.6.2-alpha-20251210145840",
|
|
6
8
|
"files": [
|
|
7
9
|
"build"
|
|
8
10
|
],
|
|
@@ -17,26 +19,24 @@
|
|
|
17
19
|
"directory": "packages/indy-vdr"
|
|
18
20
|
},
|
|
19
21
|
"dependencies": {
|
|
20
|
-
"@credo-ts/anoncreds": "0.6.
|
|
21
|
-
"@credo-ts/core": "0.6.
|
|
22
|
+
"@credo-ts/anoncreds": "0.6.2-alpha-20251210145840",
|
|
23
|
+
"@credo-ts/core": "0.6.2-alpha-20251210145840"
|
|
22
24
|
},
|
|
23
25
|
"devDependencies": {
|
|
24
|
-
"@hyperledger/indy-vdr-nodejs": "^0.2.
|
|
25
|
-
"@hyperledger/indy-vdr-shared": "^0.2.
|
|
26
|
-
"@stablelib/ed25519": "^
|
|
27
|
-
"@types/ref-array-di": "^1.2.
|
|
28
|
-
"@types/ref-struct-di": "^1.1.
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"typescript": "~5.5.2"
|
|
26
|
+
"@hyperledger/indy-vdr-nodejs": "^0.2.3",
|
|
27
|
+
"@hyperledger/indy-vdr-shared": "^0.2.3",
|
|
28
|
+
"@stablelib/ed25519": "^2.0.2",
|
|
29
|
+
"@types/ref-array-di": "^1.2.8",
|
|
30
|
+
"@types/ref-struct-di": "^1.1.12",
|
|
31
|
+
"rxjs": "^7.8.2",
|
|
32
|
+
"typescript": "~5.9.3"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {
|
|
34
|
-
"@hyperledger/indy-vdr-shared": "^0.2.
|
|
35
|
+
"@hyperledger/indy-vdr-shared": "^0.2.3"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
37
|
-
"build": "
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
38
|
+
"build": "tsdown --config-loader unconfig"
|
|
39
|
+
},
|
|
40
|
+
"types": "./build/index.d.mts",
|
|
41
|
+
"module": "./build/index.mjs"
|
|
42
42
|
}
|
package/build/IndyVdrApi.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { AgentContext } from '@credo-ts/core';
|
|
2
|
-
import { IndyVdrPoolService } from './pool';
|
|
3
|
-
export declare class IndyVdrApi {
|
|
4
|
-
private agentContext;
|
|
5
|
-
private indyVdrPoolService;
|
|
6
|
-
constructor(agentContext: AgentContext, indyVdrPoolService: IndyVdrPoolService);
|
|
7
|
-
private multiSignRequest;
|
|
8
|
-
private signRequest;
|
|
9
|
-
/**
|
|
10
|
-
* This method refreshes the pool connection and ensures the pool is up to date with the ledger.
|
|
11
|
-
*/
|
|
12
|
-
refreshPoolConnections(): Promise<PromiseSettledResult<void>[]>;
|
|
13
|
-
/**
|
|
14
|
-
* This method gets the updated transactions of the pool.
|
|
15
|
-
* @returns The transactions of the pool ledger
|
|
16
|
-
*/
|
|
17
|
-
getAllPoolTransactions(): Promise<PromiseSettledResult<{
|
|
18
|
-
config: import("./pool").IndyVdrPoolConfig;
|
|
19
|
-
transactions: import("@hyperledger/indy-vdr-shared").Transactions;
|
|
20
|
-
}>[]>;
|
|
21
|
-
/**
|
|
22
|
-
* This method endorses a transaction. The transaction can be either a string or a JSON object.
|
|
23
|
-
* If the transaction has a signature, it means the transaction was created by another author and will be endorsed.
|
|
24
|
-
* This requires the `endorser` on the transaction to be equal to the unqualified variant of the `endorserDid`.
|
|
25
|
-
*
|
|
26
|
-
* If the transaction is not signed, we have a special case where the endorser will author the transaction.
|
|
27
|
-
* This is required when a new did is created, as the author and the endorser did must already exist on the ledger.
|
|
28
|
-
* In this case, the author did (`identifier`) must be equal to the unqualified identifier of the `endorserDid`.
|
|
29
|
-
* @param transaction the transaction body to be endorsed
|
|
30
|
-
* @param endorserDid the did of the endorser
|
|
31
|
-
* @returns An endorsed transaction
|
|
32
|
-
*/
|
|
33
|
-
endorseTransaction(transaction: string | Record<string, unknown>, endorserDid: string): Promise<string>;
|
|
34
|
-
}
|
package/build/IndyVdrApi.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.IndyVdrApi = void 0;
|
|
13
|
-
const anoncreds_1 = require("@credo-ts/anoncreds");
|
|
14
|
-
const core_1 = require("@credo-ts/core");
|
|
15
|
-
const indy_vdr_shared_1 = require("@hyperledger/indy-vdr-shared");
|
|
16
|
-
const didIndyUtil_1 = require("./dids/didIndyUtil");
|
|
17
|
-
const error_1 = require("./error");
|
|
18
|
-
const pool_1 = require("./pool");
|
|
19
|
-
const sign_1 = require("./utils/sign");
|
|
20
|
-
let IndyVdrApi = class IndyVdrApi {
|
|
21
|
-
constructor(agentContext, indyVdrPoolService) {
|
|
22
|
-
this.agentContext = agentContext;
|
|
23
|
-
this.indyVdrPoolService = indyVdrPoolService;
|
|
24
|
-
}
|
|
25
|
-
async multiSignRequest(request, signingKey, identifier) {
|
|
26
|
-
return (0, sign_1.multiSignRequest)(this.agentContext, request, signingKey, identifier);
|
|
27
|
-
}
|
|
28
|
-
async signRequest(request, submitterDid) {
|
|
29
|
-
const { pool } = await this.indyVdrPoolService.getPoolForDid(this.agentContext, submitterDid);
|
|
30
|
-
return (0, sign_1.signRequest)(this.agentContext, pool, request, submitterDid);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* This method refreshes the pool connection and ensures the pool is up to date with the ledger.
|
|
34
|
-
*/
|
|
35
|
-
refreshPoolConnections() {
|
|
36
|
-
return this.indyVdrPoolService.refreshPoolConnections();
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* This method gets the updated transactions of the pool.
|
|
40
|
-
* @returns The transactions of the pool ledger
|
|
41
|
-
*/
|
|
42
|
-
getAllPoolTransactions() {
|
|
43
|
-
return this.indyVdrPoolService.getAllPoolTransactions();
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* This method endorses a transaction. The transaction can be either a string or a JSON object.
|
|
47
|
-
* If the transaction has a signature, it means the transaction was created by another author and will be endorsed.
|
|
48
|
-
* This requires the `endorser` on the transaction to be equal to the unqualified variant of the `endorserDid`.
|
|
49
|
-
*
|
|
50
|
-
* If the transaction is not signed, we have a special case where the endorser will author the transaction.
|
|
51
|
-
* This is required when a new did is created, as the author and the endorser did must already exist on the ledger.
|
|
52
|
-
* In this case, the author did (`identifier`) must be equal to the unqualified identifier of the `endorserDid`.
|
|
53
|
-
* @param transaction the transaction body to be endorsed
|
|
54
|
-
* @param endorserDid the did of the endorser
|
|
55
|
-
* @returns An endorsed transaction
|
|
56
|
-
*/
|
|
57
|
-
async endorseTransaction(transaction, endorserDid) {
|
|
58
|
-
const endorserSigningKey = await (0, didIndyUtil_1.verificationKeyForIndyDid)(this.agentContext, endorserDid);
|
|
59
|
-
const { namespaceIdentifier } = (0, anoncreds_1.parseIndyDid)(endorserDid);
|
|
60
|
-
const request = new indy_vdr_shared_1.CustomRequest({ customRequest: transaction });
|
|
61
|
-
let endorsedTransaction;
|
|
62
|
-
// the request is not parsed correctly due to too large numbers. The reqId overflows.
|
|
63
|
-
const txBody = typeof transaction === 'string' ? JSON.parse(transaction) : transaction;
|
|
64
|
-
if (txBody.signature) {
|
|
65
|
-
if (txBody.endorser !== namespaceIdentifier)
|
|
66
|
-
throw new error_1.IndyVdrError('Submitter does not match Endorser');
|
|
67
|
-
endorsedTransaction = await this.multiSignRequest(request, endorserSigningKey, namespaceIdentifier);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
if (txBody.identifier !== namespaceIdentifier)
|
|
71
|
-
throw new error_1.IndyVdrError('Submitter does not match identifier');
|
|
72
|
-
endorsedTransaction = await this.signRequest(request, endorserDid);
|
|
73
|
-
}
|
|
74
|
-
return endorsedTransaction.body;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
exports.IndyVdrApi = IndyVdrApi;
|
|
78
|
-
exports.IndyVdrApi = IndyVdrApi = __decorate([
|
|
79
|
-
(0, core_1.injectable)(),
|
|
80
|
-
__metadata("design:paramtypes", [core_1.AgentContext, pool_1.IndyVdrPoolService])
|
|
81
|
-
], IndyVdrApi);
|
|
82
|
-
//# sourceMappingURL=IndyVdrApi.js.map
|
package/build/IndyVdrApi.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IndyVdrApi.js","sourceRoot":"","sources":["../src/IndyVdrApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,mDAAkD;AAClD,yCAAyD;AACzD,kEAA4D;AAE5D,oDAA8D;AAC9D,mCAAsC;AACtC,iCAA2C;AAC3C,uCAA4D;AAGrD,IAAM,UAAU,GAAhB,MAAM,UAAU;IAIrB,YAAmB,YAA0B,EAAE,kBAAsC;QACnF,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAChC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAA;IAC9C,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAC5B,OAAgB,EAChB,UAAe,EACf,UAAkB;QAElB,OAAO,IAAA,uBAAgB,EAAC,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAAA;IAC7E,CAAC;IAEO,KAAK,CAAC,WAAW,CAAiC,OAAgB,EAAE,YAAoB;QAC9F,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;QAC7F,OAAO,IAAA,kBAAW,EAAC,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;IACpE,CAAC;IAED;;OAEG;IACI,sBAAsB;QAC3B,OAAO,IAAI,CAAC,kBAAkB,CAAC,sBAAsB,EAAE,CAAA;IACzD,CAAC;IAED;;;OAGG;IACI,sBAAsB;QAC3B,OAAO,IAAI,CAAC,kBAAkB,CAAC,sBAAsB,EAAE,CAAA;IACzD,CAAC;IAED;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,kBAAkB,CAAC,WAA6C,EAAE,WAAmB;QAChG,MAAM,kBAAkB,GAAG,MAAM,IAAA,uCAAyB,EAAC,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;QAC1F,MAAM,EAAE,mBAAmB,EAAE,GAAG,IAAA,wBAAY,EAAC,WAAW,CAAC,CAAA;QAEzD,MAAM,OAAO,GAAG,IAAI,+BAAa,CAAC,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC,CAAA;QACjE,IAAI,mBAAkC,CAAA;QAEtC,qFAAqF;QACrF,MAAM,MAAM,GAAG,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA;QACtF,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,IAAI,MAAM,CAAC,QAAQ,KAAK,mBAAmB;gBAAE,MAAM,IAAI,oBAAY,CAAC,mCAAmC,CAAC,CAAA;YACxG,mBAAmB,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,CAAA;QACrG,CAAC;aAAM,CAAC;YACN,IAAI,MAAM,CAAC,UAAU,KAAK,mBAAmB;gBAAE,MAAM,IAAI,oBAAY,CAAC,qCAAqC,CAAC,CAAA;YAC5G,mBAAmB,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;QACpE,CAAC;QACD,OAAO,mBAAmB,CAAC,IAAI,CAAA;IACjC,CAAC;CACF,CAAA;AAnEY,gCAAU;qBAAV,UAAU;IADtB,IAAA,iBAAU,GAAE;qCAKsB,mBAAY,EAAsB,yBAAkB;GAJ1E,UAAU,CAmEtB"}
|
package/build/IndyVdrModule.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { IndyVdrModuleConfigOptions } from './IndyVdrModuleConfig';
|
|
2
|
-
import type { AgentContext, DependencyManager, Module } from '@credo-ts/core';
|
|
3
|
-
import { IndyVdrApi } from './IndyVdrApi';
|
|
4
|
-
import { IndyVdrModuleConfig } from './IndyVdrModuleConfig';
|
|
5
|
-
/**
|
|
6
|
-
* @public
|
|
7
|
-
* */
|
|
8
|
-
export declare class IndyVdrModule implements Module {
|
|
9
|
-
readonly config: IndyVdrModuleConfig;
|
|
10
|
-
readonly api: typeof IndyVdrApi;
|
|
11
|
-
constructor(config: IndyVdrModuleConfigOptions);
|
|
12
|
-
register(dependencyManager: DependencyManager): void;
|
|
13
|
-
initialize(agentContext: AgentContext): Promise<void>;
|
|
14
|
-
}
|
package/build/IndyVdrModule.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IndyVdrModule = void 0;
|
|
4
|
-
const IndyVdrApi_1 = require("./IndyVdrApi");
|
|
5
|
-
const IndyVdrModuleConfig_1 = require("./IndyVdrModuleConfig");
|
|
6
|
-
const IndyVdrPoolService_1 = require("./pool/IndyVdrPoolService");
|
|
7
|
-
/**
|
|
8
|
-
* @public
|
|
9
|
-
* */
|
|
10
|
-
class IndyVdrModule {
|
|
11
|
-
constructor(config) {
|
|
12
|
-
this.api = IndyVdrApi_1.IndyVdrApi;
|
|
13
|
-
this.config = new IndyVdrModuleConfig_1.IndyVdrModuleConfig(config);
|
|
14
|
-
}
|
|
15
|
-
register(dependencyManager) {
|
|
16
|
-
// Config
|
|
17
|
-
dependencyManager.registerInstance(IndyVdrModuleConfig_1.IndyVdrModuleConfig, this.config);
|
|
18
|
-
// Services
|
|
19
|
-
dependencyManager.registerSingleton(IndyVdrPoolService_1.IndyVdrPoolService);
|
|
20
|
-
}
|
|
21
|
-
async initialize(agentContext) {
|
|
22
|
-
const indyVdrPoolService = agentContext.dependencyManager.resolve(IndyVdrPoolService_1.IndyVdrPoolService);
|
|
23
|
-
for (const pool of indyVdrPoolService.pools) {
|
|
24
|
-
if (pool.config.connectOnStartup) {
|
|
25
|
-
await pool.connect();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.IndyVdrModule = IndyVdrModule;
|
|
31
|
-
//# sourceMappingURL=IndyVdrModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IndyVdrModule.js","sourceRoot":"","sources":["../src/IndyVdrModule.ts"],"names":[],"mappings":";;;AAGA,6CAAyC;AACzC,+DAA2D;AAC3D,kEAA8D;AAE9D;;KAEK;AACL,MAAa,aAAa;IAIxB,YAAmB,MAAkC;QAFrC,QAAG,GAAG,uBAAU,CAAA;QAG9B,IAAI,CAAC,MAAM,GAAG,IAAI,yCAAmB,CAAC,MAAM,CAAC,CAAA;IAC/C,CAAC;IAEM,QAAQ,CAAC,iBAAoC;QAClD,SAAS;QACT,iBAAiB,CAAC,gBAAgB,CAAC,yCAAmB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAEpE,WAAW;QACX,iBAAiB,CAAC,iBAAiB,CAAC,uCAAkB,CAAC,CAAA;IACzD,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,YAA0B;QAChD,MAAM,kBAAkB,GAAG,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,uCAAkB,CAAC,CAAA;QAErF,KAAK,MAAM,IAAI,IAAI,kBAAkB,CAAC,KAAK,EAAE,CAAC;YAC5C,IAAI,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;gBACjC,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;YACtB,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAzBD,sCAyBC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { IndyVdrPoolConfig } from './pool';
|
|
2
|
-
import type { IndyVdr } from '@hyperledger/indy-vdr-shared';
|
|
3
|
-
export interface IndyVdrModuleConfigOptions {
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* ## Node.JS
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* import { indyVdr } from '@hyperledger/indy-vdr-nodejs';
|
|
10
|
-
*
|
|
11
|
-
* const agent = new Agent({
|
|
12
|
-
* config: {},
|
|
13
|
-
* dependencies: agentDependencies,
|
|
14
|
-
* modules: {
|
|
15
|
-
* indyVdr: new IndyVdrModule({
|
|
16
|
-
* indyVdr,
|
|
17
|
-
* })
|
|
18
|
-
* }
|
|
19
|
-
* })
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* ## React Native
|
|
23
|
-
*
|
|
24
|
-
* ```ts
|
|
25
|
-
* import { indyVdr } from '@hyperledger/indy-vdr-react-native';
|
|
26
|
-
*
|
|
27
|
-
* const agent = new Agent({
|
|
28
|
-
* config: {},
|
|
29
|
-
* dependencies: agentDependencies,
|
|
30
|
-
* modules: {
|
|
31
|
-
* indyVdr: new IndyVdrModule({
|
|
32
|
-
* indyVdr,
|
|
33
|
-
* })
|
|
34
|
-
* }
|
|
35
|
-
* })
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
indyVdr: IndyVdr;
|
|
39
|
-
/**
|
|
40
|
-
* Array of indy networks to connect to.
|
|
41
|
-
*
|
|
42
|
-
* @default []
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```
|
|
46
|
-
* {
|
|
47
|
-
* isProduction: false,
|
|
48
|
-
* genesisTransactions: 'xxx',
|
|
49
|
-
* indyNamespace: 'localhost:test',
|
|
50
|
-
* transactionAuthorAgreement: {
|
|
51
|
-
* version: '1',
|
|
52
|
-
* acceptanceMechanism: 'accept'
|
|
53
|
-
* }
|
|
54
|
-
* }
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
networks: [IndyVdrPoolConfig, ...IndyVdrPoolConfig[]];
|
|
58
|
-
}
|
|
59
|
-
export declare class IndyVdrModuleConfig {
|
|
60
|
-
private options;
|
|
61
|
-
constructor(options: IndyVdrModuleConfigOptions);
|
|
62
|
-
/** See {@link IndyVdrModuleConfigOptions.networks} */
|
|
63
|
-
get networks(): [IndyVdrPoolConfig, ...IndyVdrPoolConfig[]];
|
|
64
|
-
/** See {@link IndyVdrModuleConfigOptions.indyVdr} */
|
|
65
|
-
get indyVdr(): IndyVdr;
|
|
66
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IndyVdrModuleConfig = void 0;
|
|
4
|
-
class IndyVdrModuleConfig {
|
|
5
|
-
constructor(options) {
|
|
6
|
-
this.options = options;
|
|
7
|
-
}
|
|
8
|
-
/** See {@link IndyVdrModuleConfigOptions.networks} */
|
|
9
|
-
get networks() {
|
|
10
|
-
return this.options.networks;
|
|
11
|
-
}
|
|
12
|
-
/** See {@link IndyVdrModuleConfigOptions.indyVdr} */
|
|
13
|
-
get indyVdr() {
|
|
14
|
-
return this.options.indyVdr;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.IndyVdrModuleConfig = IndyVdrModuleConfig;
|
|
18
|
-
//# sourceMappingURL=IndyVdrModuleConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IndyVdrModuleConfig.js","sourceRoot":"","sources":["../src/IndyVdrModuleConfig.ts"],"names":[],"mappings":";;;AA6DA,MAAa,mBAAmB;IAG9B,YAAmB,OAAmC;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,sDAAsD;IACtD,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;IAC9B,CAAC;IAED,qDAAqD;IACrD,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAA;IAC7B,CAAC;CACF;AAhBD,kDAgBC"}
|