-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b22eae
commit f103639
Showing
11 changed files
with
300 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2023 Shinya Kato. All rights reserved. | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided the conditions. | ||
|
||
// π¦ Package imports: | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
part 'signing_key.freezed.dart'; | ||
part 'signing_key.g.dart'; | ||
|
||
/// Represents an issued signing key. | ||
@freezed | ||
class SigningKey with _$SigningKey { | ||
/// Creates a new instance of [SigningKey]. | ||
const factory SigningKey({ | ||
/// Public signing key in the form of a did:key. | ||
required String signingKey, | ||
}) = _SigningKey; | ||
|
||
/// Creates a new instance of [SigningKey] from a JSON object. | ||
/// | ||
/// The [json] parameter must be a map with keys and values that can be used | ||
/// to populate an instance of [SigningKey]. | ||
factory SigningKey.fromJson(Map<String, Object?> json) => | ||
_$SigningKeyFromJson(json); | ||
} |
156 changes: 156 additions & 0 deletions
156
packages/atproto/lib/src/entities/signing_key.freezed.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
// coverage:ignore-file | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: type=lint | ||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark | ||
|
||
part of 'signing_key.dart'; | ||
|
||
// ************************************************************************** | ||
// FreezedGenerator | ||
// ************************************************************************** | ||
|
||
T _$identity<T>(T value) => value; | ||
|
||
final _privateConstructorUsedError = UnsupportedError( | ||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); | ||
|
||
SigningKey _$SigningKeyFromJson(Map<String, dynamic> json) { | ||
return _SigningKey.fromJson(json); | ||
} | ||
|
||
/// @nodoc | ||
mixin _$SigningKey { | ||
/// Public signing key in the form of a did:key. | ||
String get signingKey => throw _privateConstructorUsedError; | ||
|
||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; | ||
@JsonKey(ignore: true) | ||
$SigningKeyCopyWith<SigningKey> get copyWith => | ||
throw _privateConstructorUsedError; | ||
} | ||
|
||
/// @nodoc | ||
abstract class $SigningKeyCopyWith<$Res> { | ||
factory $SigningKeyCopyWith( | ||
SigningKey value, $Res Function(SigningKey) then) = | ||
_$SigningKeyCopyWithImpl<$Res, SigningKey>; | ||
@useResult | ||
$Res call({String signingKey}); | ||
} | ||
|
||
/// @nodoc | ||
class _$SigningKeyCopyWithImpl<$Res, $Val extends SigningKey> | ||
implements $SigningKeyCopyWith<$Res> { | ||
_$SigningKeyCopyWithImpl(this._value, this._then); | ||
|
||
// ignore: unused_field | ||
final $Val _value; | ||
// ignore: unused_field | ||
final $Res Function($Val) _then; | ||
|
||
@pragma('vm:prefer-inline') | ||
@override | ||
$Res call({ | ||
Object? signingKey = null, | ||
}) { | ||
return _then(_value.copyWith( | ||
signingKey: null == signingKey | ||
? _value.signingKey | ||
: signingKey // ignore: cast_nullable_to_non_nullable | ||
as String, | ||
) as $Val); | ||
} | ||
} | ||
|
||
/// @nodoc | ||
abstract class _$$_SigningKeyCopyWith<$Res> | ||
implements $SigningKeyCopyWith<$Res> { | ||
factory _$$_SigningKeyCopyWith( | ||
_$_SigningKey value, $Res Function(_$_SigningKey) then) = | ||
__$$_SigningKeyCopyWithImpl<$Res>; | ||
@override | ||
@useResult | ||
$Res call({String signingKey}); | ||
} | ||
|
||
/// @nodoc | ||
class __$$_SigningKeyCopyWithImpl<$Res> | ||
extends _$SigningKeyCopyWithImpl<$Res, _$_SigningKey> | ||
implements _$$_SigningKeyCopyWith<$Res> { | ||
__$$_SigningKeyCopyWithImpl( | ||
_$_SigningKey _value, $Res Function(_$_SigningKey) _then) | ||
: super(_value, _then); | ||
|
||
@pragma('vm:prefer-inline') | ||
@override | ||
$Res call({ | ||
Object? signingKey = null, | ||
}) { | ||
return _then(_$_SigningKey( | ||
signingKey: null == signingKey | ||
? _value.signingKey | ||
: signingKey // ignore: cast_nullable_to_non_nullable | ||
as String, | ||
)); | ||
} | ||
} | ||
|
||
/// @nodoc | ||
@JsonSerializable() | ||
class _$_SigningKey implements _SigningKey { | ||
const _$_SigningKey({required this.signingKey}); | ||
|
||
factory _$_SigningKey.fromJson(Map<String, dynamic> json) => | ||
_$$_SigningKeyFromJson(json); | ||
|
||
/// Public signing key in the form of a did:key. | ||
@override | ||
final String signingKey; | ||
|
||
@override | ||
String toString() { | ||
return 'SigningKey(signingKey: $signingKey)'; | ||
} | ||
|
||
@override | ||
bool operator ==(dynamic other) { | ||
return identical(this, other) || | ||
(other.runtimeType == runtimeType && | ||
other is _$_SigningKey && | ||
(identical(other.signingKey, signingKey) || | ||
other.signingKey == signingKey)); | ||
} | ||
|
||
@JsonKey(ignore: true) | ||
@override | ||
int get hashCode => Object.hash(runtimeType, signingKey); | ||
|
||
@JsonKey(ignore: true) | ||
@override | ||
@pragma('vm:prefer-inline') | ||
_$$_SigningKeyCopyWith<_$_SigningKey> get copyWith => | ||
__$$_SigningKeyCopyWithImpl<_$_SigningKey>(this, _$identity); | ||
|
||
@override | ||
Map<String, dynamic> toJson() { | ||
return _$$_SigningKeyToJson( | ||
this, | ||
); | ||
} | ||
} | ||
|
||
abstract class _SigningKey implements SigningKey { | ||
const factory _SigningKey({required final String signingKey}) = _$_SigningKey; | ||
|
||
factory _SigningKey.fromJson(Map<String, dynamic> json) = | ||
_$_SigningKey.fromJson; | ||
|
||
@override | ||
|
||
/// Public signing key in the form of a did:key. | ||
String get signingKey; | ||
@override | ||
@JsonKey(ignore: true) | ||
_$$_SigningKeyCopyWith<_$_SigningKey> get copyWith => | ||
throw _privateConstructorUsedError; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/atproto/test/src/servers/data/create_signing_key.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"signingKey": "did:plc:iijrtk7ocored6zuziwmqq3c" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters