@dxos/credentials 0.5.1-next.638da00 → 0.5.1-next.65aaa36
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/lib/browser/index.mjs +167 -740
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +144 -713
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/credentials/credential-factory.d.ts +1 -3
- package/dist/types/src/credentials/credential-factory.d.ts.map +1 -1
- package/dist/types/src/credentials/credential-generator.d.ts +2 -12
- package/dist/types/src/credentials/credential-generator.d.ts.map +1 -1
- package/dist/types/src/credentials/verifier.d.ts +1 -1
- package/dist/types/src/credentials/verifier.d.ts.map +1 -1
- package/dist/types/src/state-machine/member-state-machine.d.ts +12 -17
- package/dist/types/src/state-machine/member-state-machine.d.ts.map +1 -1
- package/dist/types/src/state-machine/space-state-machine.d.ts +3 -3
- package/dist/types/src/state-machine/space-state-machine.d.ts.map +1 -1
- package/package.json +16 -16
- package/src/credentials/credential-factory.ts +1 -9
- package/src/credentials/credential-generator.ts +2 -15
- package/src/credentials/verifier.test.ts +0 -25
- package/src/credentials/verifier.ts +1 -5
- package/src/state-machine/invitation-state-machine.test.ts +1 -1
- package/src/state-machine/member-state-machine.ts +53 -111
- package/src/state-machine/space-state-machine.test.ts +16 -20
- package/src/state-machine/space-state-machine.ts +33 -12
- package/dist/types/src/graph/credential-graph.d.ts +0 -152
- package/dist/types/src/graph/credential-graph.d.ts.map +0 -1
- package/dist/types/src/state-machine/member-state-machine.test.d.ts +0 -2
- package/dist/types/src/state-machine/member-state-machine.test.d.ts.map +0 -1
- package/src/graph/credential-graph.ts +0 -557
- package/src/state-machine/member-state-machine.test.ts +0 -580
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/core/halo/credentials/src/invitations.ts":{"bytes":1745,"imports":[],"format":"esm"},"packages/core/halo/credentials/src/passcode.ts":{"bytes":1420,"imports":[],"format":"esm"},"packages/core/halo/credentials/src/credentials/signing.ts":{"bytes":10731,"imports":[{"path":"json-stable-stringify","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/timeframe","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/core/halo/credentials/src/presentations/signing.ts":{"bytes":1805,"imports":[{"path":"packages/core/halo/credentials/src/credentials/signing.ts","kind":"import-statement","original":"../credentials/signing"}],"format":"esm"},"packages/core/halo/credentials/src/credentials/assertions.ts":{"bytes":3773,"imports":[],"format":"esm"},"packages/core/halo/credentials/src/credentials/verifier.ts":{"bytes":8446,"imports":[{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/assertions.ts","kind":"import-statement","original":"./assertions"},{"path":"packages/core/halo/credentials/src/credentials/signing.ts","kind":"import-statement","original":"./signing"}],"format":"esm"},"packages/core/halo/credentials/src/credentials/credential-factory.ts":{"bytes":11552,"imports":[{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/signing.ts","kind":"import-statement","original":"./signing"},{"path":"packages/core/halo/credentials/src/credentials/verifier.ts","kind":"import-statement","original":"./verifier"}],"format":"esm"},"packages/core/halo/credentials/src/credentials/credential-generator.ts":{"bytes":25106,"imports":[{"path":"@dxos/protocols/proto/dxos/halo/credentials","kind":"import-statement","external":true},{"path":"@dxos/timeframe","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/credential-factory.ts","kind":"import-statement","original":"./credential-factory"}],"format":"esm"},"packages/core/halo/credentials/src/credentials/index.ts":{"bytes":893,"imports":[{"path":"packages/core/halo/credentials/src/credentials/assertions.ts","kind":"import-statement","original":"./assertions"},{"path":"packages/core/halo/credentials/src/credentials/credential-factory.ts","kind":"import-statement","original":"./credential-factory"},{"path":"packages/core/halo/credentials/src/credentials/credential-generator.ts","kind":"import-statement","original":"./credential-generator"},{"path":"packages/core/halo/credentials/src/credentials/signing.ts","kind":"import-statement","original":"./signing"},{"path":"packages/core/halo/credentials/src/credentials/verifier.ts","kind":"import-statement","original":"./verifier"}],"format":"esm"},"packages/core/halo/credentials/src/presentations/presentation.ts":{"bytes":3538,"imports":[{"path":"packages/core/halo/credentials/src/presentations/signing.ts","kind":"import-statement","original":"./signing"},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/presentations/verifier.ts":{"bytes":10278,"imports":[{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/presentations/signing.ts","kind":"import-statement","original":"./signing"},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/presentations/index.ts":{"bytes":671,"imports":[{"path":"packages/core/halo/credentials/src/presentations/signing.ts","kind":"import-statement","original":"./signing"},{"path":"packages/core/halo/credentials/src/presentations/presentation.ts","kind":"import-statement","original":"./presentation"},{"path":"packages/core/halo/credentials/src/presentations/verifier.ts","kind":"import-statement","original":"./verifier"}],"format":"esm"},"packages/core/halo/credentials/src/state-machine/feed-state-machine.ts":{"bytes":5928,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/state-machine/invitation-state-machine.ts":{"bytes":11594,"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/graph/credential-graph.ts":{"bytes":72854,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/core/halo/credentials/src/state-machine/member-state-machine.ts":{"bytes":21527,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/halo/credentials","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"},{"path":"packages/core/halo/credentials/src/graph/credential-graph.ts","kind":"import-statement","original":"../graph/credential-graph"}],"format":"esm"},"packages/core/halo/credentials/src/state-machine/space-state-machine.ts":{"bytes":35511,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/halo/credentials","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/state-machine/feed-state-machine.ts","kind":"import-statement","original":"./feed-state-machine"},{"path":"packages/core/halo/credentials/src/state-machine/invitation-state-machine.ts","kind":"import-statement","original":"./invitation-state-machine"},{"path":"packages/core/halo/credentials/src/state-machine/member-state-machine.ts","kind":"import-statement","original":"./member-state-machine"},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/state-machine/index.ts":{"bytes":873,"imports":[{"path":"packages/core/halo/credentials/src/state-machine/space-state-machine.ts","kind":"import-statement","original":"./space-state-machine"},{"path":"packages/core/halo/credentials/src/state-machine/feed-state-machine.ts","kind":"import-statement","original":"./feed-state-machine"},{"path":"packages/core/halo/credentials/src/state-machine/member-state-machine.ts","kind":"import-statement","original":"./member-state-machine"},{"path":"packages/core/halo/credentials/src/state-machine/invitation-state-machine.ts","kind":"import-statement","original":"./invitation-state-machine"}],"format":"esm"},"packages/core/halo/credentials/src/processor/credential-processor.ts":{"bytes":703,"imports":[],"format":"esm"},"packages/core/halo/credentials/src/processor/device-state-machine.ts":{"bytes":10524,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/processor/profile-state-machine.ts":{"bytes":5432,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/processor/index.ts":{"bytes":753,"imports":[{"path":"packages/core/halo/credentials/src/processor/credential-processor.ts","kind":"import-statement","original":"./credential-processor"},{"path":"packages/core/halo/credentials/src/processor/device-state-machine.ts","kind":"import-statement","original":"./device-state-machine"},{"path":"packages/core/halo/credentials/src/processor/profile-state-machine.ts","kind":"import-statement","original":"./profile-state-machine"}],"format":"esm"},"packages/core/halo/credentials/src/index.ts":{"bytes":1056,"imports":[{"path":"packages/core/halo/credentials/src/invitations.ts","kind":"import-statement","original":"./invitations"},{"path":"packages/core/halo/credentials/src/passcode.ts","kind":"import-statement","original":"./passcode"},{"path":"packages/core/halo/credentials/src/presentations/index.ts","kind":"import-statement","original":"./presentations"},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"./credentials"},{"path":"packages/core/halo/credentials/src/state-machine/index.ts","kind":"import-statement","original":"./state-machine"},{"path":"packages/core/halo/credentials/src/processor/index.ts","kind":"import-statement","original":"./processor"}],"format":"esm"}},"outputs":{"packages/core/halo/credentials/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":116300},"packages/core/halo/credentials/dist/lib/node/index.cjs":{"imports":[{"path":"json-stable-stringify","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/timeframe","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/halo/credentials","kind":"import-statement","external":true},{"path":"@dxos/timeframe","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/halo/credentials","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/halo/credentials","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["CredentialGenerator","DeviceStateMachine","FeedStateMachine","InvitationStateMachine","MemberStateMachine","ProfileStateMachine","SIGNATURE_TYPE_ED25519","SpaceStateMachine","canonicalStringify","checkCredentialType","createAdmissionCredentials","createCancelDelegatedSpaceInvitationCredential","createCredential","createCredentialMessage","createCredentialSignerWithChain","createCredentialSignerWithKey","createDelegatedSpaceInvitationCredential","createDeviceAuthorization","credentialTypeFilter","defaultSecretProvider","defaultSecretValidator","generatePasscode","getCredentialAssertion","getCredentialProofPayload","getPresentationProofPayload","isValidAuthorizedDeviceCredential","signPresentation","verifyChain","verifyCredential","verifyCredentialSignature","verifyPresentation","verifyPresentationChain","verifyPresentationSignature"],"entryPoint":"packages/core/halo/credentials/src/index.ts","inputs":{"packages/core/halo/credentials/src/invitations.ts":{"bytesInOutput":126},"packages/core/halo/credentials/src/index.ts":{"bytesInOutput":0},"packages/core/halo/credentials/src/passcode.ts":{"bytesInOutput":178},"packages/core/halo/credentials/src/credentials/signing.ts":{"bytesInOutput":1948},"packages/core/halo/credentials/src/presentations/signing.ts":{"bytesInOutput":236},"packages/core/halo/credentials/src/presentations/index.ts":{"bytesInOutput":0},"packages/core/halo/credentials/src/credentials/assertions.ts":{"bytesInOutput":648},"packages/core/halo/credentials/src/credentials/index.ts":{"bytesInOutput":0},"packages/core/halo/credentials/src/credentials/credential-factory.ts":{"bytesInOutput":2632},"packages/core/halo/credentials/src/credentials/verifier.ts":{"bytesInOutput":1762},"packages/core/halo/credentials/src/credentials/credential-generator.ts":{"bytesInOutput":5630},"packages/core/halo/credentials/src/presentations/presentation.ts":{"bytesInOutput":578},"packages/core/halo/credentials/src/presentations/verifier.ts":{"bytesInOutput":2302},"packages/core/halo/credentials/src/state-machine/space-state-machine.ts":{"bytesInOutput":8564},"packages/core/halo/credentials/src/state-machine/feed-state-machine.ts":{"bytesInOutput":1545},"packages/core/halo/credentials/src/state-machine/invitation-state-machine.ts":{"bytesInOutput":2764},"packages/core/halo/credentials/src/state-machine/member-state-machine.ts":{"bytesInOutput":5260},"packages/core/halo/credentials/src/graph/credential-graph.ts":{"bytesInOutput":18877},"packages/core/halo/credentials/src/state-machine/index.ts":{"bytesInOutput":0},"packages/core/halo/credentials/src/processor/index.ts":{"bytesInOutput":0},"packages/core/halo/credentials/src/processor/device-state-machine.ts":{"bytesInOutput":2782},"packages/core/halo/credentials/src/processor/profile-state-machine.ts":{"bytesInOutput":1204}},"bytes":59347}}}
|
|
1
|
+
{"inputs":{"packages/core/halo/credentials/src/invitations.ts":{"bytes":1745,"imports":[],"format":"esm"},"packages/core/halo/credentials/src/passcode.ts":{"bytes":1420,"imports":[],"format":"esm"},"packages/core/halo/credentials/src/credentials/signing.ts":{"bytes":10731,"imports":[{"path":"json-stable-stringify","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/timeframe","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/core/halo/credentials/src/presentations/signing.ts":{"bytes":1805,"imports":[{"path":"packages/core/halo/credentials/src/credentials/signing.ts","kind":"import-statement","original":"../credentials/signing"}],"format":"esm"},"packages/core/halo/credentials/src/credentials/assertions.ts":{"bytes":3773,"imports":[],"format":"esm"},"packages/core/halo/credentials/src/credentials/verifier.ts":{"bytes":8058,"imports":[{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/assertions.ts","kind":"import-statement","original":"./assertions"},{"path":"packages/core/halo/credentials/src/credentials/signing.ts","kind":"import-statement","original":"./signing"}],"format":"esm"},"packages/core/halo/credentials/src/credentials/credential-factory.ts":{"bytes":10807,"imports":[{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/signing.ts","kind":"import-statement","original":"./signing"},{"path":"packages/core/halo/credentials/src/credentials/verifier.ts","kind":"import-statement","original":"./verifier"}],"format":"esm"},"packages/core/halo/credentials/src/credentials/credential-generator.ts":{"bytes":23506,"imports":[{"path":"@dxos/protocols/proto/dxos/halo/credentials","kind":"import-statement","external":true},{"path":"@dxos/timeframe","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/credential-factory.ts","kind":"import-statement","original":"./credential-factory"}],"format":"esm"},"packages/core/halo/credentials/src/credentials/index.ts":{"bytes":893,"imports":[{"path":"packages/core/halo/credentials/src/credentials/assertions.ts","kind":"import-statement","original":"./assertions"},{"path":"packages/core/halo/credentials/src/credentials/credential-factory.ts","kind":"import-statement","original":"./credential-factory"},{"path":"packages/core/halo/credentials/src/credentials/credential-generator.ts","kind":"import-statement","original":"./credential-generator"},{"path":"packages/core/halo/credentials/src/credentials/signing.ts","kind":"import-statement","original":"./signing"},{"path":"packages/core/halo/credentials/src/credentials/verifier.ts","kind":"import-statement","original":"./verifier"}],"format":"esm"},"packages/core/halo/credentials/src/presentations/presentation.ts":{"bytes":3538,"imports":[{"path":"packages/core/halo/credentials/src/presentations/signing.ts","kind":"import-statement","original":"./signing"},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/presentations/verifier.ts":{"bytes":10278,"imports":[{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/presentations/signing.ts","kind":"import-statement","original":"./signing"},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/presentations/index.ts":{"bytes":671,"imports":[{"path":"packages/core/halo/credentials/src/presentations/signing.ts","kind":"import-statement","original":"./signing"},{"path":"packages/core/halo/credentials/src/presentations/presentation.ts","kind":"import-statement","original":"./presentation"},{"path":"packages/core/halo/credentials/src/presentations/verifier.ts","kind":"import-statement","original":"./verifier"}],"format":"esm"},"packages/core/halo/credentials/src/state-machine/feed-state-machine.ts":{"bytes":5928,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/state-machine/invitation-state-machine.ts":{"bytes":11594,"imports":[{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/state-machine/member-state-machine.ts":{"bytes":11748,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/state-machine/space-state-machine.ts":{"bytes":39703,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/halo/credentials","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/state-machine/feed-state-machine.ts","kind":"import-statement","original":"./feed-state-machine"},{"path":"packages/core/halo/credentials/src/state-machine/invitation-state-machine.ts","kind":"import-statement","original":"./invitation-state-machine"},{"path":"packages/core/halo/credentials/src/state-machine/member-state-machine.ts","kind":"import-statement","original":"./member-state-machine"},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/state-machine/index.ts":{"bytes":873,"imports":[{"path":"packages/core/halo/credentials/src/state-machine/space-state-machine.ts","kind":"import-statement","original":"./space-state-machine"},{"path":"packages/core/halo/credentials/src/state-machine/feed-state-machine.ts","kind":"import-statement","original":"./feed-state-machine"},{"path":"packages/core/halo/credentials/src/state-machine/member-state-machine.ts","kind":"import-statement","original":"./member-state-machine"},{"path":"packages/core/halo/credentials/src/state-machine/invitation-state-machine.ts","kind":"import-statement","original":"./invitation-state-machine"}],"format":"esm"},"packages/core/halo/credentials/src/processor/credential-processor.ts":{"bytes":703,"imports":[],"format":"esm"},"packages/core/halo/credentials/src/processor/device-state-machine.ts":{"bytes":10524,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/processor/profile-state-machine.ts":{"bytes":5432,"imports":[{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"../credentials"}],"format":"esm"},"packages/core/halo/credentials/src/processor/index.ts":{"bytes":753,"imports":[{"path":"packages/core/halo/credentials/src/processor/credential-processor.ts","kind":"import-statement","original":"./credential-processor"},{"path":"packages/core/halo/credentials/src/processor/device-state-machine.ts","kind":"import-statement","original":"./device-state-machine"},{"path":"packages/core/halo/credentials/src/processor/profile-state-machine.ts","kind":"import-statement","original":"./profile-state-machine"}],"format":"esm"},"packages/core/halo/credentials/src/index.ts":{"bytes":1056,"imports":[{"path":"packages/core/halo/credentials/src/invitations.ts","kind":"import-statement","original":"./invitations"},{"path":"packages/core/halo/credentials/src/passcode.ts","kind":"import-statement","original":"./passcode"},{"path":"packages/core/halo/credentials/src/presentations/index.ts","kind":"import-statement","original":"./presentations"},{"path":"packages/core/halo/credentials/src/credentials/index.ts","kind":"import-statement","original":"./credentials"},{"path":"packages/core/halo/credentials/src/state-machine/index.ts","kind":"import-statement","original":"./state-machine"},{"path":"packages/core/halo/credentials/src/processor/index.ts","kind":"import-statement","original":"./processor"}],"format":"esm"}},"outputs":{"packages/core/halo/credentials/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":75803},"packages/core/halo/credentials/dist/lib/node/index.cjs":{"imports":[{"path":"json-stable-stringify","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/timeframe","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/halo/credentials","kind":"import-statement","external":true},{"path":"@dxos/timeframe","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/halo/credentials","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["CredentialGenerator","DeviceStateMachine","FeedStateMachine","InvitationStateMachine","MemberStateMachine","ProfileStateMachine","SIGNATURE_TYPE_ED25519","SpaceStateMachine","canonicalStringify","checkCredentialType","createAdmissionCredentials","createCancelDelegatedSpaceInvitationCredential","createCredential","createCredentialMessage","createCredentialSignerWithChain","createCredentialSignerWithKey","createDelegatedSpaceInvitationCredential","createDeviceAuthorization","credentialTypeFilter","defaultSecretProvider","defaultSecretValidator","generatePasscode","getCredentialAssertion","getCredentialProofPayload","getPresentationProofPayload","isValidAuthorizedDeviceCredential","signPresentation","verifyChain","verifyCredential","verifyCredentialSignature","verifyPresentation","verifyPresentationChain","verifyPresentationSignature"],"entryPoint":"packages/core/halo/credentials/src/index.ts","inputs":{"packages/core/halo/credentials/src/invitations.ts":{"bytesInOutput":126},"packages/core/halo/credentials/src/index.ts":{"bytesInOutput":0},"packages/core/halo/credentials/src/passcode.ts":{"bytesInOutput":178},"packages/core/halo/credentials/src/credentials/signing.ts":{"bytesInOutput":1948},"packages/core/halo/credentials/src/presentations/signing.ts":{"bytesInOutput":236},"packages/core/halo/credentials/src/presentations/index.ts":{"bytesInOutput":0},"packages/core/halo/credentials/src/credentials/assertions.ts":{"bytesInOutput":648},"packages/core/halo/credentials/src/credentials/index.ts":{"bytesInOutput":0},"packages/core/halo/credentials/src/credentials/credential-factory.ts":{"bytesInOutput":2455},"packages/core/halo/credentials/src/credentials/verifier.ts":{"bytesInOutput":1661},"packages/core/halo/credentials/src/credentials/credential-generator.ts":{"bytesInOutput":5547},"packages/core/halo/credentials/src/presentations/presentation.ts":{"bytesInOutput":578},"packages/core/halo/credentials/src/presentations/verifier.ts":{"bytesInOutput":2302},"packages/core/halo/credentials/src/state-machine/space-state-machine.ts":{"bytesInOutput":9839},"packages/core/halo/credentials/src/state-machine/feed-state-machine.ts":{"bytesInOutput":1545},"packages/core/halo/credentials/src/state-machine/invitation-state-machine.ts":{"bytesInOutput":2764},"packages/core/halo/credentials/src/state-machine/member-state-machine.ts":{"bytesInOutput":2956},"packages/core/halo/credentials/src/state-machine/index.ts":{"bytesInOutput":0},"packages/core/halo/credentials/src/processor/index.ts":{"bytesInOutput":0},"packages/core/halo/credentials/src/processor/device-state-machine.ts":{"bytesInOutput":2782},"packages/core/halo/credentials/src/processor/profile-state-machine.ts":{"bytesInOutput":1204}},"bytes":38938}}}
|
|
@@ -6,7 +6,6 @@ export type CreateCredentialSignerParams = {
|
|
|
6
6
|
subject: PublicKey;
|
|
7
7
|
assertion: TypedMessage;
|
|
8
8
|
nonce?: Uint8Array;
|
|
9
|
-
parentCredentialIds?: PublicKey[];
|
|
10
9
|
};
|
|
11
10
|
export type CreateCredentialParams = {
|
|
12
11
|
signer: Signer;
|
|
@@ -16,12 +15,11 @@ export type CreateCredentialParams = {
|
|
|
16
15
|
subject: PublicKey;
|
|
17
16
|
assertion: TypedMessage;
|
|
18
17
|
nonce?: Uint8Array;
|
|
19
|
-
parentCredentialIds?: PublicKey[];
|
|
20
18
|
};
|
|
21
19
|
/**
|
|
22
20
|
* Construct a signed credential message.
|
|
23
21
|
*/
|
|
24
|
-
export declare const createCredential: ({ signer, issuer, subject, assertion, signingKey, chain, nonce,
|
|
22
|
+
export declare const createCredential: ({ signer, issuer, subject, assertion, signingKey, chain, nonce, }: CreateCredentialParams) => Promise<Credential>;
|
|
25
23
|
export declare const createCredentialMessage: (credential: Credential) => {
|
|
26
24
|
'@type': string;
|
|
27
25
|
credential: Credential;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-factory.d.ts","sourceRoot":"","sources":["../../../../src/credentials/credential-factory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,cAAc,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CA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AAC,MAAM,EAAE,4BAA4B,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACjF;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B,WAAY,MAAM,UAAU,SAAS,KAAG,gBAUhF,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,+BAA+B,WAClC,MAAM,SACP,KAAK,cACA,SAAS,KACpB,gBAYD,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { type Signer } from '@dxos/crypto';
|
|
|
2
2
|
import { type PublicKey } from '@dxos/keys';
|
|
3
3
|
import { type TypedMessage } from '@dxos/protocols';
|
|
4
4
|
import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
5
|
-
import { AdmittedFeed, type Credential, type DeviceProfileDocument, type ProfileDocument
|
|
5
|
+
import { AdmittedFeed, type Credential, type DeviceProfileDocument, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
6
6
|
import { type DelegateSpaceInvitation } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
7
7
|
import { type CredentialSigner } from './credential-factory';
|
|
8
8
|
/**
|
|
@@ -38,17 +38,7 @@ export declare class CredentialGenerator {
|
|
|
38
38
|
createEpochCredential(spaceKey: PublicKey): Promise<Credential>;
|
|
39
39
|
}
|
|
40
40
|
export declare const createDeviceAuthorization: (signer: CredentialSigner, identityKey: PublicKey, deviceKey: PublicKey) => Promise<TypedMessage[]>;
|
|
41
|
-
|
|
42
|
-
* @param signer - invitation signer.
|
|
43
|
-
* @param identityKey - identity key of the admitted member.
|
|
44
|
-
* @param spaceKey - subject space key.
|
|
45
|
-
* @param genesisFeedKey - genesis feed key of the space.
|
|
46
|
-
* @param role - role of the newly added member.
|
|
47
|
-
* @param membershipChainHeads - ids of the last known SpaceMember credentials (branching possible).
|
|
48
|
-
* @param profile - profile of the newly added member.
|
|
49
|
-
* @param invitationCredentialId - id of the delegated invitation credential in case one was used to add the member.
|
|
50
|
-
*/
|
|
51
|
-
export declare const createAdmissionCredentials: (signer: CredentialSigner, identityKey: PublicKey, spaceKey: PublicKey, genesisFeedKey: PublicKey, role?: SpaceMember.Role, membershipChainHeads?: PublicKey[], profile?: ProfileDocument, invitationCredentialId?: PublicKey) => Promise<FeedMessage.Payload[]>;
|
|
41
|
+
export declare const createAdmissionCredentials: (signer: CredentialSigner, identityKey: PublicKey, spaceKey: PublicKey, genesisFeedKey: PublicKey, profile?: ProfileDocument, invitationCredentialId?: PublicKey) => Promise<FeedMessage.Payload[]>;
|
|
52
42
|
export declare const createDelegatedSpaceInvitationCredential: (signer: CredentialSigner, subject: PublicKey, invitation: DelegateSpaceInvitation) => Promise<FeedMessage.Payload>;
|
|
53
43
|
/**
|
|
54
44
|
* @param signer - credential issuer.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-generator.d.ts","sourceRoot":"","sources":["../../../../src/credentials/credential-generator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EACL,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"credential-generator.d.ts","sourceRoot":"","sources":["../../../../src/credentials/credential-generator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EACL,YAAY,EACZ,KAAK,UAAU,EACf,KAA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,yBAAyB,WAC5B,gBAAgB,eACX,SAAS,aACX,SAAS,KACnB,QAAQ,YAAY,EAAE,CAgBxB,CAAC;AAGF,eAAO,MAAM,0BAA0B,WAC7B,gBAAgB,eACX,SAAS,YACZ,SAAS,kBACH,SAAS,YACf,eAAe,2BACA,SAAS,KACjC,QAAQ,YAAY,OAAO,EAAE,CAkB/B,CAAC;AAEF,eAAO,MAAM,wCAAwC,WAC3C,gBAAgB,WACf,SAAS,cACN,uBAAuB,KAClC,QAAQ,YAAY,OAAO,CAe7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,8CAA8C,WACjD,gBAAgB,WACf,SAAS,0BACM,SAAS,KAChC,QAAQ,YAAY,OAAO,CAS7B,CAAC"}
|
|
@@ -14,7 +14,7 @@ export declare const verifyCredential: (credential: Credential) => Promise<Verif
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const verifyCredentialSignature: (credential: Credential) => Promise<VerificationResult>;
|
|
16
16
|
/**
|
|
17
|
-
* Verifies
|
|
17
|
+
* Verifies the the signer has the delegated authority to create credentials on the half of the issuer.
|
|
18
18
|
*/
|
|
19
19
|
export declare const verifyChain: (chain: Chain, authority: PublicKey, subject: PublicKey) => Promise<VerificationResult>;
|
|
20
20
|
//# sourceMappingURL=verifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../../../../src/credentials/verifier.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAK1F,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AAEzD,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEvF,eAAO,MAAM,gBAAgB,eAAsB,UAAU,KAAG,QAAQ,kBAAkB,
|
|
1
|
+
{"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../../../../src/credentials/verifier.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAK1F,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AAEzD,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEvF,eAAO,MAAM,gBAAgB,eAAsB,UAAU,KAAG,QAAQ,kBAAkB,CAqBzF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,eAAsB,UAAU,KAAG,QAAQ,kBAAkB,CAclG,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,UACf,KAAK,aACD,SAAS,WACX,SAAS,KACjB,QAAQ,kBAAkB,CAc5B,CAAC"}
|
|
@@ -1,39 +1,34 @@
|
|
|
1
1
|
import { PublicKey } from '@dxos/keys';
|
|
2
|
-
import { type Credential, SpaceMember, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
3
|
-
import { type
|
|
2
|
+
import { type Credential, type SpaceMember, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
3
|
+
import { type AsyncCallback, Callback } from '@dxos/util';
|
|
4
4
|
export interface MemberInfo {
|
|
5
5
|
key: PublicKey;
|
|
6
|
-
role: SpaceMember.Role;
|
|
7
6
|
credential: Credential;
|
|
8
7
|
assertion: SpaceMember;
|
|
8
|
+
removed: boolean;
|
|
9
9
|
profile?: ProfileDocument;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Tracks the list of members (with roles) for the space.
|
|
13
13
|
* Provides a list of admitted feeds.
|
|
14
14
|
*/
|
|
15
|
-
export declare class MemberStateMachine
|
|
15
|
+
export declare class MemberStateMachine {
|
|
16
16
|
private readonly _spaceKey;
|
|
17
|
-
private
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
private _creator;
|
|
18
|
+
/**
|
|
19
|
+
* Member IDENTITY key => info
|
|
20
|
+
*/
|
|
21
|
+
private _members;
|
|
22
|
+
readonly onMemberAdmitted: Callback<AsyncCallback<MemberInfo>>;
|
|
21
23
|
constructor(_spaceKey: PublicKey);
|
|
22
24
|
get creator(): MemberInfo | undefined;
|
|
23
25
|
get members(): ReadonlyMap<PublicKey, MemberInfo>;
|
|
24
|
-
|
|
25
|
-
getRole(member: PublicKey): SpaceMember.Role;
|
|
26
|
+
getRole(member: PublicKey): SpaceMember.Role | undefined;
|
|
26
27
|
/**
|
|
27
28
|
* Processes the SpaceMember credential.
|
|
28
29
|
* Assumes the credential is already pre-verified and the issuer has been authorized to issue credentials of this type.
|
|
29
30
|
*/
|
|
30
31
|
process(credential: Credential): Promise<void>;
|
|
31
|
-
|
|
32
|
-
isUpdateAllowed(scope: StateScope<SpaceMember>, credential: Credential, assertion: SpaceMember): boolean;
|
|
33
|
-
getConflictingPaths(paths: PathState<SpaceMember>[], update: ChainVertex<SpaceMember>): PathState<SpaceMember>[];
|
|
34
|
-
tryPickWinningUpdate(scope1: StateScope<SpaceMember>, update1: Credential, scope2: StateScope<SpaceMember>, update2: Credential): Credential | null;
|
|
35
|
-
toLogString(assertion: SpaceMember | undefined): string;
|
|
36
|
-
hasStateChanged(s1?: MemberInfo, s2?: MemberInfo): boolean;
|
|
37
|
-
private _getRole;
|
|
32
|
+
onRevoked(revoked: Credential, revocation: Credential): Promise<void>;
|
|
38
33
|
}
|
|
39
34
|
//# sourceMappingURL=member-state-machine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member-state-machine.d.ts","sourceRoot":"","sources":["../../../../src/state-machine/member-state-machine.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,KAAK,UAAU,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"member-state-machine.d.ts","sourceRoot":"","sources":["../../../../src/state-machine/member-state-machine.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACtH,OAAO,EAAE,KAAK,aAAa,EAAE,QAAQ,EAAc,MAAM,YAAY,CAAC;AAItE,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,SAAS,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,WAAW,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED;;;GAGG;AACH,qBAAa,kBAAkB;IAUjB,OAAO,CAAC,QAAQ,CAAC,SAAS;IATtC,OAAO,CAAC,QAAQ,CAAyB;IAEzC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAyD;IAEzE,QAAQ,CAAC,gBAAgB,sCAA6C;gBAEzC,SAAS,EAAE,SAAS;IAEjD,IAAI,OAAO,IAAI,UAAU,GAAG,SAAS,CAEpC;IAED,IAAI,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC,CAEhD;IAED,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC,IAAI,GAAG,SAAS;IAIxD;;;OAGG;IACG,OAAO,CAAC,UAAU,EAAE,UAAU;IAoD9B,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAS5D"}
|
|
@@ -8,7 +8,6 @@ import { type MemberInfo } from './member-state-machine';
|
|
|
8
8
|
import { type CredentialProcessor } from '../processor/credential-processor';
|
|
9
9
|
export interface SpaceState {
|
|
10
10
|
readonly members: ReadonlyMap<PublicKey, MemberInfo>;
|
|
11
|
-
readonly membershipChainHeads: PublicKey[];
|
|
12
11
|
readonly feeds: ReadonlyMap<PublicKey, FeedInfo>;
|
|
13
12
|
readonly credentials: Credential[];
|
|
14
13
|
readonly genesisCredential: Credential | undefined;
|
|
@@ -43,14 +42,13 @@ export declare class SpaceStateMachine implements SpaceState {
|
|
|
43
42
|
private _genesisCredential;
|
|
44
43
|
private _credentialProcessors;
|
|
45
44
|
readonly onCredentialProcessed: Callback<AsyncCallback<Credential>>;
|
|
46
|
-
readonly
|
|
45
|
+
readonly onMemberAdmitted: Callback<AsyncCallback<MemberInfo>>;
|
|
47
46
|
readonly onFeedAdmitted: Callback<AsyncCallback<FeedInfo>>;
|
|
48
47
|
readonly onDelegatedInvitation: Callback<AsyncCallback<import("./invitation-state-machine").DelegateInvitationCredential>>;
|
|
49
48
|
readonly onDelegatedInvitationRemoved: Callback<AsyncCallback<import("./invitation-state-machine").DelegateInvitationCredential>>;
|
|
50
49
|
constructor(_spaceKey: PublicKey);
|
|
51
50
|
get creator(): MemberInfo | undefined;
|
|
52
51
|
get members(): ReadonlyMap<PublicKey, MemberInfo>;
|
|
53
|
-
get membershipChainHeads(): PublicKey[];
|
|
54
52
|
get feeds(): ReadonlyMap<PublicKey, FeedInfo>;
|
|
55
53
|
get credentials(): Credential[];
|
|
56
54
|
get credentialEntries(): CredentialEntry[];
|
|
@@ -66,5 +64,7 @@ export declare class SpaceStateMachine implements SpaceState {
|
|
|
66
64
|
process(credential: Credential, { sourceFeed, skipVerification }: ProcessOptions): Promise<boolean>;
|
|
67
65
|
private _canInviteNewMembers;
|
|
68
66
|
private _canAdmitFeeds;
|
|
67
|
+
private _canRevokeCredentials;
|
|
68
|
+
private _credentialCanBeRevoked;
|
|
69
69
|
}
|
|
70
70
|
//# sourceMappingURL=space-state-machine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space-state-machine.d.ts","sourceRoot":"","sources":["../../../../src/state-machine/space-state-machine.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,KAAK,aAAa,EAAE,QAAQ,EAA0B,MAAM,YAAY,CAAC;AAElF,OAAO,EAAE,KAAK,QAAQ,EAAoB,MAAM,sBAAsB,CAAC;AAEvE,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE7E,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACrD,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"space-state-machine.d.ts","sourceRoot":"","sources":["../../../../src/state-machine/space-state-machine.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,KAAK,aAAa,EAAE,QAAQ,EAA0B,MAAM,YAAY,CAAC;AAElF,OAAO,EAAE,KAAK,QAAQ,EAAoB,MAAM,sBAAsB,CAAC;AAEvE,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,wBA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
|
{
|
|
2
2
|
"name": "@dxos/credentials",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.65aaa36",
|
|
4
4
|
"description": "DXOS Credentials",
|
|
5
5
|
"homepage": "https://github.com/dxos/dxos/tree/main/packages/core/halo/credentials#readme",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
"performance-now": "^2.1.0",
|
|
26
26
|
"pump": "^3.0.0",
|
|
27
27
|
"stream-to-array": "^2.3.0",
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/crypto": "0.5.1-next.
|
|
32
|
-
"@dxos/debug": "0.5.1-next.
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/keyring": "0.5.1-next.
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
28
|
+
"@dxos/context": "0.5.1-next.65aaa36",
|
|
29
|
+
"@dxos/async": "0.5.1-next.65aaa36",
|
|
30
|
+
"@dxos/codec-protobuf": "0.5.1-next.65aaa36",
|
|
31
|
+
"@dxos/crypto": "0.5.1-next.65aaa36",
|
|
32
|
+
"@dxos/debug": "0.5.1-next.65aaa36",
|
|
33
|
+
"@dxos/invariant": "0.5.1-next.65aaa36",
|
|
34
|
+
"@dxos/keyring": "0.5.1-next.65aaa36",
|
|
35
|
+
"@dxos/log": "0.5.1-next.65aaa36",
|
|
36
|
+
"@dxos/feed-store": "0.5.1-next.65aaa36",
|
|
37
|
+
"@dxos/keys": "0.5.1-next.65aaa36",
|
|
38
|
+
"@dxos/node-std": "0.5.1-next.65aaa36",
|
|
39
|
+
"@dxos/protocols": "0.5.1-next.65aaa36",
|
|
40
|
+
"@dxos/timeframe": "0.5.1-next.65aaa36",
|
|
41
|
+
"@dxos/util": "0.5.1-next.65aaa36"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/encoding-down": "^5.0.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@types/pify": "^3.0.2",
|
|
51
51
|
"@types/pump": "^1.1.0",
|
|
52
52
|
"@types/stream-to-array": "^2.3.0",
|
|
53
|
-
"@dxos/random-access-storage": "0.5.1-next.
|
|
53
|
+
"@dxos/random-access-storage": "0.5.1-next.65aaa36"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
@@ -15,7 +15,6 @@ export type CreateCredentialSignerParams = {
|
|
|
15
15
|
subject: PublicKey;
|
|
16
16
|
assertion: TypedMessage;
|
|
17
17
|
nonce?: Uint8Array;
|
|
18
|
-
parentCredentialIds?: PublicKey[];
|
|
19
18
|
};
|
|
20
19
|
|
|
21
20
|
export type CreateCredentialParams = {
|
|
@@ -29,7 +28,6 @@ export type CreateCredentialParams = {
|
|
|
29
28
|
subject: PublicKey;
|
|
30
29
|
assertion: TypedMessage;
|
|
31
30
|
nonce?: Uint8Array;
|
|
32
|
-
parentCredentialIds?: PublicKey[];
|
|
33
31
|
};
|
|
34
32
|
|
|
35
33
|
/**
|
|
@@ -43,7 +41,6 @@ export const createCredential = async ({
|
|
|
43
41
|
signingKey,
|
|
44
42
|
chain,
|
|
45
43
|
nonce,
|
|
46
|
-
parentCredentialIds,
|
|
47
44
|
}: CreateCredentialParams): Promise<Credential> => {
|
|
48
45
|
invariant(assertion['@type'], 'Invalid assertion.');
|
|
49
46
|
invariant(!!signingKey === !!chain, 'Chain must be provided if and only if the signing key differs from the issuer.');
|
|
@@ -69,10 +66,6 @@ export const createCredential = async ({
|
|
|
69
66
|
},
|
|
70
67
|
};
|
|
71
68
|
|
|
72
|
-
if ((parentCredentialIds?.length ?? 0) > 0) {
|
|
73
|
-
credential.parentCredentialIds = parentCredentialIds;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
69
|
// Set proof after creating signature.
|
|
77
70
|
const signedPayload = getCredentialProofPayload(credential);
|
|
78
71
|
credential.proof!.value = await signer.sign(signingKey ?? issuer, signedPayload);
|
|
@@ -104,14 +97,13 @@ export interface CredentialSigner {
|
|
|
104
97
|
*/
|
|
105
98
|
export const createCredentialSignerWithKey = (signer: Signer, issuer: PublicKey): CredentialSigner => ({
|
|
106
99
|
getIssuer: () => issuer,
|
|
107
|
-
createCredential: ({ subject, assertion, nonce
|
|
100
|
+
createCredential: ({ subject, assertion, nonce }) =>
|
|
108
101
|
createCredential({
|
|
109
102
|
signer,
|
|
110
103
|
issuer,
|
|
111
104
|
subject,
|
|
112
105
|
assertion,
|
|
113
106
|
nonce,
|
|
114
|
-
parentCredentialIds,
|
|
115
107
|
}),
|
|
116
108
|
});
|
|
117
109
|
|
|
@@ -88,7 +88,7 @@ export class CredentialGenerator {
|
|
|
88
88
|
assertion: {
|
|
89
89
|
'@type': 'dxos.halo.credentials.SpaceMember',
|
|
90
90
|
spaceKey,
|
|
91
|
-
role: SpaceMember.Role.
|
|
91
|
+
role: SpaceMember.Role.MEMBER,
|
|
92
92
|
genesisFeedKey,
|
|
93
93
|
},
|
|
94
94
|
}),
|
|
@@ -202,34 +202,21 @@ export const createDeviceAuthorization = async (
|
|
|
202
202
|
};
|
|
203
203
|
|
|
204
204
|
// TODO(burdon): Reconcile with above (esp. Signer).
|
|
205
|
-
/**
|
|
206
|
-
* @param signer - invitation signer.
|
|
207
|
-
* @param identityKey - identity key of the admitted member.
|
|
208
|
-
* @param spaceKey - subject space key.
|
|
209
|
-
* @param genesisFeedKey - genesis feed key of the space.
|
|
210
|
-
* @param role - role of the newly added member.
|
|
211
|
-
* @param membershipChainHeads - ids of the last known SpaceMember credentials (branching possible).
|
|
212
|
-
* @param profile - profile of the newly added member.
|
|
213
|
-
* @param invitationCredentialId - id of the delegated invitation credential in case one was used to add the member.
|
|
214
|
-
*/
|
|
215
205
|
export const createAdmissionCredentials = async (
|
|
216
206
|
signer: CredentialSigner,
|
|
217
207
|
identityKey: PublicKey,
|
|
218
208
|
spaceKey: PublicKey,
|
|
219
209
|
genesisFeedKey: PublicKey,
|
|
220
|
-
role: SpaceMember.Role = SpaceMember.Role.ADMIN,
|
|
221
|
-
membershipChainHeads: PublicKey[] = [],
|
|
222
210
|
profile?: ProfileDocument,
|
|
223
211
|
invitationCredentialId?: PublicKey,
|
|
224
212
|
): Promise<FeedMessage.Payload[]> => {
|
|
225
213
|
const credentials = await Promise.all([
|
|
226
214
|
await signer.createCredential({
|
|
227
215
|
subject: identityKey,
|
|
228
|
-
parentCredentialIds: membershipChainHeads,
|
|
229
216
|
assertion: {
|
|
230
217
|
'@type': 'dxos.halo.credentials.SpaceMember',
|
|
231
218
|
spaceKey,
|
|
232
|
-
role,
|
|
219
|
+
role: SpaceMember.Role.ADMIN, // TODO(burdon): Configure.
|
|
233
220
|
profile,
|
|
234
221
|
genesisFeedKey,
|
|
235
222
|
invitationCredentialId,
|
|
@@ -142,31 +142,6 @@ describe('verifier', () => {
|
|
|
142
142
|
});
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
-
test('parent references are part of the proof', async () => {
|
|
146
|
-
const keyring = new Keyring();
|
|
147
|
-
const issuer = await keyring.createKey();
|
|
148
|
-
const credential = await createCredential({
|
|
149
|
-
parentCredentialIds: [PublicKey.random()],
|
|
150
|
-
assertion: {
|
|
151
|
-
'@type': 'dxos.halo.credentials.SpaceMember',
|
|
152
|
-
spaceKey: PublicKey.random(),
|
|
153
|
-
role: SpaceMember.Role.ADMIN,
|
|
154
|
-
genesisFeedKey: PublicKey.random(),
|
|
155
|
-
},
|
|
156
|
-
issuer,
|
|
157
|
-
signer: keyring,
|
|
158
|
-
subject: PublicKey.random(),
|
|
159
|
-
});
|
|
160
|
-
expect(credential.parentCredentialIds?.length).toEqual(1);
|
|
161
|
-
expect(await verifyCredential(credential)).toMatchObject({ kind: 'pass' });
|
|
162
|
-
|
|
163
|
-
// Tamper with the credential.
|
|
164
|
-
credential.parentCredentialIds?.push(PublicKey.random());
|
|
165
|
-
expect(await verifyCredential(credential)).toMatchObject({
|
|
166
|
-
kind: 'fail',
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
|
|
170
145
|
describe('chain', () => {
|
|
171
146
|
test('pass - delegated authority with 1 device', async () => {
|
|
172
147
|
const keyring = new Keyring();
|
|
@@ -14,10 +14,6 @@ export const SIGNATURE_TYPE_ED25519 = 'ED25519Signature';
|
|
|
14
14
|
export type VerificationResult = { kind: 'pass' } | { kind: 'fail'; errors: string[] };
|
|
15
15
|
|
|
16
16
|
export const verifyCredential = async (credential: Credential): Promise<VerificationResult> => {
|
|
17
|
-
if (credential.parentCredentialIds?.length === 0) {
|
|
18
|
-
delete credential.parentCredentialIds;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
17
|
if (!credential.issuer.equals(credential.proof!.signer)) {
|
|
22
18
|
if (!credential.proof!.chain) {
|
|
23
19
|
return {
|
|
@@ -61,7 +57,7 @@ export const verifyCredentialSignature = async (credential: Credential): Promise
|
|
|
61
57
|
};
|
|
62
58
|
|
|
63
59
|
/**
|
|
64
|
-
* Verifies
|
|
60
|
+
* Verifies the the signer has the delegated authority to create credentials on the half of the issuer.
|
|
65
61
|
*/
|
|
66
62
|
export const verifyChain = async (
|
|
67
63
|
chain: Chain,
|
|
@@ -43,7 +43,7 @@ describe('InvitationStateMachine', () => {
|
|
|
43
43
|
|
|
44
44
|
test('multiple invitations', async () => {
|
|
45
45
|
const stateMachine = createStateMachine();
|
|
46
|
-
const invitations = range(3
|
|
46
|
+
const invitations = range(3).map(() => ({ ...baseInvitation, invitationId: PublicKey.random().toHex() }));
|
|
47
47
|
await Promise.all(
|
|
48
48
|
invitations.map(async (invitation) => {
|
|
49
49
|
return stateMachine.process(await delegateInvitation(invitation));
|