at_auth 3.3.0
at_auth: ^3.3.0 copied to clipboard
Package that implements common logic for onboarding/authenticating an atsign to a secondary server
3.3.0 #
- feat: add
AtAuthSession(exported) — the explicit auth→client hand-off artifact: the confirmed subset of an auth request that client creation actually needs (atSign,rootDomain,namespace,atKeysIo,enrollmentId), promoted to its own type so "request" no longer doubles as "session". Keys cross the boundary as anAtKeysIosource, not as live crypto state: the client derives its ownAtKeysviaatKeysIo.read(atSign)rather than adopting auth'sAtChops/AtLookUp. The session also carries auth's already-authenticatedatLookUpso a caller can opt in to reusing that connection (AtClientManager.fromAuthSession(session, reuse: true)) and skip a second PKAM handshake; the default hand-off rebuilds a fresh connection. - feat:
AtAuthImpl.authenticate(...)and.onboard(...)populate the newAuthResponse.sessionon success whenever the request supplied anatKeysIo— pass it straight toAtClientManager.fromAuthSession(...). The legacyatAuthKeys-only path has no key source to hand across, so it gets no session and keeps behaving exactly as before. - feat:
AtEnrollmentRequestnow takes asession(the requesting app's atSign, rootDomain and theatKeysIoits new keys will be persisted into) in place of the individualatSign/rootDomain/apkamPublicKey/encryptedAPKAMSymmetricKeyparams. On approval,waitForApproval(...)flushes the completed keyset intosession.atKeysIo(when it is aWrittenAtKeysIo) and hands back a ready-to-useAtEnrollmentResponse.session. Supplying neithersessionnor the deprecatedatSignthrowsArgumentError. The legacy path (no session, or a read-onlyAtKeysIo) leavesatAuthKeyspopulated for the caller to persist and setssessionto null. - deprecation: everything the
AtAuthSessionhand-off replaces is marked@Deprecated(... 'remove in v4')and still fully functional in 3.3.0 —AuthResponseand itsAtAuthResponse/AtOnboardingResponsesubclasses, theatAuthKeys/atLookUp/atChopsresponse fields,AtEnrollmentResponse.atSign/.rootDomain/.atAuthKeys, and theAtEnrollmentRequestparams listed above. No runtime behaviour changed; this release is additive so consumers can migrate tosessionbefore at_auth 4. - feat: add
AtKeysMaterial— the only key typeAtKeys's API deals in (addKey,getKey,keysForKeyId,keysForEnrollment,retireKey, thekeysListconstructor param, ...). It's fully self-describing:keyId/enrollmentIdpluskeyPartType(an openString— the mechanical crypto role; known tokens inCryptographicKeyType: symmetric encryption/authentication and the public/private halves of encryption, verification/signing, encapsulation/decapsulation and key agreement),keyAlgorithmType(an openString— the algorithm family; known tokens inKeyAlgorithmType:aes256/rsa2048/ecc_secp256r1/ed25519/x25519/mlkem768/mldsa65/xwing, matching the pkam/enrollmentsigningAlgoliterals),bytes,operations,createdAt, andstatus(active/retired/dead;withStatus(...)copies a material at a new status). Both token fields are deliberately Strings, not enums: unknown tokens are preserved and round-tripped, so a keyfile written by a newer client stays readable — and losslessly flushable — by an older one; whether an algorithm is classical, post-quantum or hybrid is carried by the algorithm token (e.g.xwing), not a separate role axis. The wire's nestedkeys[].keyParts[]document shape — grouping the materials sharing akeyId(e.g. the public+private halves of a keypair) — is produced/consumed byencodeAtKeysDocument/parseAtKeysDocument(also exported), not a separate model type. Keys produced by one enrollment are grouped by an optionalenrollmentIdand queried viaAtKeys.keysForEnrollment(...); at most one material of a givenCryptographicKeyTypemay share anenrollmentId. - feat:
AtKeys.toJson()/.fromJson(...)now produce/consume the versioned typed-keys document shape (version,atsign,keys, with legacy fields flat at the top level — upgrading a legacy file to the typed-keys document is additive, not a format swap), replacing the former codec/resolver/document layer. Backward compatible:fromJsonaccepts json without aversionfield as the legacy flat shape, and throwsAtKeysUnsupportedVersionExceptionon an unknown version. Typed materials are looked up viaAtKeys.getKey(keyId, type)and.keysForKeyId(keyId). - feat: add
WrittenAtKeysIo.flush(Atsign, AtKeys)— the runtime persist operation: mutate the in-memoryAtKeys(addKey,retireKey, ...), then flush the complete state. On an existing file, flush safety-checks the rewrite (AtKeysAssurance.validateMapUpdate— nothing may be lost: every existing(keyId, keyPartType)must survive with identical fields, thoughstatusmay move forwardactive→retired→deadand new materials may be added), then rewrites; flushing a legacy.atKeysfile upgrades it in place to the typed-keys document format (legacy fields preserved byte-for-byte). On a missing file, flush creates it.write(...)stays the create-only initial persist. (Theappend/savemethods that existed briefly during this release's development are gone — never published.)FileAtKeysIowrites are atomic (write-to-temp + rename, so a crash can never truncate the keyfile) and a flush over an existing file first preserves it as<file>.bak. - feat:
AtKeysAssuranceis now the single home for all atKeys validation — both the low-levelexpect*/optional*value/type checks used byAtKeysMaterial.fromJson/AtKeys.fromJson, and the structural invariants (validateKeyMaterials: duplicatekeyId, one material of eachCryptographicKeyTypeper enrollment, the flush-safety checkvalidateMapUpdate). - feat: add passphrase envelope support via
AtKeysPassphraseEnvelopeCodec(encode/decode/isEnvelope, argon2id key derivation), and addInMemoryAtKeysIofor in-memory/test flows (both exported). - fix:
AtKeys.==/hashCodenow also coveratsign,metadata(compared structurally — nested maps/lists by value, not identity) and the typed key materials (order-insensitive). - chore(deps): require
at_chops^3.4.1 for hashing algorithm barrel exports used by AtKeys passphrase handling. - fix:
RegistrarServicenow fails loudly on a bad API key instead of reporting an ordinary negative result. The constructor throwsAtExceptionwhenapiKeyis empty or whitespace-only, and every registrar call that requires authentication throwsAtExceptionnaming the endpoint and status code when the registrar answers 401/403. Previously a rejected key surfaced assendActivationOtp()returningfalse(or an empty atsign list), which is indistinguishable from a legitimate "no" — callers that treated a falsy result as an expected outcome will now see an exception (#1909).
3.2.0 #
- feat: bound
AtAuthImpl.validateAtServerwith a single overall deadline so a dead network can no longer hang authentication/onboarding.RetryOptionsgains an optionaloverallTimeout; when null the default depends on the request: authentication usesAtNetworkTimeouts.effectiveDefault(30s) so a dead network fails fast, while ONBOARDING usesAtNetworkTimeouts.defaultOnboardingTimeout(5 min) because a newly-registered atSign can take minutes to be provisioned. The loop is deadline-driven — it retries everyretryDelayuntil the budget is spent, then throwsAtTimeoutException; each inner network call (the atDirectory lookup and the connectivity probe) is bounded by the remaining budget and capped at 60s.RetryOptions.maxRetriesno longer bounds this loop (the deadline does) (#1923). Requiresat_commons ^5.13.0. - chore(deps):
at_lookup: ^3.6.0—validateAtServerpasses thetimeoutparameter thatSecondaryAddressFinder.findSecondarygained in at_lookup 3.6.0, so this version does not compile against at_lookup ≤3.5.x.
3.1.1 #
- refactor: route enrollment RSA (encrypt/decrypt
apkamSymmetricKeyunder the default encryption keypair) through at_chops (RsaEncryptionAlgo) —cryptonno longer imported inliband moved todev_dependencies(only the enrollment test still uses it for RSA keypair fixtures). Same framing, byte-identical by construction. - fix:
decodeAtKeys()now reliably throwsAtDecryptionExceptionon an incorrect passphrase. ThejsonDecodeof the decrypted bytes now runs inside the decrypt try/catch, so wrong-passphrase garbage no longer escapes as an uncaughtFormatException(an intermittent failure inat_keys_io_test).
3.1.0 #
- feat:
validateAtServer()now emits progress events and probes atSign connectivity before returning - fix:
decodeAtKeys()now throws when an invalid passphrase is provided - fix:
FileAtKeysIOnow encrypts the key file with a passphrase when one is available - fix: throws
AtAuthenticationExceptionwhen the atSign is already onboarded - feat: use AtBytes.equals in
AtKeys(requires at_commons: ^5.9.0)
3.0.1 #
- feat: improve
AtEnrollmentImpl - feat: introduce
NamespacePermission - fix: ensure directory when writing keys in FileAtKeysIo
3.0.0 #
- chore(deps): at_chops ^3.0.0
- refactor: remove all singletons, injecting dependecies via
AuthRequest - feat:
AtKeysIointerface which defines interaction between stored/generated keys and at_auth - feat:
FileAtKeysIoclass which defines implementation - feat: authentication returns
AtLookupandAtChopsviaAuthResponse - feat:
AtAuthexposes aProgressStreamto consume status of at_auth
2.4.0 #
- chore(deps): at_commons ^5.5.0
2.3.0 #
- feat: add
AtLookUp? atLookUpto theAtAuthinterface so that it can be reused (e.g. by AtClient) once auth is complete
2.2.0 #
- feat: enable callers of
AtAuth.onboardto control post-auth activation completion (set the encryption public key on the server, delete the "cram" secret)
2.1.0 #
- fix: potential bug handling atSigns which end in
datae.g.@foo_data
2.0.10 #
- fix: Replace legacy IVs with random IVs for encrypting "defaultEncryptionPrivateKey" and "selfEncryptionKey" in APKAM flow
2.0.9 #
- fix:Enable caching of encryption public key
2.0.8 #
- feat: Add "passPhrase" in "AtAuthRequest" to support password protected atKeys file
- build[deps]: Upgraded the following packages:
- at_commons to v5.0.2
- at_auth to v2.2.0
- lints to v5.0.0
- test to v1.25.8
- mocktail to v1.0.4
2.0.7 #
- build[deps]: Upgraded the following packages:
- at_commons to v5.0.0
- at_lookup to v3.0.49
- at_utils to v3.0.19
- at_chops to v2.0.1
2.0.6 #
- fix: Add "apkamKeysExpiryDuration" to "EnrollmentRequest" to support auto expiry of APKAM keys
2.0.5 #
- fix: set atChops in atLookup before pkam auth in AtAuthImpl
- build[deps]: Upgraded the following packages:
- at_commons to 4.0.11
- at_lookup to 3.0.47
- feat: Add signing SigningAlgoType and HashingAlgoType in AtAuthRequest, AtOnboardingRequest
2.0.4 #
- fix: Add "revoke" to the "AtEnrollmentBase" to support enroll:revoke operation
2.0.3 #
- fix: Add optional parameters to the "atAuth" method in "AtAuthInterface"
2.0.2 #
- fix: set default value for app name and device name if they are not passed in the onboarding request.
2.0.1 #
- fix: deprecate enableEnrollment flag in OnboardingRequest and removed the check in AtAuthImpl
2.0.0 #
- build[deps]: Upgraded the following packages:
- at_commons to 4.0.5
- at_lookup to 3.0.46
- Implement new methods for enrollment operations within AtEnrollmentImpl and remove older methods.
- Enhance readability by renaming the current classes associated with EnrollmentRequest.
1.0.5 #
- build[deps]: Upgraded the following packages:
- at_chops to v2.0.0
- at_lookup to v3.0.45
1.0.4 #
- build[deps]: Upgraded the following packages:
- at_commons to v4.0.0
- at_utils to v3.0.16
- at_chops to v1.0.7
- at_lookup to v3.0.44
1.0.3 #
- fix: upgrade at_lookup to 3.0.43 since 3.0.42 has breaking change for private key reference
1.0.2 #
- feat: enrollment common code from at_client_mobile and at_onboarding_cli
- chore: upgrade at_lookup to 3.0.42 and at_demo_data to 1.0.3
1.0.1 #
- feat: Introduce "submitEnrollment" and "manageEnrollment" methods for APKAM
1.0.0 #
- Implemented onboard and authenticate methods.