@atproto/bsky 0.0.171 → 0.0.173

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 (64) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/api/app/bsky/notification/registerPush.d.ts.map +1 -1
  3. package/dist/api/app/bsky/notification/registerPush.js +6 -7
  4. package/dist/api/app/bsky/notification/registerPush.js.map +1 -1
  5. package/dist/api/app/bsky/notification/unregisterPush.d.ts +4 -0
  6. package/dist/api/app/bsky/notification/unregisterPush.d.ts.map +1 -0
  7. package/dist/api/app/bsky/notification/unregisterPush.js +33 -0
  8. package/dist/api/app/bsky/notification/unregisterPush.js.map +1 -0
  9. package/dist/api/app/bsky/notification/util.d.ts +4 -0
  10. package/dist/api/app/bsky/notification/util.d.ts.map +1 -1
  11. package/dist/api/app/bsky/notification/util.js +14 -1
  12. package/dist/api/app/bsky/notification/util.js.map +1 -1
  13. package/dist/api/app/bsky/unspecced/initAgeAssurance.d.ts.map +1 -1
  14. package/dist/api/app/bsky/unspecced/initAgeAssurance.js +52 -10
  15. package/dist/api/app/bsky/unspecced/initAgeAssurance.js.map +1 -1
  16. package/dist/config.js +1 -1
  17. package/dist/config.js.map +1 -1
  18. package/dist/kws.d.ts +2 -0
  19. package/dist/kws.d.ts.map +1 -1
  20. package/dist/kws.js +10 -2
  21. package/dist/kws.js.map +1 -1
  22. package/dist/lexicon/index.d.ts +2 -0
  23. package/dist/lexicon/index.d.ts.map +1 -1
  24. package/dist/lexicon/index.js +4 -0
  25. package/dist/lexicon/index.js.map +1 -1
  26. package/dist/lexicon/lexicons.d.ts +76 -0
  27. package/dist/lexicon/lexicons.d.ts.map +1 -1
  28. package/dist/lexicon/lexicons.js +42 -0
  29. package/dist/lexicon/lexicons.js.map +1 -1
  30. package/dist/lexicon/types/app/bsky/notification/unregisterPush.d.ts +17 -0
  31. package/dist/lexicon/types/app/bsky/notification/unregisterPush.d.ts.map +1 -0
  32. package/dist/lexicon/types/app/bsky/notification/unregisterPush.js +7 -0
  33. package/dist/lexicon/types/app/bsky/notification/unregisterPush.js.map +1 -0
  34. package/dist/lexicon/types/app/bsky/unspecced/initAgeAssurance.d.ts +1 -0
  35. package/dist/lexicon/types/app/bsky/unspecced/initAgeAssurance.d.ts.map +1 -1
  36. package/dist/proto/bsky_pb.d.ts +4 -0
  37. package/dist/proto/bsky_pb.d.ts.map +1 -1
  38. package/dist/proto/bsky_pb.js +15 -0
  39. package/dist/proto/bsky_pb.js.map +1 -1
  40. package/dist/proto/courier_connect.d.ts +19 -1
  41. package/dist/proto/courier_connect.d.ts.map +1 -1
  42. package/dist/proto/courier_connect.js +18 -0
  43. package/dist/proto/courier_connect.js.map +1 -1
  44. package/dist/proto/courier_pb.d.ts +76 -0
  45. package/dist/proto/courier_pb.d.ts.map +1 -1
  46. package/dist/proto/courier_pb.js +233 -1
  47. package/dist/proto/courier_pb.js.map +1 -1
  48. package/package.json +4 -4
  49. package/proto/bsky.proto +1 -0
  50. package/proto/courier.proto +18 -0
  51. package/src/api/app/bsky/notification/registerPush.ts +5 -8
  52. package/src/api/app/bsky/notification/unregisterPush.ts +38 -0
  53. package/src/api/app/bsky/notification/util.ts +18 -0
  54. package/src/api/app/bsky/unspecced/initAgeAssurance.ts +65 -12
  55. package/src/config.ts +1 -1
  56. package/src/kws.ts +9 -1
  57. package/src/lexicon/index.ts +13 -0
  58. package/src/lexicon/lexicons.ts +43 -0
  59. package/src/lexicon/types/app/bsky/notification/unregisterPush.ts +36 -0
  60. package/src/lexicon/types/app/bsky/unspecced/initAgeAssurance.ts +1 -0
  61. package/src/proto/bsky_pb.ts +11 -0
  62. package/src/proto/courier_connect.ts +22 -0
  63. package/src/proto/courier_pb.ts +246 -0
  64. package/tsconfig.build.tsbuildinfo +1 -1
@@ -8,7 +8,10 @@ import {
8
8
  } from '@atproto/xrpc-server'
9
9
  import { AppContext } from '../../../../context'
10
10
  import { GateID } from '../../../../feature-gates'
11
+ import { KwsExternalPayloadError } from '../../../../kws'
11
12
  import { Server } from '../../../../lexicon'
13
+ import { InputSchema } from '../../../../lexicon/types/app/bsky/unspecced/initAgeAssurance'
14
+ import { httpLogger as log } from '../../../../logger'
12
15
  import { KwsExternalPayload } from '../../../kws/types'
13
16
  import { createStashEvent, getClientUa } from '../../../kws/util'
14
17
 
@@ -30,12 +33,7 @@ export default function (server: Server, ctx: AppContext) {
30
33
  throw new ForbiddenError()
31
34
  }
32
35
 
33
- const { email, language, countryCode } = input.body
34
- if (!isEmailValid(email) || isDisposableEmail(email)) {
35
- throw new InvalidRequestError(
36
- 'This email address is not supported, please use a different email.',
37
- )
38
- }
36
+ const { countryCode, email, language } = validateInput(input.body)
39
37
 
40
38
  const attemptId = crypto.randomUUID()
41
39
  // Assumes `app.set('trust proxy', ...)` configured with `true` or specific values.
@@ -43,12 +41,26 @@ export default function (server: Server, ctx: AppContext) {
43
41
  const initUa = getClientUa(req)
44
42
  const externalPayload: KwsExternalPayload = { actorDid, attemptId }
45
43
 
46
- await ctx.kwsClient.sendEmail({
47
- countryCode,
48
- email,
49
- externalPayload,
50
- language,
51
- })
44
+ try {
45
+ await ctx.kwsClient.sendEmail({
46
+ countryCode: countryCode.toUpperCase(),
47
+ email,
48
+ externalPayload,
49
+ language,
50
+ })
51
+ } catch (err) {
52
+ if (err instanceof KwsExternalPayloadError) {
53
+ log.error(
54
+ { externalPayload },
55
+ 'Age Assurance flow failed because external payload got too long, which is caused by the DID being too long',
56
+ )
57
+ throw new InvalidRequestError(
58
+ 'Age Assurance flow failed because DID is too long',
59
+ 'DidTooLong',
60
+ )
61
+ }
62
+ throw err
63
+ }
52
64
 
53
65
  const event = await createStashEvent(ctx, {
54
66
  actorDid,
@@ -69,3 +81,44 @@ export default function (server: Server, ctx: AppContext) {
69
81
  },
70
82
  })
71
83
  }
84
+
85
+ // Supported languages for KWS Adult Verification.
86
+ // This list comes from KWS's AV Developer Guide PDF doc.
87
+ const kwsAvSupportedLanguages = [
88
+ 'en',
89
+ 'ar',
90
+ 'zh-Hans',
91
+ 'nl',
92
+ 'tl',
93
+ 'fr',
94
+ 'de',
95
+ 'id',
96
+ 'it',
97
+ 'ja',
98
+ 'ko',
99
+ 'pl',
100
+ 'pt-BR',
101
+ 'pt',
102
+ 'ru',
103
+ 'es',
104
+ 'th',
105
+ 'tr',
106
+ 'vi',
107
+ ]
108
+
109
+ const validateInput = (input: InputSchema): InputSchema => {
110
+ const { countryCode, email, language } = input
111
+
112
+ if (!isEmailValid(email) || isDisposableEmail(email)) {
113
+ throw new InvalidRequestError(
114
+ 'This email address is not supported, please use a different email.',
115
+ 'InvalidEmail',
116
+ )
117
+ }
118
+
119
+ return {
120
+ countryCode,
121
+ email,
122
+ language: kwsAvSupportedLanguages.includes(language) ? language : 'en',
123
+ }
124
+ }
package/src/config.ts CHANGED
@@ -242,7 +242,7 @@ export class ServerConfig {
242
242
  const kwsRedirectUrl = process.env.BSKY_KWS_REDIRECT_URL
243
243
  const kwsUserAgent = process.env.BSKY_KWS_USER_AGENT
244
244
  const kwsVerificationSecret = process.env.BSKY_KWS_VERIFICATION_SECRET
245
- const kwsWebhookSecret = process.env.BSKY_KWS_WEBHOOK_SIGNING_KEY
245
+ const kwsWebhookSecret = process.env.BSKY_KWS_WEBHOOK_SECRET
246
246
  if (
247
247
  kwsApiKey ||
248
248
  kwsApiOrigin ||
package/src/kws.ts CHANGED
@@ -14,6 +14,9 @@ const authResponseSchema = z.object({
14
14
  access_token: z.string(),
15
15
  })
16
16
 
17
+ const EXTERNAL_PAYLOAD_CHAR_LIMIT = 200
18
+ export class KwsExternalPayloadError extends Error {}
19
+
17
20
  export class KwsClient {
18
21
  constructor(public cfg: KwsConfig) {}
19
22
 
@@ -76,6 +79,11 @@ export class KwsClient {
76
79
  externalPayload: KwsExternalPayload
77
80
  language: string
78
81
  }) {
82
+ const serializedExternalPayload = serializeExternalPayload(externalPayload)
83
+ if (serializedExternalPayload.length > EXTERNAL_PAYLOAD_CHAR_LIMIT) {
84
+ throw new KwsExternalPayloadError()
85
+ }
86
+
79
87
  const res = await this.fetchWithAuth(
80
88
  `${this.cfg.apiOrigin}/v1/verifications/send-email`,
81
89
  {
@@ -86,7 +94,7 @@ export class KwsClient {
86
94
  },
87
95
  body: JSON.stringify({
88
96
  email,
89
- externalPayload: serializeExternalPayload(externalPayload),
97
+ externalPayload: serializedExternalPayload,
90
98
  language,
91
99
  location: countryCode,
92
100
  userContext: 'adult',
@@ -147,6 +147,7 @@ import * as AppBskyNotificationPutActivitySubscription from './types/app/bsky/no
147
147
  import * as AppBskyNotificationPutPreferences from './types/app/bsky/notification/putPreferences.js'
148
148
  import * as AppBskyNotificationPutPreferencesV2 from './types/app/bsky/notification/putPreferencesV2.js'
149
149
  import * as AppBskyNotificationRegisterPush from './types/app/bsky/notification/registerPush.js'
150
+ import * as AppBskyNotificationUnregisterPush from './types/app/bsky/notification/unregisterPush.js'
150
151
  import * as AppBskyNotificationUpdateSeen from './types/app/bsky/notification/updateSeen.js'
151
152
  import * as AppBskyUnspeccedGetAgeAssuranceState from './types/app/bsky/unspecced/getAgeAssuranceState.js'
152
153
  import * as AppBskyUnspeccedGetConfig from './types/app/bsky/unspecced/getConfig.js'
@@ -2079,6 +2080,18 @@ export class AppBskyNotificationNS {
2079
2080
  return this._server.xrpc.method(nsid, cfg)
2080
2081
  }
2081
2082
 
2083
+ unregisterPush<A extends Auth = void>(
2084
+ cfg: MethodConfigOrHandler<
2085
+ A,
2086
+ AppBskyNotificationUnregisterPush.QueryParams,
2087
+ AppBskyNotificationUnregisterPush.HandlerInput,
2088
+ AppBskyNotificationUnregisterPush.HandlerOutput
2089
+ >,
2090
+ ) {
2091
+ const nsid = 'app.bsky.notification.unregisterPush' // @ts-ignore
2092
+ return this._server.xrpc.method(nsid, cfg)
2093
+ }
2094
+
2082
2095
  updateSeen<A extends Auth = void>(
2083
2096
  cfg: MethodConfigOrHandler<
2084
2097
  A,
@@ -10372,6 +10372,40 @@ export const schemaDict = {
10372
10372
  },
10373
10373
  },
10374
10374
  },
10375
+ AppBskyNotificationUnregisterPush: {
10376
+ lexicon: 1,
10377
+ id: 'app.bsky.notification.unregisterPush',
10378
+ defs: {
10379
+ main: {
10380
+ type: 'procedure',
10381
+ description:
10382
+ 'The inverse of registerPush - inform a specified service that push notifications should no longer be sent to the given token for the requesting account. Requires auth.',
10383
+ input: {
10384
+ encoding: 'application/json',
10385
+ schema: {
10386
+ type: 'object',
10387
+ required: ['serviceDid', 'token', 'platform', 'appId'],
10388
+ properties: {
10389
+ serviceDid: {
10390
+ type: 'string',
10391
+ format: 'did',
10392
+ },
10393
+ token: {
10394
+ type: 'string',
10395
+ },
10396
+ platform: {
10397
+ type: 'string',
10398
+ knownValues: ['ios', 'android', 'web'],
10399
+ },
10400
+ appId: {
10401
+ type: 'string',
10402
+ },
10403
+ },
10404
+ },
10405
+ },
10406
+ },
10407
+ },
10408
+ },
10375
10409
  AppBskyNotificationUpdateSeen: {
10376
10410
  lexicon: 1,
10377
10411
  id: 'app.bsky.notification.updateSeen',
@@ -11555,6 +11589,14 @@ export const schemaDict = {
11555
11589
  ref: 'lex:app.bsky.unspecced.defs#ageAssuranceState',
11556
11590
  },
11557
11591
  },
11592
+ errors: [
11593
+ {
11594
+ name: 'InvalidEmail',
11595
+ },
11596
+ {
11597
+ name: 'DidTooLong',
11598
+ },
11599
+ ],
11558
11600
  },
11559
11601
  },
11560
11602
  },
@@ -13485,6 +13527,7 @@ export const ids = {
13485
13527
  AppBskyNotificationPutPreferences: 'app.bsky.notification.putPreferences',
13486
13528
  AppBskyNotificationPutPreferencesV2: 'app.bsky.notification.putPreferencesV2',
13487
13529
  AppBskyNotificationRegisterPush: 'app.bsky.notification.registerPush',
13530
+ AppBskyNotificationUnregisterPush: 'app.bsky.notification.unregisterPush',
13488
13531
  AppBskyNotificationUpdateSeen: 'app.bsky.notification.updateSeen',
13489
13532
  AppBskyRichtextFacet: 'app.bsky.richtext.facet',
13490
13533
  AppBskyUnspeccedDefs: 'app.bsky.unspecced.defs',
@@ -0,0 +1,36 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
+ import { CID } from 'multiformats/cid'
6
+ import { validate as _validate } from '../../../../lexicons'
7
+ import {
8
+ type $Typed,
9
+ is$typed as _is$typed,
10
+ type OmitKey,
11
+ } from '../../../../util'
12
+
13
+ const is$typed = _is$typed,
14
+ validate = _validate
15
+ const id = 'app.bsky.notification.unregisterPush'
16
+
17
+ export type QueryParams = {}
18
+
19
+ export interface InputSchema {
20
+ serviceDid: string
21
+ token: string
22
+ platform: 'ios' | 'android' | 'web' | (string & {})
23
+ appId: string
24
+ }
25
+
26
+ export interface HandlerInput {
27
+ encoding: 'application/json'
28
+ body: InputSchema
29
+ }
30
+
31
+ export interface HandlerError {
32
+ status: number
33
+ message?: string
34
+ }
35
+
36
+ export type HandlerOutput = HandlerError | void
@@ -42,6 +42,7 @@ export interface HandlerSuccess {
42
42
  export interface HandlerError {
43
43
  status: number
44
44
  message?: string
45
+ error?: 'InvalidEmail' | 'DidTooLong'
45
46
  }
46
47
 
47
48
  export type HandlerOutput = HandlerError | HandlerSuccess
@@ -5752,6 +5752,11 @@ export class AgeAssuranceStatus extends Message<AgeAssuranceStatus> {
5752
5752
  */
5753
5753
  lastInitiatedAt?: Timestamp
5754
5754
 
5755
+ /**
5756
+ * @generated from field: bool override_applied = 3;
5757
+ */
5758
+ overrideApplied = false
5759
+
5755
5760
  constructor(data?: PartialMessage<AgeAssuranceStatus>) {
5756
5761
  super()
5757
5762
  proto3.util.initPartial(data, this)
@@ -5762,6 +5767,12 @@ export class AgeAssuranceStatus extends Message<AgeAssuranceStatus> {
5762
5767
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
5763
5768
  { no: 1, name: 'status', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
5764
5769
  { no: 2, name: 'last_initiated_at', kind: 'message', T: Timestamp },
5770
+ {
5771
+ no: 3,
5772
+ name: 'override_applied',
5773
+ kind: 'scalar',
5774
+ T: 8 /* ScalarType.BOOL */,
5775
+ },
5765
5776
  ])
5766
5777
 
5767
5778
  static fromBinary(
@@ -10,6 +10,10 @@ import {
10
10
  PushNotificationsResponse,
11
11
  RegisterDeviceTokenRequest,
12
12
  RegisterDeviceTokenResponse,
13
+ SetAgeRestrictedRequest,
14
+ SetAgeRestrictedResponse,
15
+ UnregisterDeviceTokenRequest,
16
+ UnregisterDeviceTokenResponse,
13
17
  } from './courier_pb'
14
18
  import { MethodKind } from '@bufbuild/protobuf'
15
19
 
@@ -46,5 +50,23 @@ export const Service = {
46
50
  O: RegisterDeviceTokenResponse,
47
51
  kind: MethodKind.Unary,
48
52
  },
53
+ /**
54
+ * @generated from rpc courier.Service.UnregisterDeviceToken
55
+ */
56
+ unregisterDeviceToken: {
57
+ name: 'UnregisterDeviceToken',
58
+ I: UnregisterDeviceTokenRequest,
59
+ O: UnregisterDeviceTokenResponse,
60
+ kind: MethodKind.Unary,
61
+ },
62
+ /**
63
+ * @generated from rpc courier.Service.SetAgeRestricted
64
+ */
65
+ setAgeRestricted: {
66
+ name: 'SetAgeRestricted',
67
+ I: SetAgeRestrictedRequest,
68
+ O: SetAgeRestrictedResponse,
69
+ kind: MethodKind.Unary,
70
+ },
49
71
  },
50
72
  } as const
@@ -493,3 +493,249 @@ export class RegisterDeviceTokenResponse extends Message<RegisterDeviceTokenResp
493
493
  return proto3.util.equals(RegisterDeviceTokenResponse, a, b)
494
494
  }
495
495
  }
496
+
497
+ /**
498
+ * @generated from message courier.UnregisterDeviceTokenRequest
499
+ */
500
+ export class UnregisterDeviceTokenRequest extends Message<UnregisterDeviceTokenRequest> {
501
+ /**
502
+ * @generated from field: string did = 1;
503
+ */
504
+ did = ''
505
+
506
+ /**
507
+ * @generated from field: string token = 2;
508
+ */
509
+ token = ''
510
+
511
+ /**
512
+ * @generated from field: string app_id = 3;
513
+ */
514
+ appId = ''
515
+
516
+ /**
517
+ * @generated from field: courier.AppPlatform platform = 4;
518
+ */
519
+ platform = AppPlatform.UNSPECIFIED
520
+
521
+ constructor(data?: PartialMessage<UnregisterDeviceTokenRequest>) {
522
+ super()
523
+ proto3.util.initPartial(data, this)
524
+ }
525
+
526
+ static readonly runtime: typeof proto3 = proto3
527
+ static readonly typeName = 'courier.UnregisterDeviceTokenRequest'
528
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
529
+ { no: 1, name: 'did', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
530
+ { no: 2, name: 'token', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
531
+ { no: 3, name: 'app_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
532
+ {
533
+ no: 4,
534
+ name: 'platform',
535
+ kind: 'enum',
536
+ T: proto3.getEnumType(AppPlatform),
537
+ },
538
+ ])
539
+
540
+ static fromBinary(
541
+ bytes: Uint8Array,
542
+ options?: Partial<BinaryReadOptions>,
543
+ ): UnregisterDeviceTokenRequest {
544
+ return new UnregisterDeviceTokenRequest().fromBinary(bytes, options)
545
+ }
546
+
547
+ static fromJson(
548
+ jsonValue: JsonValue,
549
+ options?: Partial<JsonReadOptions>,
550
+ ): UnregisterDeviceTokenRequest {
551
+ return new UnregisterDeviceTokenRequest().fromJson(jsonValue, options)
552
+ }
553
+
554
+ static fromJsonString(
555
+ jsonString: string,
556
+ options?: Partial<JsonReadOptions>,
557
+ ): UnregisterDeviceTokenRequest {
558
+ return new UnregisterDeviceTokenRequest().fromJsonString(
559
+ jsonString,
560
+ options,
561
+ )
562
+ }
563
+
564
+ static equals(
565
+ a:
566
+ | UnregisterDeviceTokenRequest
567
+ | PlainMessage<UnregisterDeviceTokenRequest>
568
+ | undefined,
569
+ b:
570
+ | UnregisterDeviceTokenRequest
571
+ | PlainMessage<UnregisterDeviceTokenRequest>
572
+ | undefined,
573
+ ): boolean {
574
+ return proto3.util.equals(UnregisterDeviceTokenRequest, a, b)
575
+ }
576
+ }
577
+
578
+ /**
579
+ * @generated from message courier.UnregisterDeviceTokenResponse
580
+ */
581
+ export class UnregisterDeviceTokenResponse extends Message<UnregisterDeviceTokenResponse> {
582
+ constructor(data?: PartialMessage<UnregisterDeviceTokenResponse>) {
583
+ super()
584
+ proto3.util.initPartial(data, this)
585
+ }
586
+
587
+ static readonly runtime: typeof proto3 = proto3
588
+ static readonly typeName = 'courier.UnregisterDeviceTokenResponse'
589
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [])
590
+
591
+ static fromBinary(
592
+ bytes: Uint8Array,
593
+ options?: Partial<BinaryReadOptions>,
594
+ ): UnregisterDeviceTokenResponse {
595
+ return new UnregisterDeviceTokenResponse().fromBinary(bytes, options)
596
+ }
597
+
598
+ static fromJson(
599
+ jsonValue: JsonValue,
600
+ options?: Partial<JsonReadOptions>,
601
+ ): UnregisterDeviceTokenResponse {
602
+ return new UnregisterDeviceTokenResponse().fromJson(jsonValue, options)
603
+ }
604
+
605
+ static fromJsonString(
606
+ jsonString: string,
607
+ options?: Partial<JsonReadOptions>,
608
+ ): UnregisterDeviceTokenResponse {
609
+ return new UnregisterDeviceTokenResponse().fromJsonString(
610
+ jsonString,
611
+ options,
612
+ )
613
+ }
614
+
615
+ static equals(
616
+ a:
617
+ | UnregisterDeviceTokenResponse
618
+ | PlainMessage<UnregisterDeviceTokenResponse>
619
+ | undefined,
620
+ b:
621
+ | UnregisterDeviceTokenResponse
622
+ | PlainMessage<UnregisterDeviceTokenResponse>
623
+ | undefined,
624
+ ): boolean {
625
+ return proto3.util.equals(UnregisterDeviceTokenResponse, a, b)
626
+ }
627
+ }
628
+
629
+ /**
630
+ * @generated from message courier.SetAgeRestrictedRequest
631
+ */
632
+ export class SetAgeRestrictedRequest extends Message<SetAgeRestrictedRequest> {
633
+ /**
634
+ * @generated from field: string did = 1;
635
+ */
636
+ did = ''
637
+
638
+ /**
639
+ * @generated from field: bool age_restricted = 2;
640
+ */
641
+ ageRestricted = false
642
+
643
+ constructor(data?: PartialMessage<SetAgeRestrictedRequest>) {
644
+ super()
645
+ proto3.util.initPartial(data, this)
646
+ }
647
+
648
+ static readonly runtime: typeof proto3 = proto3
649
+ static readonly typeName = 'courier.SetAgeRestrictedRequest'
650
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
651
+ { no: 1, name: 'did', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
652
+ {
653
+ no: 2,
654
+ name: 'age_restricted',
655
+ kind: 'scalar',
656
+ T: 8 /* ScalarType.BOOL */,
657
+ },
658
+ ])
659
+
660
+ static fromBinary(
661
+ bytes: Uint8Array,
662
+ options?: Partial<BinaryReadOptions>,
663
+ ): SetAgeRestrictedRequest {
664
+ return new SetAgeRestrictedRequest().fromBinary(bytes, options)
665
+ }
666
+
667
+ static fromJson(
668
+ jsonValue: JsonValue,
669
+ options?: Partial<JsonReadOptions>,
670
+ ): SetAgeRestrictedRequest {
671
+ return new SetAgeRestrictedRequest().fromJson(jsonValue, options)
672
+ }
673
+
674
+ static fromJsonString(
675
+ jsonString: string,
676
+ options?: Partial<JsonReadOptions>,
677
+ ): SetAgeRestrictedRequest {
678
+ return new SetAgeRestrictedRequest().fromJsonString(jsonString, options)
679
+ }
680
+
681
+ static equals(
682
+ a:
683
+ | SetAgeRestrictedRequest
684
+ | PlainMessage<SetAgeRestrictedRequest>
685
+ | undefined,
686
+ b:
687
+ | SetAgeRestrictedRequest
688
+ | PlainMessage<SetAgeRestrictedRequest>
689
+ | undefined,
690
+ ): boolean {
691
+ return proto3.util.equals(SetAgeRestrictedRequest, a, b)
692
+ }
693
+ }
694
+
695
+ /**
696
+ * @generated from message courier.SetAgeRestrictedResponse
697
+ */
698
+ export class SetAgeRestrictedResponse extends Message<SetAgeRestrictedResponse> {
699
+ constructor(data?: PartialMessage<SetAgeRestrictedResponse>) {
700
+ super()
701
+ proto3.util.initPartial(data, this)
702
+ }
703
+
704
+ static readonly runtime: typeof proto3 = proto3
705
+ static readonly typeName = 'courier.SetAgeRestrictedResponse'
706
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [])
707
+
708
+ static fromBinary(
709
+ bytes: Uint8Array,
710
+ options?: Partial<BinaryReadOptions>,
711
+ ): SetAgeRestrictedResponse {
712
+ return new SetAgeRestrictedResponse().fromBinary(bytes, options)
713
+ }
714
+
715
+ static fromJson(
716
+ jsonValue: JsonValue,
717
+ options?: Partial<JsonReadOptions>,
718
+ ): SetAgeRestrictedResponse {
719
+ return new SetAgeRestrictedResponse().fromJson(jsonValue, options)
720
+ }
721
+
722
+ static fromJsonString(
723
+ jsonString: string,
724
+ options?: Partial<JsonReadOptions>,
725
+ ): SetAgeRestrictedResponse {
726
+ return new SetAgeRestrictedResponse().fromJsonString(jsonString, options)
727
+ }
728
+
729
+ static equals(
730
+ a:
731
+ | SetAgeRestrictedResponse
732
+ | PlainMessage<SetAgeRestrictedResponse>
733
+ | undefined,
734
+ b:
735
+ | SetAgeRestrictedResponse
736
+ | PlainMessage<SetAgeRestrictedResponse>
737
+ | undefined,
738
+ ): boolean {
739
+ return proto3.util.equals(SetAgeRestrictedResponse, a, b)
740
+ }
741
+ }