@dxos/credentials 0.5.0 → 0.5.1-main.0ba1ecb

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.
Files changed (34) hide show
  1. package/dist/lib/browser/index.mjs +755 -167
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +729 -144
  5. package/dist/lib/node/index.cjs.map +4 -4
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/types/src/credentials/credential-factory.d.ts +3 -1
  8. package/dist/types/src/credentials/credential-factory.d.ts.map +1 -1
  9. package/dist/types/src/credentials/credential-generator.d.ts +18 -2
  10. package/dist/types/src/credentials/credential-generator.d.ts.map +1 -1
  11. package/dist/types/src/credentials/signing.d.ts.map +1 -1
  12. package/dist/types/src/credentials/verifier.d.ts +1 -1
  13. package/dist/types/src/credentials/verifier.d.ts.map +1 -1
  14. package/dist/types/src/graph/credential-graph.d.ts +152 -0
  15. package/dist/types/src/graph/credential-graph.d.ts.map +1 -0
  16. package/dist/types/src/state-machine/member-state-machine.d.ts +17 -12
  17. package/dist/types/src/state-machine/member-state-machine.d.ts.map +1 -1
  18. package/dist/types/src/state-machine/member-state-machine.test.d.ts +2 -0
  19. package/dist/types/src/state-machine/member-state-machine.test.d.ts.map +1 -0
  20. package/dist/types/src/state-machine/space-state-machine.d.ts +3 -3
  21. package/dist/types/src/state-machine/space-state-machine.d.ts.map +1 -1
  22. package/package.json +16 -16
  23. package/project.json +3 -0
  24. package/src/credentials/credential-factory.ts +9 -1
  25. package/src/credentials/credential-generator.ts +35 -2
  26. package/src/credentials/signing.ts +1 -0
  27. package/src/credentials/verifier.test.ts +25 -0
  28. package/src/credentials/verifier.ts +5 -1
  29. package/src/graph/credential-graph.ts +557 -0
  30. package/src/state-machine/invitation-state-machine.test.ts +1 -1
  31. package/src/state-machine/member-state-machine.test.ts +580 -0
  32. package/src/state-machine/member-state-machine.ts +111 -53
  33. package/src/state-machine/space-state-machine.test.ts +20 -16
  34. package/src/state-machine/space-state-machine.ts +12 -33
@@ -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":10466,"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":21633,"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":74778},"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","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":5177},"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":38518}}}
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}}}
@@ -6,6 +6,7 @@ export type CreateCredentialSignerParams = {
6
6
  subject: PublicKey;
7
7
  assertion: TypedMessage;
8
8
  nonce?: Uint8Array;
9
+ parentCredentialIds?: PublicKey[];
9
10
  };
10
11
  export type CreateCredentialParams = {
11
12
  signer: Signer;
@@ -15,11 +16,12 @@ export type CreateCredentialParams = {
15
16
  subject: PublicKey;
16
17
  assertion: TypedMessage;
17
18
  nonce?: Uint8Array;
19
+ parentCredentialIds?: PublicKey[];
18
20
  };
19
21
  /**
20
22
  * Construct a signed credential message.
21
23
  */
22
- export declare const createCredential: ({ signer, issuer, subject, assertion, signingKey, chain, nonce, }: CreateCredentialParams) => Promise<Credential>;
24
+ export declare const createCredential: ({ signer, issuer, subject, assertion, signingKey, chain, nonce, parentCredentialIds, }: CreateCredentialParams) => Promise<Credential>;
23
25
  export declare const createCredentialMessage: (credential: Credential) => {
24
26
  '@type': string;
25
27
  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,CAAC;AACvC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAK1F,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,SAAS,CAAC;IACnB,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,CAAC;IAGvB,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd,OAAO,EAAE,SAAS,CAAC;IACnB,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,sEAQ1B,sBAAsB,KAAG,QAAQ,UAAU,CAmC7C,CAAC;AAGF,eAAO,MAAM,uBAAuB,eAAgB,UAAU;;;CAK7D,CAAC;AAGF,MAAM,WAAW,gBAAgB;IAC/B,SAAS,IAAI,SAAS,CAAC;IACvB,gBAAgB,EAAE,CAAC,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"}
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,CAAC;AACvC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAK1F,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,SAAS,CAAC;IACnB,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,mBAAmB,CAAC,EAAE,SAAS,EAAE,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,CAAC;IAGvB,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd,OAAO,EAAE,SAAS,CAAC;IACnB,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,mBAAmB,CAAC,EAAE,SAAS,EAAE,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,2FAS1B,sBAAsB,KAAG,QAAQ,UAAU,CAuC7C,CAAC;AAGF,eAAO,MAAM,uBAAuB,eAAgB,UAAU;;;CAK7D,CAAC;AAGF,MAAM,WAAW,gBAAgB;IAC/B,SAAS,IAAI,SAAS,CAAC;IACvB,gBAAgB,EAAE,CAAC,MAAM,EAAE,4BAA4B,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACjF;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B,WAAY,MAAM,UAAU,SAAS,KAAG,gBAWhF,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 } from '@dxos/protocols/proto/dxos/halo/credentials';
5
+ import { AdmittedFeed, type Credential, type DeviceProfileDocument, type ProfileDocument, SpaceMember } 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,6 +38,22 @@ 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
- export declare const createAdmissionCredentials: (signer: CredentialSigner, identityKey: PublicKey, spaceKey: PublicKey, genesisFeedKey: PublicKey, profile?: ProfileDocument, invitationCredentialId?: PublicKey) => Promise<FeedMessage.Payload[]>;
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[]>;
42
52
  export declare const createDelegatedSpaceInvitationCredential: (signer: CredentialSigner, subject: PublicKey, invitation: DelegateSpaceInvitation) => Promise<FeedMessage.Payload>;
53
+ /**
54
+ * @param signer - credential issuer.
55
+ * @param subject - key of the space the invitation was for.
56
+ * @param invitationCredentialId id of a dxos.halo.invitations.DelegateSpaceInvitation credential.
57
+ */
58
+ export declare const createCancelDelegatedSpaceInvitationCredential: (signer: CredentialSigner, subject: PublicKey, invitationCredentialId: PublicKey) => Promise<FeedMessage.Payload>;
43
59
  //# sourceMappingURL=credential-generator.d.ts.map
@@ -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,EAErB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAG3F,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAK/E;;GAEG;AACH,qBAAa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAFV,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,SAAS,EACvB,UAAU,EAAE,SAAS;IAGxC;;OAEG;IACG,kBAAkB,CACtB,QAAQ,EAAE,SAAS,EACnB,UAAU,EAAE,SAAS,EACrB,cAAc,CAAC,EAAE,eAAe,GAC/B,OAAO,CAAC,UAAU,EAAE,CAAC;IA6BxB;;;OAGG;IAEG,sBAAsB,CAC1B,QAAQ,EAAE,SAAS,EACnB,WAAW,EAAE,SAAS,EACtB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,SAAS,EACrB,OAAO,EAAE,SAAS,EAClB,cAAc,EAAE,SAAS,GACxB,OAAO,CAAC,UAAU,EAAE,CAAC;IAmBxB;;OAEG;IAEG,yBAAyB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;IAa1E;;OAEG;IACG,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC;IAY9E;;OAEG;IACG,mBAAmB,CACvB,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,SAAS,EAClB,WAAW,EAAE,YAAY,CAAC,WAAW,GACpC,OAAO,CAAC,UAAU,CAAC;IAehB,uBAAuB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IAYtE,qBAAqB,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;CAYtE;AAGD,eAAO,MAAM,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"}
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,EACpB,WAAW,EACZ,MAAM,6CAA6C,CAAC;A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,YAAY,EAAE,CAgBxB,CAAC;AAGF;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,WAC7B,gBAAgB,eACX,SAAS,YACZ,SAAS,kBACH,SAAS,SACnB,YAAY,IAAI,yBACA,SAAS,EAAE,YACvB,eAAe,2BACA,SAAS,KACjC,QAAQ,YAAY,OAAO,EAAE,CAmB/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"}
@@ -1 +1 @@
1
- {"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../../../src/credentials/signing.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAI9E;;GAEG;AACH,eAAO,MAAM,yBAAyB,eAAgB,UAAU,KAAG,UAYlE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,QAAS,GAAG,WA8CvC,CAAC;AAUL;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG"}
1
+ {"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../../../src/credentials/signing.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAI9E;;GAEG;AAEH,eAAO,MAAM,yBAAyB,eAAgB,UAAU,KAAG,UAYlE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,QAAS,GAAG,WA8CvC,CAAC;AAUL;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG"}
@@ -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 the the signer has the delegated authority to create credentials on the half of the issuer.
17
+ * Verifies that the signer has the delegated authority to create credentials on behalf 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,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
+ {"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,CAyBzF,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"}
@@ -0,0 +1,152 @@
1
+ import { PublicKey } from '@dxos/keys';
2
+ import { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
3
+ import { type AsyncCallback, Callback, ComplexMap, ComplexSet } from '@dxos/util';
4
+ export declare class CredentialGraph<A, State> {
5
+ private readonly _stateHandler;
6
+ /**
7
+ * Local ids are used during traversals.
8
+ */
9
+ private _vertexIdGenerator;
10
+ /**
11
+ * All credentials without parent references are connected to the root.
12
+ */
13
+ private _root;
14
+ /**
15
+ * A credential which is not a parent of any other credential has the sentinel as a child.
16
+ * Sentinel is a virtual merge-point of all credentials.
17
+ */
18
+ private _sentinel;
19
+ /**
20
+ * Vertex references are used for fast credential inserts into the graph.
21
+ */
22
+ private _vertexByCredentialId;
23
+ /**
24
+ * The current state of the graph.
25
+ */
26
+ private _subjectToVertex;
27
+ private _subjectToState;
28
+ onSubjectStateChanged: Callback<AsyncCallback<State[]>>;
29
+ constructor(_stateHandler: CredentialGraphStateHandler<A, State>);
30
+ getSubjectState(subjectId: PublicKey): State | undefined;
31
+ getState(): ReadonlyMap<PublicKey, State>;
32
+ getLeafIds(): PublicKey[];
33
+ getGlobalStateScope(): StateScope<A>;
34
+ addVertex(credential: Credential, assertion: A): Promise<void>;
35
+ private _removeSentinelConnection;
36
+ private _onVertexInserted;
37
+ /**
38
+ * DFS the graph from root to sentinel pausing on merge points (nodes with multiple parents).
39
+ * Continue after all paths leading to a merge point converge by merging their states.
40
+ * In case of a concurrent update paths are replayed taking into account the state set
41
+ * by the winning branch.
42
+ */
43
+ private _recomputeState;
44
+ private _replayFailedPaths;
45
+ private _handleMergePoint;
46
+ private _updatePathState;
47
+ private _forkTraversal;
48
+ /**
49
+ * Updates the current graph state.
50
+ * @returns changed states.
51
+ */
52
+ private _setCurrentState;
53
+ private _leastCommonAncestor;
54
+ /**
55
+ * We might be merging paths where some of them had fork points after the initial forking.
56
+ * We need all the paths to point to the least common fork point and contain all the changes
57
+ * that happened after it.
58
+ */
59
+ private _moveUpToForkPoint;
60
+ private _mergePaths;
61
+ /**
62
+ * A candidate credential is preferred over the existing credential if:
63
+ * 1. It is the merge-point, because it's the last credential that was issued in awareness of all
64
+ * the previously existing ones.
65
+ * 2. A path where candidate was set contains existing credential in it, which means that the candidate
66
+ * was issued after the existing credential by a legitimate issuer.
67
+ * 3. A state-specific logic (_stateHandler) is able to justify using the candidate credential.
68
+ * 4. The path where candidate was set has more issuers than the existing path (longer branch).
69
+ * 5. The issuance time of the candidate is after the issuance time of the existing credential (LWW).
70
+ */
71
+ private _shouldOverrideCredential;
72
+ private _createRootPath;
73
+ }
74
+ export interface StateScope<A> {
75
+ head?: {
76
+ id: number;
77
+ };
78
+ state: ReadonlyMap<PublicKey, ChainVertex<A>>;
79
+ stateOverrides?: ReadonlyMap<PublicKey, ChainVertex<A>>;
80
+ }
81
+ export interface CredentialGraphStateHandler<Assertion, State> {
82
+ hasStateChanged(s1?: State, s2?: State): boolean;
83
+ createState(credential: Credential, assertion: Assertion): State;
84
+ isUpdateAllowed: (scope: StateScope<Assertion>, update: Credential, assertion: Assertion) => boolean;
85
+ getConflictingPaths(paths: PathState<Assertion>[], update: ChainVertex<Assertion>): PathState<Assertion>[];
86
+ tryPickWinningUpdate(scope1: StateScope<Assertion>, update1: Credential, scope2: StateScope<Assertion>, update2: Credential): Credential | null;
87
+ toLogString(assertion: Assertion): string;
88
+ }
89
+ export interface PathState<A> {
90
+ /**
91
+ * The current vertex position in path, always advances.
92
+ */
93
+ head: ChainVertex<A>;
94
+ /**
95
+ * Subject info local to the current path.
96
+ */
97
+ state: ComplexMap<PublicKey, ChainVertex<A>>;
98
+ /**
99
+ * Used during path replay to throw away cascading concurrent modifications.
100
+ * Overrides pathState.
101
+ */
102
+ stateOverrides?: ComplexMap<PublicKey, ChainVertex<A>>;
103
+ /**
104
+ * Used to faster search of conflicting branches. Is different from pathState.keys()
105
+ * because pathState is not reset on forks.
106
+ */
107
+ forkChangedSubjects: ComplexSet<PublicKey>;
108
+ /**
109
+ * Used to find winning branches. A branch wins if it had more participants.
110
+ * Ties are broken using credential issuance date.
111
+ */
112
+ forkIssuers: ComplexSet<PublicKey>;
113
+ /**
114
+ * All the credentials processed during this path traversal.
115
+ */
116
+ credentials: ComplexSet<PublicKey>;
117
+ /**
118
+ * PathState where we had multiple children in the current vertex.
119
+ * Will be merged with child branches when they converge.
120
+ */
121
+ forkPoint?: PathState<A>;
122
+ /**
123
+ * Used for a particular path replay with stateOverrides for conflict resolution
124
+ * forkVertexId is mapped to child vertex selection.
125
+ * Contains choices that lead to the current state. Value is an array when
126
+ * some branches converged before converging with the remaining branches.
127
+ */
128
+ chosenPath: {
129
+ [forkVertexId: number]: ChainVertex<A>[];
130
+ };
131
+ }
132
+ export interface ChainVertex<Assertion> {
133
+ /**
134
+ * The field is missing on root and sentinel vertices. Assertion is not undefined to avoid
135
+ * always asserting two fields.
136
+ */
137
+ credential?: Credential;
138
+ assertion: Assertion;
139
+ /**
140
+ * Local incrementing counter used to form paths. Is used only for causality resolution.
141
+ */
142
+ id: number;
143
+ /**
144
+ * Parents references are used to handle divergent branch merge-points.
145
+ */
146
+ parents: ChainVertex<Assertion>[];
147
+ /**
148
+ * Child references are traversed when computing the current state.
149
+ */
150
+ children: ChainVertex<Assertion>[];
151
+ }
152
+ //# sourceMappingURL=credential-graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-graph.d.ts","sourceRoot":"","sources":["../../../../src/graph/credential-graph.ts"],"names":[],"mappings":"AAK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,UAAU,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C;;;OAGG;IACH,cAAc,CAAC,EAAE,UAAU,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD;;;OAGG;IACH,mBAAmB,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAC3C;;;OAGG;IACH,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACnC;;OAEG;IACH,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACnC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACzB;;;;;OAKG;IACH,UAAU,EAAE;QAAE,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,CAAA;KAAE,CAAC;CAC1D;AAED,MAAM,WAAW,WAAW,CAAC,SAAS;IACpC;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;IAClC;;OAEG;IACH,QAAQ,EAAE,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;CACpC"}
@@ -1,34 +1,39 @@
1
1
  import { PublicKey } from '@dxos/keys';
2
- import { type Credential, type SpaceMember, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
3
- import { type AsyncCallback, Callback } from '@dxos/util';
2
+ import { type Credential, SpaceMember, type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
3
+ import { type ChainVertex, type CredentialGraphStateHandler, type PathState, type StateScope } from '../graph/credential-graph';
4
4
  export interface MemberInfo {
5
5
  key: PublicKey;
6
+ role: SpaceMember.Role;
6
7
  credential: Credential;
7
8
  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 implements CredentialGraphStateHandler<SpaceMember, MemberInfo> {
16
16
  private readonly _spaceKey;
17
- private _creator;
18
- /**
19
- * Member IDENTITY key => info
20
- */
21
- private _members;
22
- readonly onMemberAdmitted: Callback<AsyncCallback<MemberInfo>>;
17
+ private _ownerKey;
18
+ private _memberProfiles;
19
+ private _hashgraph;
20
+ readonly onMemberRoleChanged: import("@dxos/util").Callback<import("@dxos/util").AsyncCallback<MemberInfo[]>>;
23
21
  constructor(_spaceKey: PublicKey);
24
22
  get creator(): MemberInfo | undefined;
25
23
  get members(): ReadonlyMap<PublicKey, MemberInfo>;
26
- getRole(member: PublicKey): SpaceMember.Role | undefined;
24
+ get membershipChainHeads(): PublicKey[];
25
+ getRole(member: PublicKey): SpaceMember.Role;
27
26
  /**
28
27
  * Processes the SpaceMember credential.
29
28
  * Assumes the credential is already pre-verified and the issuer has been authorized to issue credentials of this type.
30
29
  */
31
30
  process(credential: Credential): Promise<void>;
32
- onRevoked(revoked: Credential, revocation: Credential): Promise<void>;
31
+ createState(credential: Credential, assertion: SpaceMember): MemberInfo;
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;
33
38
  }
34
39
  //# 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,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"}
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;AAIjH,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,2BAA2B,EAChC,KAAK,SAAS,EACd,K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B,OAAO,EAAE,UAAU,GAClB,UAAU,GAAG,IAAI;IAUb,WAAW,CAAC,SAAS,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM;IAKvD,eAAe,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO;IAIjE,OAAO,CAAC,QAAQ;CAkBjB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=member-state-machine.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"member-state-machine.test.d.ts","sourceRoot":"","sources":["../../../../src/state-machine/member-state-machine.test.ts"],"names":[],"mappings":""}
@@ -8,6 +8,7 @@ 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[];
11
12
  readonly feeds: ReadonlyMap<PublicKey, FeedInfo>;
12
13
  readonly credentials: Credential[];
13
14
  readonly genesisCredential: Credential | undefined;
@@ -42,13 +43,14 @@ export declare class SpaceStateMachine implements SpaceState {
42
43
  private _genesisCredential;
43
44
  private _credentialProcessors;
44
45
  readonly onCredentialProcessed: Callback<AsyncCallback<Credential>>;
45
- readonly onMemberAdmitted: Callback<AsyncCallback<MemberInfo>>;
46
+ readonly onMemberRoleChanged: Callback<AsyncCallback<MemberInfo[]>>;
46
47
  readonly onFeedAdmitted: Callback<AsyncCallback<FeedInfo>>;
47
48
  readonly onDelegatedInvitation: Callback<AsyncCallback<import("./invitation-state-machine").DelegateInvitationCredential>>;
48
49
  readonly onDelegatedInvitationRemoved: Callback<AsyncCallback<import("./invitation-state-machine").DelegateInvitationCredential>>;
49
50
  constructor(_spaceKey: PublicKey);
50
51
  get creator(): MemberInfo | undefined;
51
52
  get members(): ReadonlyMap<PublicKey, MemberInfo>;
53
+ get membershipChainHeads(): PublicKey[];
52
54
  get feeds(): ReadonlyMap<PublicKey, FeedInfo>;
53
55
  get credentials(): Credential[];
54
56
  get credentialEntries(): CredentialEntry[];
@@ -64,7 +66,5 @@ export declare class SpaceStateMachine implements SpaceState {
64
66
  process(credential: Credential, { sourceFeed, skipVerification }: ProcessOptions): Promise<boolean>;
65
67
  private _canInviteNewMembers;
66
68
  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,KAAK,EAAE,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACjD,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,CAAC;IACnC,QAAQ,CAAC,iBAAiB,EAAE,UAAU,GAAG,SAAS,CAAC;IACnD,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,W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GED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/credentials",
3
- "version": "0.5.0",
3
+ "version": "0.5.1-main.0ba1ecb",
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/codec-protobuf": "0.5.0",
29
- "@dxos/context": "0.5.0",
30
- "@dxos/crypto": "0.5.0",
31
- "@dxos/async": "0.5.0",
32
- "@dxos/debug": "0.5.0",
33
- "@dxos/feed-store": "0.5.0",
34
- "@dxos/keyring": "0.5.0",
35
- "@dxos/invariant": "0.5.0",
36
- "@dxos/keys": "0.5.0",
37
- "@dxos/node-std": "0.5.0",
38
- "@dxos/protocols": "0.5.0",
39
- "@dxos/log": "0.5.0",
40
- "@dxos/timeframe": "0.5.0",
41
- "@dxos/util": "0.5.0"
28
+ "@dxos/codec-protobuf": "0.5.1-main.0ba1ecb",
29
+ "@dxos/async": "0.5.1-main.0ba1ecb",
30
+ "@dxos/crypto": "0.5.1-main.0ba1ecb",
31
+ "@dxos/context": "0.5.1-main.0ba1ecb",
32
+ "@dxos/feed-store": "0.5.1-main.0ba1ecb",
33
+ "@dxos/keyring": "0.5.1-main.0ba1ecb",
34
+ "@dxos/debug": "0.5.1-main.0ba1ecb",
35
+ "@dxos/keys": "0.5.1-main.0ba1ecb",
36
+ "@dxos/invariant": "0.5.1-main.0ba1ecb",
37
+ "@dxos/log": "0.5.1-main.0ba1ecb",
38
+ "@dxos/node-std": "0.5.1-main.0ba1ecb",
39
+ "@dxos/protocols": "0.5.1-main.0ba1ecb",
40
+ "@dxos/timeframe": "0.5.1-main.0ba1ecb",
41
+ "@dxos/util": "0.5.1-main.0ba1ecb"
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.0"
53
+ "@dxos/random-access-storage": "0.5.1-main.0ba1ecb"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"
package/project.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "$schema": "../../../../node_modules/nx/schemas/project-schema.json",
3
3
  "name": "credentials",
4
+ "tags": [
5
+ "scope:halo"
6
+ ],
4
7
  "sourceRoot": "packages/core/halo/credentials/src",
5
8
  "projectType": "library",
6
9
  "targets": {
@@ -15,6 +15,7 @@ export type CreateCredentialSignerParams = {
15
15
  subject: PublicKey;
16
16
  assertion: TypedMessage;
17
17
  nonce?: Uint8Array;
18
+ parentCredentialIds?: PublicKey[];
18
19
  };
19
20
 
20
21
  export type CreateCredentialParams = {
@@ -28,6 +29,7 @@ export type CreateCredentialParams = {
28
29
  subject: PublicKey;
29
30
  assertion: TypedMessage;
30
31
  nonce?: Uint8Array;
32
+ parentCredentialIds?: PublicKey[];
31
33
  };
32
34
 
33
35
  /**
@@ -41,6 +43,7 @@ export const createCredential = async ({
41
43
  signingKey,
42
44
  chain,
43
45
  nonce,
46
+ parentCredentialIds,
44
47
  }: CreateCredentialParams): Promise<Credential> => {
45
48
  invariant(assertion['@type'], 'Invalid assertion.');
46
49
  invariant(!!signingKey === !!chain, 'Chain must be provided if and only if the signing key differs from the issuer.');
@@ -66,6 +69,10 @@ export const createCredential = async ({
66
69
  },
67
70
  };
68
71
 
72
+ if ((parentCredentialIds?.length ?? 0) > 0) {
73
+ credential.parentCredentialIds = parentCredentialIds;
74
+ }
75
+
69
76
  // Set proof after creating signature.
70
77
  const signedPayload = getCredentialProofPayload(credential);
71
78
  credential.proof!.value = await signer.sign(signingKey ?? issuer, signedPayload);
@@ -97,13 +104,14 @@ export interface CredentialSigner {
97
104
  */
98
105
  export const createCredentialSignerWithKey = (signer: Signer, issuer: PublicKey): CredentialSigner => ({
99
106
  getIssuer: () => issuer,
100
- createCredential: ({ subject, assertion, nonce }) =>
107
+ createCredential: ({ subject, assertion, nonce, parentCredentialIds }) =>
101
108
  createCredential({
102
109
  signer,
103
110
  issuer,
104
111
  subject,
105
112
  assertion,
106
113
  nonce,
114
+ parentCredentialIds,
107
115
  }),
108
116
  });
109
117