@dxos/echo-db 2.33.2 → 2.33.3-dev.0cff904f
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/src/echo.js +2 -2
- package/dist/src/echo.js.map +1 -1
- package/dist/src/echo.test.js +10 -10
- package/dist/src/echo.test.js.map +1 -1
- package/dist/src/halo/halo.d.ts +1 -0
- package/dist/src/halo/halo.d.ts.map +1 -1
- package/dist/src/halo/halo.js +10 -1
- package/dist/src/halo/halo.js.map +1 -1
- package/dist/src/halo/identity-manager.d.ts +0 -1
- package/dist/src/halo/identity-manager.d.ts.map +1 -1
- package/dist/src/halo/identity-manager.js +11 -11
- package/dist/src/halo/identity-manager.js.map +1 -1
- package/dist/src/halo/identity.d.ts +18 -13
- package/dist/src/halo/identity.d.ts.map +1 -1
- package/dist/src/halo/identity.js +24 -27
- package/dist/src/halo/identity.js.map +1 -1
- package/dist/src/invitations/offline-invitation-claimer.d.ts +2 -2
- package/dist/src/invitations/offline-invitation-claimer.d.ts.map +1 -1
- package/dist/src/invitations/offline-invitation-claimer.js +2 -4
- package/dist/src/invitations/offline-invitation-claimer.js.map +1 -1
- package/dist/src/parties/party-factory.d.ts +2 -2
- package/dist/src/parties/party-factory.d.ts.map +1 -1
- package/dist/src/parties/party-factory.js +11 -20
- package/dist/src/parties/party-factory.js.map +1 -1
- package/dist/src/parties/party-manager.d.ts +2 -2
- package/dist/src/parties/party-manager.d.ts.map +1 -1
- package/dist/src/parties/party-manager.js +2 -1
- package/dist/src/parties/party-manager.js.map +1 -1
- package/dist/src/parties/party-manager.test.js +7 -22
- package/dist/src/parties/party-manager.test.js.map +1 -1
- package/dist/src/protocol/credentials-signer.d.ts +4 -4
- package/dist/src/protocol/credentials-signer.d.ts.map +1 -1
- package/dist/src/protocol/credentials-signer.js +8 -8
- package/dist/src/protocol/credentials-signer.js.map +1 -1
- package/dist/src/protocol/identity-credentials.d.ts +21 -0
- package/dist/src/protocol/identity-credentials.d.ts.map +1 -0
- package/dist/src/protocol/identity-credentials.js +35 -0
- package/dist/src/protocol/identity-credentials.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -17
- package/src/echo.test.ts +10 -10
- package/src/echo.ts +1 -1
- package/src/halo/halo.ts +8 -1
- package/src/halo/identity-manager.ts +13 -14
- package/src/halo/identity.ts +39 -41
- package/src/invitations/offline-invitation-claimer.ts +6 -7
- package/src/parties/party-factory.ts +13 -20
- package/src/parties/party-manager.test.ts +8 -42
- package/src/parties/party-manager.ts +4 -3
- package/src/protocol/credentials-signer.ts +9 -9
- package/src/protocol/identity-credentials.ts +56 -0
|
@@ -19,17 +19,17 @@ export class CredentialsSigner {
|
|
|
19
19
|
|
|
20
20
|
return new CredentialsSigner(
|
|
21
21
|
keyring,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
identityKey,
|
|
23
|
+
deviceKey,
|
|
24
|
+
deviceKey
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
constructor (
|
|
29
29
|
private readonly _signer: Signer,
|
|
30
|
-
private readonly
|
|
31
|
-
private readonly
|
|
32
|
-
private readonly
|
|
30
|
+
private readonly _identityKey: KeyRecord,
|
|
31
|
+
private readonly _deviceKey: KeyRecord,
|
|
32
|
+
private readonly _signingKeys: KeyRecord | KeyChain
|
|
33
33
|
) {}
|
|
34
34
|
|
|
35
35
|
get signer (): Signer {
|
|
@@ -37,11 +37,11 @@ export class CredentialsSigner {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
getIdentityKey (): KeyRecord {
|
|
40
|
-
return this.
|
|
40
|
+
return this._identityKey;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
getDeviceKey (): KeyRecord {
|
|
44
|
-
return this.
|
|
44
|
+
return this._deviceKey;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -55,6 +55,6 @@ export class CredentialsSigner {
|
|
|
55
55
|
* Devices need to sign with their keyChain including the device key admission credential in the signature.
|
|
56
56
|
*/
|
|
57
57
|
getDeviceSigningKeys (): KeyRecord | KeyChain {
|
|
58
|
-
return this.
|
|
58
|
+
return this._signingKeys;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { createIdentityInfoMessage, createKeyAdmitMessage, createPartyGenesisMessage, KeyChain, KeyRecord, Keyring, KeyType, SignedMessage } from '@dxos/credentials';
|
|
6
|
+
|
|
7
|
+
import { ContactManager, Preferences } from '../halo';
|
|
8
|
+
import { CredentialsSigner } from './credentials-signer';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Provides access to identity credentials without revealing the underlying mechanism (HALO party).
|
|
12
|
+
*/
|
|
13
|
+
export interface IdentityCredentials {
|
|
14
|
+
keyring: Keyring
|
|
15
|
+
identityKey: KeyRecord
|
|
16
|
+
deviceKey: KeyRecord
|
|
17
|
+
deviceKeyChain: KeyChain
|
|
18
|
+
identityGenesis: SignedMessage
|
|
19
|
+
identityInfo: SignedMessage | undefined
|
|
20
|
+
displayName: string | undefined
|
|
21
|
+
createCredentialsSigner(): CredentialsSigner
|
|
22
|
+
preferences: Preferences | undefined
|
|
23
|
+
contacts: ContactManager | undefined
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type IdentityCredentialsProvider = () => IdentityCredentials | undefined
|
|
27
|
+
|
|
28
|
+
export async function createTestIdentityCredentials (keyring: Keyring): Promise<IdentityCredentials> {
|
|
29
|
+
const identityKey = await keyring.createKeyRecord({ type: KeyType.IDENTITY });
|
|
30
|
+
const deviceKey = await keyring.createKeyRecord({ type: KeyType.DEVICE });
|
|
31
|
+
const feedKey = await keyring.createKeyRecord({ type: KeyType.FEED });
|
|
32
|
+
|
|
33
|
+
const partyGenesis = createPartyGenesisMessage(keyring, identityKey, feedKey.publicKey, deviceKey);
|
|
34
|
+
const keyAdmit = createKeyAdmitMessage(keyring, identityKey.publicKey, identityKey);
|
|
35
|
+
|
|
36
|
+
const messageMap = new Map();
|
|
37
|
+
messageMap.set(deviceKey.publicKey.toHex(), partyGenesis);
|
|
38
|
+
messageMap.set(identityKey.publicKey.toHex(), keyAdmit);
|
|
39
|
+
const deviceKeyChain = Keyring.buildKeyChain(deviceKey.publicKey, messageMap, [feedKey.publicKey]);
|
|
40
|
+
|
|
41
|
+
const displayName = identityKey.publicKey.humanize();
|
|
42
|
+
const identityInfo = createIdentityInfoMessage(keyring, displayName, identityKey);
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
keyring,
|
|
46
|
+
identityKey,
|
|
47
|
+
deviceKey,
|
|
48
|
+
deviceKeyChain,
|
|
49
|
+
identityGenesis: keyAdmit.payload as SignedMessage,
|
|
50
|
+
identityInfo: identityInfo.payload as SignedMessage,
|
|
51
|
+
displayName,
|
|
52
|
+
createCredentialsSigner: () => new CredentialsSigner(keyring, identityKey, deviceKey, deviceKeyChain),
|
|
53
|
+
preferences: undefined,
|
|
54
|
+
contacts: undefined
|
|
55
|
+
};
|
|
56
|
+
}
|