@dxos/credentials 2.28.2-dev.8a42e72c → 2.28.2-dev.c4856dba
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/.rush/temp/package-deps_build.json +13 -13
- package/.rush/temp/package-deps_build:test.json +13 -13
- package/.rush/temp/package-deps_prerelease.json +13 -13
- package/dist/src/auth/auth-plugin.js +1 -1
- package/dist/src/auth/auth-plugin.js.map +1 -1
- package/dist/src/auth/auth-plugin.test.js +1 -1
- package/dist/src/auth/auth-plugin.test.js.map +1 -1
- package/dist/src/auth/authenticator.d.ts +0 -5
- package/dist/src/auth/authenticator.d.ts.map +1 -1
- package/dist/src/auth/authenticator.js +10 -17
- package/dist/src/auth/authenticator.js.map +1 -1
- package/dist/src/greet/greeter-plugin.test.js +1 -1
- package/dist/src/greet/greeter-plugin.test.js.map +1 -1
- package/dist/src/greet/greeter.js +1 -1
- package/dist/src/greet/greeter.js.map +1 -1
- package/dist/src/greet/greeting-command-plugin.js +1 -1
- package/dist/src/greet/greeting-command-plugin.js.map +1 -1
- package/dist/src/greet/party-invitation-claim-handler.js +1 -1
- package/dist/src/greet/party-invitation-claim-handler.js.map +1 -1
- package/dist/src/identity/identity-message-processor.js +1 -1
- package/dist/src/identity/identity-message-processor.js.map +1 -1
- package/dist/src/keys/keystore.js +1 -1
- package/dist/src/keys/keystore.js.map +1 -1
- package/dist/src/party/party-invitation-manager.js +1 -1
- package/dist/src/party/party-invitation-manager.js.map +1 -1
- package/dist/src/party/party-invitations.test.js +1 -1
- package/dist/src/party/party-invitations.test.js.map +1 -1
- package/dist/src/party/party-state.js +1 -1
- package/dist/src/party/party-state.js.map +1 -1
- package/dist/src/party/party-state.test.js +1 -1
- package/dist/src/party/party-state.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/src/auth/auth-plugin.test.ts +1 -1
- package/src/auth/auth-plugin.ts +1 -1
- package/src/auth/authenticator.ts +11 -17
- package/src/greet/greeter-plugin.test.ts +1 -1
- package/src/greet/greeter.ts +1 -1
- package/src/greet/greeting-command-plugin.ts +1 -1
- package/src/greet/party-invitation-claim-handler.ts +1 -1
- package/src/identity/identity-message-processor.ts +1 -1
- package/src/keys/keystore.ts +1 -1
- package/src/party/party-invitation-manager.ts +1 -1
- package/src/party/party-invitations.test.js +1 -1
- package/src/party/party-state.test.js +1 -1
- package/src/party/party-state.ts +1 -1
|
@@ -12,7 +12,7 @@ import { Keyring } from '../keys';
|
|
|
12
12
|
import { isSignedMessage, PartyState } from '../party';
|
|
13
13
|
import { codec, KeyType, Message } from '../proto';
|
|
14
14
|
|
|
15
|
-
const log = debug('dxos:
|
|
15
|
+
const log = debug('dxos:halo:auth');
|
|
16
16
|
|
|
17
17
|
const MAX_AGE = 24 * 60 * 60; // One day.
|
|
18
18
|
|
|
@@ -20,23 +20,17 @@ const MAX_AGE = 24 * 60 * 60; // One day.
|
|
|
20
20
|
* Abstract base class for Authenticators.
|
|
21
21
|
* Used by AuthPlugin for authenticating nodes during handshake.
|
|
22
22
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*/
|
|
23
|
+
// TODO(telackey): Explain here the intention behind the abstract base class:
|
|
24
|
+
// E.g., to have different authentication methods (besides the current PartyAuthenticator) for replication auth,
|
|
25
|
+
// or to use this base class everywhere auth is done in the project (not used in greeting at present, for example)?
|
|
27
26
|
export abstract class Authenticator {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @param {Message} credentials
|
|
33
|
-
*/
|
|
27
|
+
// TODO(dboreham): The following static methods:
|
|
28
|
+
// temporary work around move encapsualtion breaking code from `data-client/partitions.js`.
|
|
29
|
+
|
|
34
30
|
static encodePayload (credentials: Message) {
|
|
35
31
|
return codec.encode(credentials);
|
|
36
32
|
}
|
|
37
33
|
|
|
38
|
-
/**
|
|
39
|
-
*/
|
|
40
34
|
static decodePayload (credentials: Buffer) {
|
|
41
35
|
return codec.decode(credentials);
|
|
42
36
|
}
|
|
@@ -74,9 +68,8 @@ export class PartyAuthenticator extends Authenticator {
|
|
|
74
68
|
* @param credentials
|
|
75
69
|
* @returns {boolean} true if authenticated, else false
|
|
76
70
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
*/
|
|
71
|
+
// TODO(dboreham): Verify that credentials is a message of type `dxos.credentials.SignedMessage`
|
|
72
|
+
// signing a message of type `dxos.credentials.auth.Auth`.
|
|
80
73
|
override async authenticate (credentials: any) {
|
|
81
74
|
if (!credentials || !isSignedMessage(credentials)) {
|
|
82
75
|
log('Bad credentials:', credentials);
|
|
@@ -90,7 +83,8 @@ export class PartyAuthenticator extends Authenticator {
|
|
|
90
83
|
return false;
|
|
91
84
|
}
|
|
92
85
|
|
|
93
|
-
/*
|
|
86
|
+
/*
|
|
87
|
+
* TODO(telackey): This is not how it should be done. We would rather use the remote
|
|
94
88
|
* nonce for anti-replay, but we will need to add hooks for retrieving it and signing it
|
|
95
89
|
* between connect() and handshake() to do that. In the meantime, not allowing infinite replay
|
|
96
90
|
* is at least something.
|
|
@@ -18,7 +18,7 @@ import { Greeter } from './greeter';
|
|
|
18
18
|
import { GreetingCommandPlugin } from './greeting-command-plugin';
|
|
19
19
|
import { SecretProvider, SecretValidator } from './invitation';
|
|
20
20
|
|
|
21
|
-
const log = debug('dxos:
|
|
21
|
+
const log = debug('dxos:halo:greet');
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Create the Greeter with Plugin and Protocol.
|
package/src/greet/greeter.ts
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
import { GreetingCommandPlugin } from './greeting-command-plugin';
|
|
26
26
|
import { Invitation, InvitationOnFinish, SecretProvider, SecretValidator } from './invitation';
|
|
27
27
|
|
|
28
|
-
const log = debug('dxos:
|
|
28
|
+
const log = debug('dxos:halo:greet');
|
|
29
29
|
|
|
30
30
|
export type PartyWriter = (params: Message[]) => Promise<Message[]>;
|
|
31
31
|
export type HintProvider = (params: Message[]) => Promise<KeyHint[]>;
|
|
@@ -20,7 +20,7 @@ import { codec, Command } from '../proto';
|
|
|
20
20
|
import { PeerId } from '../typedefs';
|
|
21
21
|
import { ERR_GREET_GENERAL } from './error-codes';
|
|
22
22
|
|
|
23
|
-
const log = debug('dxos:
|
|
23
|
+
const log = debug('dxos:halo:greet:plugin'); // eslint-disable-line unused-imports/no-unused-vars
|
|
24
24
|
|
|
25
25
|
const DEFAULT_TIMEOUT = 30000;
|
|
26
26
|
|
|
@@ -12,7 +12,7 @@ import { ERR_GREET_GENERAL, ERR_GREET_INVALID_COMMAND, ERR_GREET_INVALID_INVITAT
|
|
|
12
12
|
import { GreetingCommandPlugin } from './greeting-command-plugin';
|
|
13
13
|
import { createGreetingClaimResponse } from './greeting-message';
|
|
14
14
|
|
|
15
|
-
const log = debug('dxos:
|
|
15
|
+
const log = debug('dxos:halo:greet:claim');
|
|
16
16
|
|
|
17
17
|
export type PartyInvitationGreetingHandler = (invitationID: Buffer, remotePeerId: Buffer, peerId: Buffer) => Promise<any>;
|
|
18
18
|
|
|
@@ -13,7 +13,7 @@ import { Keyring, assertValidPublicKey } from '../keys';
|
|
|
13
13
|
import { PartyState, isEnvelope, isSignedMessage } from '../party';
|
|
14
14
|
import { SignedMessage } from '../proto';
|
|
15
15
|
|
|
16
|
-
const log = debug('dxos:
|
|
16
|
+
const log = debug('dxos:halo:party');
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Process and manage IdentityInfo, DeviceInfo, and other "identity" Party messages.
|
package/src/keys/keystore.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { PublicKey } from '@dxos/crypto';
|
|
|
14
14
|
|
|
15
15
|
import { KeyRecord } from '../proto';
|
|
16
16
|
|
|
17
|
-
const log = debug('dxos:
|
|
17
|
+
const log = debug('dxos:halo:keys:keystore'); // eslint-disable-line unused-imports/no-unused-vars
|
|
18
18
|
|
|
19
19
|
const marshaller = {
|
|
20
20
|
marshall (record: KeyRecord) {
|
|
@@ -11,7 +11,7 @@ import { KeyRecord, SignedMessage } from '../proto';
|
|
|
11
11
|
import { PartyEventType } from './events';
|
|
12
12
|
import { PartyState } from './party-state';
|
|
13
13
|
|
|
14
|
-
const log = debug('dxos:
|
|
14
|
+
const log = debug('dxos:halo:party');
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* A class to manage the lifecycle of invitations which are written to the Party.
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import { PartyState } from './party-state';
|
|
21
21
|
|
|
22
22
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
23
|
-
const log = debug('dxos:
|
|
23
|
+
const log = debug('dxos:halo:party:test');
|
|
24
24
|
|
|
25
25
|
const createPartyKeyrings = async () => {
|
|
26
26
|
// This Keyring has all the keypairs, so it is the initial source of things.
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import { PartyState } from './party-state';
|
|
22
22
|
|
|
23
23
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
24
|
-
const log = debug('dxos:
|
|
24
|
+
const log = debug('dxos:halo:party:test');
|
|
25
25
|
|
|
26
26
|
const createPartyKeyrings = async () => {
|
|
27
27
|
// This Keyring has all the keypairs, so it is the initial source of things.
|
package/src/party/party-state.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { PartyEventType } from './events';
|
|
|
15
15
|
import { isEnvelope, isPartyInvitationMessage, isSignedMessage } from './party-credential';
|
|
16
16
|
import { PartyInvitationManager } from './party-invitation-manager';
|
|
17
17
|
|
|
18
|
-
const log = debug('dxos:
|
|
18
|
+
const log = debug('dxos:halo:party');
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* The party state is constructed via signed messages on the feeds.
|