@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
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { AgentContext, Key } from '@credo-ts/core';
|
|
2
|
-
import type { IndyVdrRequest, RequestResponseType } from '@hyperledger/indy-vdr-shared';
|
|
3
|
-
export interface TransactionAuthorAgreement {
|
|
4
|
-
version?: `${number}.${number}` | `${number}`;
|
|
5
|
-
acceptanceMechanism: string;
|
|
6
|
-
}
|
|
7
|
-
export interface AuthorAgreement {
|
|
8
|
-
digest: string;
|
|
9
|
-
version: string;
|
|
10
|
-
text: string;
|
|
11
|
-
ratification_ts: number;
|
|
12
|
-
acceptanceMechanisms: AcceptanceMechanisms;
|
|
13
|
-
}
|
|
14
|
-
export interface AcceptanceMechanisms {
|
|
15
|
-
aml: Record<string, string>;
|
|
16
|
-
amlContext: string;
|
|
17
|
-
version: string;
|
|
18
|
-
}
|
|
19
|
-
export interface IndyVdrPoolConfig {
|
|
20
|
-
genesisTransactions: string;
|
|
21
|
-
isProduction: boolean;
|
|
22
|
-
indyNamespace: string;
|
|
23
|
-
transactionAuthorAgreement?: TransactionAuthorAgreement;
|
|
24
|
-
connectOnStartup?: boolean;
|
|
25
|
-
}
|
|
26
|
-
export declare class IndyVdrPool {
|
|
27
|
-
private _pool?;
|
|
28
|
-
private poolConfig;
|
|
29
|
-
authorAgreement?: AuthorAgreement | null;
|
|
30
|
-
constructor(poolConfig: IndyVdrPoolConfig);
|
|
31
|
-
get indyNamespace(): string;
|
|
32
|
-
get config(): IndyVdrPoolConfig;
|
|
33
|
-
connect(): void;
|
|
34
|
-
/**
|
|
35
|
-
* Refreshes the connection to the pool.
|
|
36
|
-
*/
|
|
37
|
-
refreshConnection(): Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Get the transactions for a pool
|
|
40
|
-
*/
|
|
41
|
-
get transactions(): Promise<import("@hyperledger/indy-vdr-shared").Transactions>;
|
|
42
|
-
private get pool();
|
|
43
|
-
close(): void;
|
|
44
|
-
prepareWriteRequest<Request extends IndyVdrRequest>(agentContext: AgentContext, request: Request, signingKey: Key, endorserDid?: string): Promise<Request>;
|
|
45
|
-
/**
|
|
46
|
-
* This method submits a request to the ledger.
|
|
47
|
-
* It does only submit the request. It does not modify it in any way.
|
|
48
|
-
* To create the request, use the `prepareWriteRequest` method.
|
|
49
|
-
* @param writeRequest
|
|
50
|
-
*/
|
|
51
|
-
submitRequest<Request extends IndyVdrRequest>(writeRequest: Request): Promise<RequestResponseType<Request>>;
|
|
52
|
-
private appendTaa;
|
|
53
|
-
private getTransactionAuthorAgreement;
|
|
54
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IndyVdrPool = void 0;
|
|
4
|
-
const anoncreds_1 = require("@credo-ts/anoncreds");
|
|
5
|
-
const core_1 = require("@credo-ts/core");
|
|
6
|
-
const indy_vdr_shared_1 = require("@hyperledger/indy-vdr-shared");
|
|
7
|
-
const error_1 = require("../error");
|
|
8
|
-
class IndyVdrPool {
|
|
9
|
-
constructor(poolConfig) {
|
|
10
|
-
this.poolConfig = poolConfig;
|
|
11
|
-
}
|
|
12
|
-
get indyNamespace() {
|
|
13
|
-
return this.poolConfig.indyNamespace;
|
|
14
|
-
}
|
|
15
|
-
get config() {
|
|
16
|
-
return this.poolConfig;
|
|
17
|
-
}
|
|
18
|
-
connect() {
|
|
19
|
-
if (this._pool) {
|
|
20
|
-
throw new error_1.IndyVdrError('Cannot connect to pool, already connected.');
|
|
21
|
-
}
|
|
22
|
-
this._pool = new indy_vdr_shared_1.PoolCreate({
|
|
23
|
-
parameters: {
|
|
24
|
-
transactions: this.config.genesisTransactions,
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Refreshes the connection to the pool.
|
|
30
|
-
*/
|
|
31
|
-
async refreshConnection() {
|
|
32
|
-
if (this._pool) {
|
|
33
|
-
await this._pool.refresh();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Get the transactions for a pool
|
|
38
|
-
*/
|
|
39
|
-
get transactions() {
|
|
40
|
-
return this.pool.transactions;
|
|
41
|
-
}
|
|
42
|
-
get pool() {
|
|
43
|
-
if (!this._pool)
|
|
44
|
-
this.connect();
|
|
45
|
-
if (!this._pool)
|
|
46
|
-
throw new error_1.IndyVdrError('Pool is not connected.');
|
|
47
|
-
return this._pool;
|
|
48
|
-
}
|
|
49
|
-
close() {
|
|
50
|
-
if (!this._pool) {
|
|
51
|
-
throw new error_1.IndyVdrError("Can't close pool. Pool is not connected");
|
|
52
|
-
}
|
|
53
|
-
// FIXME: this method doesn't work??
|
|
54
|
-
// this.pool.close()
|
|
55
|
-
}
|
|
56
|
-
async prepareWriteRequest(agentContext, request, signingKey, endorserDid) {
|
|
57
|
-
await this.appendTaa(request);
|
|
58
|
-
if (endorserDid) {
|
|
59
|
-
request.setEndorser({ endorser: (0, anoncreds_1.parseIndyDid)(endorserDid).namespaceIdentifier });
|
|
60
|
-
}
|
|
61
|
-
const signature = await agentContext.wallet.sign({
|
|
62
|
-
data: core_1.TypedArrayEncoder.fromString(request.signatureInput),
|
|
63
|
-
key: signingKey,
|
|
64
|
-
});
|
|
65
|
-
request.setSignature({
|
|
66
|
-
signature,
|
|
67
|
-
});
|
|
68
|
-
return request;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* This method submits a request to the ledger.
|
|
72
|
-
* It does only submit the request. It does not modify it in any way.
|
|
73
|
-
* To create the request, use the `prepareWriteRequest` method.
|
|
74
|
-
* @param writeRequest
|
|
75
|
-
*/
|
|
76
|
-
async submitRequest(writeRequest) {
|
|
77
|
-
return await this.pool.submitRequest(writeRequest);
|
|
78
|
-
}
|
|
79
|
-
async appendTaa(request) {
|
|
80
|
-
const authorAgreement = await this.getTransactionAuthorAgreement();
|
|
81
|
-
const poolTaa = this.config.transactionAuthorAgreement;
|
|
82
|
-
// If ledger does not have TAA, we can just send request
|
|
83
|
-
if (authorAgreement == null) {
|
|
84
|
-
return request;
|
|
85
|
-
}
|
|
86
|
-
// Ledger has taa but user has not specified which one to use
|
|
87
|
-
if (!poolTaa) {
|
|
88
|
-
throw new error_1.IndyVdrError(`Please, specify a transaction author agreement with version and acceptance mechanism. ${JSON.stringify(authorAgreement)}`);
|
|
89
|
-
}
|
|
90
|
-
// Throw an error if the pool doesn't have the specified version and acceptance mechanism
|
|
91
|
-
if (authorAgreement.version !== poolTaa.version ||
|
|
92
|
-
!authorAgreement.acceptanceMechanisms.aml[poolTaa.acceptanceMechanism]) {
|
|
93
|
-
// Throw an error with a helpful message
|
|
94
|
-
const errMessage = `Unable to satisfy matching TAA with mechanism ${JSON.stringify(poolTaa.acceptanceMechanism)} and version ${poolTaa.version} in pool.\n Found ${JSON.stringify(authorAgreement.acceptanceMechanisms.aml)} and version ${authorAgreement.version} in pool.`;
|
|
95
|
-
throw new error_1.IndyVdrError(errMessage);
|
|
96
|
-
}
|
|
97
|
-
const acceptance = indy_vdr_shared_1.indyVdr.prepareTxnAuthorAgreementAcceptance({
|
|
98
|
-
text: authorAgreement.text,
|
|
99
|
-
version: authorAgreement.version,
|
|
100
|
-
taaDigest: authorAgreement.digest,
|
|
101
|
-
time: Math.floor(new Date().getTime() / 1000),
|
|
102
|
-
acceptanceMechanismType: poolTaa.acceptanceMechanism,
|
|
103
|
-
});
|
|
104
|
-
request.setTransactionAuthorAgreementAcceptance({
|
|
105
|
-
acceptance: JSON.parse(acceptance),
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
async getTransactionAuthorAgreement() {
|
|
109
|
-
// TODO Replace this condition with memoization
|
|
110
|
-
if (this.authorAgreement !== undefined) {
|
|
111
|
-
return this.authorAgreement;
|
|
112
|
-
}
|
|
113
|
-
const taaRequest = new indy_vdr_shared_1.GetTransactionAuthorAgreementRequest({});
|
|
114
|
-
const taaResponse = await this.submitRequest(taaRequest);
|
|
115
|
-
const acceptanceMechanismRequest = new indy_vdr_shared_1.GetAcceptanceMechanismsRequest({});
|
|
116
|
-
const acceptanceMechanismResponse = await this.submitRequest(acceptanceMechanismRequest);
|
|
117
|
-
const taaData = taaResponse.result.data;
|
|
118
|
-
// TAA can be null
|
|
119
|
-
if (taaData == null) {
|
|
120
|
-
this.authorAgreement = null;
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
// If TAA is not null, we can be sure AcceptanceMechanisms is also not null
|
|
124
|
-
const authorAgreement = taaData;
|
|
125
|
-
const acceptanceMechanisms = acceptanceMechanismResponse.result.data;
|
|
126
|
-
this.authorAgreement = Object.assign(Object.assign({}, authorAgreement), { acceptanceMechanisms });
|
|
127
|
-
return this.authorAgreement;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
exports.IndyVdrPool = IndyVdrPool;
|
|
131
|
-
//# sourceMappingURL=IndyVdrPool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IndyVdrPool.js","sourceRoot":"","sources":["../../src/pool/IndyVdrPool.ts"],"names":[],"mappings":";;;AAGA,mDAAkD;AAClD,yCAAkD;AAClD,kEAKqC;AAErC,oCAAuC;AA6BvC,MAAa,WAAW;IAKtB,YAAmB,UAA6B;QAC9C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAED,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAA;IACtC,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAEM,OAAO;QACZ,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,oBAAY,CAAC,4CAA4C,CAAC,CAAA;QACtE,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,4BAAU,CAAC;YAC1B,UAAU,EAAE;gBACV,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,mBAAmB;aAC9C;SACF,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,iBAAiB;QAC5B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAA;QAC5B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAA;IAC/B,CAAC;IAED,IAAY,IAAI;QACd,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,IAAI,CAAC,OAAO,EAAE,CAAA;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GAAG,IAAI,sDAAoC,CAAC,EAAE,CAAC,CAAA;QAC/D,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAA;QAExD,MAAM,0BAA0B,GAAG,IAAI,gDAA8B,CAAC,EAAE,CAAC,CAAA;QACzE,MAAM,2BAA2B,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,0BAA0B,CAAC,CAAA;QAExF,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAA;QAEvC,kBAAkB;QAClB,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAA;YAC3B,OAAO,IAAI,CAAA;QACb,CAAC;QAED,2EAA2E;QAC3E,MAAM,eAAe,GAAG,OAAwD,CAAA;QAEhF,MAAM,oBAAoB,GAAG,2BAA2B,CAAC,MAAM,CAAC,IAA4B,CAAA;QAC5F,IAAI,CAAC,eAAe,mCACf,eAAe,KAClB,oBAAoB,GACrB,CAAA;QAED,OAAO,IAAI,CAAC,eAAe,CAAA;IAC7B,CAAC;CACF;AA9KD,kCA8KC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { AgentContext } from '@credo-ts/core';
|
|
2
|
-
import type { GetNymResponse } from '@hyperledger/indy-vdr-shared';
|
|
3
|
-
import { Logger } from '@credo-ts/core';
|
|
4
|
-
import { IndyVdrModuleConfig } from '../IndyVdrModuleConfig';
|
|
5
|
-
import { IndyVdrPool } from './IndyVdrPool';
|
|
6
|
-
export interface CachedDidResponse {
|
|
7
|
-
nymResponse: {
|
|
8
|
-
did: string;
|
|
9
|
-
verkey: string;
|
|
10
|
-
};
|
|
11
|
-
indyNamespace: string;
|
|
12
|
-
}
|
|
13
|
-
export declare class IndyVdrPoolService {
|
|
14
|
-
pools: IndyVdrPool[];
|
|
15
|
-
private logger;
|
|
16
|
-
private indyVdrModuleConfig;
|
|
17
|
-
constructor(logger: Logger, indyVdrModuleConfig: IndyVdrModuleConfig);
|
|
18
|
-
/**
|
|
19
|
-
* Get the most appropriate pool for the given did.
|
|
20
|
-
* If the did is a qualified indy did, the pool will be determined based on the namespace.
|
|
21
|
-
* If it is a legacy unqualified indy did, the pool will be determined based on the algorithm as described in this document:
|
|
22
|
-
* https://docs.google.com/document/d/109C_eMsuZnTnYe2OAd02jAts1vC4axwEKIq7_4dnNVA/edit
|
|
23
|
-
*
|
|
24
|
-
* This method will optionally return a nym response when the did has been resolved to determine the ledger
|
|
25
|
-
* either now or in the past. The nymResponse can be used to prevent multiple ledger quries fetching the same
|
|
26
|
-
* did
|
|
27
|
-
*/
|
|
28
|
-
getPoolForDid(agentContext: AgentContext, did: string): Promise<{
|
|
29
|
-
pool: IndyVdrPool;
|
|
30
|
-
nymResponse?: CachedDidResponse['nymResponse'];
|
|
31
|
-
}>;
|
|
32
|
-
private getPoolForLegacyDid;
|
|
33
|
-
private getSettledDidResponsesFromPools;
|
|
34
|
-
/**
|
|
35
|
-
* Refresh the pool connections asynchronously
|
|
36
|
-
*/
|
|
37
|
-
refreshPoolConnections(): Promise<PromiseSettledResult<void>[]>;
|
|
38
|
-
/**
|
|
39
|
-
* Get all pool transactions
|
|
40
|
-
*/
|
|
41
|
-
getAllPoolTransactions(): Promise<PromiseSettledResult<{
|
|
42
|
-
config: import("./IndyVdrPool").IndyVdrPoolConfig;
|
|
43
|
-
transactions: import("@hyperledger/indy-vdr-shared").Transactions;
|
|
44
|
-
}>[]>;
|
|
45
|
-
/**
|
|
46
|
-
* Get the most appropriate pool for the given indyNamespace
|
|
47
|
-
*/
|
|
48
|
-
getPoolForNamespace(indyNamespace: string): IndyVdrPool;
|
|
49
|
-
private getDidFromPool;
|
|
50
|
-
}
|
|
51
|
-
export interface PublicDidRequest {
|
|
52
|
-
did: CachedDidResponse;
|
|
53
|
-
pool: IndyVdrPool;
|
|
54
|
-
response: GetNymResponse;
|
|
55
|
-
}
|
|
@@ -1,175 +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
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.IndyVdrPoolService = void 0;
|
|
16
|
-
const anoncreds_1 = require("@credo-ts/anoncreds");
|
|
17
|
-
const core_1 = require("@credo-ts/core");
|
|
18
|
-
const indy_vdr_shared_1 = require("@hyperledger/indy-vdr-shared");
|
|
19
|
-
const IndyVdrModuleConfig_1 = require("../IndyVdrModuleConfig");
|
|
20
|
-
const error_1 = require("../error");
|
|
21
|
-
const did_1 = require("../utils/did");
|
|
22
|
-
const promises_1 = require("../utils/promises");
|
|
23
|
-
const IndyVdrPool_1 = require("./IndyVdrPool");
|
|
24
|
-
let IndyVdrPoolService = class IndyVdrPoolService {
|
|
25
|
-
constructor(logger, indyVdrModuleConfig) {
|
|
26
|
-
this.pools = [];
|
|
27
|
-
this.logger = logger;
|
|
28
|
-
this.indyVdrModuleConfig = indyVdrModuleConfig;
|
|
29
|
-
this.pools = this.indyVdrModuleConfig.networks.map((poolConfig) => new IndyVdrPool_1.IndyVdrPool(poolConfig));
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Get the most appropriate pool for the given did.
|
|
33
|
-
* If the did is a qualified indy did, the pool will be determined based on the namespace.
|
|
34
|
-
* If it is a legacy unqualified indy did, the pool will be determined based on the algorithm as described in this document:
|
|
35
|
-
* https://docs.google.com/document/d/109C_eMsuZnTnYe2OAd02jAts1vC4axwEKIq7_4dnNVA/edit
|
|
36
|
-
*
|
|
37
|
-
* This method will optionally return a nym response when the did has been resolved to determine the ledger
|
|
38
|
-
* either now or in the past. The nymResponse can be used to prevent multiple ledger quries fetching the same
|
|
39
|
-
* did
|
|
40
|
-
*/
|
|
41
|
-
async getPoolForDid(agentContext, did) {
|
|
42
|
-
// Check if the did starts with did:indy
|
|
43
|
-
const match = did.match(anoncreds_1.didIndyRegex);
|
|
44
|
-
if (match) {
|
|
45
|
-
const [, namespace] = match;
|
|
46
|
-
const pool = this.getPoolForNamespace(namespace);
|
|
47
|
-
if (pool)
|
|
48
|
-
return { pool };
|
|
49
|
-
throw new error_1.IndyVdrError(`Pool for indy namespace '${namespace}' not found`);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
return await this.getPoolForLegacyDid(agentContext, did);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
async getPoolForLegacyDid(agentContext, did) {
|
|
56
|
-
var _a;
|
|
57
|
-
const pools = this.pools;
|
|
58
|
-
if (pools.length === 0) {
|
|
59
|
-
throw new error_1.IndyVdrNotConfiguredError('No indy ledgers configured. Provide at least one pool configuration in IndyVdrModuleConfigOptions.networks');
|
|
60
|
-
}
|
|
61
|
-
const cache = agentContext.dependencyManager.resolve(core_1.CacheModuleConfig).cache;
|
|
62
|
-
const cacheKey = `IndyVdrPoolService:${did}`;
|
|
63
|
-
const cachedNymResponse = await cache.get(agentContext, cacheKey);
|
|
64
|
-
const pool = this.pools.find((pool) => pool.indyNamespace === (cachedNymResponse === null || cachedNymResponse === void 0 ? void 0 : cachedNymResponse.indyNamespace));
|
|
65
|
-
// If we have the nym response with associated pool in the cache, we'll use that
|
|
66
|
-
if (cachedNymResponse && pool) {
|
|
67
|
-
this.logger.trace(`Found ledger id '${pool.indyNamespace}' for did '${did}' in cache`);
|
|
68
|
-
return { pool, nymResponse: cachedNymResponse.nymResponse };
|
|
69
|
-
}
|
|
70
|
-
const { successful, rejected } = await this.getSettledDidResponsesFromPools(did, pools);
|
|
71
|
-
if (successful.length === 0) {
|
|
72
|
-
const allNotFound = rejected.every((e) => e.reason instanceof error_1.IndyVdrNotFoundError);
|
|
73
|
-
const rejectedOtherThanNotFound = rejected.filter((e) => !(e.reason instanceof error_1.IndyVdrNotFoundError));
|
|
74
|
-
// All ledgers returned response that the did was not found
|
|
75
|
-
if (allNotFound) {
|
|
76
|
-
throw new error_1.IndyVdrNotFoundError(`Did '${did}' not found on any of the ledgers (total ${this.pools.length}).`);
|
|
77
|
-
}
|
|
78
|
-
// one or more of the ledgers returned an unknown error
|
|
79
|
-
throw new error_1.IndyVdrError(`Unknown error retrieving did '${did}' from '${rejectedOtherThanNotFound.length}' of '${pools.length}' ledgers. ${rejectedOtherThanNotFound[0].reason}`, { cause: rejectedOtherThanNotFound[0].reason });
|
|
80
|
-
}
|
|
81
|
-
// If there are self certified DIDs we always prefer it over non self certified DIDs
|
|
82
|
-
// We take the first self certifying DID as we take the order in the
|
|
83
|
-
// IndyVdrModuleConfigOptions.networks config as the order of preference of ledgers
|
|
84
|
-
let value = (_a = successful.find((response) => (0, did_1.isSelfCertifiedDid)(response.value.did.nymResponse.did, response.value.did.nymResponse.verkey))) === null || _a === void 0 ? void 0 : _a.value;
|
|
85
|
-
if (!value) {
|
|
86
|
-
// Split between production and nonProduction ledgers. If there is at least one
|
|
87
|
-
// successful response from a production ledger, only keep production ledgers
|
|
88
|
-
// otherwise we only keep the non production ledgers.
|
|
89
|
-
const production = successful.filter((s) => s.value.pool.config.isProduction);
|
|
90
|
-
const nonProduction = successful.filter((s) => !s.value.pool.config.isProduction);
|
|
91
|
-
const productionOrNonProduction = production.length >= 1 ? production : nonProduction;
|
|
92
|
-
// We take the first value as we take the order in the IndyVdrModuleConfigOptions.networks
|
|
93
|
-
// config as the order of preference of ledgers
|
|
94
|
-
value = productionOrNonProduction[0].value;
|
|
95
|
-
}
|
|
96
|
-
await cache.set(agentContext, cacheKey, {
|
|
97
|
-
nymResponse: {
|
|
98
|
-
did: value.did.nymResponse.did,
|
|
99
|
-
verkey: value.did.nymResponse.verkey,
|
|
100
|
-
},
|
|
101
|
-
indyNamespace: value.did.indyNamespace,
|
|
102
|
-
});
|
|
103
|
-
return { pool: value.pool, nymResponse: value.did.nymResponse };
|
|
104
|
-
}
|
|
105
|
-
async getSettledDidResponsesFromPools(did, pools) {
|
|
106
|
-
this.logger.trace(`Retrieving did '${did}' from ${pools.length} ledgers`);
|
|
107
|
-
const didResponses = await (0, promises_1.allSettled)(pools.map((pool) => this.getDidFromPool(did, pool)));
|
|
108
|
-
const successful = (0, promises_1.onlyFulfilled)(didResponses);
|
|
109
|
-
this.logger.trace(`Retrieved ${successful.length} responses from ledgers for did '${did}'`);
|
|
110
|
-
const rejected = (0, promises_1.onlyRejected)(didResponses);
|
|
111
|
-
return {
|
|
112
|
-
rejected,
|
|
113
|
-
successful,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Refresh the pool connections asynchronously
|
|
118
|
-
*/
|
|
119
|
-
refreshPoolConnections() {
|
|
120
|
-
return Promise.allSettled(this.pools.map((pool) => pool.refreshConnection()));
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Get all pool transactions
|
|
124
|
-
*/
|
|
125
|
-
getAllPoolTransactions() {
|
|
126
|
-
return Promise.allSettled(this.pools.map(async (pool) => {
|
|
127
|
-
return { config: pool.config, transactions: await pool.transactions };
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Get the most appropriate pool for the given indyNamespace
|
|
132
|
-
*/
|
|
133
|
-
getPoolForNamespace(indyNamespace) {
|
|
134
|
-
if (this.pools.length === 0) {
|
|
135
|
-
throw new error_1.IndyVdrNotConfiguredError('No indy ledgers configured. Provide at least one pool configuration in IndyVdrModuleConfigOptions.networks');
|
|
136
|
-
}
|
|
137
|
-
const pool = this.pools.find((pool) => pool.indyNamespace === indyNamespace);
|
|
138
|
-
if (!pool) {
|
|
139
|
-
throw new error_1.IndyVdrError(`No ledgers found for indy namespace '${indyNamespace}'.`);
|
|
140
|
-
}
|
|
141
|
-
return pool;
|
|
142
|
-
}
|
|
143
|
-
async getDidFromPool(did, pool) {
|
|
144
|
-
try {
|
|
145
|
-
this.logger.trace(`Get public did '${did}' from ledger '${pool.indyNamespace}'`);
|
|
146
|
-
const request = new indy_vdr_shared_1.GetNymRequest({ dest: did });
|
|
147
|
-
this.logger.trace(`Submitting get did request for did '${did}' to ledger '${pool.indyNamespace}'`);
|
|
148
|
-
const response = await pool.submitRequest(request);
|
|
149
|
-
if (!response.result.data) {
|
|
150
|
-
throw new error_1.IndyVdrNotFoundError(`Did ${did} not found on indy pool with namespace ${pool.indyNamespace}`);
|
|
151
|
-
}
|
|
152
|
-
const result = JSON.parse(response.result.data);
|
|
153
|
-
this.logger.trace(`Retrieved did '${did}' from ledger '${pool.indyNamespace}'`, result);
|
|
154
|
-
return {
|
|
155
|
-
did: { nymResponse: { did: result.dest, verkey: result.verkey }, indyNamespace: pool.indyNamespace },
|
|
156
|
-
pool,
|
|
157
|
-
response,
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
catch (error) {
|
|
161
|
-
this.logger.trace(`Error retrieving did '${did}' from ledger '${pool.indyNamespace}'`, {
|
|
162
|
-
error,
|
|
163
|
-
did,
|
|
164
|
-
});
|
|
165
|
-
throw error;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
exports.IndyVdrPoolService = IndyVdrPoolService;
|
|
170
|
-
exports.IndyVdrPoolService = IndyVdrPoolService = __decorate([
|
|
171
|
-
(0, core_1.injectable)(),
|
|
172
|
-
__param(0, (0, core_1.inject)(core_1.InjectionSymbols.Logger)),
|
|
173
|
-
__metadata("design:paramtypes", [Object, IndyVdrModuleConfig_1.IndyVdrModuleConfig])
|
|
174
|
-
], IndyVdrPoolService);
|
|
175
|
-
//# sourceMappingURL=IndyVdrPoolService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IndyVdrPoolService.js","sourceRoot":"","sources":["../../src/pool/IndyVdrPoolService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,mDAAkD;AAClD,yCAAgG;AAChG,kEAA4D;AAE5D,gEAA4D;AAC5D,oCAAwF;AACxF,sCAAiD;AACjD,gDAA2E;AAE3E,+CAA2C;AAUpC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAK7B,YAAoD,MAAc,EAAE,mBAAwC;QAJrG,UAAK,GAAkB,EAAE,CAAA;QAK9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAA;QAE9C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,yBAAW,CAAC,UAAU,CAAC,CAAC,CAAA;IACjG,CAAC;IAED;;;;;;;;;OASG;IACI,KAAK,CAAC,aAAa,CACxB,YAA0B,EAC1B,GAAW;QAEX,wCAAwC;QACxC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,wBAAY,CAAC,CAAA;QAErC,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAA;YAE3B,MAAM,IAAI,GAAG,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAA;YAEhD,IAAI,IAAI;gBAAE,OAAO,EAAE,IAAI,EAAE,CAAA;YAEzB,MAAM,IAAI,oBAAY,CAAC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 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./IndyVdrPool"), exports);
|
|
18
|
-
__exportStar(require("./IndyVdrPoolService"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
package/build/pool/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pool/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,uDAAoC"}
|
package/build/utils/did.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Based on DidUtils implementation in Aries Framework .NET
|
|
3
|
-
* @see: https://github.com/hyperledger/aries-framework-dotnet/blob/f90eaf9db8548f6fc831abea917e906201755763/src/Hyperledger.Aries/Utils/DidUtils.cs
|
|
4
|
-
*
|
|
5
|
-
* Some context about full verkeys versus abbreviated verkeys:
|
|
6
|
-
* 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.
|
|
7
|
-
* An abbreviated verkey replaces the first 16 bytes of the verkey with ~ when it matches the DID.
|
|
8
|
-
*
|
|
9
|
-
* 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.
|
|
10
|
-
* 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.
|
|
11
|
-
*
|
|
12
|
-
* For this reason we need some methods to check whether verkeys are full or abbreviated, so we can align this with `indy.abbreviateVerkey`
|
|
13
|
-
*
|
|
14
|
-
* Aries Framework .NET also abbreviates verkey before sending to ledger:
|
|
15
|
-
* https://github.com/hyperledger/aries-framework-dotnet/blob/f90eaf9db8548f6fc831abea917e906201755763/src/Hyperledger.Aries/Ledger/DefaultLedgerService.cs#L139-L147
|
|
16
|
-
*/
|
|
17
|
-
export declare const ABBREVIATED_VERKEY_REGEX: RegExp;
|
|
18
|
-
/**
|
|
19
|
-
* Check whether the did is a self certifying did. If the verkey is abbreviated this method
|
|
20
|
-
* will always return true. Make sure that the verkey you pass in this method belongs to the
|
|
21
|
-
* did passed in
|
|
22
|
-
*
|
|
23
|
-
* @return Boolean indicating whether the did is self certifying
|
|
24
|
-
*/
|
|
25
|
-
export declare function isSelfCertifiedDid(did: string, verkey: string): boolean;
|
|
26
|
-
export declare function indyDidFromPublicKeyBase58(publicKeyBase58: string): string;
|
|
27
|
-
/**
|
|
28
|
-
* Check a base58 encoded string against a regex expression to determine if it is a valid abbreviated verkey
|
|
29
|
-
* @param verkey Base58 encoded string representation of an abbreviated verkey
|
|
30
|
-
* @returns Boolean indicating if the string is a valid abbreviated verkey
|
|
31
|
-
*/
|
|
32
|
-
export declare function isAbbreviatedVerkey(verkey: string): boolean;
|
package/build/utils/did.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Based on DidUtils implementation in Aries Framework .NET
|
|
4
|
-
* @see: https://github.com/hyperledger/aries-framework-dotnet/blob/f90eaf9db8548f6fc831abea917e906201755763/src/Hyperledger.Aries/Utils/DidUtils.cs
|
|
5
|
-
*
|
|
6
|
-
* Some context about full verkeys versus abbreviated verkeys:
|
|
7
|
-
* 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.
|
|
8
|
-
* An abbreviated verkey replaces the first 16 bytes of the verkey with ~ when it matches the DID.
|
|
9
|
-
*
|
|
10
|
-
* 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.
|
|
11
|
-
* 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.
|
|
12
|
-
*
|
|
13
|
-
* For this reason we need some methods to check whether verkeys are full or abbreviated, so we can align this with `indy.abbreviateVerkey`
|
|
14
|
-
*
|
|
15
|
-
* Aries Framework .NET also abbreviates verkey before sending to ledger:
|
|
16
|
-
* https://github.com/hyperledger/aries-framework-dotnet/blob/f90eaf9db8548f6fc831abea917e906201755763/src/Hyperledger.Aries/Ledger/DefaultLedgerService.cs#L139-L147
|
|
17
|
-
*/
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.ABBREVIATED_VERKEY_REGEX = void 0;
|
|
20
|
-
exports.isSelfCertifiedDid = isSelfCertifiedDid;
|
|
21
|
-
exports.indyDidFromPublicKeyBase58 = indyDidFromPublicKeyBase58;
|
|
22
|
-
exports.isAbbreviatedVerkey = isAbbreviatedVerkey;
|
|
23
|
-
const core_1 = require("@credo-ts/core");
|
|
24
|
-
exports.ABBREVIATED_VERKEY_REGEX = /^~[1-9A-HJ-NP-Za-km-z]{21,22}$/;
|
|
25
|
-
/**
|
|
26
|
-
* Check whether the did is a self certifying did. If the verkey is abbreviated this method
|
|
27
|
-
* will always return true. Make sure that the verkey you pass in this method belongs to the
|
|
28
|
-
* did passed in
|
|
29
|
-
*
|
|
30
|
-
* @return Boolean indicating whether the did is self certifying
|
|
31
|
-
*/
|
|
32
|
-
function isSelfCertifiedDid(did, verkey) {
|
|
33
|
-
// If the verkey is Abbreviated, it means the full verkey
|
|
34
|
-
// is the did + the verkey
|
|
35
|
-
if (isAbbreviatedVerkey(verkey)) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
const didFromVerkey = indyDidFromPublicKeyBase58(verkey);
|
|
39
|
-
if (didFromVerkey === did) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
function indyDidFromPublicKeyBase58(publicKeyBase58) {
|
|
45
|
-
const buffer = core_1.TypedArrayEncoder.fromBase58(publicKeyBase58);
|
|
46
|
-
const did = core_1.TypedArrayEncoder.toBase58(buffer.slice(0, 16));
|
|
47
|
-
return did;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Check a base58 encoded string against a regex expression to determine if it is a valid abbreviated verkey
|
|
51
|
-
* @param verkey Base58 encoded string representation of an abbreviated verkey
|
|
52
|
-
* @returns Boolean indicating if the string is a valid abbreviated verkey
|
|
53
|
-
*/
|
|
54
|
-
function isAbbreviatedVerkey(verkey) {
|
|
55
|
-
return exports.ABBREVIATED_VERKEY_REGEX.test(verkey);
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=did.js.map
|
package/build/utils/did.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"did.js","sourceRoot":"","sources":["../../src/utils/did.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAaH,gDAcC;AAED,gEAMC;AAOD,kDAEC;AA1CD,yCAAkD;AAErC,QAAA,wBAAwB,GAAG,gCAAgC,CAAA;AAExE;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAAC,GAAW,EAAE,MAAc;IAC5D,yDAAyD;IACzD,0BAA0B;IAC1B,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,aAAa,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAA;IAExD,IAAI,aAAa,KAAK,GAAG,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAgB,0BAA0B,CAAC,eAAuB;IAChE,MAAM,MAAM,GAAG,wBAAiB,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;IAE5D,MAAM,GAAG,GAAG,wBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IAE3D,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,MAAc;IAChD,OAAO,gCAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAC9C,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export type AllSettledFulfilled<T> = {
|
|
2
|
-
status: 'fulfilled';
|
|
3
|
-
value: T;
|
|
4
|
-
};
|
|
5
|
-
export type AllSettledRejected = {
|
|
6
|
-
status: 'rejected';
|
|
7
|
-
reason: any;
|
|
8
|
-
};
|
|
9
|
-
export declare function allSettled<T>(promises: Promise<T>[]): Promise<(AllSettledRejected | AllSettledFulfilled<T>)[]>;
|
|
10
|
-
export declare function onlyFulfilled<T>(entries: Array<AllSettledFulfilled<T> | AllSettledRejected>): AllSettledFulfilled<T>[];
|
|
11
|
-
export declare function onlyRejected<T>(entries: Array<AllSettledFulfilled<T> | AllSettledRejected>): AllSettledRejected[];
|
package/build/utils/promises.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file polyfills the allSettled method introduced in ESNext
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.allSettled = allSettled;
|
|
5
|
-
exports.onlyFulfilled = onlyFulfilled;
|
|
6
|
-
exports.onlyRejected = onlyRejected;
|
|
7
|
-
function allSettled(promises) {
|
|
8
|
-
return Promise.all(promises.map((p) => p
|
|
9
|
-
.then((value) => ({
|
|
10
|
-
status: 'fulfilled',
|
|
11
|
-
value,
|
|
12
|
-
}))
|
|
13
|
-
.catch((reason) => ({
|
|
14
|
-
status: 'rejected',
|
|
15
|
-
reason,
|
|
16
|
-
}))));
|
|
17
|
-
}
|
|
18
|
-
function onlyFulfilled(entries) {
|
|
19
|
-
// We filter for only the rejected values, so we can safely cast the type
|
|
20
|
-
return entries.filter((e) => e.status === 'fulfilled');
|
|
21
|
-
}
|
|
22
|
-
function onlyRejected(entries) {
|
|
23
|
-
// We filter for only the rejected values, so we can safely cast the type
|
|
24
|
-
return entries.filter((e) => e.status === 'rejected');
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=promises.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promises.js","sourceRoot":"","sources":["../../src/utils/promises.ts"],"names":[],"mappings":";AAAA,iEAAiE;;AAajE,gCAoBC;AAED,sCAGC;AAED,oCAGC;AA9BD,SAAgB,UAAU,CAAI,QAAsB;IAClD,OAAO,OAAO,CAAC,GAAG,CAChB,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACjB,CAAC;SACE,IAAI,CACH,CAAC,KAAK,EAAE,EAAE,CACR,CAAC;QACC,MAAM,EAAE,WAAW;QACnB,KAAK;KACqB,CAAA,CAC/B;SACA,KAAK,CACJ,CAAC,MAAM,EAAE,EAAE,CACT,CAAC;QACC,MAAM,EAAE,UAAU;QAClB,MAAM;KACgB,CAAA,CAC3B,CACJ,CACF,CAAA;AACH,CAAC;AAED,SAAgB,aAAa,CAAI,OAA2D;IAC1F,yEAAyE;IACzE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,WAAW,CAA6B,CAAA;AACpF,CAAC;AAED,SAAgB,YAAY,CAAI,OAA2D;IACzF,yEAAyE;IACzE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAyB,CAAA;AAC/E,CAAC"}
|
package/build/utils/sign.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { IndyVdrPool } from '../pool';
|
|
2
|
-
import type { AgentContext, Key } from '@credo-ts/core';
|
|
3
|
-
import type { IndyVdrRequest } from '@hyperledger/indy-vdr-shared';
|
|
4
|
-
export declare function multiSignRequest<Request extends IndyVdrRequest>(agentContext: AgentContext, request: Request, signingKey: Key, identifier: string): Promise<Request>;
|
|
5
|
-
export declare function signRequest<Request extends IndyVdrRequest>(agentContext: AgentContext, pool: IndyVdrPool, request: Request, submitterDid: string): Promise<Request>;
|
package/build/utils/sign.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.multiSignRequest = multiSignRequest;
|
|
4
|
-
exports.signRequest = signRequest;
|
|
5
|
-
const core_1 = require("@credo-ts/core");
|
|
6
|
-
const didIndyUtil_1 = require("../dids/didIndyUtil");
|
|
7
|
-
async function multiSignRequest(agentContext, request, signingKey, identifier) {
|
|
8
|
-
const signature = await agentContext.wallet.sign({
|
|
9
|
-
data: core_1.TypedArrayEncoder.fromString(request.signatureInput),
|
|
10
|
-
key: signingKey,
|
|
11
|
-
});
|
|
12
|
-
request.setMultiSignature({
|
|
13
|
-
signature,
|
|
14
|
-
identifier,
|
|
15
|
-
});
|
|
16
|
-
return request;
|
|
17
|
-
}
|
|
18
|
-
async function signRequest(agentContext, pool, request, submitterDid) {
|
|
19
|
-
const signingKey = await (0, didIndyUtil_1.verificationKeyForIndyDid)(agentContext, submitterDid);
|
|
20
|
-
const signedRequest = await pool.prepareWriteRequest(agentContext, request, signingKey);
|
|
21
|
-
return signedRequest;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=sign.js.map
|
package/build/utils/sign.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/utils/sign.ts"],"names":[],"mappings":";;AAQA,4CAiBC;AAED,kCAUC;AAjCD,yCAAkD;AAElD,qDAA+D;AAExD,KAAK,UAAU,gBAAgB,CACpC,YAA0B,EAC1B,OAAgB,EAChB,UAAe,EACf,UAAkB;IAElB,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC;QAC/C,IAAI,EAAE,wBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC;QAC1D,GAAG,EAAE,UAAU;KAChB,CAAC,CAAA;IAEF,OAAO,CAAC,iBAAiB,CAAC;QACxB,SAAS;QACT,UAAU;KACX,CAAC,CAAA;IAEF,OAAO,OAAO,CAAA;AAChB,CAAC;AAEM,KAAK,UAAU,WAAW,CAC/B,YAA0B,EAC1B,IAAiB,EACjB,OAAgB,EAChB,YAAoB;IAEpB,MAAM,UAAU,GAAG,MAAM,IAAA,uCAAyB,EAAC,YAAY,EAAE,YAAY,CAAC,CAAA;IAC9E,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,YAAY,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;IAEvF,OAAO,aAAa,CAAA;AACtB,CAAC"}
|