@extrimian/agent 0.8.7
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/dist/agent.d.ts +50 -0
- package/dist/agent.js +152 -0
- package/dist/agent.js.map +1 -0
- package/dist/data-share-behaviours/data-share-behavior.d.ts +4 -0
- package/dist/data-share-behaviours/data-share-behavior.js +3 -0
- package/dist/data-share-behaviours/data-share-behavior.js.map +1 -0
- package/dist/data-share-behaviours/identity-data-share-behavior.d.ts +16 -0
- package/dist/data-share-behaviours/identity-data-share-behavior.js +3 -0
- package/dist/data-share-behaviours/identity-data-share-behavior.js.map +1 -0
- package/dist/data-share-behaviours/identity-plaintext-data-share-behavior.d.ts +5 -0
- package/dist/data-share-behaviours/identity-plaintext-data-share-behavior.js +29 -0
- package/dist/data-share-behaviours/identity-plaintext-data-share-behavior.js.map +1 -0
- package/dist/did/did-services.d.ts +14 -0
- package/dist/did/did-services.js +15 -0
- package/dist/did/did-services.js.map +1 -0
- package/dist/exceptions/agent-plugin-not-found.d.ts +2 -0
- package/dist/exceptions/agent-plugin-not-found.js +7 -0
- package/dist/exceptions/agent-plugin-not-found.js.map +1 -0
- package/dist/exceptions/vc-protocol-not-found.d.ts +3 -0
- package/dist/exceptions/vc-protocol-not-found.js +12 -0
- package/dist/exceptions/vc-protocol-not-found.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/messaging/messaging.d.ts +37 -0
- package/dist/messaging/messaging.js +96 -0
- package/dist/messaging/messaging.js.map +1 -0
- package/dist/models/agent-identity.d.ts +81 -0
- package/dist/models/agent-identity.js +395 -0
- package/dist/models/agent-identity.js.map +1 -0
- package/dist/models/agent-pbk.d.ts +11 -0
- package/dist/models/agent-pbk.js +12 -0
- package/dist/models/agent-pbk.js.map +1 -0
- package/dist/models/agent-registry.d.ts +90 -0
- package/dist/models/agent-registry.js +142 -0
- package/dist/models/agent-registry.js.map +1 -0
- package/dist/models/agent-resolver.d.ts +19 -0
- package/dist/models/agent-resolver.js +51 -0
- package/dist/models/agent-resolver.js.map +1 -0
- package/dist/models/agent-secure-storage.d.ts +3 -0
- package/dist/models/agent-secure-storage.js +3 -0
- package/dist/models/agent-secure-storage.js.map +1 -0
- package/dist/models/agent-secure-storages/filesystem-agent-secure-storage.d.ts +14 -0
- package/dist/models/agent-secure-storages/filesystem-agent-secure-storage.js +64 -0
- package/dist/models/agent-secure-storages/filesystem-agent-secure-storage.js.map +1 -0
- package/dist/models/agent-storage.d.ts +9 -0
- package/dist/models/agent-storage.js +3 -0
- package/dist/models/agent-storage.js.map +1 -0
- package/dist/models/did.d.ts +19 -0
- package/dist/models/did.js +64 -0
- package/dist/models/did.js.map +1 -0
- package/dist/models/transports/connectable-transport.d.ts +25 -0
- package/dist/models/transports/connectable-transport.js +37 -0
- package/dist/models/transports/connectable-transport.js.map +1 -0
- package/dist/models/transports/dwn-transport.d.ts +30 -0
- package/dist/models/transports/dwn-transport.js +213 -0
- package/dist/models/transports/dwn-transport.js.map +1 -0
- package/dist/models/transports/messaging-transport.d.ts +3 -0
- package/dist/models/transports/messaging-transport.js +3 -0
- package/dist/models/transports/messaging-transport.js.map +1 -0
- package/dist/models/transports/transport.d.ts +29 -0
- package/dist/models/transports/transport.js +8 -0
- package/dist/models/transports/transport.js.map +1 -0
- package/dist/models/transports/websocket-client-transport.d.ts +5 -0
- package/dist/models/transports/websocket-client-transport.js +45 -0
- package/dist/models/transports/websocket-client-transport.js.map +1 -0
- package/dist/models/transports/websocket-server-transport.d.ts +7 -0
- package/dist/models/transports/websocket-server-transport.js +22 -0
- package/dist/models/transports/websocket-server-transport.js.map +1 -0
- package/dist/models/transports/websocket-transport.d.ts +30 -0
- package/dist/models/transports/websocket-transport.js +100 -0
- package/dist/models/transports/websocket-transport.js.map +1 -0
- package/dist/models/vc-storage.d.ts +8 -0
- package/dist/models/vc-storage.js +3 -0
- package/dist/models/vc-storage.js.map +1 -0
- package/dist/plugins/iplugin.d.ts +17 -0
- package/dist/plugins/iplugin.js +3 -0
- package/dist/plugins/iplugin.js.map +1 -0
- package/dist/plugins/plugin-dispatcher.d.ts +6 -0
- package/dist/plugins/plugin-dispatcher.js +31 -0
- package/dist/plugins/plugin-dispatcher.js.map +1 -0
- package/dist/transport/transport.d.ts +41 -0
- package/dist/transport/transport.js +99 -0
- package/dist/transport/transport.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +15 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/lite-event.d.ts +25 -0
- package/dist/utils/lite-event.js +33 -0
- package/dist/utils/lite-event.js.map +1 -0
- package/dist/vc/models/credentia-flow.d.ts +4 -0
- package/dist/vc/models/credentia-flow.js +9 -0
- package/dist/vc/models/credentia-flow.js.map +1 -0
- package/dist/vc/models/credential-request.d.ts +3 -0
- package/dist/vc/models/credential-request.js +3 -0
- package/dist/vc/models/credential-request.js.map +1 -0
- package/dist/vc/models/vc-create-key-request.d.ts +4 -0
- package/dist/vc/models/vc-create-key-request.js +3 -0
- package/dist/vc/models/vc-create-key-request.js.map +1 -0
- package/dist/vc/models/waci-message.d.ts +3 -0
- package/dist/vc/models/waci-message.js +8 -0
- package/dist/vc/models/waci-message.js.map +1 -0
- package/dist/vc/protocols/openid-protocol.d.ts +159 -0
- package/dist/vc/protocols/openid-protocol.js +147 -0
- package/dist/vc/protocols/openid-protocol.js.map +1 -0
- package/dist/vc/protocols/vc-protocol.d.ts +98 -0
- package/dist/vc/protocols/vc-protocol.js +37 -0
- package/dist/vc/protocols/vc-protocol.js.map +1 -0
- package/dist/vc/protocols/waci-protocol.d.ts +144 -0
- package/dist/vc/protocols/waci-protocol.js +391 -0
- package/dist/vc/protocols/waci-protocol.js.map +1 -0
- package/dist/vc/vc-setup/vc-setup.d.ts +0 -0
- package/dist/vc/vc-setup/vc-setup.js +1 -0
- package/dist/vc/vc-setup/vc-setup.js.map +1 -0
- package/dist/vc/vc.d.ts +152 -0
- package/dist/vc/vc.js +263 -0
- package/dist/vc/vc.js.map +1 -0
- package/package.json +50 -0
- package/readme.md +392 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { IJWK, IKeyPair, IKMS } from '@extrimian/kms-core';
|
|
2
|
+
import { IdentityDataShareBehavior, IdentityExportResult } from '../data-share-behaviours/identity-data-share-behavior';
|
|
3
|
+
import { IAgentRegistry, KeyDefinition, ServiceDefinition, VMKey } from './agent-registry';
|
|
4
|
+
import { IAgentResolver } from './agent-resolver';
|
|
5
|
+
import { IAgentStorage } from './agent-storage';
|
|
6
|
+
import { DID } from './did';
|
|
7
|
+
export declare class AgentIdentity {
|
|
8
|
+
private agentStorage;
|
|
9
|
+
private kms;
|
|
10
|
+
private resolver;
|
|
11
|
+
private registry;
|
|
12
|
+
private _dids;
|
|
13
|
+
private _did;
|
|
14
|
+
private _onOperationalDIDChanged;
|
|
15
|
+
get operationalDIDChanged(): import("../utils/lite-event").ILiteEvent<{
|
|
16
|
+
did: DID;
|
|
17
|
+
}>;
|
|
18
|
+
private _onIdentityInitialized;
|
|
19
|
+
get identityInitialized(): import("../utils/lite-event").ILiteEvent<void>;
|
|
20
|
+
private readonly onDidCreated;
|
|
21
|
+
get didCreated(): import("../utils/lite-event").ILiteEvent<{
|
|
22
|
+
did: DID;
|
|
23
|
+
}>;
|
|
24
|
+
constructor(params: {
|
|
25
|
+
agentStorage?: IAgentStorage;
|
|
26
|
+
resolver: IAgentResolver;
|
|
27
|
+
registry: IAgentRegistry;
|
|
28
|
+
kms: IKMS;
|
|
29
|
+
});
|
|
30
|
+
private _initialized;
|
|
31
|
+
get initialized(): boolean;
|
|
32
|
+
initialize(params?: {
|
|
33
|
+
operationalDID?: DID;
|
|
34
|
+
resolver: IAgentResolver;
|
|
35
|
+
registry: IAgentRegistry;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
addDID(params: {
|
|
38
|
+
did: DID;
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
setOperationalDID(did: DID): Promise<void>;
|
|
41
|
+
getOperationalDID(): DID;
|
|
42
|
+
getDIDs(): string[];
|
|
43
|
+
createNewDID(): Promise<DID>;
|
|
44
|
+
createNewDID(params: {
|
|
45
|
+
preventCredentialCreation?: boolean;
|
|
46
|
+
dwnUrl?: string | string[];
|
|
47
|
+
services?: ServiceDefinition[];
|
|
48
|
+
keysToCreate?: KeyDefinition[];
|
|
49
|
+
keysToImport?: {
|
|
50
|
+
id: string;
|
|
51
|
+
vmKey: VMKey;
|
|
52
|
+
publicKeyJWK: IJWK;
|
|
53
|
+
secrets: IKeyPair;
|
|
54
|
+
}[];
|
|
55
|
+
didMethod?: string;
|
|
56
|
+
}): Promise<DID>;
|
|
57
|
+
waitForDIDPublish(shortDid: DID): Promise<void>;
|
|
58
|
+
updateDID(params?: {
|
|
59
|
+
did?: DID;
|
|
60
|
+
dwnUrl?: {
|
|
61
|
+
id?: string;
|
|
62
|
+
url: string;
|
|
63
|
+
}[];
|
|
64
|
+
idsOfServiceToRemove?: string[];
|
|
65
|
+
controllersToAdd?: IJWK[];
|
|
66
|
+
servicesToAdd?: ServiceDefinition[];
|
|
67
|
+
verificationMethodsToAdd?: KeyDefinition[];
|
|
68
|
+
updateKeysToRemove?: {
|
|
69
|
+
publicKeys?: IJWK[];
|
|
70
|
+
updateCommitment?: string[];
|
|
71
|
+
};
|
|
72
|
+
idsOfVerificationMethodsToRemove?: string[];
|
|
73
|
+
}): Promise<void>;
|
|
74
|
+
exportKeys(params: {
|
|
75
|
+
exportBehavior: IdentityDataShareBehavior;
|
|
76
|
+
}): Promise<IdentityExportResult>;
|
|
77
|
+
importKeys(params: {
|
|
78
|
+
exportResult: IdentityExportResult;
|
|
79
|
+
exportBehavior: IdentityDataShareBehavior;
|
|
80
|
+
}): Promise<void>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AgentIdentity = void 0;
|
|
13
|
+
const did_core_1 = require("@extrimian/did-core");
|
|
14
|
+
const kms_core_1 = require("@extrimian/kms-core");
|
|
15
|
+
const lite_event_1 = require("../utils/lite-event");
|
|
16
|
+
const agent_registry_1 = require("./agent-registry");
|
|
17
|
+
const did_1 = require("./did");
|
|
18
|
+
const modena_sdk_1 = require("@extrimian/modena-sdk");
|
|
19
|
+
const AGENT_DID_KEY = 'agent-did';
|
|
20
|
+
const OPERATIONAL_DID_KEY = 'operational-did';
|
|
21
|
+
class AgentIdentity {
|
|
22
|
+
constructor(params) {
|
|
23
|
+
this._dids = new Array();
|
|
24
|
+
this._onOperationalDIDChanged = new lite_event_1.LiteEvent();
|
|
25
|
+
this._onIdentityInitialized = new lite_event_1.LiteEvent();
|
|
26
|
+
this.onDidCreated = new lite_event_1.LiteEvent();
|
|
27
|
+
this.agentStorage = params.agentStorage;
|
|
28
|
+
this.kms = params.kms;
|
|
29
|
+
this.resolver = params.resolver;
|
|
30
|
+
this.registry = params.registry;
|
|
31
|
+
}
|
|
32
|
+
get operationalDIDChanged() {
|
|
33
|
+
return this._onOperationalDIDChanged.expose();
|
|
34
|
+
}
|
|
35
|
+
get identityInitialized() {
|
|
36
|
+
return this._onIdentityInitialized.expose();
|
|
37
|
+
}
|
|
38
|
+
get didCreated() {
|
|
39
|
+
return this.onDidCreated.expose();
|
|
40
|
+
}
|
|
41
|
+
get initialized() {
|
|
42
|
+
return this._initialized;
|
|
43
|
+
}
|
|
44
|
+
initialize(params) {
|
|
45
|
+
var _a;
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
this.resolver = params.resolver;
|
|
48
|
+
this.registry = params.registry;
|
|
49
|
+
this._dids =
|
|
50
|
+
(yield this.agentStorage.get(AGENT_DID_KEY)) || new Array();
|
|
51
|
+
if (params.operationalDID) {
|
|
52
|
+
if (this._dids.indexOf(params.operationalDID.value) == -1) {
|
|
53
|
+
throw new Error(`Operational DID ${params.operationalDID} not exists on agent. You must import the did with its private keys`);
|
|
54
|
+
}
|
|
55
|
+
yield this.setOperationalDID(params.operationalDID);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const did = (yield this.agentStorage.get(OPERATIONAL_DID_KEY));
|
|
59
|
+
this._did = did != null ? did_1.DID.from(did) : null;
|
|
60
|
+
if (!this._did && this._dids && this._dids.length > 0) {
|
|
61
|
+
yield this.setOperationalDID(did_1.DID.from(this._dids[0]));
|
|
62
|
+
}
|
|
63
|
+
else if (this._did) {
|
|
64
|
+
yield this.setOperationalDID(this._did);
|
|
65
|
+
}
|
|
66
|
+
if ((_a = this._did) === null || _a === void 0 ? void 0 : _a.isLongDID()) {
|
|
67
|
+
const shortDID = this.getDIDs().map(x => did_1.DID.from(x)).find(x => this._did.isLongDIDFor(x));
|
|
68
|
+
if (shortDID) {
|
|
69
|
+
this.waitForDIDPublish(shortDID);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
this._initialized = true;
|
|
74
|
+
this._onIdentityInitialized.trigger();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
addDID(params) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
if (!this._did) {
|
|
80
|
+
this._did = params.did;
|
|
81
|
+
}
|
|
82
|
+
if (!this._dids[params.did.value]) {
|
|
83
|
+
this._dids.push(params.did.value);
|
|
84
|
+
yield this.agentStorage.add(AGENT_DID_KEY, this._dids);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
setOperationalDID(did) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
if (!did) {
|
|
91
|
+
throw new Error("Operational DID to set can't be null or undefined.");
|
|
92
|
+
}
|
|
93
|
+
if (this._dids.indexOf(did.value) == -1) {
|
|
94
|
+
throw new Error('Operational DID to set must be defined on dids of the identity. You must import the did with its private keys');
|
|
95
|
+
}
|
|
96
|
+
const auxDid = this._did;
|
|
97
|
+
this._did = did;
|
|
98
|
+
yield this.agentStorage.add(OPERATIONAL_DID_KEY, this._did.value);
|
|
99
|
+
if (auxDid != did) {
|
|
100
|
+
this._onOperationalDIDChanged.trigger({ did });
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
getOperationalDID() {
|
|
105
|
+
return this._did;
|
|
106
|
+
}
|
|
107
|
+
getDIDs() {
|
|
108
|
+
return [...this._dids];
|
|
109
|
+
}
|
|
110
|
+
createNewDID(params) {
|
|
111
|
+
var _a, _b, _c;
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
params = params || {};
|
|
114
|
+
if (!params.keysToCreate) {
|
|
115
|
+
params.keysToCreate = new Array();
|
|
116
|
+
if (!params.preventCredentialCreation) {
|
|
117
|
+
params.keysToCreate.push({ id: 'vc-bbsbls', vmKey: agent_registry_1.VMKey.VC });
|
|
118
|
+
}
|
|
119
|
+
params.keysToCreate.push({ id: 'didcomm', vmKey: agent_registry_1.VMKey.DIDComm });
|
|
120
|
+
params.keysToCreate.push({ id: 'rsa', vmKey: agent_registry_1.VMKey.RSA });
|
|
121
|
+
}
|
|
122
|
+
const updateKey = yield this.kms.create(kms_core_1.Suite.ES256k);
|
|
123
|
+
const recoveryKey = yield this.kms.create(kms_core_1.Suite.ES256k);
|
|
124
|
+
if (params.keysToImport) {
|
|
125
|
+
for (let ktu of params.keysToImport) {
|
|
126
|
+
yield this.kms.import({
|
|
127
|
+
publicKeyHex: kms_core_1.BaseConverter.convert(ktu.publicKeyJWK, kms_core_1.Base.JWK, kms_core_1.Base.Hex, ktu.secrets.keyType),
|
|
128
|
+
secret: ktu.secrets,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const didCommKeys = [...yield Promise.all(params.keysToCreate
|
|
133
|
+
.filter((x) => x.vmKey == agent_registry_1.VMKey.DIDComm)
|
|
134
|
+
.map((x) => __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
return ({
|
|
136
|
+
id: x.id,
|
|
137
|
+
pbk: yield this.kms.create(kms_core_1.Suite.DIDCommV2),
|
|
138
|
+
});
|
|
139
|
+
}))), ...(_a = (params.keysToImport || [])) === null || _a === void 0 ? void 0 : _a.filter(x => x.vmKey == agent_registry_1.VMKey.DIDComm).map(x => ({
|
|
140
|
+
id: x.id,
|
|
141
|
+
pbk: { publicKeyJWK: x.publicKeyJWK }
|
|
142
|
+
}))];
|
|
143
|
+
const bbsbls2020Keys = [...yield Promise.all(params.keysToCreate
|
|
144
|
+
.filter((x) => x.vmKey == agent_registry_1.VMKey.VC)
|
|
145
|
+
.map((x) => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
return ({
|
|
147
|
+
id: x.id,
|
|
148
|
+
pbk: yield this.kms.create(kms_core_1.Suite.Bbsbls2020),
|
|
149
|
+
});
|
|
150
|
+
}))),
|
|
151
|
+
...(_b = (params.keysToImport || [])) === null || _b === void 0 ? void 0 : _b.filter(x => x.vmKey == agent_registry_1.VMKey.VC).map(x => ({
|
|
152
|
+
id: x.id,
|
|
153
|
+
pbk: { publicKeyJWK: x.publicKeyJWK }
|
|
154
|
+
}))];
|
|
155
|
+
const rsaKeys = [...yield Promise.all(params.keysToCreate
|
|
156
|
+
.filter((x) => x.vmKey == agent_registry_1.VMKey.RSA)
|
|
157
|
+
.map((x) => __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
return ({
|
|
159
|
+
id: x.id,
|
|
160
|
+
pbk: yield this.kms.create(kms_core_1.Suite.RsaSignature2018),
|
|
161
|
+
});
|
|
162
|
+
}))),
|
|
163
|
+
...(_c = (params.keysToImport || [])) === null || _c === void 0 ? void 0 : _c.filter(x => x.vmKey == agent_registry_1.VMKey.RSA).map(x => ({
|
|
164
|
+
id: x.id,
|
|
165
|
+
pbk: { publicKeyJWK: x.publicKeyJWK }
|
|
166
|
+
}))];
|
|
167
|
+
if (!params.services) {
|
|
168
|
+
params.services = new Array();
|
|
169
|
+
}
|
|
170
|
+
if (params.dwnUrl) {
|
|
171
|
+
params.services.push({
|
|
172
|
+
id: 'dwn-default',
|
|
173
|
+
type: 'DecentralizedWebNode',
|
|
174
|
+
serviceEndpoint: {
|
|
175
|
+
nodes: typeof params.dwnUrl === 'string' ? [params.dwnUrl] : params.dwnUrl,
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
const response = yield this.registry.createDID({
|
|
180
|
+
didMethod: params.didMethod,
|
|
181
|
+
recoveryKeys: [recoveryKey.publicKeyJWK],
|
|
182
|
+
updateKeys: [updateKey.publicKeyJWK],
|
|
183
|
+
services: params.services,
|
|
184
|
+
verificationMethods: didCommKeys
|
|
185
|
+
.map((x) => ({
|
|
186
|
+
id: x.id,
|
|
187
|
+
publicKeyJwk: x.pbk.publicKeyJWK,
|
|
188
|
+
purpose: [new did_core_1.KeyAgreementPurpose()],
|
|
189
|
+
type: 'X25519KeyAgreementKey2019',
|
|
190
|
+
controller: this.getOperationalDID(),
|
|
191
|
+
}))
|
|
192
|
+
.concat(bbsbls2020Keys
|
|
193
|
+
.map((x) => ({
|
|
194
|
+
id: x.id,
|
|
195
|
+
publicKeyJwk: x.pbk.publicKeyJWK,
|
|
196
|
+
purpose: [new did_core_1.AssertionMethodPurpose()],
|
|
197
|
+
type: 'Bls12381G1Key2020',
|
|
198
|
+
controller: this.getOperationalDID(),
|
|
199
|
+
}))
|
|
200
|
+
.concat(rsaKeys.map((x) => ({
|
|
201
|
+
id: x.id,
|
|
202
|
+
publicKeyJwk: x.pbk.publicKeyJWK,
|
|
203
|
+
purpose: [new did_core_1.AuthenticationPurpose()],
|
|
204
|
+
type: 'RsaSignature2018',
|
|
205
|
+
controller: this.getOperationalDID(),
|
|
206
|
+
})))),
|
|
207
|
+
});
|
|
208
|
+
if ('longDid' in response) {
|
|
209
|
+
const sidetreeResponse = response;
|
|
210
|
+
this.addDID({ did: did_1.DID.from(sidetreeResponse.longDid) });
|
|
211
|
+
const h = (args) => {
|
|
212
|
+
if (args.did.value == response.did) {
|
|
213
|
+
this.onDidCreated.off(h);
|
|
214
|
+
if (this.getOperationalDID().isEqual(did_1.DID.from(sidetreeResponse.longDid))) {
|
|
215
|
+
this.setOperationalDID(args.did);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
yield this.setOperationalDID(did_1.DID.from(sidetreeResponse.longDid));
|
|
220
|
+
this.onDidCreated.on(h);
|
|
221
|
+
}
|
|
222
|
+
this.addDID({ did: did_1.DID.from(response.did) });
|
|
223
|
+
this.waitForDIDPublish(did_1.DID.from(response.did));
|
|
224
|
+
return did_1.DID.from(response.did);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
waitForDIDPublish(shortDid) {
|
|
228
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
229
|
+
let interval = null;
|
|
230
|
+
const checkDIDPublished = () => __awaiter(this, void 0, void 0, function* () {
|
|
231
|
+
if (this.getOperationalDID()) {
|
|
232
|
+
const didDocument = yield this.resolver.resolve(shortDid);
|
|
233
|
+
if (didDocument) {
|
|
234
|
+
if (interval) {
|
|
235
|
+
clearInterval(interval);
|
|
236
|
+
}
|
|
237
|
+
this.onDidCreated.trigger({ did: shortDid });
|
|
238
|
+
// this.setOperationalDID(DID.from(response.did));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
;
|
|
242
|
+
});
|
|
243
|
+
checkDIDPublished();
|
|
244
|
+
interval = setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
|
245
|
+
checkDIDPublished();
|
|
246
|
+
}), 5000);
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
updateDID(params) {
|
|
250
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
251
|
+
params.did = params.did || this.getOperationalDID();
|
|
252
|
+
const didDoc = yield this.resolver.resolveWithMetdata(params.did);
|
|
253
|
+
const keys = (yield this.kms.getPublicKeysBySuiteType(kms_core_1.Suite.ES256k)).map(jwk => ({
|
|
254
|
+
jwk,
|
|
255
|
+
updateCommitmentHash: modena_sdk_1.UpdateCommitmentUtils.getUpdateCommitmentHash(jwk),
|
|
256
|
+
}));
|
|
257
|
+
const updateKey = keys.find(x => didDoc.didDocumentMetadata.method.updateCommitment.some(y => y == x.updateCommitmentHash));
|
|
258
|
+
const newUpdateKey = yield this.kms.create(kms_core_1.Suite.ES256k);
|
|
259
|
+
params.verificationMethodsToAdd = params.verificationMethodsToAdd || [];
|
|
260
|
+
const didCommKeys = yield Promise.all(params.verificationMethodsToAdd
|
|
261
|
+
.filter((x) => x.vmKey == agent_registry_1.VMKey.DIDComm)
|
|
262
|
+
.map((x) => __awaiter(this, void 0, void 0, function* () {
|
|
263
|
+
return ({
|
|
264
|
+
id: x.id,
|
|
265
|
+
pbk: yield this.kms.create(kms_core_1.Suite.DIDCommV2),
|
|
266
|
+
});
|
|
267
|
+
})));
|
|
268
|
+
const bbsbls2020Keys = yield Promise.all(params.verificationMethodsToAdd
|
|
269
|
+
.filter((x) => x.vmKey == agent_registry_1.VMKey.VC)
|
|
270
|
+
.map((x) => __awaiter(this, void 0, void 0, function* () {
|
|
271
|
+
return ({
|
|
272
|
+
id: x.id,
|
|
273
|
+
pbk: yield this.kms.create(kms_core_1.Suite.Bbsbls2020),
|
|
274
|
+
});
|
|
275
|
+
})));
|
|
276
|
+
const rsaKeys = yield Promise.all(params.verificationMethodsToAdd
|
|
277
|
+
.filter((x) => x.vmKey == agent_registry_1.VMKey.RSA)
|
|
278
|
+
.map((x) => __awaiter(this, void 0, void 0, function* () {
|
|
279
|
+
return ({
|
|
280
|
+
id: x.id,
|
|
281
|
+
pbk: yield this.kms.create(kms_core_1.Suite.RsaSignature2018),
|
|
282
|
+
});
|
|
283
|
+
})));
|
|
284
|
+
let time = Date.now();
|
|
285
|
+
if (params.dwnUrl) {
|
|
286
|
+
for (let dwn of params.dwnUrl) {
|
|
287
|
+
dwn.id = dwn.id || `dwn-service-${time++}`;
|
|
288
|
+
params.servicesToAdd = params.servicesToAdd || new Array;
|
|
289
|
+
params.servicesToAdd.push({
|
|
290
|
+
id: dwn.id,
|
|
291
|
+
type: 'DecentralizedWebNode',
|
|
292
|
+
serviceEndpoint: {
|
|
293
|
+
nodes: typeof params.dwnUrl === 'string' ? [params.dwnUrl] : params.dwnUrl,
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
yield this.registry.updateDIDDocument({
|
|
299
|
+
did: params.did,
|
|
300
|
+
updatePublicKey: updateKey.jwk,
|
|
301
|
+
kms: this.kms,
|
|
302
|
+
documentMetadata: didDoc.didDocumentMetadata,
|
|
303
|
+
newUpdateKeys: [...(params.controllersToAdd || []), newUpdateKey.publicKeyJWK],
|
|
304
|
+
servicesToAdd: params.servicesToAdd,
|
|
305
|
+
idsOfServiceToRemove: params.idsOfServiceToRemove,
|
|
306
|
+
idsOfVerificationMethodsToRemove: params.idsOfVerificationMethodsToRemove,
|
|
307
|
+
updateKeysToRemove: params.updateKeysToRemove,
|
|
308
|
+
verificationMethodsToAdd: didCommKeys
|
|
309
|
+
.map((x) => ({
|
|
310
|
+
id: x.id,
|
|
311
|
+
publicKeyJwk: x.pbk.publicKeyJWK,
|
|
312
|
+
purpose: [new did_core_1.KeyAgreementPurpose()],
|
|
313
|
+
type: 'X25519KeyAgreementKey2019',
|
|
314
|
+
controller: this.getOperationalDID(),
|
|
315
|
+
}))
|
|
316
|
+
.concat(bbsbls2020Keys
|
|
317
|
+
.map((x) => ({
|
|
318
|
+
id: x.id,
|
|
319
|
+
publicKeyJwk: x.pbk.publicKeyJWK,
|
|
320
|
+
purpose: [new did_core_1.AssertionMethodPurpose()],
|
|
321
|
+
type: 'Bls12381G1Key2020',
|
|
322
|
+
controller: this.getOperationalDID(),
|
|
323
|
+
}))
|
|
324
|
+
.concat(rsaKeys.map((x) => ({
|
|
325
|
+
id: x.id,
|
|
326
|
+
publicKeyJwk: x.pbk.publicKeyJWK,
|
|
327
|
+
purpose: [new did_core_1.AuthenticationPurpose()],
|
|
328
|
+
type: 'RsaSignature2018',
|
|
329
|
+
controller: this.getOperationalDID(),
|
|
330
|
+
})))),
|
|
331
|
+
// verificationMethodsToAdd: didCommKeys
|
|
332
|
+
// .map((x) => ({
|
|
333
|
+
// id: x.id,
|
|
334
|
+
// publicKeyJwk: x.pbk.publicKeyJWK,
|
|
335
|
+
// purpose: [new KeyAgreementPurpose()],
|
|
336
|
+
// type: 'X25519KeyAgreementKey2019',
|
|
337
|
+
// controller: this.getOperationalDID(),
|
|
338
|
+
// }))
|
|
339
|
+
// .concat(
|
|
340
|
+
// bbsbls2020Keys
|
|
341
|
+
// .map((x) => ({
|
|
342
|
+
// id: x.id,
|
|
343
|
+
// publicKeyJwk: x.pbk.publicKeyJWK,
|
|
344
|
+
// purpose: [new AssertionMethodPurpose()],
|
|
345
|
+
// type: 'Bls12381G1Key2020',
|
|
346
|
+
// controller: this.getOperationalDID(),
|
|
347
|
+
// }))
|
|
348
|
+
// .concat(
|
|
349
|
+
// rsaKeys.map((x) => ({
|
|
350
|
+
// id: x.id,
|
|
351
|
+
// publicKeyJwk: x.pbk.publicKeyJWK,
|
|
352
|
+
// purpose: [new AuthenticationPurpose()],
|
|
353
|
+
// type: 'RsaSignature2018',
|
|
354
|
+
// controller: this.getOperationalDID(),
|
|
355
|
+
// }))
|
|
356
|
+
// )
|
|
357
|
+
// ),
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
exportKeys(params) {
|
|
362
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
363
|
+
const keys = yield this.kms.getAllPublicKeys();
|
|
364
|
+
const exportResult = yield params.exportBehavior.export({
|
|
365
|
+
dids: this._dids,
|
|
366
|
+
operationalDID: this.getOperationalDID().value,
|
|
367
|
+
keys: yield Promise.all(keys.map((x) => __awaiter(this, void 0, void 0, function* () {
|
|
368
|
+
return ({
|
|
369
|
+
publicKeyHex: kms_core_1.BaseConverter.convert(x, kms_core_1.Base.JWK, kms_core_1.Base.Hex, x.kty),
|
|
370
|
+
secret: yield this.kms.export(x),
|
|
371
|
+
});
|
|
372
|
+
}))),
|
|
373
|
+
});
|
|
374
|
+
return exportResult;
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
importKeys(params) {
|
|
378
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
379
|
+
const importResult = yield params.exportBehavior.import(params.exportResult);
|
|
380
|
+
if (importResult.dids.length == 0)
|
|
381
|
+
throw new Error('agent importKeys requires at least one did in exportResult');
|
|
382
|
+
yield Promise.all(importResult.keys.map((key) => __awaiter(this, void 0, void 0, function* () {
|
|
383
|
+
return this.kms.import({
|
|
384
|
+
publicKeyHex: key.publicKeyHex,
|
|
385
|
+
secret: key.secret,
|
|
386
|
+
});
|
|
387
|
+
})));
|
|
388
|
+
this._dids = importResult.dids;
|
|
389
|
+
yield this.agentStorage.add(AGENT_DID_KEY, this._dids);
|
|
390
|
+
yield this.setOperationalDID(did_1.DID.from(importResult.operationalDID || this._dids[0]));
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
exports.AgentIdentity = AgentIdentity;
|
|
395
|
+
//# sourceMappingURL=agent-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-identity.js","sourceRoot":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AAC,CAAO,GAAG,EAAE,EAAE;gBAClC,OAAA,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;oBACd,YAAY,EAAE,GAAG,CAAC,YAAY;oBAC9B,MAAM,EAAE,GAAG,CAAC,MAAM;iBACnB,CAAC,CAAA;cAAA,CACH,CACF,CAAC;YAEF,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC;YAE/B,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACvD,MAAM,IAAI,CAAC,iBAAiB,CAC1B,SAAG,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACvD,CAAC;QACJ,CAAC;KAAA;CACF;AAzfD,sCAyfC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentPublicKey = void 0;
|
|
4
|
+
class AgentPublicKey {
|
|
5
|
+
constructor(params) {
|
|
6
|
+
this.name = params.name;
|
|
7
|
+
this.description = params.description;
|
|
8
|
+
this.publicKeyJWK = params.publicKeyJWK;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.AgentPublicKey = AgentPublicKey;
|
|
12
|
+
//# sourceMappingURL=agent-pbk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-pbk.js","sourceRoot":"","sources":["../../src/models/agent-pbk.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAc;IAKvB,YAAY,MAIX;QACG,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;IAC5C,CAAC;CACJ;AAdD,wCAcC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { IJWK, IKMS } from "@extrimian/kms-core";
|
|
2
|
+
import { Did, ModenaUniversalRegistry } from "@extrimian/did-registry";
|
|
3
|
+
import { Purpose, Service } from "@extrimian/did-core";
|
|
4
|
+
import { DID } from "./did";
|
|
5
|
+
import { DIDDocumentMetadata } from "@extrimian/modena-sdk";
|
|
6
|
+
export declare abstract class IAgentRegistry {
|
|
7
|
+
protected kms: IKMS;
|
|
8
|
+
initialize(params: {
|
|
9
|
+
kms: IKMS;
|
|
10
|
+
}): void;
|
|
11
|
+
abstract createDID(createRequest: CreateDIDRequest): Promise<CreateDIDResponse>;
|
|
12
|
+
abstract updateDIDDocument(updateRequest: UpdateDIDRequest): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare abstract class IAgentSidetreeRegistry extends IAgentRegistry {
|
|
15
|
+
protected kms: IKMS;
|
|
16
|
+
initialize(params: {
|
|
17
|
+
kms: IKMS;
|
|
18
|
+
}): void;
|
|
19
|
+
abstract createDID(createRequest: CreateDIDRequest): Promise<CreateDIDSidetreeResponse>;
|
|
20
|
+
}
|
|
21
|
+
export interface CreateDIDRequest {
|
|
22
|
+
didMethod?: string;
|
|
23
|
+
updateKeys: IJWK[];
|
|
24
|
+
recoveryKeys: IJWK[];
|
|
25
|
+
verificationMethods: {
|
|
26
|
+
id: string;
|
|
27
|
+
type: string;
|
|
28
|
+
publicKeyJwk: IJWK;
|
|
29
|
+
purpose: Purpose[];
|
|
30
|
+
}[];
|
|
31
|
+
services?: Service[];
|
|
32
|
+
}
|
|
33
|
+
export interface UpdateDIDRequest {
|
|
34
|
+
did: DID;
|
|
35
|
+
updatePublicKey: IJWK;
|
|
36
|
+
kms: IKMS;
|
|
37
|
+
newUpdateKeys: IJWK[];
|
|
38
|
+
documentMetadata: DIDDocumentMetadata;
|
|
39
|
+
updateKeysToRemove?: {
|
|
40
|
+
publicKeys?: IJWK[];
|
|
41
|
+
updateCommitment?: string[];
|
|
42
|
+
};
|
|
43
|
+
verificationMethodsToAdd?: {
|
|
44
|
+
id: string;
|
|
45
|
+
type: string;
|
|
46
|
+
publicKeyJwk: IJWK;
|
|
47
|
+
purpose: Purpose[];
|
|
48
|
+
}[];
|
|
49
|
+
idsOfVerificationMethodsToRemove?: string[];
|
|
50
|
+
servicesToAdd?: ServiceDefinition[];
|
|
51
|
+
idsOfServiceToRemove?: string[];
|
|
52
|
+
}
|
|
53
|
+
export interface CreateDIDResponse {
|
|
54
|
+
did: string;
|
|
55
|
+
}
|
|
56
|
+
export interface CreateDIDSidetreeResponse extends CreateDIDResponse {
|
|
57
|
+
longDid: string;
|
|
58
|
+
}
|
|
59
|
+
export interface KeyDefinition {
|
|
60
|
+
id: string;
|
|
61
|
+
vmKey: VMKey;
|
|
62
|
+
}
|
|
63
|
+
export declare enum VMKey {
|
|
64
|
+
DIDComm = 0,
|
|
65
|
+
VC = 1,
|
|
66
|
+
RSA = 2
|
|
67
|
+
}
|
|
68
|
+
export interface ServiceDefinition {
|
|
69
|
+
id: string;
|
|
70
|
+
type: string;
|
|
71
|
+
serviceEndpoint: string | string[] | Record<string, string | string[]>;
|
|
72
|
+
}
|
|
73
|
+
export declare class AgentModenaUniversalRegistry extends IAgentSidetreeRegistry {
|
|
74
|
+
private modenaEndpointURL;
|
|
75
|
+
_defaultDidMethod: string;
|
|
76
|
+
didService: ModenaUniversalRegistry;
|
|
77
|
+
constructor(modenaEndpointURL: string, defaultDidMethod?: string);
|
|
78
|
+
setDefaultDIDMethod(didMethod: string): void;
|
|
79
|
+
getSupportedDidMethods(): Promise<string[]>;
|
|
80
|
+
createDID(createRequest: CreateDIDRequest): Promise<CreateDIDSidetreeResponse>;
|
|
81
|
+
updateDIDDocument(request: UpdateDIDRequest): Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
export declare class AgentModenaRegistry extends IAgentSidetreeRegistry {
|
|
84
|
+
private modenaEndpointURL;
|
|
85
|
+
private didMethod?;
|
|
86
|
+
didService: Did;
|
|
87
|
+
constructor(modenaEndpointURL: string, didMethod?: string);
|
|
88
|
+
createDID(createRequest: CreateDIDRequest): Promise<CreateDIDSidetreeResponse>;
|
|
89
|
+
updateDIDDocument(request: UpdateDIDRequest): Promise<void>;
|
|
90
|
+
}
|