@clioplaylists/clio 0.1.5 → 0.1.6
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/api/com/clioplaylists/alpha/actor/getProfile.d.ts +0 -0
- package/dist/api/com/clioplaylists/alpha/actor/getProfile.js +37 -0
- package/dist/api/com/clioplaylists/alpha/feed/getSongs.d.ts +0 -0
- package/dist/api/com/clioplaylists/alpha/feed/getSongs.js +37 -0
- package/dist/api/health.d.ts +3 -0
- package/dist/api/health.js +32 -0
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.js +43 -0
- package/dist/api/util.d.ts +9 -0
- package/dist/api/util.js +17 -0
- package/dist/auth-verifier.d.ts +92 -0
- package/dist/auth-verifier.js +473 -0
- package/dist/client.d.ts +9 -0
- package/dist/client.js +40 -0
- package/dist/config.d.ts +21 -0
- package/dist/config.js +65 -0
- package/dist/context.d.ts +11 -0
- package/dist/context.js +19 -0
- package/dist/dataplane/client.d.ts +27 -0
- package/dist/dataplane/client.js +165 -0
- package/dist/dataplane/index.d.ts +2 -0
- package/dist/dataplane/index.js +18 -0
- package/dist/dataplane/server/background.d.ts +13 -0
- package/dist/dataplane/server/background.js +51 -0
- package/dist/dataplane/server/db/database-schema.d.ts +13 -0
- package/dist/dataplane/server/db/database-schema.js +2 -0
- package/dist/dataplane/server/db/db.d.ts +32 -0
- package/dist/dataplane/server/db/db.js +228 -0
- package/dist/dataplane/server/db/index.d.ts +1 -0
- package/dist/dataplane/server/db/index.js +17 -0
- package/dist/dataplane/server/db/migrations/20230309T045948368Z-init.d.ts +3 -0
- package/dist/dataplane/server/db/migrations/20230309T045948368Z-init.js +117 -0
- package/dist/dataplane/server/db/migrations/20230420T211446071Z-did-cache.d.ts +3 -0
- package/dist/dataplane/server/db/migrations/20230420T211446071Z-did-cache.js +15 -0
- package/dist/dataplane/server/db/migrations/index.d.ts +2 -0
- package/dist/dataplane/server/db/migrations/index.js +41 -0
- package/dist/dataplane/server/db/migrations/provider.d.ts +11 -0
- package/dist/dataplane/server/db/migrations/provider.js +31 -0
- package/dist/dataplane/server/db/pagination.d.ts +86 -0
- package/dist/dataplane/server/db/pagination.js +144 -0
- package/dist/dataplane/server/db/tables/actor-sync.d.ts +9 -0
- package/dist/dataplane/server/db/tables/actor-sync.js +4 -0
- package/dist/dataplane/server/db/tables/actor.d.ts +11 -0
- package/dist/dataplane/server/db/tables/actor.js +4 -0
- package/dist/dataplane/server/db/tables/artist-list-item.d.ts +11 -0
- package/dist/dataplane/server/db/tables/artist-list-item.js +4 -0
- package/dist/dataplane/server/db/tables/artist.d.ts +10 -0
- package/dist/dataplane/server/db/tables/artist.js +4 -0
- package/dist/dataplane/server/db/tables/playlist-idea.d.ts +14 -0
- package/dist/dataplane/server/db/tables/playlist-idea.js +4 -0
- package/dist/dataplane/server/db/tables/playlist-item.d.ts +11 -0
- package/dist/dataplane/server/db/tables/playlist-item.js +4 -0
- package/dist/dataplane/server/db/tables/playlist.d.ts +10 -0
- package/dist/dataplane/server/db/tables/playlist.js +4 -0
- package/dist/dataplane/server/db/tables/profile.d.ts +15 -0
- package/dist/dataplane/server/db/tables/profile.js +4 -0
- package/dist/dataplane/server/db/tables/record.d.ts +12 -0
- package/dist/dataplane/server/db/tables/record.js +4 -0
- package/dist/dataplane/server/db/tables/song.d.ts +12 -0
- package/dist/dataplane/server/db/tables/song.js +4 -0
- package/dist/dataplane/server/db/types.d.ts +9 -0
- package/dist/dataplane/server/db/types.js +2 -0
- package/dist/dataplane/server/db/util.d.ts +20 -0
- package/dist/dataplane/server/db/util.js +48 -0
- package/dist/dataplane/server/index.d.ts +11 -0
- package/dist/dataplane/server/index.js +52 -0
- package/dist/dataplane/server/indexing/index.d.ts +32 -0
- package/dist/dataplane/server/indexing/index.js +321 -0
- package/dist/dataplane/server/indexing/plugins/playlist-idea.d.ts +14 -0
- package/dist/dataplane/server/indexing/plugins/playlist-idea.js +163 -0
- package/dist/dataplane/server/indexing/plugins/profile.d.ts +8 -0
- package/dist/dataplane/server/indexing/plugins/profile.js +81 -0
- package/dist/dataplane/server/indexing/processor.d.ts +22 -0
- package/dist/dataplane/server/indexing/processor.js +90 -0
- package/dist/dataplane/server/routes/identity.d.ts +6 -0
- package/dist/dataplane/server/routes/identity.js +56 -0
- package/dist/dataplane/server/routes/index.d.ts +5 -0
- package/dist/dataplane/server/routes/index.js +19 -0
- package/dist/dataplane/server/routes/profile.d.ts +5 -0
- package/dist/dataplane/server/routes/profile.js +61 -0
- package/dist/dataplane/server/routes/records.d.ts +11 -0
- package/dist/dataplane/server/routes/records.js +88 -0
- package/dist/dataplane/server/routes/sync.d.ts +5 -0
- package/dist/dataplane/server/routes/sync.js +14 -0
- package/dist/dataplane/server/subscription.d.ts +25 -0
- package/dist/dataplane/server/subscription.js +114 -0
- package/dist/error.d.ts +2 -0
- package/dist/error.js +14 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +115 -0
- package/dist/lexicons/index.d.ts +278 -0
- package/dist/lexicons/index.js +638 -0
- package/dist/lexicons/lexicons.d.ts +8466 -0
- package/dist/lexicons/lexicons.js +4551 -0
- package/dist/lexicons/types/com/atproto/admin/defs.d.ts +50 -0
- package/dist/lexicons/types/com/atproto/admin/defs.js +54 -0
- package/dist/lexicons/types/com/atproto/admin/deleteAccount.d.ts +29 -0
- package/dist/lexicons/types/com/atproto/admin/deleteAccount.js +2 -0
- package/dist/lexicons/types/com/atproto/admin/disableAccountInvites.d.ts +31 -0
- package/dist/lexicons/types/com/atproto/admin/disableAccountInvites.js +2 -0
- package/dist/lexicons/types/com/atproto/admin/disableInviteCodes.d.ts +30 -0
- package/dist/lexicons/types/com/atproto/admin/disableInviteCodes.js +2 -0
- package/dist/lexicons/types/com/atproto/admin/enableAccountInvites.d.ts +31 -0
- package/dist/lexicons/types/com/atproto/admin/enableAccountInvites.js +2 -0
- package/dist/lexicons/types/com/atproto/admin/getAccountInfo.d.ts +33 -0
- package/dist/lexicons/types/com/atproto/admin/getAccountInfo.js +2 -0
- package/dist/lexicons/types/com/atproto/admin/getAccountInfos.d.ts +36 -0
- package/dist/lexicons/types/com/atproto/admin/getAccountInfos.js +2 -0
- package/dist/lexicons/types/com/atproto/admin/getInviteCodes.d.ts +39 -0
- package/dist/lexicons/types/com/atproto/admin/getInviteCodes.js +2 -0
- package/dist/lexicons/types/com/atproto/admin/getSubjectStatus.d.ts +44 -0
- package/dist/lexicons/types/com/atproto/admin/getSubjectStatus.js +2 -0
- package/dist/lexicons/types/com/atproto/admin/searchAccounts.d.ts +39 -0
- package/dist/lexicons/types/com/atproto/admin/searchAccounts.js +2 -0
- package/dist/lexicons/types/com/atproto/admin/sendEmail.d.ts +45 -0
- package/dist/lexicons/types/com/atproto/admin/sendEmail.js +2 -0
- package/dist/lexicons/types/com/atproto/admin/updateAccountEmail.d.ts +31 -0
- package/dist/lexicons/types/com/atproto/admin/updateAccountEmail.js +2 -0
- package/dist/lexicons/types/com/atproto/admin/updateAccountHandle.d.ts +30 -0
- package/dist/lexicons/types/com/atproto/admin/updateAccountHandle.js +2 -0
- package/dist/lexicons/types/com/atproto/admin/updateAccountPassword.d.ts +30 -0
- package/dist/lexicons/types/com/atproto/admin/updateAccountPassword.js +2 -0
- package/dist/lexicons/types/com/atproto/admin/updateSubjectStatus.d.ts +51 -0
- package/dist/lexicons/types/com/atproto/admin/updateSubjectStatus.js +2 -0
- package/dist/lexicons/types/com/atproto/identity/defs.d.ts +14 -0
- package/dist/lexicons/types/com/atproto/identity/defs.js +14 -0
- package/dist/lexicons/types/com/atproto/identity/getRecommendedDidCredentials.d.ts +38 -0
- package/dist/lexicons/types/com/atproto/identity/getRecommendedDidCredentials.js +2 -0
- package/dist/lexicons/types/com/atproto/identity/refreshIdentity.d.ts +39 -0
- package/dist/lexicons/types/com/atproto/identity/refreshIdentity.js +2 -0
- package/dist/lexicons/types/com/atproto/identity/requestPlcOperationSignature.d.ts +23 -0
- package/dist/lexicons/types/com/atproto/identity/requestPlcOperationSignature.js +2 -0
- package/dist/lexicons/types/com/atproto/identity/resolveDid.d.ts +38 -0
- package/dist/lexicons/types/com/atproto/identity/resolveDid.js +2 -0
- package/dist/lexicons/types/com/atproto/identity/resolveHandle.d.ts +37 -0
- package/dist/lexicons/types/com/atproto/identity/resolveHandle.js +2 -0
- package/dist/lexicons/types/com/atproto/identity/resolveIdentity.d.ts +35 -0
- package/dist/lexicons/types/com/atproto/identity/resolveIdentity.js +2 -0
- package/dist/lexicons/types/com/atproto/identity/signPlcOperation.d.ts +46 -0
- package/dist/lexicons/types/com/atproto/identity/signPlcOperation.js +2 -0
- package/dist/lexicons/types/com/atproto/identity/submitPlcOperation.d.ts +29 -0
- package/dist/lexicons/types/com/atproto/identity/submitPlcOperation.js +2 -0
- package/dist/lexicons/types/com/atproto/identity/updateHandle.d.ts +30 -0
- package/dist/lexicons/types/com/atproto/identity/updateHandle.js +2 -0
- package/dist/lexicons/types/com/atproto/label/defs.d.ts +73 -0
- package/dist/lexicons/types/com/atproto/label/defs.js +54 -0
- package/dist/lexicons/types/com/atproto/label/queryLabels.d.ts +42 -0
- package/dist/lexicons/types/com/atproto/label/queryLabels.js +2 -0
- package/dist/lexicons/types/com/atproto/label/subscribeLabels.d.ts +38 -0
- package/dist/lexicons/types/com/atproto/label/subscribeLabels.js +24 -0
- package/dist/lexicons/types/com/atproto/lexicon/schema.d.ts +11 -0
- package/dist/lexicons/types/com/atproto/lexicon/schema.js +15 -0
- package/dist/lexicons/types/com/atproto/moderation/createReport.d.ts +57 -0
- package/dist/lexicons/types/com/atproto/moderation/createReport.js +2 -0
- package/dist/lexicons/types/com/atproto/moderation/defs.d.ts +20 -0
- package/dist/lexicons/types/com/atproto/moderation/defs.js +20 -0
- package/dist/lexicons/types/com/atproto/repo/applyWrites.d.ts +98 -0
- package/dist/lexicons/types/com/atproto/repo/applyWrites.js +64 -0
- package/dist/lexicons/types/com/atproto/repo/createRecord.d.ts +56 -0
- package/dist/lexicons/types/com/atproto/repo/createRecord.js +2 -0
- package/dist/lexicons/types/com/atproto/repo/defs.d.ts +11 -0
- package/dist/lexicons/types/com/atproto/repo/defs.js +14 -0
- package/dist/lexicons/types/com/atproto/repo/deleteRecord.d.ts +51 -0
- package/dist/lexicons/types/com/atproto/repo/deleteRecord.js +2 -0
- package/dist/lexicons/types/com/atproto/repo/describeRepo.d.ts +43 -0
- package/dist/lexicons/types/com/atproto/repo/describeRepo.js +2 -0
- package/dist/lexicons/types/com/atproto/repo/getRecord.d.ts +45 -0
- package/dist/lexicons/types/com/atproto/repo/getRecord.js +2 -0
- package/dist/lexicons/types/com/atproto/repo/importRepo.d.ts +27 -0
- package/dist/lexicons/types/com/atproto/repo/importRepo.js +2 -0
- package/dist/lexicons/types/com/atproto/repo/listMissingBlobs.d.ts +45 -0
- package/dist/lexicons/types/com/atproto/repo/listMissingBlobs.js +14 -0
- package/dist/lexicons/types/com/atproto/repo/listRecords.d.ts +53 -0
- package/dist/lexicons/types/com/atproto/repo/listRecords.js +14 -0
- package/dist/lexicons/types/com/atproto/repo/putRecord.d.ts +58 -0
- package/dist/lexicons/types/com/atproto/repo/putRecord.js +2 -0
- package/dist/lexicons/types/com/atproto/repo/strongRef.d.ts +11 -0
- package/dist/lexicons/types/com/atproto/repo/strongRef.js +15 -0
- package/dist/lexicons/types/com/atproto/repo/uploadBlob.d.ts +39 -0
- package/dist/lexicons/types/com/atproto/repo/uploadBlob.js +2 -0
- package/dist/lexicons/types/com/atproto/server/activateAccount.d.ts +23 -0
- package/dist/lexicons/types/com/atproto/server/activateAccount.js +2 -0
- package/dist/lexicons/types/com/atproto/server/checkAccountStatus.d.ts +42 -0
- package/dist/lexicons/types/com/atproto/server/checkAccountStatus.js +2 -0
- package/dist/lexicons/types/com/atproto/server/confirmEmail.d.ts +31 -0
- package/dist/lexicons/types/com/atproto/server/confirmEmail.js +2 -0
- package/dist/lexicons/types/com/atproto/server/createAccount.d.ts +61 -0
- package/dist/lexicons/types/com/atproto/server/createAccount.js +2 -0
- package/dist/lexicons/types/com/atproto/server/createAppPassword.d.ts +51 -0
- package/dist/lexicons/types/com/atproto/server/createAppPassword.js +14 -0
- package/dist/lexicons/types/com/atproto/server/createInviteCode.d.ts +41 -0
- package/dist/lexicons/types/com/atproto/server/createInviteCode.js +2 -0
- package/dist/lexicons/types/com/atproto/server/createInviteCodes.d.ts +50 -0
- package/dist/lexicons/types/com/atproto/server/createInviteCodes.js +14 -0
- package/dist/lexicons/types/com/atproto/server/createSession.d.ts +56 -0
- package/dist/lexicons/types/com/atproto/server/createSession.js +2 -0
- package/dist/lexicons/types/com/atproto/server/deactivateAccount.d.ts +30 -0
- package/dist/lexicons/types/com/atproto/server/deactivateAccount.js +2 -0
- package/dist/lexicons/types/com/atproto/server/defs.d.ts +23 -0
- package/dist/lexicons/types/com/atproto/server/defs.js +24 -0
- package/dist/lexicons/types/com/atproto/server/deleteAccount.d.ts +32 -0
- package/dist/lexicons/types/com/atproto/server/deleteAccount.js +2 -0
- package/dist/lexicons/types/com/atproto/server/deleteSession.d.ts +23 -0
- package/dist/lexicons/types/com/atproto/server/deleteSession.js +2 -0
- package/dist/lexicons/types/com/atproto/server/describeServer.d.ts +56 -0
- package/dist/lexicons/types/com/atproto/server/describeServer.js +24 -0
- package/dist/lexicons/types/com/atproto/server/getAccountInviteCodes.d.ts +39 -0
- package/dist/lexicons/types/com/atproto/server/getAccountInviteCodes.js +2 -0
- package/dist/lexicons/types/com/atproto/server/getServiceAuth.d.ts +41 -0
- package/dist/lexicons/types/com/atproto/server/getServiceAuth.js +2 -0
- package/dist/lexicons/types/com/atproto/server/getSession.d.ts +42 -0
- package/dist/lexicons/types/com/atproto/server/getSession.js +2 -0
- package/dist/lexicons/types/com/atproto/server/listAppPasswords.d.ts +44 -0
- package/dist/lexicons/types/com/atproto/server/listAppPasswords.js +14 -0
- package/dist/lexicons/types/com/atproto/server/refreshSession.d.ts +42 -0
- package/dist/lexicons/types/com/atproto/server/refreshSession.js +2 -0
- package/dist/lexicons/types/com/atproto/server/requestAccountDelete.d.ts +23 -0
- package/dist/lexicons/types/com/atproto/server/requestAccountDelete.js +2 -0
- package/dist/lexicons/types/com/atproto/server/requestEmailConfirmation.d.ts +23 -0
- package/dist/lexicons/types/com/atproto/server/requestEmailConfirmation.js +2 -0
- package/dist/lexicons/types/com/atproto/server/requestEmailUpdate.d.ts +34 -0
- package/dist/lexicons/types/com/atproto/server/requestEmailUpdate.js +2 -0
- package/dist/lexicons/types/com/atproto/server/requestPasswordReset.d.ts +29 -0
- package/dist/lexicons/types/com/atproto/server/requestPasswordReset.js +2 -0
- package/dist/lexicons/types/com/atproto/server/reserveSigningKey.d.ts +42 -0
- package/dist/lexicons/types/com/atproto/server/reserveSigningKey.js +2 -0
- package/dist/lexicons/types/com/atproto/server/resetPassword.d.ts +31 -0
- package/dist/lexicons/types/com/atproto/server/resetPassword.js +2 -0
- package/dist/lexicons/types/com/atproto/server/revokeAppPassword.d.ts +29 -0
- package/dist/lexicons/types/com/atproto/server/revokeAppPassword.js +2 -0
- package/dist/lexicons/types/com/atproto/server/updateEmail.d.ts +33 -0
- package/dist/lexicons/types/com/atproto/server/updateEmail.js +2 -0
- package/dist/lexicons/types/com/atproto/sync/getBlob.d.ts +36 -0
- package/dist/lexicons/types/com/atproto/sync/getBlob.js +2 -0
- package/dist/lexicons/types/com/atproto/sync/getBlocks.d.ts +35 -0
- package/dist/lexicons/types/com/atproto/sync/getBlocks.js +2 -0
- package/dist/lexicons/types/com/atproto/sync/getCheckout.d.ts +33 -0
- package/dist/lexicons/types/com/atproto/sync/getCheckout.js +2 -0
- package/dist/lexicons/types/com/atproto/sync/getHead.d.ts +37 -0
- package/dist/lexicons/types/com/atproto/sync/getHead.js +2 -0
- package/dist/lexicons/types/com/atproto/sync/getLatestCommit.d.ts +38 -0
- package/dist/lexicons/types/com/atproto/sync/getLatestCommit.js +2 -0
- package/dist/lexicons/types/com/atproto/sync/getRecord.d.ts +37 -0
- package/dist/lexicons/types/com/atproto/sync/getRecord.js +2 -0
- package/dist/lexicons/types/com/atproto/sync/getRepo.d.ts +36 -0
- package/dist/lexicons/types/com/atproto/sync/getRepo.js +2 -0
- package/dist/lexicons/types/com/atproto/sync/getRepoStatus.d.ts +42 -0
- package/dist/lexicons/types/com/atproto/sync/getRepoStatus.js +2 -0
- package/dist/lexicons/types/com/atproto/sync/listBlobs.d.ts +42 -0
- package/dist/lexicons/types/com/atproto/sync/listBlobs.js +2 -0
- package/dist/lexicons/types/com/atproto/sync/listRepos.d.ts +50 -0
- package/dist/lexicons/types/com/atproto/sync/listRepos.js +14 -0
- package/dist/lexicons/types/com/atproto/sync/listReposByCollection.d.ts +46 -0
- package/dist/lexicons/types/com/atproto/sync/listReposByCollection.js +14 -0
- package/dist/lexicons/types/com/atproto/sync/notifyOfUpdate.d.ts +30 -0
- package/dist/lexicons/types/com/atproto/sync/notifyOfUpdate.js +2 -0
- package/dist/lexicons/types/com/atproto/sync/requestCrawl.d.ts +30 -0
- package/dist/lexicons/types/com/atproto/sync/requestCrawl.js +2 -0
- package/dist/lexicons/types/com/atproto/sync/subscribeRepos.d.ts +111 -0
- package/dist/lexicons/types/com/atproto/sync/subscribeRepos.js +64 -0
- package/dist/lexicons/types/com/atproto/temp/addReservedHandle.d.ts +39 -0
- package/dist/lexicons/types/com/atproto/temp/addReservedHandle.js +2 -0
- package/dist/lexicons/types/com/atproto/temp/checkSignupQueue.d.ts +36 -0
- package/dist/lexicons/types/com/atproto/temp/checkSignupQueue.js +2 -0
- package/dist/lexicons/types/com/atproto/temp/fetchLabels.d.ts +37 -0
- package/dist/lexicons/types/com/atproto/temp/fetchLabels.js +2 -0
- package/dist/lexicons/types/com/atproto/temp/requestPhoneVerification.d.ts +29 -0
- package/dist/lexicons/types/com/atproto/temp/requestPhoneVerification.js +2 -0
- package/dist/lexicons/types/com/clioplaylists/alpha/actor/profile.d.ts +19 -0
- package/dist/lexicons/types/com/clioplaylists/alpha/actor/profile.js +15 -0
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/defs.d.ts +32 -0
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/defs.js +24 -0
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/getSongs.d.ts +37 -0
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/getSongs.js +2 -0
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/playlistIdea.d.ts +32 -0
- package/dist/lexicons/types/com/clioplaylists/alpha/feed/playlistIdea.js +35 -0
- package/dist/lexicons/util.d.ts +5 -0
- package/dist/lexicons/util.js +13 -0
- package/dist/logger.d.ts +6 -0
- package/dist/logger.js +26 -0
- package/dist/rpc/clio_connect.d.ts +103 -0
- package/dist/rpc/clio_connect.js +110 -0
- package/dist/rpc/clio_pb.d.ts +457 -0
- package/dist/rpc/clio_pb.js +1365 -0
- package/dist/start.d.ts +1 -0
- package/dist/util/retry.d.ts +2 -0
- package/dist/util/retry.js +16 -0
- package/dist/util/uris.d.ts +1 -0
- package/dist/util/uris.js +7 -0
- package/dist/util.d.ts +23 -0
- package/dist/util.js +119 -0
- package/package.json +7 -7
- /package/{start.js → dist/start.js} +0 -0
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.verifySignatureWithKey = exports.createPublicKeyObject = exports.buildBasicAuth = exports.parseBasicAuth = exports.AuthVerifier = exports.RoleStatus = void 0;
|
|
40
|
+
const xrpc_server_1 = require("@atproto/xrpc-server");
|
|
41
|
+
const jose = __importStar(require("jose"));
|
|
42
|
+
const key_encoder_1 = __importDefault(require("key-encoder"));
|
|
43
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
44
|
+
const ui8 = __importStar(require("uint8arrays"));
|
|
45
|
+
// import { GetIdentityByDidResponse } from './proto/bsky_pb'
|
|
46
|
+
const crypto_1 = require("@atproto/crypto");
|
|
47
|
+
var RoleStatus;
|
|
48
|
+
(function (RoleStatus) {
|
|
49
|
+
RoleStatus[RoleStatus["Valid"] = 0] = "Valid";
|
|
50
|
+
RoleStatus[RoleStatus["Invalid"] = 1] = "Invalid";
|
|
51
|
+
RoleStatus[RoleStatus["Missing"] = 2] = "Missing";
|
|
52
|
+
})(RoleStatus || (exports.RoleStatus = RoleStatus = {}));
|
|
53
|
+
const ALLOWED_AUTH_SCOPES = new Set([
|
|
54
|
+
'com.atproto.access',
|
|
55
|
+
'com.atproto.appPass',
|
|
56
|
+
'com.atproto.appPassPrivileged',
|
|
57
|
+
]);
|
|
58
|
+
class AuthVerifier {
|
|
59
|
+
constructor(dataplane, opts) {
|
|
60
|
+
Object.defineProperty(this, "dataplane", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
configurable: true,
|
|
63
|
+
writable: true,
|
|
64
|
+
value: dataplane
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(this, "ownDid", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
configurable: true,
|
|
69
|
+
writable: true,
|
|
70
|
+
value: void 0
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(this, "standardAudienceDids", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true,
|
|
75
|
+
writable: true,
|
|
76
|
+
value: void 0
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(this, "modServiceDid", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
configurable: true,
|
|
81
|
+
writable: true,
|
|
82
|
+
value: void 0
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(this, "adminPasses", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
configurable: true,
|
|
87
|
+
writable: true,
|
|
88
|
+
value: void 0
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(this, "entrywayJwtPublicKey", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
configurable: true,
|
|
93
|
+
writable: true,
|
|
94
|
+
value: void 0
|
|
95
|
+
});
|
|
96
|
+
// verifiers (arrow fns to preserve scope)
|
|
97
|
+
Object.defineProperty(this, "standardOptionalParameterized", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
configurable: true,
|
|
100
|
+
writable: true,
|
|
101
|
+
value: (opts) => async (ctx) => {
|
|
102
|
+
// @TODO remove! basic auth + did supported just for testing.
|
|
103
|
+
if (isBasicToken(ctx.req)) {
|
|
104
|
+
const aud = this.ownDid;
|
|
105
|
+
const iss = ctx.req.headers['appview-as-did'];
|
|
106
|
+
if (typeof iss !== 'string' || !iss.startsWith('did:')) {
|
|
107
|
+
throw new xrpc_server_1.AuthRequiredError('bad issuer');
|
|
108
|
+
}
|
|
109
|
+
if (!this.parseRoleCreds(ctx.req).admin) {
|
|
110
|
+
throw new xrpc_server_1.AuthRequiredError('bad credentials');
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
credentials: { type: 'standard', iss, aud },
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
else if (isBearerToken(ctx.req)) {
|
|
117
|
+
// @NOTE temporarily accept entryway session tokens to shed load from PDS instances
|
|
118
|
+
const token = bearerTokenFromReq(ctx.req);
|
|
119
|
+
const header = token ? jose.decodeProtectedHeader(token) : undefined;
|
|
120
|
+
if (header?.typ === 'at+jwt') {
|
|
121
|
+
// we should never use entryway session tokens in the case of flexible auth audiences (namely in the case of getFeed)
|
|
122
|
+
if (opts.skipAudCheck) {
|
|
123
|
+
throw new xrpc_server_1.AuthRequiredError('Malformed token', 'InvalidToken');
|
|
124
|
+
}
|
|
125
|
+
return this.entrywaySession(ctx);
|
|
126
|
+
}
|
|
127
|
+
// const { iss, aud } = await this.verifyServiceJwt(ctx, {
|
|
128
|
+
// lxmCheck: opts.lxmCheck,
|
|
129
|
+
// iss: null,
|
|
130
|
+
// aud: null,
|
|
131
|
+
// })
|
|
132
|
+
const { aud } = {
|
|
133
|
+
// iss: '',
|
|
134
|
+
aud: '',
|
|
135
|
+
};
|
|
136
|
+
if (!opts.skipAudCheck && !this.standardAudienceDids.has(aud)) {
|
|
137
|
+
throw new xrpc_server_1.AuthRequiredError('jwt audience does not match service did', 'BadJwtAudience');
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
credentials: {
|
|
141
|
+
type: 'standard',
|
|
142
|
+
iss: '',
|
|
143
|
+
aud: '',
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
return this.nullCreds();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
Object.defineProperty(this, "standardOptional", {
|
|
153
|
+
enumerable: true,
|
|
154
|
+
configurable: true,
|
|
155
|
+
writable: true,
|
|
156
|
+
value: this.standardOptionalParameterized({})
|
|
157
|
+
});
|
|
158
|
+
Object.defineProperty(this, "standard", {
|
|
159
|
+
enumerable: true,
|
|
160
|
+
configurable: true,
|
|
161
|
+
writable: true,
|
|
162
|
+
value: async (ctx) => {
|
|
163
|
+
const output = await this.standardOptional(ctx);
|
|
164
|
+
if (output.credentials.type === 'none') {
|
|
165
|
+
throw new xrpc_server_1.AuthRequiredError(undefined, 'AuthMissing');
|
|
166
|
+
}
|
|
167
|
+
return output;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(this, "role", {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
configurable: true,
|
|
173
|
+
writable: true,
|
|
174
|
+
value: (ctx) => {
|
|
175
|
+
const creds = this.parseRoleCreds(ctx.req);
|
|
176
|
+
if (creds.status !== RoleStatus.Valid) {
|
|
177
|
+
throw new xrpc_server_1.AuthRequiredError();
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
credentials: {
|
|
181
|
+
...creds,
|
|
182
|
+
type: 'role',
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
Object.defineProperty(this, "standardOrRole", {
|
|
188
|
+
enumerable: true,
|
|
189
|
+
configurable: true,
|
|
190
|
+
writable: true,
|
|
191
|
+
value: async (ctx) => {
|
|
192
|
+
if (isBearerToken(ctx.req)) {
|
|
193
|
+
return this.standard(ctx);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
return this.role(ctx);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
Object.defineProperty(this, "optionalStandardOrRole", {
|
|
201
|
+
enumerable: true,
|
|
202
|
+
configurable: true,
|
|
203
|
+
writable: true,
|
|
204
|
+
value: async (ctx) => {
|
|
205
|
+
if (isBearerToken(ctx.req)) {
|
|
206
|
+
return await this.standard(ctx);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
const creds = this.parseRoleCreds(ctx.req);
|
|
210
|
+
if (creds.status === RoleStatus.Valid) {
|
|
211
|
+
return {
|
|
212
|
+
credentials: {
|
|
213
|
+
...creds,
|
|
214
|
+
type: 'role',
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
else if (creds.status === RoleStatus.Missing) {
|
|
219
|
+
return this.nullCreds();
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
throw new xrpc_server_1.AuthRequiredError();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
// @NOTE this auth verifier method is not recommended to be implemented by most appviews
|
|
228
|
+
// this is a short term fix to remove proxy load from Bluesky's PDS and in line with possible
|
|
229
|
+
// future plans to have the client talk directly with the appview
|
|
230
|
+
Object.defineProperty(this, "entrywaySession", {
|
|
231
|
+
enumerable: true,
|
|
232
|
+
configurable: true,
|
|
233
|
+
writable: true,
|
|
234
|
+
value: async (reqCtx) => {
|
|
235
|
+
const token = bearerTokenFromReq(reqCtx.req);
|
|
236
|
+
if (!token) {
|
|
237
|
+
throw new xrpc_server_1.AuthRequiredError(undefined, 'AuthMissing');
|
|
238
|
+
}
|
|
239
|
+
// if entryway jwt key not configured then do not parsed these tokens
|
|
240
|
+
if (!this.entrywayJwtPublicKey) {
|
|
241
|
+
throw new xrpc_server_1.AuthRequiredError('Malformed token', 'InvalidToken');
|
|
242
|
+
}
|
|
243
|
+
const res = await jose
|
|
244
|
+
.jwtVerify(token, this.entrywayJwtPublicKey)
|
|
245
|
+
.catch((err) => {
|
|
246
|
+
if (err?.['code'] === 'ERR_JWT_EXPIRED') {
|
|
247
|
+
throw new xrpc_server_1.AuthRequiredError('Token has expired', 'ExpiredToken');
|
|
248
|
+
}
|
|
249
|
+
throw new xrpc_server_1.AuthRequiredError('Token could not be verified', 'InvalidToken');
|
|
250
|
+
});
|
|
251
|
+
const { sub, aud, scope } = res.payload;
|
|
252
|
+
if (typeof sub !== 'string' || !sub.startsWith('did:')) {
|
|
253
|
+
throw new xrpc_server_1.AuthRequiredError('Malformed token', 'InvalidToken');
|
|
254
|
+
}
|
|
255
|
+
else if (typeof aud !== 'string' ||
|
|
256
|
+
!aud.startsWith('did:web:') ||
|
|
257
|
+
!aud.endsWith('.bsky.network')) {
|
|
258
|
+
throw new xrpc_server_1.AuthRequiredError('Bad token aud', 'InvalidToken');
|
|
259
|
+
}
|
|
260
|
+
else if (typeof scope !== 'string' || !ALLOWED_AUTH_SCOPES.has(scope)) {
|
|
261
|
+
throw new xrpc_server_1.AuthRequiredError('Bad token scope', 'InvalidToken');
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
credentials: {
|
|
265
|
+
type: 'standard',
|
|
266
|
+
aud: this.ownDid,
|
|
267
|
+
iss: sub,
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
this.ownDid = opts.ownDid;
|
|
273
|
+
this.standardAudienceDids = new Set([
|
|
274
|
+
opts.ownDid,
|
|
275
|
+
...opts.alternateAudienceDids,
|
|
276
|
+
]);
|
|
277
|
+
this.modServiceDid = opts.modServiceDid;
|
|
278
|
+
this.adminPasses = new Set(opts.adminPasses);
|
|
279
|
+
this.entrywayJwtPublicKey = opts.entrywayJwtPublicKey;
|
|
280
|
+
}
|
|
281
|
+
// modService = async (reqCtx: ReqCtx): Promise<ModServiceOutput> => {
|
|
282
|
+
// const { iss, aud } = await this.verifyServiceJwt(reqCtx, {
|
|
283
|
+
// aud: this.ownDid,
|
|
284
|
+
// iss: [this.modServiceDid, `${this.modServiceDid}#atproto_labeler`],
|
|
285
|
+
// })
|
|
286
|
+
// return { credentials: { type: 'mod_service', aud, iss } }
|
|
287
|
+
// }
|
|
288
|
+
// roleOrModService = async (
|
|
289
|
+
// reqCtx: ReqCtx,
|
|
290
|
+
// ): Promise<RoleOutput | ModServiceOutput> => {
|
|
291
|
+
// if (isBearerToken(reqCtx.req)) {
|
|
292
|
+
// return this.modService(reqCtx)
|
|
293
|
+
// } else {
|
|
294
|
+
// return this.role(reqCtx)
|
|
295
|
+
// }
|
|
296
|
+
// }
|
|
297
|
+
parseRoleCreds(req) {
|
|
298
|
+
const parsed = (0, exports.parseBasicAuth)(req.headers.authorization || '');
|
|
299
|
+
const { Missing, Valid, Invalid } = RoleStatus;
|
|
300
|
+
if (!parsed) {
|
|
301
|
+
return { status: Missing, admin: false, moderator: false, triage: false };
|
|
302
|
+
}
|
|
303
|
+
const { username, password } = parsed;
|
|
304
|
+
if (username === 'admin' && this.adminPasses.has(password)) {
|
|
305
|
+
return { status: Valid, admin: true };
|
|
306
|
+
}
|
|
307
|
+
return { status: Invalid, admin: false };
|
|
308
|
+
}
|
|
309
|
+
// async verifyServiceJwt(
|
|
310
|
+
// reqCtx: ReqCtx,
|
|
311
|
+
// opts: {
|
|
312
|
+
// iss: string[] | null
|
|
313
|
+
// aud: string | null
|
|
314
|
+
// lxmCheck?: (method?: string) => boolean
|
|
315
|
+
// },
|
|
316
|
+
// ) {
|
|
317
|
+
// const getSigningKey = async (
|
|
318
|
+
// iss: string,
|
|
319
|
+
// _forceRefresh: boolean, // @TODO consider propagating to dataplane
|
|
320
|
+
// ): Promise<string> => {
|
|
321
|
+
// if (opts.iss !== null && !opts.iss.includes(iss)) {
|
|
322
|
+
// throw new AuthRequiredError('Untrusted issuer', 'UntrustedIss')
|
|
323
|
+
// }
|
|
324
|
+
// const [did, serviceId] = iss.split('#')
|
|
325
|
+
// const keyId =
|
|
326
|
+
// serviceId === 'atproto_labeler' ? 'atproto_label' : 'atproto'
|
|
327
|
+
// let identity: GetIdentityByDidResponse
|
|
328
|
+
// try {
|
|
329
|
+
// identity = await this.dataplane.getIdentityByDid({ did })
|
|
330
|
+
// } catch (err) {
|
|
331
|
+
// if (isDataplaneError(err, Code.NotFound)) {
|
|
332
|
+
// throw new AuthRequiredError('identity unknown')
|
|
333
|
+
// }
|
|
334
|
+
// throw err
|
|
335
|
+
// }
|
|
336
|
+
// const keys = unpackIdentityKeys(identity.keys)
|
|
337
|
+
// const didKey = getKeyAsDidKey(keys, { id: keyId })
|
|
338
|
+
// if (!didKey) {
|
|
339
|
+
// throw new AuthRequiredError('missing or bad key')
|
|
340
|
+
// }
|
|
341
|
+
// return didKey
|
|
342
|
+
// }
|
|
343
|
+
// const assertLxmCheck = () => {
|
|
344
|
+
// const lxm = parseReqNsid(reqCtx.req)
|
|
345
|
+
// if (
|
|
346
|
+
// (opts.lxmCheck && !opts.lxmCheck(payload.lxm)) ||
|
|
347
|
+
// (!opts.lxmCheck && payload.lxm !== lxm)
|
|
348
|
+
// ) {
|
|
349
|
+
// throw new AuthRequiredError(
|
|
350
|
+
// payload.lxm !== undefined
|
|
351
|
+
// ? `bad jwt lexicon method ("lxm"). must match: ${lxm}`
|
|
352
|
+
// : `missing jwt lexicon method ("lxm"). must match: ${lxm}`,
|
|
353
|
+
// 'BadJwtLexiconMethod',
|
|
354
|
+
// )
|
|
355
|
+
// }
|
|
356
|
+
// }
|
|
357
|
+
// const jwtStr = bearerTokenFromReq(reqCtx.req)
|
|
358
|
+
// if (!jwtStr) {
|
|
359
|
+
// throw new AuthRequiredError('missing jwt', 'MissingJwt')
|
|
360
|
+
// }
|
|
361
|
+
// // if validating additional scopes, skip scope check in initial validation & follow up afterwards
|
|
362
|
+
// const payload = await verifyServiceJwt(
|
|
363
|
+
// jwtStr,
|
|
364
|
+
// opts.aud,
|
|
365
|
+
// null,
|
|
366
|
+
// getSigningKey,
|
|
367
|
+
// verifySignatureWithKey,
|
|
368
|
+
// )
|
|
369
|
+
// if (
|
|
370
|
+
// !payload.iss.endsWith('#atproto_labeler') ||
|
|
371
|
+
// payload.lxm !== undefined
|
|
372
|
+
// ) {
|
|
373
|
+
// // @TODO currently permissive of labelers who dont set lxm yet.
|
|
374
|
+
// // we'll allow ozone self-hosters to upgrade before removing this condition.
|
|
375
|
+
// assertLxmCheck()
|
|
376
|
+
// }
|
|
377
|
+
// return { iss: payload.iss, aud: payload.aud }
|
|
378
|
+
// }
|
|
379
|
+
isModService(iss) {
|
|
380
|
+
return [
|
|
381
|
+
this.modServiceDid,
|
|
382
|
+
`${this.modServiceDid}#atproto_labeler`,
|
|
383
|
+
].includes(iss);
|
|
384
|
+
}
|
|
385
|
+
nullCreds() {
|
|
386
|
+
return {
|
|
387
|
+
credentials: {
|
|
388
|
+
type: 'none',
|
|
389
|
+
iss: null,
|
|
390
|
+
},
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
parseCreds(creds) {
|
|
394
|
+
const viewer = creds.credentials.type === 'standard' ? creds.credentials.iss : null;
|
|
395
|
+
const includeTakedownsAnd3pBlocks = (creds.credentials.type === 'role' && creds.credentials.admin) ||
|
|
396
|
+
creds.credentials.type === 'mod_service' ||
|
|
397
|
+
(creds.credentials.type === 'standard' &&
|
|
398
|
+
this.isModService(creds.credentials.iss));
|
|
399
|
+
const canPerformTakedown = (creds.credentials.type === 'role' && creds.credentials.admin) ||
|
|
400
|
+
creds.credentials.type === 'mod_service';
|
|
401
|
+
return {
|
|
402
|
+
viewer,
|
|
403
|
+
includeTakedowns: includeTakedownsAnd3pBlocks,
|
|
404
|
+
include3pBlocks: includeTakedownsAnd3pBlocks,
|
|
405
|
+
canPerformTakedown,
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
exports.AuthVerifier = AuthVerifier;
|
|
410
|
+
// HELPERS
|
|
411
|
+
// ---------
|
|
412
|
+
const BEARER = 'Bearer ';
|
|
413
|
+
const BASIC = 'Basic ';
|
|
414
|
+
const isBearerToken = (req) => {
|
|
415
|
+
return req.headers.authorization?.startsWith(BEARER) ?? false;
|
|
416
|
+
};
|
|
417
|
+
const isBasicToken = (req) => {
|
|
418
|
+
return req.headers.authorization?.startsWith(BASIC) ?? false;
|
|
419
|
+
};
|
|
420
|
+
const bearerTokenFromReq = (req) => {
|
|
421
|
+
const header = req.headers.authorization || '';
|
|
422
|
+
if (!header.startsWith(BEARER))
|
|
423
|
+
return null;
|
|
424
|
+
return header.slice(BEARER.length).trim();
|
|
425
|
+
};
|
|
426
|
+
const parseBasicAuth = (token) => {
|
|
427
|
+
if (!token.startsWith(BASIC))
|
|
428
|
+
return null;
|
|
429
|
+
const b64 = token.slice(BASIC.length);
|
|
430
|
+
let parsed;
|
|
431
|
+
try {
|
|
432
|
+
parsed = ui8.toString(ui8.fromString(b64, 'base64pad'), 'utf8').split(':');
|
|
433
|
+
}
|
|
434
|
+
catch (err) {
|
|
435
|
+
return null;
|
|
436
|
+
}
|
|
437
|
+
const [username, password] = parsed;
|
|
438
|
+
if (!username || !password)
|
|
439
|
+
return null;
|
|
440
|
+
return { username, password };
|
|
441
|
+
};
|
|
442
|
+
exports.parseBasicAuth = parseBasicAuth;
|
|
443
|
+
const buildBasicAuth = (username, password) => {
|
|
444
|
+
return (BASIC +
|
|
445
|
+
ui8.toString(ui8.fromString(`${username}:${password}`, 'utf8'), 'base64pad'));
|
|
446
|
+
};
|
|
447
|
+
exports.buildBasicAuth = buildBasicAuth;
|
|
448
|
+
const keyEncoder = new key_encoder_1.default('secp256k1');
|
|
449
|
+
const createPublicKeyObject = (publicKeyHex) => {
|
|
450
|
+
const key = keyEncoder.encodePublic(publicKeyHex, 'raw', 'pem');
|
|
451
|
+
return node_crypto_1.default.createPublicKey({ format: 'pem', key });
|
|
452
|
+
};
|
|
453
|
+
exports.createPublicKeyObject = createPublicKeyObject;
|
|
454
|
+
const verifySig = (publicKey, data, sig) => {
|
|
455
|
+
const keyEncoder = new key_encoder_1.default('secp256k1');
|
|
456
|
+
const pemKey = keyEncoder.encodePublic(ui8.toString(publicKey, 'hex'), 'raw', 'pem');
|
|
457
|
+
const key = node_crypto_1.default.createPublicKey({ format: 'pem', key: pemKey });
|
|
458
|
+
return node_crypto_1.default.verify('sha256', data, {
|
|
459
|
+
key,
|
|
460
|
+
dsaEncoding: 'ieee-p1363',
|
|
461
|
+
}, sig);
|
|
462
|
+
};
|
|
463
|
+
const verifySignatureWithKey = async (didKey, msgBytes, sigBytes, alg) => {
|
|
464
|
+
if (alg === crypto_1.SECP256K1_JWT_ALG) {
|
|
465
|
+
const parsed = (0, crypto_1.parseDidKey)(didKey);
|
|
466
|
+
if (alg !== parsed.jwtAlg) {
|
|
467
|
+
throw new Error(`Expected key alg ${alg}, got ${parsed.jwtAlg}`);
|
|
468
|
+
}
|
|
469
|
+
return verifySig(parsed.keyBytes, msgBytes, sigBytes);
|
|
470
|
+
}
|
|
471
|
+
return (0, xrpc_server_1.cryptoVerifySignatureWithKey)(didKey, msgBytes, sigBytes, alg);
|
|
472
|
+
};
|
|
473
|
+
exports.verifySignatureWithKey = verifySignatureWithKey;
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Client } from '@connectrpc/connect';
|
|
2
|
+
import { ClioService } from './rpc/clio_connect';
|
|
3
|
+
export type DataPlaneClient = Client<typeof ClioService>;
|
|
4
|
+
type HttpVersion = '1.1' | '2';
|
|
5
|
+
export declare const createBaseClient: (baseUrl: string, opts: {
|
|
6
|
+
httpVersion?: HttpVersion;
|
|
7
|
+
rejectUnauthorized?: boolean;
|
|
8
|
+
}) => DataPlaneClient;
|
|
9
|
+
export {};
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createBaseClient = void 0;
|
|
7
|
+
const connect_1 = require("@connectrpc/connect");
|
|
8
|
+
const connect_node_1 = require("@connectrpc/connect-node");
|
|
9
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
10
|
+
const clio_connect_1 = require("./rpc/clio_connect");
|
|
11
|
+
const createBaseClient = (baseUrl, opts) => {
|
|
12
|
+
const { httpVersion = '2', rejectUnauthorized = true } = opts;
|
|
13
|
+
const transport = (0, connect_node_1.createGrpcTransport)({
|
|
14
|
+
baseUrl,
|
|
15
|
+
acceptCompression: [],
|
|
16
|
+
httpVersion,
|
|
17
|
+
nodeOptions: { rejectUnauthorized },
|
|
18
|
+
});
|
|
19
|
+
(0, node_assert_1.default)(validateUrl(baseUrl));
|
|
20
|
+
return (0, connect_1.createClient)(clio_connect_1.ClioService, transport);
|
|
21
|
+
};
|
|
22
|
+
exports.createBaseClient = createBaseClient;
|
|
23
|
+
const validateUrl = (urlStr) => {
|
|
24
|
+
let url;
|
|
25
|
+
try {
|
|
26
|
+
url = new URL(urlStr);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
if (!['http:', 'https:'].includes(url.protocol)) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
else if (!url.hostname) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return urlStr;
|
|
39
|
+
}
|
|
40
|
+
};
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ServerConfigValues {
|
|
2
|
+
version?: string;
|
|
3
|
+
debugMode?: boolean;
|
|
4
|
+
port?: number;
|
|
5
|
+
serverDid: string;
|
|
6
|
+
didPlcUrl: string;
|
|
7
|
+
handleResolverNameservers?: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare class ServerConfig {
|
|
10
|
+
private cfg;
|
|
11
|
+
private assignedPort?;
|
|
12
|
+
constructor(cfg: ServerConfigValues);
|
|
13
|
+
static readEnv(overrides?: Partial<ServerConfigValues>): ServerConfig;
|
|
14
|
+
assignPort(port: number): void;
|
|
15
|
+
get version(): string | undefined;
|
|
16
|
+
get debugMode(): boolean;
|
|
17
|
+
get port(): number | undefined;
|
|
18
|
+
get localUrl(): string;
|
|
19
|
+
get serverDid(): string;
|
|
20
|
+
get didPlcUrl(): string;
|
|
21
|
+
}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ServerConfig = void 0;
|
|
7
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
8
|
+
class ServerConfig {
|
|
9
|
+
constructor(cfg) {
|
|
10
|
+
Object.defineProperty(this, "cfg", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: cfg
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "assignedPort", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: void 0
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
static readEnv(overrides) {
|
|
24
|
+
const version = overrides?.version || process.env.CLIO_VERSION || undefined;
|
|
25
|
+
const debugMode = overrides?.debugMode || process.env.NODE_ENV !== 'production';
|
|
26
|
+
const serverDid = overrides?.serverDid || process.env.CLIO_SERVER_DID || 'did:example:test';
|
|
27
|
+
const didPlcUrl = overrides?.didPlcUrl || process.env.DID_PLC_URL || 'http://localhost:2582';
|
|
28
|
+
// const handleResolverNameservers = process.env.BSKY_HANDLE_RESOLVER_NAMESERVERS
|
|
29
|
+
// ? process.env.BSKY_HANDLE_RESOLVER_NAMESERVERS.split(',')
|
|
30
|
+
// : []
|
|
31
|
+
const envPort = overrides?.port || parseInt(process.env.CLIO_PORT || '', 10);
|
|
32
|
+
const port = isNaN(envPort) ? 2635 : envPort;
|
|
33
|
+
return new ServerConfig({
|
|
34
|
+
version,
|
|
35
|
+
debugMode,
|
|
36
|
+
port,
|
|
37
|
+
serverDid,
|
|
38
|
+
didPlcUrl,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
assignPort(port) {
|
|
42
|
+
(0, node_assert_1.default)(!this.cfg.port || this.cfg.port === port, 'Conflicting port in config');
|
|
43
|
+
this.assignedPort = port;
|
|
44
|
+
}
|
|
45
|
+
get version() {
|
|
46
|
+
return this.cfg.version;
|
|
47
|
+
}
|
|
48
|
+
get debugMode() {
|
|
49
|
+
return !!this.cfg.debugMode;
|
|
50
|
+
}
|
|
51
|
+
get port() {
|
|
52
|
+
return this.assignedPort || this.cfg.port;
|
|
53
|
+
}
|
|
54
|
+
get localUrl() {
|
|
55
|
+
(0, node_assert_1.default)(this.port, 'No port assigned');
|
|
56
|
+
return `http://localhost:${this.port}`;
|
|
57
|
+
}
|
|
58
|
+
get serverDid() {
|
|
59
|
+
return this.cfg.serverDid;
|
|
60
|
+
}
|
|
61
|
+
get didPlcUrl() {
|
|
62
|
+
return this.cfg.didPlcUrl;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.ServerConfig = ServerConfig;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DataPlaneClient } from './client';
|
|
2
|
+
import { ServerConfig } from './config';
|
|
3
|
+
export default class AppContext {
|
|
4
|
+
private opts;
|
|
5
|
+
constructor(opts: {
|
|
6
|
+
cfg: ServerConfig;
|
|
7
|
+
dataplane: DataPlaneClient;
|
|
8
|
+
});
|
|
9
|
+
get cfg(): ServerConfig;
|
|
10
|
+
get dataplane(): DataPlaneClient;
|
|
11
|
+
}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class AppContext {
|
|
4
|
+
constructor(opts) {
|
|
5
|
+
Object.defineProperty(this, "opts", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true,
|
|
9
|
+
value: opts
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
get cfg() {
|
|
13
|
+
return this.opts.cfg;
|
|
14
|
+
}
|
|
15
|
+
get dataplane() {
|
|
16
|
+
return this.opts.dataplane;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.default = AppContext;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Client, Code, ConnectError } from '@connectrpc/connect';
|
|
2
|
+
import { ClioService } from '../rpc/clio_connect';
|
|
3
|
+
export type DataPlaneClient = Client<typeof ClioService>;
|
|
4
|
+
type HttpVersion = '1.1' | '2';
|
|
5
|
+
export declare const createDataPlaneClient: (baseUrls: string[], opts: {
|
|
6
|
+
httpVersion?: HttpVersion;
|
|
7
|
+
rejectUnauthorized?: boolean;
|
|
8
|
+
}) => DataPlaneClient;
|
|
9
|
+
export { Code };
|
|
10
|
+
export declare const isDataplaneError: (err: unknown, code?: Code) => err is ConnectError;
|
|
11
|
+
export declare const unpackIdentityServices: (servicesBytes: Uint8Array) => UnpackedServices;
|
|
12
|
+
export declare const unpackIdentityKeys: (keysBytes: Uint8Array) => UnpackedKeys;
|
|
13
|
+
export declare const getServiceEndpoint: (services: UnpackedServices, opts: {
|
|
14
|
+
id: string;
|
|
15
|
+
type: string;
|
|
16
|
+
}) => string | undefined;
|
|
17
|
+
export declare const getKeyAsDidKey: (keys: UnpackedKeys, opts: {
|
|
18
|
+
id: string;
|
|
19
|
+
}) => string | undefined;
|
|
20
|
+
type UnpackedServices = Record<string, {
|
|
21
|
+
Type: string;
|
|
22
|
+
URL: string;
|
|
23
|
+
}>;
|
|
24
|
+
type UnpackedKeys = Record<string, {
|
|
25
|
+
Type: string;
|
|
26
|
+
PublicKeyMultibase: string;
|
|
27
|
+
}>;
|