@astrale-os/kernel-core 0.9.0-beta.39 → 0.9.0-beta.40
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/auth/index.d.ts +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/auth/jwk/index.d.ts +1 -1
- package/dist/auth/jwk/index.js +1 -1
- package/dist/auth/jwk/thumbprint.d.ts +2 -0
- package/dist/auth/jwk/thumbprint.js +12 -6
- package/dist/auth/register/fingerprint/fingerprint.d.ts +25 -0
- package/dist/auth/register/fingerprint/fingerprint.js +31 -0
- package/dist/auth/register/fingerprint/index.d.ts +2 -0
- package/dist/auth/register/index.d.ts +5 -0
- package/dist/auth/register/request/admission.d.ts +3 -0
- package/dist/auth/register/request/admission.js +103 -0
- package/dist/auth/register/request/index.d.ts +3 -0
- package/dist/auth/register/request/limits.d.ts +6 -0
- package/dist/auth/register/request/limits.js +6 -0
- package/dist/auth/register/request/request.d.ts +19 -0
- package/dist/auth/{provision → register}/request/self-issuer.d.ts +1 -1
- package/dist/auth/{provision → register}/request/self-issuer.js +1 -1
- package/dist/auth/register/result/index.d.ts +1 -0
- package/dist/auth/register/result/result.d.ts +10 -0
- package/dist/schema/kernel/projection/project.js +4 -4
- package/dist/schema/kernel/schema.d.ts +40 -534
- package/dist/schema/kernel/schema.js +1 -1
- package/dist/schema/kernel/syscalls/contracts/index.d.ts +1 -1
- package/dist/schema/kernel/syscalls/contracts/index.js +1 -1
- package/dist/schema/kernel/syscalls/contracts/register.d.ts +20 -0
- package/dist/schema/kernel/syscalls/contracts/register.js +24 -0
- package/dist/schema/kernel/syscalls/declarations/index.d.ts +10 -257
- package/dist/schema/kernel/syscalls/declarations/index.js +2 -2
- package/dist/schema/kernel/syscalls/declarations/register.d.ts +23 -0
- package/dist/schema/kernel/syscalls/declarations/register.js +8 -0
- package/dist/schema/kernel/syscalls/descriptors/functions.d.ts +1 -1
- package/dist/schema/kernel/syscalls/descriptors/functions.js +1 -1
- package/dist/schema/kernel/syscalls/descriptors/index.d.ts +1 -1
- package/dist/schema/kernel/syscalls/descriptors/index.js +1 -1
- package/dist/schema/kernel/syscalls/index.d.ts +1 -1
- package/dist/schema/kernel/syscalls/index.js +1 -1
- package/dist/schema/kernel/syscalls/references/functions.d.ts +2 -2
- package/dist/schema/kernel/syscalls/references/functions.js +1 -1
- package/dist/schema/kernel/syscalls/references/index.d.ts +1 -1
- package/dist/schema/kernel/syscalls/references/index.js +1 -1
- package/package.json +1 -1
- package/dist/auth/provision/fingerprint/fingerprint.d.ts +0 -9
- package/dist/auth/provision/fingerprint/fingerprint.js +0 -30
- package/dist/auth/provision/fingerprint/index.d.ts +0 -2
- package/dist/auth/provision/index.d.ts +0 -5
- package/dist/auth/provision/request/admission.d.ts +0 -3
- package/dist/auth/provision/request/admission.js +0 -197
- package/dist/auth/provision/request/index.d.ts +0 -3
- package/dist/auth/provision/request/request.d.ts +0 -35
- package/dist/auth/provision/result/index.d.ts +0 -1
- package/dist/auth/provision/result/result.d.ts +0 -19
- package/dist/schema/kernel/syscalls/contracts/provision.d.ts +0 -301
- package/dist/schema/kernel/syscalls/contracts/provision.js +0 -28
- package/dist/schema/kernel/syscalls/declarations/provision.d.ts +0 -270
- package/dist/schema/kernel/syscalls/declarations/provision.js +0 -8
- /package/dist/auth/{provision → register}/fingerprint/index.js +0 -0
- /package/dist/auth/{provision → register}/index.js +0 -0
- /package/dist/auth/{provision → register}/request/index.js +0 -0
- /package/dist/auth/{provision → register}/request/request.js +0 -0
- /package/dist/auth/{provision → register}/result/index.js +0 -0
- /package/dist/auth/{provision → register}/result/result.js +0 -0
|
@@ -448,273 +448,26 @@ export declare const Functions: Readonly<{
|
|
|
448
448
|
createdNodes: Record<string, string>;
|
|
449
449
|
};
|
|
450
450
|
}, "authorized", false, "default">>;
|
|
451
|
-
|
|
451
|
+
register: builder.Function<builder.CallableProjection<{
|
|
452
452
|
idempotencyKey: string;
|
|
453
|
-
mutation?: {
|
|
454
|
-
format: "astrale.graph.mutation";
|
|
455
|
-
version: "v3";
|
|
456
|
-
preconditions: ({
|
|
457
|
-
kind: "node";
|
|
458
|
-
node: string;
|
|
459
|
-
class: string;
|
|
460
|
-
props?: {
|
|
461
|
-
equals: Record<string, unknown>;
|
|
462
|
-
absent?: string[] | undefined;
|
|
463
|
-
} | {
|
|
464
|
-
absent: string[];
|
|
465
|
-
} | undefined;
|
|
466
|
-
} | {
|
|
467
|
-
kind: "edge";
|
|
468
|
-
edge: {
|
|
469
|
-
source: string;
|
|
470
|
-
target: string;
|
|
471
|
-
class: string;
|
|
472
|
-
};
|
|
473
|
-
slug?: unknown;
|
|
474
|
-
props?: {
|
|
475
|
-
equals: Record<string, unknown>;
|
|
476
|
-
absent?: string[] | undefined;
|
|
477
|
-
} | {
|
|
478
|
-
absent: string[];
|
|
479
|
-
} | undefined;
|
|
480
|
-
} | {
|
|
481
|
-
kind: "query";
|
|
482
|
-
query: {
|
|
483
|
-
format: "astrale.graph.query";
|
|
484
|
-
version: "v6";
|
|
485
|
-
source: {
|
|
486
|
-
kind: "node";
|
|
487
|
-
terms: ({
|
|
488
|
-
kind: "path";
|
|
489
|
-
path: string;
|
|
490
|
-
} | {
|
|
491
|
-
kind: "class";
|
|
492
|
-
class: {
|
|
493
|
-
origin: string;
|
|
494
|
-
kind: "class";
|
|
495
|
-
name: string;
|
|
496
|
-
};
|
|
497
|
-
})[];
|
|
498
|
-
binding: string;
|
|
499
|
-
} | {
|
|
500
|
-
kind: "edge";
|
|
501
|
-
terms: {
|
|
502
|
-
kind: "class";
|
|
503
|
-
class: {
|
|
504
|
-
origin: string;
|
|
505
|
-
kind: "class";
|
|
506
|
-
name: string;
|
|
507
|
-
};
|
|
508
|
-
}[];
|
|
509
|
-
bindings: {
|
|
510
|
-
source: string;
|
|
511
|
-
edge: string;
|
|
512
|
-
target: string;
|
|
513
|
-
};
|
|
514
|
-
};
|
|
515
|
-
steps: ({
|
|
516
|
-
op: "filter";
|
|
517
|
-
binding: string;
|
|
518
|
-
predicate: {
|
|
519
|
-
kind: "class.satisfies";
|
|
520
|
-
class: {
|
|
521
|
-
origin: string;
|
|
522
|
-
kind: "class";
|
|
523
|
-
name: string;
|
|
524
|
-
};
|
|
525
|
-
} | {
|
|
526
|
-
kind: "class.equal";
|
|
527
|
-
class: {
|
|
528
|
-
origin: string;
|
|
529
|
-
kind: "class";
|
|
530
|
-
name: string;
|
|
531
|
-
};
|
|
532
|
-
} | {
|
|
533
|
-
kind: "property.equal";
|
|
534
|
-
property: string;
|
|
535
|
-
value: unknown;
|
|
536
|
-
} | {
|
|
537
|
-
kind: "property.present";
|
|
538
|
-
property: string;
|
|
539
|
-
} | {
|
|
540
|
-
kind: "identity.equal";
|
|
541
|
-
identity: string | {
|
|
542
|
-
source: string;
|
|
543
|
-
target: string;
|
|
544
|
-
class: string;
|
|
545
|
-
};
|
|
546
|
-
};
|
|
547
|
-
} | {
|
|
548
|
-
op: "expand";
|
|
549
|
-
from: string;
|
|
550
|
-
via: {
|
|
551
|
-
origin: string;
|
|
552
|
-
kind: "class";
|
|
553
|
-
name: string;
|
|
554
|
-
}[];
|
|
555
|
-
direction: "incident" | "incoming" | "outgoing";
|
|
556
|
-
bindings: {
|
|
557
|
-
edge: string;
|
|
558
|
-
node: string;
|
|
559
|
-
};
|
|
560
|
-
})[];
|
|
561
|
-
select: {
|
|
562
|
-
kind: "graph";
|
|
563
|
-
binding: string;
|
|
564
|
-
order?: {
|
|
565
|
-
property: string;
|
|
566
|
-
direction: "asc" | "desc";
|
|
567
|
-
unranked: "first" | "last";
|
|
568
|
-
} | undefined;
|
|
569
|
-
} | {
|
|
570
|
-
kind: "nodes";
|
|
571
|
-
binding: string;
|
|
572
|
-
projection: {
|
|
573
|
-
kind: "reference" | "value";
|
|
574
|
-
};
|
|
575
|
-
order?: {
|
|
576
|
-
property: string;
|
|
577
|
-
direction: "asc" | "desc";
|
|
578
|
-
unranked: "first" | "last";
|
|
579
|
-
} | undefined;
|
|
580
|
-
} | {
|
|
581
|
-
kind: "edges";
|
|
582
|
-
binding: string;
|
|
583
|
-
projection: {
|
|
584
|
-
edge: "reference" | "value";
|
|
585
|
-
source: "reference" | "value";
|
|
586
|
-
target: "reference" | "value";
|
|
587
|
-
};
|
|
588
|
-
order?: {
|
|
589
|
-
property: string;
|
|
590
|
-
direction: "asc" | "desc";
|
|
591
|
-
unranked: "first" | "last";
|
|
592
|
-
} | undefined;
|
|
593
|
-
};
|
|
594
|
-
};
|
|
595
|
-
equals: {
|
|
596
|
-
kind: "node";
|
|
597
|
-
ids: string[];
|
|
598
|
-
} | {
|
|
599
|
-
kind: "edge";
|
|
600
|
-
keys: {
|
|
601
|
-
source: string;
|
|
602
|
-
target: string;
|
|
603
|
-
class: string;
|
|
604
|
-
}[];
|
|
605
|
-
};
|
|
606
|
-
})[];
|
|
607
|
-
operations: ({
|
|
608
|
-
op: "node.create";
|
|
609
|
-
as: string;
|
|
610
|
-
class: string;
|
|
611
|
-
props: Record<string, unknown>;
|
|
612
|
-
} | {
|
|
613
|
-
op: "node.update";
|
|
614
|
-
node: string;
|
|
615
|
-
class: string;
|
|
616
|
-
props: {
|
|
617
|
-
set: Record<string, unknown>;
|
|
618
|
-
unset: string[];
|
|
619
|
-
};
|
|
620
|
-
} | {
|
|
621
|
-
op: "node.delete";
|
|
622
|
-
node: string;
|
|
623
|
-
class: string;
|
|
624
|
-
} | {
|
|
625
|
-
op: "edge.create";
|
|
626
|
-
class: string;
|
|
627
|
-
source: string | {
|
|
628
|
-
created: string;
|
|
629
|
-
};
|
|
630
|
-
target: string | {
|
|
631
|
-
created: string;
|
|
632
|
-
};
|
|
633
|
-
slug?: unknown;
|
|
634
|
-
props: Record<string, unknown>;
|
|
635
|
-
} | {
|
|
636
|
-
op: "edge.update";
|
|
637
|
-
edge: {
|
|
638
|
-
source: string;
|
|
639
|
-
target: string;
|
|
640
|
-
class: string;
|
|
641
|
-
};
|
|
642
|
-
slug: unknown;
|
|
643
|
-
props?: {
|
|
644
|
-
set: Record<string, unknown>;
|
|
645
|
-
unset: string[];
|
|
646
|
-
} | undefined;
|
|
647
|
-
} | {
|
|
648
|
-
op: "edge.update";
|
|
649
|
-
edge: {
|
|
650
|
-
source: string;
|
|
651
|
-
target: string;
|
|
652
|
-
class: string;
|
|
653
|
-
};
|
|
654
|
-
props: {
|
|
655
|
-
set: Record<string, unknown>;
|
|
656
|
-
unset: string[];
|
|
657
|
-
};
|
|
658
|
-
} | {
|
|
659
|
-
op: "edge.delete";
|
|
660
|
-
edge: {
|
|
661
|
-
source: string;
|
|
662
|
-
target: string;
|
|
663
|
-
class: string;
|
|
664
|
-
};
|
|
665
|
-
})[];
|
|
666
|
-
} | undefined;
|
|
667
453
|
identities: ({
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
authentication?: {
|
|
672
|
-
iss: string;
|
|
673
|
-
sub: string;
|
|
674
|
-
} | {
|
|
675
|
-
credentials: {
|
|
676
|
-
publicKey: unknown;
|
|
677
|
-
proof: string;
|
|
678
|
-
};
|
|
679
|
-
} | undefined;
|
|
680
|
-
requiredClaims?: ({
|
|
681
|
-
claim: string;
|
|
682
|
-
op: "contains";
|
|
683
|
-
value: unknown;
|
|
684
|
-
} | {
|
|
685
|
-
claim: string;
|
|
686
|
-
op: "eq";
|
|
687
|
-
value: unknown;
|
|
688
|
-
} | {
|
|
689
|
-
claim: string;
|
|
690
|
-
op: "exists";
|
|
691
|
-
})[] | undefined;
|
|
454
|
+
id: string;
|
|
455
|
+
mode: "external";
|
|
456
|
+
credential: string;
|
|
692
457
|
} | {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
authentication: {
|
|
698
|
-
iss: string;
|
|
699
|
-
sub: string;
|
|
700
|
-
} | {
|
|
701
|
-
credentials: {
|
|
702
|
-
publicKey: unknown;
|
|
703
|
-
proof: string;
|
|
704
|
-
};
|
|
705
|
-
};
|
|
458
|
+
id: string;
|
|
459
|
+
mode: "self";
|
|
460
|
+
publicKey: unknown;
|
|
461
|
+
credential: string;
|
|
706
462
|
})[];
|
|
707
463
|
}, {
|
|
708
464
|
readonly mode: 'value';
|
|
709
465
|
readonly value: {
|
|
710
|
-
|
|
711
|
-
identities: ({
|
|
712
|
-
id: string;
|
|
713
|
-
} | {
|
|
466
|
+
identities: {
|
|
714
467
|
id: string;
|
|
715
468
|
iss: string;
|
|
716
469
|
sub: string;
|
|
717
|
-
}
|
|
470
|
+
}[];
|
|
718
471
|
};
|
|
719
472
|
}, "authorized", false, "default">>;
|
|
720
473
|
install: builder.Function<builder.CallableProjection<{
|
|
@@ -6,8 +6,8 @@ import { Introspect } from './introspect.js';
|
|
|
6
6
|
import { Journal } from './journal.js';
|
|
7
7
|
import { Mint } from './mint.js';
|
|
8
8
|
import { Mutate } from './mutate.js';
|
|
9
|
-
import { Provision } from './provision.js';
|
|
10
9
|
import { Query } from './query.js';
|
|
10
|
+
import { Register } from './register.js';
|
|
11
11
|
import { Uninstall } from './uninstall.js';
|
|
12
12
|
import { ViewResolve } from './view-resolve.js';
|
|
13
13
|
import { Whoami } from './whoami.js';
|
|
@@ -15,7 +15,7 @@ import { Whois } from './whois.js';
|
|
|
15
15
|
export const Functions = Object.freeze({
|
|
16
16
|
query: Query,
|
|
17
17
|
mutate: Mutate,
|
|
18
|
-
|
|
18
|
+
register: Register,
|
|
19
19
|
install: Install,
|
|
20
20
|
introspect: Introspect,
|
|
21
21
|
uninstall: Uninstall,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type builder } from '@astrale-os/kernel-dsl/v1';
|
|
2
|
+
export declare const Register: builder.Function<builder.CallableProjection<{
|
|
3
|
+
idempotencyKey: string;
|
|
4
|
+
identities: ({
|
|
5
|
+
id: string;
|
|
6
|
+
mode: "external";
|
|
7
|
+
credential: string;
|
|
8
|
+
} | {
|
|
9
|
+
id: string;
|
|
10
|
+
mode: "self";
|
|
11
|
+
publicKey: unknown;
|
|
12
|
+
credential: string;
|
|
13
|
+
})[];
|
|
14
|
+
}, {
|
|
15
|
+
readonly mode: 'value';
|
|
16
|
+
readonly value: {
|
|
17
|
+
identities: {
|
|
18
|
+
id: string;
|
|
19
|
+
iss: string;
|
|
20
|
+
sub: string;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
}, "authorized", false, "default">>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { func } from '@astrale-os/kernel-dsl/v1';
|
|
2
|
+
import { registerInput, registerOutput } from '../contracts/index.js';
|
|
3
|
+
export const Register = func({
|
|
4
|
+
description: 'Atomically establish credential-evidenced, write-once Authentication on existing Identity-bearing Nodes.',
|
|
5
|
+
auth: 'authorized',
|
|
6
|
+
input: registerInput,
|
|
7
|
+
output: registerOutput,
|
|
8
|
+
});
|
|
@@ -2,7 +2,7 @@ import { K } from '../../index.js';
|
|
|
2
2
|
import { type FunctionSyscall } from './model.js';
|
|
3
3
|
export declare const query: FunctionSyscall<'kernel.astrale.ai', 'query', typeof K.functions.query>;
|
|
4
4
|
export declare const mutate: FunctionSyscall<'kernel.astrale.ai', 'mutate', typeof K.functions.mutate>;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const register: FunctionSyscall<'kernel.astrale.ai', 'register', typeof K.functions.register>;
|
|
6
6
|
export declare const install: FunctionSyscall<'kernel.astrale.ai', 'install', typeof K.functions.install>;
|
|
7
7
|
export declare const introspect: FunctionSyscall<'kernel.astrale.ai', 'introspect', typeof K.functions.introspect>;
|
|
8
8
|
export declare const uninstall: FunctionSyscall<'kernel.astrale.ai', 'uninstall', typeof K.functions.uninstall>;
|
|
@@ -3,7 +3,7 @@ import * as references from '../references/functions.js';
|
|
|
3
3
|
import { functionSyscall } from './model.js';
|
|
4
4
|
export const query = functionSyscall(references.query, K.functions.query);
|
|
5
5
|
export const mutate = functionSyscall(references.mutate, K.functions.mutate);
|
|
6
|
-
export const
|
|
6
|
+
export const register = functionSyscall(references.register, K.functions.register);
|
|
7
7
|
export const install = functionSyscall(references.install, K.functions.install);
|
|
8
8
|
export const introspect = functionSyscall(references.introspect, K.functions.introspect);
|
|
9
9
|
export const uninstall = functionSyscall(references.uninstall, K.functions.uninstall);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { FunctionSyscall, MethodSyscall, Syscall, SyscallRef } from './model.js';
|
|
2
|
-
export { install, introspect, journal, mutate,
|
|
2
|
+
export { install, introspect, journal, mutate, register, query, uninstall } from './functions.js';
|
|
3
3
|
export * as identity from './identity.js';
|
|
4
4
|
export * as function from './function.js';
|
|
5
5
|
export * as view from './view.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { install, introspect, journal, mutate,
|
|
1
|
+
export { install, introspect, journal, mutate, register, query, uninstall } from './functions.js';
|
|
2
2
|
export * as identity from './identity.js';
|
|
3
3
|
export * as function from './function.js';
|
|
4
4
|
export * as view from './view.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { FunctionSyscall, MethodSyscall, Syscall, SyscallRef } from './descriptors/index.js';
|
|
2
2
|
export * as references from './references/index.js';
|
|
3
|
-
export { install, introspect, journal, mutate,
|
|
3
|
+
export { install, introspect, journal, mutate, register, query, uninstall, } from './descriptors/index.js';
|
|
4
4
|
export { function, identity, view } from './descriptors/index.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * as references from './references/index.js';
|
|
2
|
-
export { install, introspect, journal, mutate,
|
|
2
|
+
export { install, introspect, journal, mutate, register, query, uninstall, } from './descriptors/index.js';
|
|
3
3
|
export { function, identity, view } from './descriptors/index.js';
|
|
@@ -8,10 +8,10 @@ export declare const mutate: Readonly<{
|
|
|
8
8
|
kind: 'function';
|
|
9
9
|
name: "mutate";
|
|
10
10
|
}>;
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const register: Readonly<{
|
|
12
12
|
origin: 'kernel.astrale.ai';
|
|
13
13
|
kind: 'function';
|
|
14
|
-
name: "
|
|
14
|
+
name: "register";
|
|
15
15
|
}>;
|
|
16
16
|
export declare const install: Readonly<{
|
|
17
17
|
origin: 'kernel.astrale.ai';
|
|
@@ -5,7 +5,7 @@ const functionRef = (name) => Object.freeze({
|
|
|
5
5
|
});
|
|
6
6
|
export const query = functionRef('query');
|
|
7
7
|
export const mutate = functionRef('mutate');
|
|
8
|
-
export const
|
|
8
|
+
export const register = functionRef('register');
|
|
9
9
|
export const install = functionRef('install');
|
|
10
10
|
export const introspect = functionRef('introspect');
|
|
11
11
|
export const uninstall = functionRef('uninstall');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { FunctionRef, SyscallRef } from './reference.js';
|
|
2
|
-
export { install, introspect, journal, mutate,
|
|
2
|
+
export { install, introspect, journal, mutate, register, query, uninstall } from './functions.js';
|
|
3
3
|
export * as identity from './identity.js';
|
|
4
4
|
export * as function from './function.js';
|
|
5
5
|
export * as view from './view.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { install, introspect, journal, mutate,
|
|
1
|
+
export { install, introspect, journal, mutate, register, query, uninstall } from './functions.js';
|
|
2
2
|
export * as identity from './identity.js';
|
|
3
3
|
export * as function from './function.js';
|
|
4
4
|
export * as view from './view.js';
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ProvisionRequest } from '../index.js';
|
|
2
|
-
declare const PROVISION_FINGERPRINT: unique symbol;
|
|
3
|
-
/** Digest of the semantic request. Self-proof bytes are deliberately excluded. */
|
|
4
|
-
export type ProvisionFingerprint = `sha256:${string}` & {
|
|
5
|
-
readonly [PROVISION_FINGERPRINT]: true;
|
|
6
|
-
};
|
|
7
|
-
/** Compute a deterministic semantic request digest without retaining bearer proof bytes. */
|
|
8
|
-
export declare function fingerprint(request: ProvisionRequest): Promise<ProvisionFingerprint>;
|
|
9
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as portable from '@astrale-os/kernel-dsl/value';
|
|
2
|
-
import { MutationAST } from '../../../graph/mutate/index.js';
|
|
3
|
-
/** Compute a deterministic semantic request digest without retaining bearer proof bytes. */
|
|
4
|
-
export async function fingerprint(request) {
|
|
5
|
-
const encoded = portable.json.encode(portable.accept(basis(request)));
|
|
6
|
-
const digest = await crypto.subtle.digest('SHA-256', Uint8Array.from(encoded).buffer);
|
|
7
|
-
return `sha256:${hex(new Uint8Array(digest))}`;
|
|
8
|
-
}
|
|
9
|
-
function basis(request) {
|
|
10
|
-
return {
|
|
11
|
-
version: 1,
|
|
12
|
-
idempotencyKey: request.idempotencyKey,
|
|
13
|
-
mutation: request.mutation === undefined ? null : MutationAST.encode(request.mutation),
|
|
14
|
-
identities: request.identities.map((identity) => ({
|
|
15
|
-
identity: identity.identity,
|
|
16
|
-
...(identity.authentication === undefined
|
|
17
|
-
? {}
|
|
18
|
-
: { authentication: fingerprintAuthentication(identity.authentication) }),
|
|
19
|
-
...('requiredClaims' in identity ? { requiredClaims: identity.requiredClaims ?? [] } : {}),
|
|
20
|
-
})),
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function fingerprintAuthentication(input) {
|
|
24
|
-
return 'credentials' in input
|
|
25
|
-
? { credentials: { publicKey: input.credentials.publicKey } }
|
|
26
|
-
: input;
|
|
27
|
-
}
|
|
28
|
-
function hex(input) {
|
|
29
|
-
return [...input].map((value) => value.toString(16).padStart(2, '0')).join('');
|
|
30
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { fingerprint } from './fingerprint/index.js';
|
|
2
|
-
export type { ProvisionFingerprint } from './fingerprint/index.js';
|
|
3
|
-
export { accept, isSelfIssuer, selfIssuer } from './request/index.js';
|
|
4
|
-
export type { AuthenticationProvision, IdentityProvision, ProvisionRequest, RequiredClaims, } from './request/index.js';
|
|
5
|
-
export type { ProvisionedIdentity, ProvisionResult } from './result/index.js';
|